@sentio/runtime 2.57.11 → 2.57.12-rc.aaa
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/chunk-DYOBLZD3.js +80341 -0
- package/lib/{chunk-VDRKULG2.js.map → chunk-DYOBLZD3.js.map} +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +125 -1
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.d.ts +33 -0
- package/lib/processor-runner.js +41147 -57
- package/lib/processor-runner.js.map +1 -1
- package/package.json +29 -4
- package/src/processor-runner.ts +12 -4
- package/src/service-manager.ts +263 -0
- package/src/service-worker.ts +116 -0
- package/src/service.ts +1 -1
- package/lib/chunk-VDRKULG2.js +0 -131
package/lib/index.d.ts
CHANGED
@@ -463,6 +463,7 @@ declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
463
463
|
}, void, undefined>;
|
464
464
|
private handleRequests;
|
465
465
|
}
|
466
|
+
declare function recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType): void;
|
466
467
|
|
467
468
|
interface ExecutionConfig {
|
468
469
|
sequential: boolean;
|
@@ -659,4 +660,4 @@ declare const processMetrics: {
|
|
659
660
|
};
|
660
661
|
declare const metricsStorage: AsyncLocalStorage<string>;
|
661
662
|
|
662
|
-
export { type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, type Semver, State, StateStorage, StoreContext, USER_PROCESSOR, compareSemver, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, metricsStorage, parseSemver, processMetrics, providerMetrics, timeoutError };
|
663
|
+
export { type ChainConfig, DummyProvider, Endpoints, GLOBAL_CONFIG, type GlobalConfig, ListStateStorage, MapStateStorage, Plugin, PluginManager, ProcessorServiceImpl, QueuedStaticJsonRpcProvider, type Semver, State, StateStorage, StoreContext, USER_PROCESSOR, compareSemver, dbMetrics, errorString, getProvider, makeEthCallKey, mergeProcessResults, metricsStorage, parseSemver, processMetrics, providerMetrics, recordRuntimeInfo, timeoutError };
|
package/lib/index.js
CHANGED
@@ -1,3 +1,127 @@
|
|
1
1
|
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
2
|
-
import
|
2
|
+
import {
|
3
|
+
DummyProvider,
|
4
|
+
Endpoints,
|
5
|
+
GLOBAL_CONFIG,
|
6
|
+
Plugin,
|
7
|
+
PluginManager,
|
8
|
+
ProcessorServiceImpl,
|
9
|
+
QueuedStaticJsonRpcProvider,
|
10
|
+
StoreContext,
|
11
|
+
USER_PROCESSOR,
|
12
|
+
compareSemver,
|
13
|
+
dbMetrics,
|
14
|
+
errorString,
|
15
|
+
getProvider,
|
16
|
+
makeEthCallKey,
|
17
|
+
mergeProcessResults,
|
18
|
+
metricsStorage,
|
19
|
+
parseSemver,
|
20
|
+
processMetrics,
|
21
|
+
providerMetrics,
|
22
|
+
recordRuntimeInfo,
|
23
|
+
timeoutError
|
24
|
+
} from "./chunk-DYOBLZD3.js";
|
25
|
+
|
26
|
+
// src/state.ts
|
27
|
+
var State = class _State {
|
28
|
+
stateMap = /* @__PURE__ */ new Map();
|
29
|
+
static INSTANCE = new _State();
|
30
|
+
static reset() {
|
31
|
+
_State.INSTANCE = new _State();
|
32
|
+
}
|
33
|
+
};
|
34
|
+
var StateStorage = class {
|
35
|
+
// TODO learn how to define single instance for all subclasses
|
36
|
+
constructor() {
|
37
|
+
}
|
38
|
+
key() {
|
39
|
+
return this.constructor.name;
|
40
|
+
}
|
41
|
+
getOrRegister() {
|
42
|
+
let metricState = State.INSTANCE.stateMap.get(this.key());
|
43
|
+
if (!metricState) {
|
44
|
+
metricState = this.initValue();
|
45
|
+
State.INSTANCE.stateMap.set(this.key(), metricState);
|
46
|
+
}
|
47
|
+
return metricState;
|
48
|
+
}
|
49
|
+
unregister() {
|
50
|
+
const value = State.INSTANCE.stateMap.get(this.key());
|
51
|
+
State.INSTANCE.stateMap.delete(this.key());
|
52
|
+
return value;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
var MapStateStorage = class extends StateStorage {
|
56
|
+
initValue() {
|
57
|
+
return /* @__PURE__ */ new Map();
|
58
|
+
}
|
59
|
+
getValue(key) {
|
60
|
+
const m = this.getOrRegister();
|
61
|
+
return m.get(key);
|
62
|
+
}
|
63
|
+
getValues() {
|
64
|
+
const m = this.getOrRegister();
|
65
|
+
return Array.from(m.values());
|
66
|
+
}
|
67
|
+
getOrSetValue(key, value) {
|
68
|
+
const m = this.getOrRegister();
|
69
|
+
const oldValue = m.get(key);
|
70
|
+
if (oldValue) {
|
71
|
+
if (oldValue !== value) {
|
72
|
+
console.warn(key, "has been registered twice, use the previous one");
|
73
|
+
}
|
74
|
+
return oldValue;
|
75
|
+
}
|
76
|
+
m.set(key, value);
|
77
|
+
return value;
|
78
|
+
}
|
79
|
+
};
|
80
|
+
var ListStateStorage = class extends StateStorage {
|
81
|
+
initValue() {
|
82
|
+
return [];
|
83
|
+
}
|
84
|
+
getValues() {
|
85
|
+
return this.getOrRegister();
|
86
|
+
}
|
87
|
+
addValue(value) {
|
88
|
+
const m = this.getOrRegister();
|
89
|
+
m.push(value);
|
90
|
+
return value;
|
91
|
+
}
|
92
|
+
};
|
93
|
+
import("node:process").then((p) => p.stdout.write(""));
|
94
|
+
|
95
|
+
// src/chain-config.ts
|
96
|
+
import("node:process").then((p) => p.stdout.write(""));
|
97
|
+
|
98
|
+
// src/index.ts
|
99
|
+
import("node:process").then((p) => p.stdout.write(""));
|
100
|
+
export {
|
101
|
+
DummyProvider,
|
102
|
+
Endpoints,
|
103
|
+
GLOBAL_CONFIG,
|
104
|
+
ListStateStorage,
|
105
|
+
MapStateStorage,
|
106
|
+
Plugin,
|
107
|
+
PluginManager,
|
108
|
+
ProcessorServiceImpl,
|
109
|
+
QueuedStaticJsonRpcProvider,
|
110
|
+
State,
|
111
|
+
StateStorage,
|
112
|
+
StoreContext,
|
113
|
+
USER_PROCESSOR,
|
114
|
+
compareSemver,
|
115
|
+
dbMetrics,
|
116
|
+
errorString,
|
117
|
+
getProvider,
|
118
|
+
makeEthCallKey,
|
119
|
+
mergeProcessResults,
|
120
|
+
metricsStorage,
|
121
|
+
parseSemver,
|
122
|
+
processMetrics,
|
123
|
+
providerMetrics,
|
124
|
+
recordRuntimeInfo,
|
125
|
+
timeoutError
|
126
|
+
};
|
3
127
|
//# 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 if (oldValue !== value) {\n console.warn(key, 'has been registered twice, use the previous one')\n }\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":"
|
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 if (oldValue !== value) {\n console.warn(key, 'has been registered twice, use the previous one')\n }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,QAAN,MAAM,OAAM;AAAA,EACjB,WAAW,oBAAI,IAAiB;AAAA,EAEhC,OAAO,WAAW,IAAI,OAAM;AAAA,EAE5B,OAAO,QAAQ;AACb,WAAM,WAAW,IAAI,OAAM;AAAA,EAC7B;AACF;AAEO,IAAe,eAAf,MAA+B;AAAA;AAAA,EAG1B,cAAc;AAAA,EAExB;AAAA,EAIA,MAAc;AACZ,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEA,gBAAmB;AACjB,QAAI,cAAiB,MAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC;AAC3D,QAAI,CAAC,aAAa;AAChB,oBAAc,KAAK,UAAU;AAC7B,YAAM,SAAS,SAAS,IAAI,KAAK,IAAI,GAAG,WAAW;AAAA,IACrD;AACA,WAAO;AAAA,EACT;AAAA,EAEA,aAAgB;AACd,UAAM,QAAQ,MAAM,SAAS,SAAS,IAAI,KAAK,IAAI,CAAC;AACpD,UAAM,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC;AACzC,WAAO;AAAA,EACT;AACF;AAEO,IAAe,kBAAf,cAA0C,aAA6B;AAAA,EAC5E,YAAY;AACV,WAAO,oBAAI,IAAe;AAAA,EAC5B;AAAA,EAEA,SAAS,KAA4B;AACnC,UAAM,IAAI,KAAK,cAAc;AAC7B,WAAO,EAAE,IAAI,GAAG;AAAA,EAClB;AAAA,EAEA,YAAiB;AACf,UAAM,IAAI,KAAK,cAAc;AAC7B,WAAO,MAAM,KAAK,EAAE,OAAO,CAAC;AAAA,EAC9B;AAAA,EAEA,cAAc,KAAa,OAAa;AACtC,UAAM,IAAI,KAAK,cAAc;AAC7B,UAAM,WAAW,EAAE,IAAI,GAAG;AAC1B,QAAI,UAAU;AACZ,UAAI,aAAa,OAAO;AACtB,gBAAQ,KAAK,KAAK,iDAAiD;AAAA,MACrE;AACA,aAAO;AAAA,IACT;AACA,MAAE,IAAI,KAAK,KAAK;AAChB,WAAO;AAAA,EACT;AACF;AAEO,IAAe,mBAAf,cAA2C,aAAkB;AAAA,EAClE,YAAY;AACV,WAAO,CAAC;AAAA,EACV;AAAA,EAEA,YAAiB;AACf,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA,EAEA,SAAS,OAAa;AACpB,UAAM,IAAI,KAAK,cAAc;AAC7B,MAAE,KAAK,KAAK;AACZ,WAAO;AAAA,EACT;AACF;AACC,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;;;AC9ErD,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;;;ACKrD,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
|
@@ -1 +1,34 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
+
declare const optionDefinitions: ({
|
3
|
+
name: string;
|
4
|
+
type: StringConstructor;
|
5
|
+
defaultOption: boolean;
|
6
|
+
alias?: undefined;
|
7
|
+
defaultValue?: undefined;
|
8
|
+
} | {
|
9
|
+
name: string;
|
10
|
+
alias: string;
|
11
|
+
type: StringConstructor;
|
12
|
+
defaultValue: string;
|
13
|
+
defaultOption?: undefined;
|
14
|
+
} | {
|
15
|
+
name: string;
|
16
|
+
type: NumberConstructor;
|
17
|
+
defaultValue: number;
|
18
|
+
defaultOption?: undefined;
|
19
|
+
alias?: undefined;
|
20
|
+
} | {
|
21
|
+
name: string;
|
22
|
+
type: StringConstructor;
|
23
|
+
defaultValue: string;
|
24
|
+
defaultOption?: undefined;
|
25
|
+
alias?: undefined;
|
26
|
+
} | {
|
27
|
+
name: string;
|
28
|
+
type: BooleanConstructor;
|
29
|
+
defaultValue: boolean;
|
30
|
+
defaultOption?: undefined;
|
31
|
+
alias?: undefined;
|
32
|
+
})[];
|
33
|
+
|
34
|
+
export { optionDefinitions };
|