@sentio/runtime 2.49.2-rc.3 → 2.49.2-rc.4

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/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import _m0 from 'protobufjs/minimal.js';
8
8
  import { JsonRpcProvider, Provider, Network } from 'ethers';
9
9
  import PQueue from 'p-queue';
10
10
  import { EthChainId } from '@sentio/chain';
11
- import { Counter, Attributes, Gauge } from '@opentelemetry/api';
11
+ import { Counter, Attributes, Gauge, Histogram } from '@opentelemetry/api';
12
12
 
13
13
  type Request = Omit<DBRequest, 'opId'>;
14
14
  type RequestType = keyof Request;
@@ -424,6 +424,15 @@ declare class G {
424
424
  record(value: number, attributes?: Attributes): void;
425
425
  get(): number;
426
426
  }
427
+ declare class H {
428
+ private name;
429
+ private _histogram;
430
+ private value;
431
+ constructor(name: string);
432
+ get histogram(): Histogram<Attributes>;
433
+ record(value: number, attributes?: Attributes): void;
434
+ get(): number;
435
+ }
427
436
  declare const dbMetrics: {
428
437
  send_counts: {
429
438
  get: C;
@@ -491,39 +500,36 @@ declare const providerMetrics: {
491
500
  hit_count: C;
492
501
  miss_count: C;
493
502
  queue_size: G;
494
- total_duration: C;
495
- total_queued: C;
496
503
  stats(): {
497
504
  hit_count: number;
498
505
  miss_count: number;
499
506
  queue_size: number;
500
- total_duration: number;
501
- total_queued: number;
502
- average_queue_time: number;
503
- average_duration: number;
504
507
  };
505
508
  };
506
509
  declare const processMetrics: {
507
510
  process_binding_count: C;
508
511
  process_binding_time: C;
509
512
  process_binding_error: C;
510
- process_ethcall_count: C;
511
513
  process_eventemit_count: C;
512
514
  process_metricrecord_count: C;
513
515
  process_pricecall_count: C;
514
- process_template_count: C;
515
- process_handler_duration: G;
516
+ processor_handler_duration: H;
517
+ processor_rpc_duration: H;
518
+ processor_rpc_queue_duration: H;
519
+ processor_template_instance_count: C;
516
520
  stats(): {
517
521
  process_binding_count: number;
518
522
  process_binding_time: number;
519
523
  process_binding_error: number;
520
- process_ethcall_count: number;
521
524
  process_eventemit_count: number;
522
525
  process_metricrecord_count: number;
523
526
  process_pricecall_count: number;
524
- process_template_count: number;
525
- process_handler_duration: number;
527
+ processor_handler_duration: number;
528
+ processor_rpc_duration: number;
529
+ processor_rpc_queue_duration: number;
530
+ processor_template_instance_count: number;
526
531
  };
527
532
  };
533
+ declare const metricsStorage: AsyncLocalStorage<string>;
528
534
 
529
- export { type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, State, StateStorage, StoreContext, USER_PROCESSOR, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, processMetrics, providerMetrics, timeoutError };
535
+ export { type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, State, StateStorage, StoreContext, USER_PROCESSOR, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, metricsStorage, processMetrics, providerMetrics, timeoutError };
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{$ as O,V as x,W as d,X as N,Y as C,Z as V,_ as w,aa as A,ba as I,i as p,j as c,m as T,n as m,o as h,p as l,q as f,y as g}from"./chunk-J24RUMUG.js";var r=class e{stateMap=new Map;static INSTANCE=new e;static reset(){e.INSTANCE=new e}},n=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=r.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),r.INSTANCE.stateMap.set(this.key(),t)),t}unregister(){let t=r.INSTANCE.stateMap.get(this.key());return r.INSTANCE.stateMap.delete(this.key()),t}},a=class extends n{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let i=this.getOrRegister(),o=i.get(t);return o?(console.warn(t,"has been registered twice, use the previous one"),o):(i.set(t,s),s)}},u=class extends n{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));export{w as DummyProvider,f as Endpoints,g as GLOBAL_CONFIG,u as ListStateStorage,a as MapStateStorage,p as Plugin,c as PluginManager,I as ProcessorServiceImpl,A as QueuedStaticJsonRpcProvider,r as State,n as StateStorage,V as StoreContext,h as USER_PROCESSOR,x as dbMetrics,m as errorString,O as getProvider,l as makeEthCallKey,T as mergeProcessResults,N as processMetrics,d as providerMetrics,C as timeoutError};
2
+ import{$ as O,V as x,W as d,X as N,Y as C,Z as V,_ as w,aa as A,ba as I,ca as M,i as p,j as c,m as T,n as m,o as h,p as l,q as f,y as g}from"./chunk-WT54VGWA.js";var r=class e{stateMap=new Map;static INSTANCE=new e;static reset(){e.INSTANCE=new e}},n=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=r.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),r.INSTANCE.stateMap.set(this.key(),t)),t}unregister(){let t=r.INSTANCE.stateMap.get(this.key());return r.INSTANCE.stateMap.delete(this.key()),t}},a=class extends n{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let i=this.getOrRegister(),o=i.get(t);return o?(console.warn(t,"has been registered twice, use the previous one"),o):(i.set(t,s),s)}},u=class extends n{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));export{O as DummyProvider,f as Endpoints,g as GLOBAL_CONFIG,u as ListStateStorage,a as MapStateStorage,p as Plugin,c as PluginManager,M as ProcessorServiceImpl,I as QueuedStaticJsonRpcProvider,r as State,n as StateStorage,w as StoreContext,h as USER_PROCESSOR,x as dbMetrics,m as errorString,A as getProvider,l as makeEthCallKey,T as mergeProcessResults,C as metricsStorage,N as processMetrics,d as providerMetrics,V as timeoutError};
3
3
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/state.ts","../src/chain-config.ts","../src/index.ts"],"sourcesContent":["export class State {\n stateMap = new Map<string, any>()\n\n static INSTANCE = new State()\n\n static reset() {\n State.INSTANCE = new State()\n }\n}\n\nexport abstract class StateStorage<T> {\n // TODO learn how to define single instance for all subclasses\n\n protected constructor() {\n //\n }\n\n abstract initValue(): T\n\n key(): string {\n return this.constructor.name\n }\n\n getOrRegister(): T {\n let metricState: T = State.INSTANCE.stateMap.get(this.key())\n if (!metricState) {\n metricState = this.initValue()\n State.INSTANCE.stateMap.set(this.key(), metricState)\n }\n return metricState\n }\n\n unregister(): T {\n const value = State.INSTANCE.stateMap.get(this.key())\n State.INSTANCE.stateMap.delete(this.key())\n return value\n }\n}\n\nexport abstract class MapStateStorage<T> extends StateStorage<Map<string, T>> {\n initValue() {\n return new Map<string, T>()\n }\n\n getValue(key: string): T | undefined {\n const m = this.getOrRegister()\n return m.get(key)\n }\n\n getValues(): T[] {\n const m = this.getOrRegister()\n return Array.from(m.values())\n }\n\n getOrSetValue(key: string, value: T): T {\n const m = this.getOrRegister()\n const oldValue = m.get(key)\n if (oldValue) {\n console.warn(key, 'has been registered twice, use the previous one')\n return oldValue\n }\n m.set(key, value)\n return value\n }\n}\n\nexport abstract class ListStateStorage<T> extends StateStorage<T[]> {\n initValue() {\n return []\n }\n\n getValues(): T[] {\n return this.getOrRegister()\n }\n\n addValue(value: T): T {\n const m = this.getOrRegister()\n m.push(value)\n return value\n }\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export interface ChainConfig {\n ChainID: string\n Https?: string[]\n ChainServer?: string\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export * from './plugin.js'\nexport * from './state.js'\nexport * from './utils.js'\nexport * from './endpoints.js'\nexport * from './chain-config.js'\nexport * from './service.js'\nexport { GLOBAL_CONFIG, type GlobalConfig } from './global-config.js'\nexport * from './db-context.js'\nexport * from './provider.js'\nexport * from './metrics.js'\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";0JAAO,IAAMA,EAAN,MAAMC,CAAM,CACjB,SAAW,IAAI,IAEf,OAAO,SAAW,IAAIA,EAEtB,OAAO,OAAQ,CACbA,EAAM,SAAW,IAAIA,CACvB,CACF,EAEsBC,EAAf,KAA+B,CAG1B,aAAc,CAExB,CAIA,KAAc,CACZ,OAAO,KAAK,YAAY,IAC1B,CAEA,eAAmB,CACjB,IAAIC,EAAiBH,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC,EAC3D,OAAKG,IACHA,EAAc,KAAK,UAAU,EAC7BH,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,EAAGG,CAAW,GAE9CA,CACT,CAEA,YAAgB,CACd,IAAMC,EAAQJ,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC,EACpD,OAAAA,EAAM,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC,EAClCI,CACT,CACF,EAEsBC,EAAf,cAA0CH,CAA6B,CAC5E,WAAY,CACV,OAAO,IAAI,GACb,CAEA,SAASI,EAA4B,CAEnC,OADU,KAAK,cAAc,EACpB,IAAIA,CAAG,CAClB,CAEA,WAAiB,CACf,IAAMC,EAAI,KAAK,cAAc,EAC7B,OAAO,MAAM,KAAKA,EAAE,OAAO,CAAC,CAC9B,CAEA,cAAcD,EAAaF,EAAa,CACtC,IAAMG,EAAI,KAAK,cAAc,EACvBC,EAAWD,EAAE,IAAID,CAAG,EAC1B,OAAIE,GACF,QAAQ,KAAKF,EAAK,iDAAiD,EAC5DE,IAETD,EAAE,IAAID,EAAKF,CAAK,EACTA,EACT,CACF,EAEsBK,EAAf,cAA2CP,CAAkB,CAClE,WAAY,CACV,MAAO,CAAC,CACV,CAEA,WAAiB,CACf,OAAO,KAAK,cAAc,CAC5B,CAEA,SAASE,EAAa,CAEpB,OADU,KAAK,cAAc,EAC3B,KAAKA,CAAK,EACLA,CACT,CACF,EACC,OAAO,cAAc,EAAE,KAAMM,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC,EC5ErD,OAAO,cAAc,EAAE,KAAMC,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC,ECKrD,OAAO,cAAc,EAAE,KAAMC,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["State","_State","StateStorage","metricState","value","MapStateStorage","key","m","oldValue","ListStateStorage","p","p","p"]}
1
+ {"version":3,"sources":["../src/state.ts","../src/chain-config.ts","../src/index.ts"],"sourcesContent":["export class State {\n stateMap = new Map<string, any>()\n\n static INSTANCE = new State()\n\n static reset() {\n State.INSTANCE = new State()\n }\n}\n\nexport abstract class StateStorage<T> {\n // TODO learn how to define single instance for all subclasses\n\n protected constructor() {\n //\n }\n\n abstract initValue(): T\n\n key(): string {\n return this.constructor.name\n }\n\n getOrRegister(): T {\n let metricState: T = State.INSTANCE.stateMap.get(this.key())\n if (!metricState) {\n metricState = this.initValue()\n State.INSTANCE.stateMap.set(this.key(), metricState)\n }\n return metricState\n }\n\n unregister(): T {\n const value = State.INSTANCE.stateMap.get(this.key())\n State.INSTANCE.stateMap.delete(this.key())\n return value\n }\n}\n\nexport abstract class MapStateStorage<T> extends StateStorage<Map<string, T>> {\n initValue() {\n return new Map<string, T>()\n }\n\n getValue(key: string): T | undefined {\n const m = this.getOrRegister()\n return m.get(key)\n }\n\n getValues(): T[] {\n const m = this.getOrRegister()\n return Array.from(m.values())\n }\n\n getOrSetValue(key: string, value: T): T {\n const m = this.getOrRegister()\n const oldValue = m.get(key)\n if (oldValue) {\n console.warn(key, 'has been registered twice, use the previous one')\n return oldValue\n }\n m.set(key, value)\n return value\n }\n}\n\nexport abstract class ListStateStorage<T> extends StateStorage<T[]> {\n initValue() {\n return []\n }\n\n getValues(): T[] {\n return this.getOrRegister()\n }\n\n addValue(value: T): T {\n const m = this.getOrRegister()\n m.push(value)\n return value\n }\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export interface ChainConfig {\n ChainID: string\n Https?: string[]\n ChainServer?: string\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));","export * from './plugin.js'\nexport * from './state.js'\nexport * from './utils.js'\nexport * from './endpoints.js'\nexport * from './chain-config.js'\nexport * from './service.js'\nexport { GLOBAL_CONFIG, type GlobalConfig } from './global-config.js'\nexport * from './db-context.js'\nexport * from './provider.js'\nexport * from './metrics.js'\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";kKAAO,IAAMA,EAAN,MAAMC,CAAM,CACjB,SAAW,IAAI,IAEf,OAAO,SAAW,IAAIA,EAEtB,OAAO,OAAQ,CACbA,EAAM,SAAW,IAAIA,CACvB,CACF,EAEsBC,EAAf,KAA+B,CAG1B,aAAc,CAExB,CAIA,KAAc,CACZ,OAAO,KAAK,YAAY,IAC1B,CAEA,eAAmB,CACjB,IAAIC,EAAiBH,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC,EAC3D,OAAKG,IACHA,EAAc,KAAK,UAAU,EAC7BH,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,EAAGG,CAAW,GAE9CA,CACT,CAEA,YAAgB,CACd,IAAMC,EAAQJ,EAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC,EACpD,OAAAA,EAAM,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC,EAClCI,CACT,CACF,EAEsBC,EAAf,cAA0CH,CAA6B,CAC5E,WAAY,CACV,OAAO,IAAI,GACb,CAEA,SAASI,EAA4B,CAEnC,OADU,KAAK,cAAc,EACpB,IAAIA,CAAG,CAClB,CAEA,WAAiB,CACf,IAAMC,EAAI,KAAK,cAAc,EAC7B,OAAO,MAAM,KAAKA,EAAE,OAAO,CAAC,CAC9B,CAEA,cAAcD,EAAaF,EAAa,CACtC,IAAMG,EAAI,KAAK,cAAc,EACvBC,EAAWD,EAAE,IAAID,CAAG,EAC1B,OAAIE,GACF,QAAQ,KAAKF,EAAK,iDAAiD,EAC5DE,IAETD,EAAE,IAAID,EAAKF,CAAK,EACTA,EACT,CACF,EAEsBK,EAAf,cAA2CP,CAAkB,CAClE,WAAY,CACV,MAAO,CAAC,CACV,CAEA,WAAiB,CACf,OAAO,KAAK,cAAc,CAC5B,CAEA,SAASE,EAAa,CAEpB,OADU,KAAK,cAAc,EAC3B,KAAKA,CAAK,EACLA,CACT,CACF,EACC,OAAO,cAAc,EAAE,KAAMM,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC,EC5ErD,OAAO,cAAc,EAAE,KAAMC,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC,ECKrD,OAAO,cAAc,EAAE,KAAMC,GAAMA,EAAE,OAAO,MAAM,EAAE,CAAC","names":["State","_State","StateStorage","metricState","value","MapStateStorage","key","m","oldValue","ListStateStorage","p","p","p"]}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
3
- import{A as EE,B as Kr,C as _E,D as SE,E as pt,F as J,G as hE,H as kt,I as Ii,J as dt,K as TE,L as Et,M as vE,N as mE,O as Ye,P as g,Q as Ci,R as it,S as X,T as Pe,U as x,a as L,b as m,ba as yE,c as h,d as nt,e as Fe,f as Y,g as kU,h as uE,j as xl,k as lE,l as cE,q as Tr,r as Ml,s as fE,t as eo,u as pE,v as dE,w as HU,x as FU,y as Ll,z as ot}from"./chunk-J24RUMUG.js";var Ee=h(Il=>{"use strict";Il.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((n,i)=>{e.push((a,s)=>a!=null?i(a):n(s)),t.apply(this,e)})},"name",{value:t.name})};Il.fromPromise=function(t){return Object.defineProperty(function(...e){let n=e[e.length-1];if(typeof n!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(i=>n(null,i),n)},"name",{value:t.name})}});var OE=h((Y7,AE)=>{"use strict";var Ht=L("constants"),YU=process.cwd,wi=null,qU=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return wi||(wi=YU.call(process)),wi};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cl=process.chdir,process.chdir=function(t){wi=null,Cl.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cl));var Cl;AE.exports=jU;function jU(t){Ht.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=i(t.chmod),t.fchmod=i(t.fchmod),t.lchmod=i(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=a(t.chmodSync),t.fchmodSync=a(t.fchmodSync),t.lchmodSync=a(t.lchmodSync),t.stat=r(t.stat),t.fstat=r(t.fstat),t.lstat=r(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,p,_){_&&process.nextTick(_)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,p,_,f){f&&process.nextTick(f)},t.lchownSync=function(){}),qU==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function p(_,f,S){var v=Date.now(),T=0;c(_,f,function A(O){if(O&&(O.code==="EACCES"||O.code==="EPERM"||O.code==="EBUSY")&&Date.now()-v<6e4){setTimeout(function(){t.stat(f,function(N,D){N&&N.code==="ENOENT"?c(_,f,A):S(O)})},T),T<100&&(T+=10);return}S&&S(O)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function p(_,f,S,v,T,A){var O;if(A&&typeof A=="function"){var N=0;O=function(D,G,F){if(D&&D.code==="EAGAIN"&&N<10)return N++,c.call(t,_,f,S,v,T,O);A.apply(this,arguments)}}return c.call(t,_,f,S,v,T,O)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(p,_,f,S,v){for(var T=0;;)try{return c.call(t,p,_,f,S,v)}catch(A){if(A.code==="EAGAIN"&&T<10){T++;continue}throw A}}}(t.readSync);function e(c){c.lchmod=function(p,_,f){c.open(p,Ht.O_WRONLY|Ht.O_SYMLINK,_,function(S,v){if(S){f&&f(S);return}c.fchmod(v,_,function(T){c.close(v,function(A){f&&f(T||A)})})})},c.lchmodSync=function(p,_){var f=c.openSync(p,Ht.O_WRONLY|Ht.O_SYMLINK,_),S=!0,v;try{v=c.fchmodSync(f,_),S=!1}finally{if(S)try{c.closeSync(f)}catch{}else c.closeSync(f)}return v}}function n(c){Ht.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(p,_,f,S){c.open(p,Ht.O_SYMLINK,function(v,T){if(v){S&&S(v);return}c.futimes(T,_,f,function(A){c.close(T,function(O){S&&S(A||O)})})})},c.lutimesSync=function(p,_,f){var S=c.openSync(p,Ht.O_SYMLINK),v,T=!0;try{v=c.futimesSync(S,_,f),T=!1}finally{if(T)try{c.closeSync(S)}catch{}else c.closeSync(S)}return v}):c.futimes&&(c.lutimes=function(p,_,f,S){S&&process.nextTick(S)},c.lutimesSync=function(){})}function i(c){return c&&function(p,_,f){return c.call(t,p,_,function(S){l(S)&&(S=null),f&&f.apply(this,arguments)})}}function a(c){return c&&function(p,_){try{return c.call(t,p,_)}catch(f){if(!l(f))throw f}}}function s(c){return c&&function(p,_,f,S){return c.call(t,p,_,f,function(v){l(v)&&(v=null),S&&S.apply(this,arguments)})}}function o(c){return c&&function(p,_,f){try{return c.call(t,p,_,f)}catch(S){if(!l(S))throw S}}}function r(c){return c&&function(p,_,f){typeof _=="function"&&(f=_,_=null);function S(v,T){T&&(T.uid<0&&(T.uid+=4294967296),T.gid<0&&(T.gid+=4294967296)),f&&f.apply(this,arguments)}return _?c.call(t,p,_,S):c.call(t,p,S)}}function u(c){return c&&function(p,_){var f=_?c.call(t,p,_):c.call(t,p);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(c){if(!c||c.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var RE=h((q7,NE)=>{"use strict";var gE=L("stream").Stream;NE.exports=$U;function $U(t){return{ReadStream:e,WriteStream:n};function e(i,a){if(!(this instanceof e))return new e(i,a);gE.call(this);var s=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,a=a||{};for(var o=Object.keys(a),r=0,u=o.length;r<u;r++){var l=o[r];this[l]=a[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(c,p){if(c){s.emit("error",c),s.readable=!1;return}s.fd=p,s.emit("open",p),s._read()})}function n(i,a){if(!(this instanceof n))return new n(i,a);gE.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,a=a||{};for(var s=Object.keys(a),o=0,r=s.length;o<r;o++){var u=s[o];this[u]=a[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var bE=h((j7,PE)=>{"use strict";PE.exports=WU;var KU=Object.getPrototypeOf||function(t){return t.__proto__};function WU(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:KU(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var zr=h(($7,Dl)=>{"use strict";var ie=L("fs"),zU=OE(),XU=RE(),JU=bE(),Ui=L("util"),me,Vi;typeof Symbol=="function"&&typeof Symbol.for=="function"?(me=Symbol.for("graceful-fs.queue"),Vi=Symbol.for("graceful-fs.previous")):(me="___graceful-fs.queue",Vi="___graceful-fs.previous");function QU(){}function LE(t,e){Object.defineProperty(t,me,{get:function(){return e}})}var vr=QU;Ui.debuglog?vr=Ui.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(vr=function(){var t=Ui.format.apply(Ui,arguments);t="GFS4: "+t.split(/\n/).join(`
3
+ import{A as EE,B as Kr,C as _E,D as SE,E as pt,F as J,G as hE,H as kt,I as Ii,J as dt,K as TE,L as Et,M as vE,N as mE,O as Ye,P as g,Q as Ci,R as it,S as X,T as Pe,U as x,a as L,b as m,c as h,ca as yE,d as nt,e as Fe,f as Y,g as kU,h as uE,j as xl,k as lE,l as cE,q as Tr,r as Ml,s as fE,t as eo,u as pE,v as dE,w as HU,x as FU,y as Ll,z as ot}from"./chunk-WT54VGWA.js";var Ee=h(Il=>{"use strict";Il.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((n,i)=>{e.push((a,s)=>a!=null?i(a):n(s)),t.apply(this,e)})},"name",{value:t.name})};Il.fromPromise=function(t){return Object.defineProperty(function(...e){let n=e[e.length-1];if(typeof n!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(i=>n(null,i),n)},"name",{value:t.name})}});var OE=h((Y7,AE)=>{"use strict";var Ht=L("constants"),YU=process.cwd,wi=null,qU=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return wi||(wi=YU.call(process)),wi};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cl=process.chdir,process.chdir=function(t){wi=null,Cl.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cl));var Cl;AE.exports=jU;function jU(t){Ht.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||n(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=i(t.chmod),t.fchmod=i(t.fchmod),t.lchmod=i(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=a(t.chmodSync),t.fchmodSync=a(t.fchmodSync),t.lchmodSync=a(t.lchmodSync),t.stat=r(t.stat),t.fstat=r(t.fstat),t.lstat=r(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,p,_){_&&process.nextTick(_)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,p,_,f){f&&process.nextTick(f)},t.lchownSync=function(){}),qU==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function p(_,f,S){var v=Date.now(),T=0;c(_,f,function A(O){if(O&&(O.code==="EACCES"||O.code==="EPERM"||O.code==="EBUSY")&&Date.now()-v<6e4){setTimeout(function(){t.stat(f,function(N,D){N&&N.code==="ENOENT"?c(_,f,A):S(O)})},T),T<100&&(T+=10);return}S&&S(O)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function p(_,f,S,v,T,A){var O;if(A&&typeof A=="function"){var N=0;O=function(D,G,F){if(D&&D.code==="EAGAIN"&&N<10)return N++,c.call(t,_,f,S,v,T,O);A.apply(this,arguments)}}return c.call(t,_,f,S,v,T,O)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,c),p}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(p,_,f,S,v){for(var T=0;;)try{return c.call(t,p,_,f,S,v)}catch(A){if(A.code==="EAGAIN"&&T<10){T++;continue}throw A}}}(t.readSync);function e(c){c.lchmod=function(p,_,f){c.open(p,Ht.O_WRONLY|Ht.O_SYMLINK,_,function(S,v){if(S){f&&f(S);return}c.fchmod(v,_,function(T){c.close(v,function(A){f&&f(T||A)})})})},c.lchmodSync=function(p,_){var f=c.openSync(p,Ht.O_WRONLY|Ht.O_SYMLINK,_),S=!0,v;try{v=c.fchmodSync(f,_),S=!1}finally{if(S)try{c.closeSync(f)}catch{}else c.closeSync(f)}return v}}function n(c){Ht.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(p,_,f,S){c.open(p,Ht.O_SYMLINK,function(v,T){if(v){S&&S(v);return}c.futimes(T,_,f,function(A){c.close(T,function(O){S&&S(A||O)})})})},c.lutimesSync=function(p,_,f){var S=c.openSync(p,Ht.O_SYMLINK),v,T=!0;try{v=c.futimesSync(S,_,f),T=!1}finally{if(T)try{c.closeSync(S)}catch{}else c.closeSync(S)}return v}):c.futimes&&(c.lutimes=function(p,_,f,S){S&&process.nextTick(S)},c.lutimesSync=function(){})}function i(c){return c&&function(p,_,f){return c.call(t,p,_,function(S){l(S)&&(S=null),f&&f.apply(this,arguments)})}}function a(c){return c&&function(p,_){try{return c.call(t,p,_)}catch(f){if(!l(f))throw f}}}function s(c){return c&&function(p,_,f,S){return c.call(t,p,_,f,function(v){l(v)&&(v=null),S&&S.apply(this,arguments)})}}function o(c){return c&&function(p,_,f){try{return c.call(t,p,_,f)}catch(S){if(!l(S))throw S}}}function r(c){return c&&function(p,_,f){typeof _=="function"&&(f=_,_=null);function S(v,T){T&&(T.uid<0&&(T.uid+=4294967296),T.gid<0&&(T.gid+=4294967296)),f&&f.apply(this,arguments)}return _?c.call(t,p,_,S):c.call(t,p,S)}}function u(c){return c&&function(p,_){var f=_?c.call(t,p,_):c.call(t,p);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function l(c){if(!c||c.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var RE=h((q7,NE)=>{"use strict";var gE=L("stream").Stream;NE.exports=$U;function $U(t){return{ReadStream:e,WriteStream:n};function e(i,a){if(!(this instanceof e))return new e(i,a);gE.call(this);var s=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,a=a||{};for(var o=Object.keys(a),r=0,u=o.length;r<u;r++){var l=o[r];this[l]=a[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(c,p){if(c){s.emit("error",c),s.readable=!1;return}s.fd=p,s.emit("open",p),s._read()})}function n(i,a){if(!(this instanceof n))return new n(i,a);gE.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,a=a||{};for(var s=Object.keys(a),o=0,r=s.length;o<r;o++){var u=s[o];this[u]=a[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var bE=h((j7,PE)=>{"use strict";PE.exports=WU;var KU=Object.getPrototypeOf||function(t){return t.__proto__};function WU(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:KU(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}});var zr=h(($7,Dl)=>{"use strict";var ie=L("fs"),zU=OE(),XU=RE(),JU=bE(),Ui=L("util"),me,Vi;typeof Symbol=="function"&&typeof Symbol.for=="function"?(me=Symbol.for("graceful-fs.queue"),Vi=Symbol.for("graceful-fs.previous")):(me="___graceful-fs.queue",Vi="___graceful-fs.previous");function QU(){}function LE(t,e){Object.defineProperty(t,me,{get:function(){return e}})}var vr=QU;Ui.debuglog?vr=Ui.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(vr=function(){var t=Ui.format.apply(Ui,arguments);t="GFS4: "+t.split(/\n/).join(`
4
4
  GFS4: `),console.error(t)});ie[me]||(xE=global[me]||[],LE(ie,xE),ie.close=function(t){function e(n,i){return t.call(ie,n,function(a){a||ME(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(e,Vi,{value:t}),e}(ie.close),ie.closeSync=function(t){function e(n){t.apply(ie,arguments),ME()}return Object.defineProperty(e,Vi,{value:t}),e}(ie.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){vr(ie[me]),L("assert").equal(ie[me].length,0)}));var xE;global[me]||LE(global,ie[me]);Dl.exports=wl(JU(ie));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ie.__patched&&(Dl.exports=wl(ie),ie.__patched=!0);function wl(t){zU(t),t.gracefulify=wl,t.createReadStream=G,t.createWriteStream=F;var e=t.readFile;t.readFile=n;function n(M,B,w){return typeof B=="function"&&(w=B,B=null),W(M,B,w);function W(z,ne,oe,se){return e(z,ne,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Wr([W,[z,ne,oe],Z,se||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}}var i=t.writeFile;t.writeFile=a;function a(M,B,w,W){return typeof w=="function"&&(W=w,w=null),z(M,B,w,W);function z(ne,oe,se,Z,ve){return i(ne,oe,se,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Wr([z,[ne,oe,se,Z],re,ve||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(M,B,w,W){return typeof w=="function"&&(W=w,w=null),z(M,B,w,W);function z(ne,oe,se,Z,ve){return s(ne,oe,se,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Wr([z,[ne,oe,se,Z],re,ve||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var r=t.copyFile;r&&(t.copyFile=u);function u(M,B,w,W){return typeof w=="function"&&(W=w,w=0),z(M,B,w,W);function z(ne,oe,se,Z,ve){return r(ne,oe,se,function(re){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Wr([z,[ne,oe,se,Z],re,ve||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}var l=t.readdir;t.readdir=p;var c=/^v[0-5]\./;function p(M,B,w){typeof B=="function"&&(w=B,B=null);var W=c.test(process.version)?function(oe,se,Z,ve){return l(oe,z(oe,se,Z,ve))}:function(oe,se,Z,ve){return l(oe,se,z(oe,se,Z,ve))};return W(M,B,w);function z(ne,oe,se,Z){return function(ve,re){ve&&(ve.code==="EMFILE"||ve.code==="ENFILE")?Wr([W,[ne,oe,se],ve,Z||Date.now(),Date.now()]):(re&&re.sort&&re.sort(),typeof se=="function"&&se.call(this,ve,re))}}}if(process.version.substr(0,4)==="v0.8"){var _=XU(t);A=_.ReadStream,N=_.WriteStream}var f=t.ReadStream;f&&(A.prototype=Object.create(f.prototype),A.prototype.open=O);var S=t.WriteStream;S&&(N.prototype=Object.create(S.prototype),N.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return A},set:function(M){A=M},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return N},set:function(M){N=M},enumerable:!0,configurable:!0});var v=A;Object.defineProperty(t,"FileReadStream",{get:function(){return v},set:function(M){v=M},enumerable:!0,configurable:!0});var T=N;Object.defineProperty(t,"FileWriteStream",{get:function(){return T},set:function(M){T=M},enumerable:!0,configurable:!0});function A(M,B){return this instanceof A?(f.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function O(){var M=this;j(M.path,M.flags,M.mode,function(B,w){B?(M.autoClose&&M.destroy(),M.emit("error",B)):(M.fd=w,M.emit("open",w),M.read())})}function N(M,B){return this instanceof N?(S.apply(this,arguments),this):N.apply(Object.create(N.prototype),arguments)}function D(){var M=this;j(M.path,M.flags,M.mode,function(B,w){B?(M.destroy(),M.emit("error",B)):(M.fd=w,M.emit("open",w))})}function G(M,B){return new t.ReadStream(M,B)}function F(M,B){return new t.WriteStream(M,B)}var ae=t.open;t.open=j;function j(M,B,w,W){return typeof w=="function"&&(W=w,w=null),z(M,B,w,W);function z(ne,oe,se,Z,ve){return ae(ne,oe,se,function(re,H7){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Wr([z,[ne,oe,se,Z],re,ve||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}}return t}function Wr(t){vr("ENQUEUE",t[0].name,t[1]),ie[me].push(t),Ul()}var Di;function ME(){for(var t=Date.now(),e=0;e<ie[me].length;++e)ie[me][e].length>2&&(ie[me][e][3]=t,ie[me][e][4]=t);Ul()}function Ul(){if(clearTimeout(Di),Di=void 0,ie[me].length!==0){var t=ie[me].shift(),e=t[0],n=t[1],i=t[2],a=t[3],s=t[4];if(a===void 0)vr("RETRY",e.name,n),e.apply(null,n);else if(Date.now()-a>=6e4){vr("TIMEOUT",e.name,n);var o=n.pop();typeof o=="function"&&o.call(null,i)}else{var r=Date.now()-s,u=Math.max(s-a,1),l=Math.min(u*1.2,100);r>=l?(vr("RETRY",e.name,n),e.apply(null,n.concat([a]))):ie[me].push(t)}Di===void 0&&(Di=setTimeout(Ul,0))}}});var Ie=h(Mt=>{"use strict";var IE=Ee().fromCallback,Le=zr(),ZU=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof Le[t]=="function");Object.assign(Mt,Le);ZU.forEach(t=>{Mt[t]=IE(Le[t])});Mt.exists=function(t,e){return typeof e=="function"?Le.exists(t,e):new Promise(n=>Le.exists(t,n))};Mt.read=function(t,e,n,i,a,s){return typeof s=="function"?Le.read(t,e,n,i,a,s):new Promise((o,r)=>{Le.read(t,e,n,i,a,(u,l,c)=>{if(u)return r(u);o({bytesRead:l,buffer:c})})})};Mt.write=function(t,e,...n){return typeof n[n.length-1]=="function"?Le.write(t,e,...n):new Promise((i,a)=>{Le.write(t,e,...n,(s,o,r)=>{if(s)return a(s);i({bytesWritten:o,buffer:r})})})};Mt.readv=function(t,e,...n){return typeof n[n.length-1]=="function"?Le.readv(t,e,...n):new Promise((i,a)=>{Le.readv(t,e,...n,(s,o,r)=>{if(s)return a(s);i({bytesRead:o,buffers:r})})})};Mt.writev=function(t,e,...n){return typeof n[n.length-1]=="function"?Le.writev(t,e,...n):new Promise((i,a)=>{Le.writev(t,e,...n,(s,o,r)=>{if(s)return a(s);i({bytesWritten:o,buffers:r})})})};typeof Le.realpath.native=="function"?Mt.realpath.native=IE(Le.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var wE=h((W7,CE)=>{"use strict";var eD=L("path");CE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(eD.parse(e).root,""))){let i=new Error(`Path contains invalid characters: ${e}`);throw i.code="EINVAL",i}}});var BE=h((z7,Vl)=>{"use strict";var UE=Ie(),{checkPath:DE}=wE(),VE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Vl.exports.makeDir=async(t,e)=>(DE(t),UE.mkdir(t,{mode:VE(e),recursive:!0}));Vl.exports.makeDirSync=(t,e)=>(DE(t),UE.mkdirSync(t,{mode:VE(e),recursive:!0}))});var at=h((X7,GE)=>{"use strict";var tD=Ee().fromPromise,{makeDir:rD,makeDirSync:Bl}=BE(),Gl=tD(rD);GE.exports={mkdirs:Gl,mkdirsSync:Bl,mkdirp:Gl,mkdirpSync:Bl,ensureDir:Gl,ensureDirSync:Bl}});var Ft=h((J7,HE)=>{"use strict";var nD=Ee().fromPromise,kE=Ie();function oD(t){return kE.access(t).then(()=>!0).catch(()=>!1)}HE.exports={pathExists:nD(oD),pathExistsSync:kE.existsSync}});var kl=h((Q7,FE)=>{"use strict";var Xr=Ie(),iD=Ee().fromPromise;async function aD(t,e,n){let i=await Xr.open(t,"r+"),a=null;try{await Xr.futimes(i,e,n)}finally{try{await Xr.close(i)}catch(s){a=s}}if(a)throw a}function sD(t,e,n){let i=Xr.openSync(t,"r+");return Xr.futimesSync(i,e,n),Xr.closeSync(i)}FE.exports={utimesMillis:iD(aD),utimesMillisSync:sD}});var mr=h((Z7,$E)=>{"use strict";var Jr=Ie(),_e=L("path"),YE=Ee().fromPromise;function uD(t,e,n){let i=n.dereference?a=>Jr.stat(a,{bigint:!0}):a=>Jr.lstat(a,{bigint:!0});return Promise.all([i(t),i(e).catch(a=>{if(a.code==="ENOENT")return null;throw a})]).then(([a,s])=>({srcStat:a,destStat:s}))}function lD(t,e,n){let i,a=n.dereference?o=>Jr.statSync(o,{bigint:!0}):o=>Jr.lstatSync(o,{bigint:!0}),s=a(t);try{i=a(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:i}}async function cD(t,e,n,i){let{srcStat:a,destStat:s}=await uD(t,e,i);if(s){if(to(a,s)){let o=_e.basename(t),r=_e.basename(e);if(n==="move"&&o!==r&&o.toLowerCase()===r.toLowerCase())return{srcStat:a,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!a.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(a.isDirectory()&&Hl(t,e))throw new Error(Bi(t,e,n));return{srcStat:a,destStat:s}}function fD(t,e,n,i){let{srcStat:a,destStat:s}=lD(t,e,i);if(s){if(to(a,s)){let o=_e.basename(t),r=_e.basename(e);if(n==="move"&&o!==r&&o.toLowerCase()===r.toLowerCase())return{srcStat:a,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!a.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(a.isDirectory()&&Hl(t,e))throw new Error(Bi(t,e,n));return{srcStat:a,destStat:s}}async function qE(t,e,n,i){let a=_e.resolve(_e.dirname(t)),s=_e.resolve(_e.dirname(n));if(s===a||s===_e.parse(s).root)return;let o;try{o=await Jr.stat(s,{bigint:!0})}catch(r){if(r.code==="ENOENT")return;throw r}if(to(e,o))throw new Error(Bi(t,n,i));return qE(t,e,s,i)}function jE(t,e,n,i){let a=_e.resolve(_e.dirname(t)),s=_e.resolve(_e.dirname(n));if(s===a||s===_e.parse(s).root)return;let o;try{o=Jr.statSync(s,{bigint:!0})}catch(r){if(r.code==="ENOENT")return;throw r}if(to(e,o))throw new Error(Bi(t,n,i));return jE(t,e,s,i)}function to(t,e){return e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev}function Hl(t,e){let n=_e.resolve(t).split(_e.sep).filter(a=>a),i=_e.resolve(e).split(_e.sep).filter(a=>a);return n.every((a,s)=>i[s]===a)}function Bi(t,e,n){return`Cannot ${n} '${t}' to a subdirectory of itself, '${e}'.`}$E.exports={checkPaths:YE(cD),checkPathsSync:fD,checkParentPaths:YE(qE),checkParentPathsSync:jE,isSrcSubdir:Hl,areIdentical:to}});var JE=h((eQ,XE)=>{"use strict";var be=Ie(),ro=L("path"),{mkdirs:pD}=at(),{pathExists:dD}=Ft(),{utimesMillis:ED}=kl(),no=mr();async function _D(t,e,n={}){typeof n=="function"&&(n={filter:n}),n.clobber="clobber"in n?!!n.clobber:!0,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
5
5
 
6
6
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:i,destStat:a}=await no.checkPaths(t,e,"copy",n);if(await no.checkParentPaths(t,i,e,"copy"),!await WE(t,e,n))return;let o=ro.dirname(e);await dD(o)||await pD(o),await zE(a,t,e,n)}async function WE(t,e,n){return n.filter?n.filter(t,e):!0}async function zE(t,e,n,i){let s=await(i.dereference?be.stat:be.lstat)(e);if(s.isDirectory())return vD(s,t,e,n,i);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return SD(s,t,e,n,i);if(s.isSymbolicLink())return mD(t,e,n,i);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function SD(t,e,n,i,a){if(!e)return KE(t,n,i,a);if(a.overwrite)return await be.unlink(i),KE(t,n,i,a);if(a.errorOnExist)throw new Error(`'${i}' already exists`)}async function KE(t,e,n,i){if(await be.copyFile(e,n),i.preserveTimestamps){hD(t.mode)&&await TD(n,t.mode);let a=await be.stat(e);await ED(n,a.atime,a.mtime)}return be.chmod(n,t.mode)}function hD(t){return(t&128)===0}function TD(t,e){return be.chmod(t,e|128)}async function vD(t,e,n,i,a){e||await be.mkdir(i);let s=await be.readdir(n);await Promise.all(s.map(async o=>{let r=ro.join(n,o),u=ro.join(i,o);if(!await WE(r,u,a))return;let{destStat:c}=await no.checkPaths(r,u,"copy",a);return zE(c,r,u,a)})),e||await be.chmod(i,t.mode)}async function mD(t,e,n,i){let a=await be.readlink(e);if(i.dereference&&(a=ro.resolve(process.cwd(),a)),!t)return be.symlink(a,n);let s=null;try{s=await be.readlink(n)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return be.symlink(a,n);throw o}if(i.dereference&&(s=ro.resolve(process.cwd(),s)),no.isSrcSubdir(a,s))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${s}'.`);if(no.isSrcSubdir(s,a))throw new Error(`Cannot overwrite '${s}' with '${a}'.`);return await be.unlink(n),be.symlink(a,n)}XE.exports=_D});var r_=h((tQ,t_)=>{"use strict";var Ce=zr(),oo=L("path"),yD=at().mkdirsSync,AD=kl().utimesMillisSync,io=mr();function OD(t,e,n){typeof n=="function"&&(n={filter:n}),n=n||{},n.clobber="clobber"in n?!!n.clobber:!0,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.49.2-rc.3",
3
+ "version": "2.49.2-rc.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/metrics.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Attributes, Counter, metrics, Gauge } from '@opentelemetry/api'
1
+ import { AsyncLocalStorage } from 'node:async_hooks'
2
+ import { Attributes, Counter, metrics, Gauge, Histogram } from '@opentelemetry/api'
2
3
 
3
4
  const getMeter = () => metrics.getMeter('processor')
4
5
 
@@ -48,6 +49,29 @@ class G {
48
49
  }
49
50
  }
50
51
 
52
+ class H {
53
+ private _histogram: Histogram<Attributes>
54
+ private value: number = 0
55
+
56
+ constructor(private name: string) {}
57
+
58
+ get histogram(): Histogram<Attributes> {
59
+ if (!this._histogram) {
60
+ this._histogram = getMeter().createHistogram(this.name)
61
+ }
62
+ return this._histogram
63
+ }
64
+
65
+ record(value: number, attributes?: Attributes) {
66
+ this.histogram.record(value, attributes)
67
+ this.value = value
68
+ }
69
+
70
+ get() {
71
+ return this.value
72
+ }
73
+ }
74
+
51
75
  export const dbMetrics = {
52
76
  send_counts: {
53
77
  get: new C('store_get_send'),
@@ -119,17 +143,11 @@ export const providerMetrics = {
119
143
  hit_count: new C('provider_hit_count'),
120
144
  miss_count: new C('provider_miss_count'),
121
145
  queue_size: new G('provider_queue_size'),
122
- total_duration: new C('provider_total_duration'),
123
- total_queued: new C('provider_total_queued'),
124
146
  stats() {
125
147
  return {
126
148
  hit_count: this.hit_count.get(),
127
149
  miss_count: this.miss_count.get(),
128
- queue_size: this.queue_size.get(),
129
- total_duration: this.total_duration.get(),
130
- total_queued: this.total_queued.get(),
131
- average_queue_time: this.total_queued.get() / (this.hit_count.get() + this.miss_count.get()),
132
- average_duration: this.total_duration.get() / (this.hit_count.get() + this.miss_count.get())
150
+ queue_size: this.queue_size.get()
133
151
  }
134
152
  }
135
153
  }
@@ -138,23 +156,27 @@ export const processMetrics = {
138
156
  process_binding_count: new C('process_binding_count'),
139
157
  process_binding_time: new C('process_binding_time'),
140
158
  process_binding_error: new C('process_binding_error'),
141
- process_ethcall_count: new C('process_ethcall_count'),
142
159
  process_eventemit_count: new C('process_eventemit_count'),
143
160
  process_metricrecord_count: new C('process_metricrecord_count'),
144
161
  process_pricecall_count: new C('process_pricecall_count'),
145
- process_template_count: new C('process_template_count'),
146
- process_handler_duration: new G('process_handler_duration'),
162
+ processor_handler_duration: new H('processor_handler_duration'),
163
+ processor_rpc_duration: new H('processor_rpc_duration'),
164
+ processor_rpc_queue_duration: new H('processor_rpc_queue_duration'),
165
+ processor_template_instance_count: new C('process_template_instance_count'),
147
166
  stats() {
148
167
  return {
149
168
  process_binding_count: this.process_binding_count.get(),
150
169
  process_binding_time: this.process_binding_time.get(),
151
170
  process_binding_error: this.process_binding_error.get(),
152
- process_ethcall_count: this.process_ethcall_count.get(),
153
171
  process_eventemit_count: this.process_eventemit_count.get(),
154
172
  process_metricrecord_count: this.process_metricrecord_count.get(),
155
173
  process_pricecall_count: this.process_pricecall_count.get(),
156
- process_template_count: this.process_template_count.get(),
157
- process_handler_duration: this.process_handler_duration.get()
174
+ processor_handler_duration: this.processor_handler_duration.get(),
175
+ processor_rpc_duration: this.processor_rpc_duration.get(),
176
+ processor_rpc_queue_duration: this.processor_rpc_queue_duration.get(),
177
+ processor_template_instance_count: this.processor_template_instance_count.get()
158
178
  }
159
179
  }
160
180
  }
181
+
182
+ export const metricsStorage = new AsyncLocalStorage<string>()
package/src/provider.ts CHANGED
@@ -4,9 +4,9 @@ import PQueue from 'p-queue'
4
4
  import { Endpoints } from './endpoints.js'
5
5
  import { EthChainId } from '@sentio/chain'
6
6
  import { LRUCache } from 'lru-cache'
7
- import { providerMetrics } from './metrics.js'
7
+ import { providerMetrics, processMetrics, metricsStorage } from './metrics.js'
8
8
  import { GLOBAL_CONFIG } from './global-config.js'
9
- const { miss_count, hit_count, total_duration, total_queued, queue_size } = providerMetrics
9
+ const { miss_count, hit_count, queue_size } = providerMetrics
10
10
 
11
11
  export const DummyProvider = new JsonRpcProvider('', Network.from(1))
12
12
 
@@ -127,11 +127,25 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
127
127
  const queued: number = Date.now()
128
128
  perform = this.executor.add(() => {
129
129
  const started = Date.now()
130
- total_queued.add(started - queued)
131
-
132
- return super.send(method, params).finally(() => {
133
- total_duration.add(Date.now() - started)
130
+ processMetrics.processor_rpc_queue_duration.record(started - queued, {
131
+ chain_id: this._network.chainId.toString(),
132
+ handler: metricsStorage.getStore()
134
133
  })
134
+
135
+ let success = true
136
+ return super
137
+ .send(method, params)
138
+ .catch((e) => {
139
+ success = false
140
+ throw e
141
+ })
142
+ .finally(() => {
143
+ processMetrics.processor_rpc_duration.record(Date.now() - started, {
144
+ chain_id: this._network.chainId.toString(),
145
+ handler: metricsStorage.getStore(),
146
+ success
147
+ })
148
+ })
135
149
  })
136
150
 
137
151
  queue_size.record(this.executor.size)