@sentio/runtime 2.59.5-rc.1 → 2.60.0-rc.10
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-L7MQIWIO.js → chunk-BOHR42T4.js} +84 -27
- package/lib/{chunk-L7MQIWIO.js.map → chunk-BOHR42T4.js.map} +1 -1
- package/lib/{chunk-U5UZYRQ4.js → chunk-CYS2DAE4.js} +2 -2
- package/lib/{chunk-LCS6SRJY.js → chunk-TC6OWLVA.js} +4897 -528
- package/lib/chunk-TC6OWLVA.js.map +1 -0
- package/lib/index.d.ts +22 -4
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.js +356 -151
- package/lib/processor-runner.js.map +1 -1
- package/lib/service-worker.js +3 -3
- package/package.json +1 -1
- package/src/db-context.ts +43 -1
- package/src/full-service.ts +167 -109
- package/src/gen/processor/protos/processor.ts +700 -13
- package/src/gen/service/common/protos/common.ts +195 -0
- package/src/plugin.ts +14 -3
- package/src/processor-runner.ts +7 -2
- package/src/service-v3.ts +211 -0
- package/lib/chunk-LCS6SRJY.js.map +0 -1
- /package/lib/{chunk-U5UZYRQ4.js.map → chunk-CYS2DAE4.js.map} +0 -0
package/lib/processor-runner.js
CHANGED
@@ -5,8 +5,9 @@ import {
|
|
5
5
|
} from "./chunk-6XHWJ2VS.js";
|
6
6
|
import {
|
7
7
|
setupLogger
|
8
|
-
} from "./chunk-
|
8
|
+
} from "./chunk-CYS2DAE4.js";
|
9
9
|
import {
|
10
|
+
DataBindingContext,
|
10
11
|
DiagConsoleLogger,
|
11
12
|
DiagLogLevel,
|
12
13
|
GLOBAL_CONFIG,
|
@@ -26,8 +27,10 @@ import {
|
|
26
27
|
createContextKey,
|
27
28
|
createNoopMeter,
|
28
29
|
diag,
|
30
|
+
errorString,
|
29
31
|
es_exports,
|
30
32
|
esm_exports,
|
33
|
+
from,
|
31
34
|
init_es,
|
32
35
|
init_esm,
|
33
36
|
isSpanContextValid,
|
@@ -35,20 +38,28 @@ import {
|
|
35
38
|
isValidTraceId,
|
36
39
|
metrics,
|
37
40
|
parseSemver,
|
41
|
+
processMetrics,
|
38
42
|
propagation,
|
43
|
+
recordRuntimeInfo,
|
44
|
+
require_cjs,
|
39
45
|
require_lib,
|
40
46
|
require_lib2,
|
41
47
|
require_lib3,
|
42
48
|
require_lib4,
|
43
49
|
require_lodash,
|
44
50
|
require_src,
|
45
|
-
trace
|
46
|
-
|
51
|
+
trace,
|
52
|
+
withAbort
|
53
|
+
} from "./chunk-BOHR42T4.js";
|
47
54
|
import {
|
48
55
|
ExecutionConfig,
|
56
|
+
HandlerType,
|
57
|
+
InitResponse,
|
49
58
|
PluginManager,
|
50
59
|
ProcessConfigResponse,
|
60
|
+
ProcessResult,
|
51
61
|
ProcessorDefinition,
|
62
|
+
ProcessorV3Definition,
|
52
63
|
StartRequest,
|
53
64
|
__commonJS,
|
54
65
|
__esm,
|
@@ -57,7 +68,7 @@ import {
|
|
57
68
|
__toCommonJS,
|
58
69
|
__toESM,
|
59
70
|
require_minimal2 as require_minimal
|
60
|
-
} from "./chunk-
|
71
|
+
} from "./chunk-TC6OWLVA.js";
|
61
72
|
|
62
73
|
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.25.1/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js
|
63
74
|
// @__NO_SIDE_EFFECTS__
|
@@ -4498,14 +4509,14 @@ var init_callback = __esm({
|
|
4498
4509
|
}
|
4499
4510
|
return ar;
|
4500
4511
|
};
|
4501
|
-
__spreadArray = function(to,
|
4502
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
4503
|
-
if (ar || !(i in
|
4504
|
-
if (!ar) ar = Array.prototype.slice.call(
|
4505
|
-
ar[i] =
|
4512
|
+
__spreadArray = function(to, from2, pack) {
|
4513
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
4514
|
+
if (ar || !(i in from2)) {
|
4515
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
4516
|
+
ar[i] = from2[i];
|
4506
4517
|
}
|
4507
4518
|
}
|
4508
|
-
return to.concat(ar || Array.prototype.slice.call(
|
4519
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
4509
4520
|
};
|
4510
4521
|
BindOnceFuture = /** @class */
|
4511
4522
|
function() {
|
@@ -5361,14 +5372,14 @@ var init_utils3 = __esm({
|
|
5361
5372
|
}
|
5362
5373
|
return ar;
|
5363
5374
|
};
|
5364
|
-
__spreadArray2 = function(to,
|
5365
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
5366
|
-
if (ar || !(i in
|
5367
|
-
if (!ar) ar = Array.prototype.slice.call(
|
5368
|
-
ar[i] =
|
5375
|
+
__spreadArray2 = function(to, from2, pack) {
|
5376
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
5377
|
+
if (ar || !(i in from2)) {
|
5378
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
5379
|
+
ar[i] = from2[i];
|
5369
5380
|
}
|
5370
5381
|
}
|
5371
|
-
return to.concat(ar || Array.prototype.slice.call(
|
5382
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
5372
5383
|
};
|
5373
5384
|
__values5 = function(o) {
|
5374
5385
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
@@ -5684,14 +5695,14 @@ var init_Buckets = __esm({
|
|
5684
5695
|
}
|
5685
5696
|
return ar;
|
5686
5697
|
};
|
5687
|
-
__spreadArray3 = function(to,
|
5688
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
5689
|
-
if (ar || !(i in
|
5690
|
-
if (!ar) ar = Array.prototype.slice.call(
|
5691
|
-
ar[i] =
|
5698
|
+
__spreadArray3 = function(to, from2, pack) {
|
5699
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
5700
|
+
if (ar || !(i in from2)) {
|
5701
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
5702
|
+
ar[i] = from2[i];
|
5692
5703
|
}
|
5693
5704
|
}
|
5694
|
-
return to.concat(ar || Array.prototype.slice.call(
|
5705
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
5695
5706
|
};
|
5696
5707
|
Buckets = /** @class */
|
5697
5708
|
function() {
|
@@ -5857,11 +5868,11 @@ var init_Buckets = __esm({
|
|
5857
5868
|
tmp.splice.apply(tmp, __spreadArray3([0, oldPositiveLimit], __read8(this._counts.slice(0, oldPositiveLimit)), false));
|
5858
5869
|
this._counts = tmp;
|
5859
5870
|
};
|
5860
|
-
BucketsBacking2.prototype.reverse = function(
|
5861
|
-
var num = Math.floor((
|
5871
|
+
BucketsBacking2.prototype.reverse = function(from2, limit) {
|
5872
|
+
var num = Math.floor((from2 + limit) / 2) - from2;
|
5862
5873
|
for (var i = 0; i < num; i++) {
|
5863
|
-
var tmp = this._counts[
|
5864
|
-
this._counts[
|
5874
|
+
var tmp = this._counts[from2 + i];
|
5875
|
+
this._counts[from2 + i] = this._counts[limit - i - 1];
|
5865
5876
|
this._counts[limit - i - 1] = tmp;
|
5866
5877
|
}
|
5867
5878
|
};
|
@@ -7109,14 +7120,14 @@ var init_MetricReader = __esm({
|
|
7109
7120
|
}
|
7110
7121
|
return ar;
|
7111
7122
|
};
|
7112
|
-
__spreadArray4 = function(to,
|
7113
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
7114
|
-
if (ar || !(i in
|
7115
|
-
if (!ar) ar = Array.prototype.slice.call(
|
7116
|
-
ar[i] =
|
7123
|
+
__spreadArray4 = function(to, from2, pack) {
|
7124
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
7125
|
+
if (ar || !(i in from2)) {
|
7126
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
7127
|
+
ar[i] = from2[i];
|
7117
7128
|
}
|
7118
7129
|
}
|
7119
|
-
return to.concat(ar || Array.prototype.slice.call(
|
7130
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
7120
7131
|
};
|
7121
7132
|
MetricReader = /** @class */
|
7122
7133
|
function() {
|
@@ -7397,14 +7408,14 @@ var init_PeriodicExportingMetricReader = __esm({
|
|
7397
7408
|
}
|
7398
7409
|
return ar;
|
7399
7410
|
};
|
7400
|
-
__spreadArray5 = function(to,
|
7401
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
7402
|
-
if (ar || !(i in
|
7403
|
-
if (!ar) ar = Array.prototype.slice.call(
|
7404
|
-
ar[i] =
|
7411
|
+
__spreadArray5 = function(to, from2, pack) {
|
7412
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
7413
|
+
if (ar || !(i in from2)) {
|
7414
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
7415
|
+
ar[i] = from2[i];
|
7405
7416
|
}
|
7406
7417
|
}
|
7407
|
-
return to.concat(ar || Array.prototype.slice.call(
|
7418
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
7408
7419
|
};
|
7409
7420
|
PeriodicExportingMetricReader = /** @class */
|
7410
7421
|
function(_super) {
|
@@ -8890,14 +8901,14 @@ var init_ObservableRegistry = __esm({
|
|
8890
8901
|
}
|
8891
8902
|
return ar;
|
8892
8903
|
};
|
8893
|
-
__spreadArray6 = function(to,
|
8894
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
8895
|
-
if (ar || !(i in
|
8896
|
-
if (!ar) ar = Array.prototype.slice.call(
|
8897
|
-
ar[i] =
|
8904
|
+
__spreadArray6 = function(to, from2, pack) {
|
8905
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
8906
|
+
if (ar || !(i in from2)) {
|
8907
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
8908
|
+
ar[i] = from2[i];
|
8898
8909
|
}
|
8899
8910
|
}
|
8900
|
-
return to.concat(ar || Array.prototype.slice.call(
|
8911
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
8901
8912
|
};
|
8902
8913
|
ObservableRegistry = /** @class */
|
8903
8914
|
function() {
|
@@ -9549,14 +9560,14 @@ var init_MetricCollector = __esm({
|
|
9549
9560
|
}
|
9550
9561
|
return ar;
|
9551
9562
|
};
|
9552
|
-
__spreadArray7 = function(to,
|
9553
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
9554
|
-
if (ar || !(i in
|
9555
|
-
if (!ar) ar = Array.prototype.slice.call(
|
9556
|
-
ar[i] =
|
9563
|
+
__spreadArray7 = function(to, from2, pack) {
|
9564
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
9565
|
+
if (ar || !(i in from2)) {
|
9566
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
9567
|
+
ar[i] = from2[i];
|
9557
9568
|
}
|
9558
9569
|
}
|
9559
|
-
return to.concat(ar || Array.prototype.slice.call(
|
9570
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
9560
9571
|
};
|
9561
9572
|
MetricCollector = /** @class */
|
9562
9573
|
function() {
|
@@ -21446,14 +21457,14 @@ var init_Span = __esm({
|
|
21446
21457
|
}
|
21447
21458
|
return ar;
|
21448
21459
|
};
|
21449
|
-
__spreadArray8 = function(to,
|
21450
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
21451
|
-
if (ar || !(i in
|
21452
|
-
if (!ar) ar = Array.prototype.slice.call(
|
21453
|
-
ar[i] =
|
21460
|
+
__spreadArray8 = function(to, from2, pack) {
|
21461
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
21462
|
+
if (ar || !(i in from2)) {
|
21463
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
21464
|
+
ar[i] = from2[i];
|
21454
21465
|
}
|
21455
21466
|
}
|
21456
|
-
return to.concat(ar || Array.prototype.slice.call(
|
21467
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
21457
21468
|
};
|
21458
21469
|
Span = /** @class */
|
21459
21470
|
function() {
|
@@ -22506,14 +22517,14 @@ var init_BasicTracerProvider = __esm({
|
|
22506
22517
|
}
|
22507
22518
|
return ar;
|
22508
22519
|
};
|
22509
|
-
__spreadArray9 = function(to,
|
22510
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
22511
|
-
if (ar || !(i in
|
22512
|
-
if (!ar) ar = Array.prototype.slice.call(
|
22513
|
-
ar[i] =
|
22520
|
+
__spreadArray9 = function(to, from2, pack) {
|
22521
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
22522
|
+
if (ar || !(i in from2)) {
|
22523
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
22524
|
+
ar[i] = from2[i];
|
22514
22525
|
}
|
22515
22526
|
}
|
22516
|
-
return to.concat(ar || Array.prototype.slice.call(
|
22527
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
22517
22528
|
};
|
22518
22529
|
(function(ForceFlushState2) {
|
22519
22530
|
ForceFlushState2[ForceFlushState2["resolved"] = 0] = "resolved";
|
@@ -22783,14 +22794,14 @@ var init_InMemorySpanExporter = __esm({
|
|
22783
22794
|
}
|
22784
22795
|
return ar;
|
22785
22796
|
};
|
22786
|
-
__spreadArray10 = function(to,
|
22787
|
-
if (pack || arguments.length === 2) for (var i = 0, l =
|
22788
|
-
if (ar || !(i in
|
22789
|
-
if (!ar) ar = Array.prototype.slice.call(
|
22790
|
-
ar[i] =
|
22797
|
+
__spreadArray10 = function(to, from2, pack) {
|
22798
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from2.length, ar; i < l; i++) {
|
22799
|
+
if (ar || !(i in from2)) {
|
22800
|
+
if (!ar) ar = Array.prototype.slice.call(from2, 0, i);
|
22801
|
+
ar[i] = from2[i];
|
22791
22802
|
}
|
22792
22803
|
}
|
22793
|
-
return to.concat(ar || Array.prototype.slice.call(
|
22804
|
+
return to.concat(ar || Array.prototype.slice.call(from2));
|
22794
22805
|
};
|
22795
22806
|
InMemorySpanExporter = /** @class */
|
22796
22807
|
function() {
|
@@ -24204,17 +24215,17 @@ var require_range = __commonJS({
|
|
24204
24215
|
debug("replaceGTE0", comp, options2);
|
24205
24216
|
return comp.trim().replace(re2[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
24206
24217
|
};
|
24207
|
-
var hyphenReplace = (incPr) => ($0,
|
24218
|
+
var hyphenReplace = (incPr) => ($0, from2, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
24208
24219
|
if (isX(fM)) {
|
24209
|
-
|
24220
|
+
from2 = "";
|
24210
24221
|
} else if (isX(fm)) {
|
24211
|
-
|
24222
|
+
from2 = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
24212
24223
|
} else if (isX(fp)) {
|
24213
|
-
|
24224
|
+
from2 = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
24214
24225
|
} else if (fpr) {
|
24215
|
-
|
24226
|
+
from2 = `>=${from2}`;
|
24216
24227
|
} else {
|
24217
|
-
|
24228
|
+
from2 = `>=${from2}${incPr ? "-0" : ""}`;
|
24218
24229
|
}
|
24219
24230
|
if (isX(tM)) {
|
24220
24231
|
to = "";
|
@@ -24229,7 +24240,7 @@ var require_range = __commonJS({
|
|
24229
24240
|
} else {
|
24230
24241
|
to = `<=${to}`;
|
24231
24242
|
}
|
24232
|
-
return `${
|
24243
|
+
return `${from2} ${to}`.trim();
|
24233
24244
|
};
|
24234
24245
|
var testSet = (set, version, options2) => {
|
24235
24246
|
for (let i = 0; i < set.length; i++) {
|
@@ -25987,87 +25998,14 @@ function locatePackageJson(pkgId) {
|
|
25987
25998
|
const content = import_fs_extra.default.readFileSync(path.join(dir, "package.json"), "utf-8");
|
25988
25999
|
return JSON.parse(content);
|
25989
26000
|
}
|
25990
|
-
var
|
25991
|
-
|
25992
|
-
|
26001
|
+
var RuntimeServicePatcher = class {
|
26002
|
+
sdkVersion;
|
26003
|
+
constructor() {
|
25993
26004
|
const sdkPackageJson = locatePackageJson("@sentio/sdk");
|
25994
26005
|
const runtimePackageJson = locatePackageJson("@sentio/runtime");
|
25995
26006
|
console.log("Runtime version:", runtimePackageJson.version, "SDK version:", sdkPackageJson.version);
|
25996
26007
|
this.sdkVersion = parseSemver(sdkPackageJson.version);
|
25997
26008
|
}
|
25998
|
-
instance;
|
25999
|
-
sdkVersion;
|
26000
|
-
async getConfig(request3, context2) {
|
26001
|
-
const config = await this.instance.getConfig(request3, context2);
|
26002
|
-
config.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution);
|
26003
|
-
if (config.contractConfigs) {
|
26004
|
-
for (const contract of config.contractConfigs) {
|
26005
|
-
if (compareSemver(this.sdkVersion, FUEL_PROTO_NO_FUEL_TRANSACTION_AS_CALL_VERSION) < 0 && contract.fuelCallConfigs) {
|
26006
|
-
contract.fuelTransactionConfigs = contract.fuelCallConfigs;
|
26007
|
-
contract.fuelCallConfigs = void 0;
|
26008
|
-
}
|
26009
|
-
if (contract.fuelLogConfigs) {
|
26010
|
-
contract.fuelReceiptConfigs = contract.fuelLogConfigs.map((e) => ({
|
26011
|
-
handlerId: e.handlerId,
|
26012
|
-
handlerName: e.handlerName,
|
26013
|
-
log: {
|
26014
|
-
logIds: e.logIds
|
26015
|
-
}
|
26016
|
-
}));
|
26017
|
-
}
|
26018
|
-
if (contract.aptosCallConfigs) {
|
26019
|
-
contract.moveCallConfigs = contract.aptosCallConfigs;
|
26020
|
-
}
|
26021
|
-
if (contract.aptosEventConfigs) {
|
26022
|
-
contract.moveEventConfigs = contract.aptosEventConfigs;
|
26023
|
-
}
|
26024
|
-
}
|
26025
|
-
}
|
26026
|
-
if (compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0) {
|
26027
|
-
PROCESSED_MOVE_EVENT_TX_HANDLER.clear();
|
26028
|
-
}
|
26029
|
-
return config;
|
26030
|
-
}
|
26031
|
-
async start(request3, context2) {
|
26032
|
-
return await this.instance.start(request3, context2);
|
26033
|
-
}
|
26034
|
-
async stop(request3, context2) {
|
26035
|
-
return await this.instance.stop(request3, context2);
|
26036
|
-
}
|
26037
|
-
async processBindings(request3, options2) {
|
26038
|
-
for (const binding of request3.bindings) {
|
26039
|
-
this.adjustDataBinding(binding);
|
26040
|
-
}
|
26041
|
-
try {
|
26042
|
-
const result = await this.instance.processBindings(request3, options2);
|
26043
|
-
this.adjustResult(result.result);
|
26044
|
-
if (!result.configUpdated && result.result?.states?.configUpdated) {
|
26045
|
-
result.configUpdated = result.result?.states?.configUpdated;
|
26046
|
-
}
|
26047
|
-
return result;
|
26048
|
-
} catch (e) {
|
26049
|
-
if (this.sdkVersion.minor <= 16) {
|
26050
|
-
if (e.code === os.constants.errno.ECONNRESET || e.code === os.constants.errno.ECONNREFUSED || e.code === os.constants.errno.ECONNABORTED) {
|
26051
|
-
process.exit(1);
|
26052
|
-
}
|
26053
|
-
}
|
26054
|
-
throw e;
|
26055
|
-
}
|
26056
|
-
}
|
26057
|
-
async *adjustBindingsStream(requests) {
|
26058
|
-
for await (const request3 of requests) {
|
26059
|
-
this.adjustDataBinding(request3.binding);
|
26060
|
-
yield request3;
|
26061
|
-
}
|
26062
|
-
}
|
26063
|
-
async *processBindingsStream(requests, context2) {
|
26064
|
-
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context2);
|
26065
|
-
}
|
26066
|
-
async *preprocessBindingsStream(requests, context2) {
|
26067
|
-
yield* this.instance.preprocessBindingsStream(this.adjustBindingsStream(requests), context2);
|
26068
|
-
}
|
26069
|
-
adjustResult(res) {
|
26070
|
-
}
|
26071
26009
|
adjustDataBinding(dataBinding) {
|
26072
26010
|
const isBeforeMoveUseRawVersion = compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0;
|
26073
26011
|
if (!dataBinding) {
|
@@ -26208,6 +26146,117 @@ var FullProcessorServiceImpl = class {
|
|
26208
26146
|
break;
|
26209
26147
|
}
|
26210
26148
|
}
|
26149
|
+
patchConfig(config) {
|
26150
|
+
config.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution);
|
26151
|
+
if (config.contractConfigs) {
|
26152
|
+
for (const contract of config.contractConfigs) {
|
26153
|
+
if (compareSemver(this.sdkVersion, FUEL_PROTO_NO_FUEL_TRANSACTION_AS_CALL_VERSION) < 0 && contract.fuelCallConfigs) {
|
26154
|
+
contract.fuelTransactionConfigs = contract.fuelCallConfigs;
|
26155
|
+
contract.fuelCallConfigs = void 0;
|
26156
|
+
}
|
26157
|
+
if (contract.fuelLogConfigs) {
|
26158
|
+
contract.fuelReceiptConfigs = contract.fuelLogConfigs.map((e) => ({
|
26159
|
+
handlerId: e.handlerId,
|
26160
|
+
handlerName: e.handlerName,
|
26161
|
+
log: {
|
26162
|
+
logIds: e.logIds
|
26163
|
+
}
|
26164
|
+
}));
|
26165
|
+
}
|
26166
|
+
if (contract.aptosCallConfigs) {
|
26167
|
+
contract.moveCallConfigs = contract.aptosCallConfigs;
|
26168
|
+
}
|
26169
|
+
if (contract.aptosEventConfigs) {
|
26170
|
+
contract.moveEventConfigs = contract.aptosEventConfigs;
|
26171
|
+
}
|
26172
|
+
}
|
26173
|
+
}
|
26174
|
+
}
|
26175
|
+
};
|
26176
|
+
var FullProcessorServiceImpl = class {
|
26177
|
+
constructor(instance) {
|
26178
|
+
this.instance = instance;
|
26179
|
+
const sdkPackageJson = locatePackageJson("@sentio/sdk");
|
26180
|
+
const runtimePackageJson = locatePackageJson("@sentio/runtime");
|
26181
|
+
console.log("Runtime version:", runtimePackageJson.version, "SDK version:", sdkPackageJson.version);
|
26182
|
+
this.sdkVersion = parseSemver(sdkPackageJson.version);
|
26183
|
+
}
|
26184
|
+
instance;
|
26185
|
+
sdkVersion;
|
26186
|
+
patcher = new RuntimeServicePatcher();
|
26187
|
+
async getConfig(request3, context2) {
|
26188
|
+
const config = await this.instance.getConfig(request3, context2);
|
26189
|
+
this.patcher.patchConfig(config);
|
26190
|
+
if (compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0) {
|
26191
|
+
PROCESSED_MOVE_EVENT_TX_HANDLER.clear();
|
26192
|
+
}
|
26193
|
+
return config;
|
26194
|
+
}
|
26195
|
+
async start(request3, context2) {
|
26196
|
+
return await this.instance.start(request3, context2);
|
26197
|
+
}
|
26198
|
+
async stop(request3, context2) {
|
26199
|
+
return await this.instance.stop(request3, context2);
|
26200
|
+
}
|
26201
|
+
async processBindings(request3, options2) {
|
26202
|
+
for (const binding of request3.bindings) {
|
26203
|
+
this.patcher.adjustDataBinding(binding);
|
26204
|
+
}
|
26205
|
+
try {
|
26206
|
+
const result = await this.instance.processBindings(request3, options2);
|
26207
|
+
this.adjustResult(result.result);
|
26208
|
+
if (!result.configUpdated && result.result?.states?.configUpdated) {
|
26209
|
+
result.configUpdated = result.result?.states?.configUpdated;
|
26210
|
+
}
|
26211
|
+
return result;
|
26212
|
+
} catch (e) {
|
26213
|
+
if (this.sdkVersion.minor <= 16) {
|
26214
|
+
if (e.code === os.constants.errno.ECONNRESET || e.code === os.constants.errno.ECONNREFUSED || e.code === os.constants.errno.ECONNABORTED) {
|
26215
|
+
process.exit(1);
|
26216
|
+
}
|
26217
|
+
}
|
26218
|
+
throw e;
|
26219
|
+
}
|
26220
|
+
}
|
26221
|
+
async *adjustBindingsStream(requests) {
|
26222
|
+
for await (const request3 of requests) {
|
26223
|
+
this.patcher.adjustDataBinding(request3.binding);
|
26224
|
+
yield request3;
|
26225
|
+
}
|
26226
|
+
}
|
26227
|
+
async *processBindingsStream(requests, context2) {
|
26228
|
+
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context2);
|
26229
|
+
}
|
26230
|
+
async *preprocessBindingsStream(requests, context2) {
|
26231
|
+
yield* this.instance.preprocessBindingsStream(this.adjustBindingsStream(requests), context2);
|
26232
|
+
}
|
26233
|
+
adjustResult(res) {
|
26234
|
+
}
|
26235
|
+
};
|
26236
|
+
var FullProcessorServiceV3Impl = class {
|
26237
|
+
constructor(instance) {
|
26238
|
+
this.instance = instance;
|
26239
|
+
}
|
26240
|
+
patcher = new RuntimeServicePatcher();
|
26241
|
+
async init(request3, context2) {
|
26242
|
+
const resp = await this.instance.init(request3, context2);
|
26243
|
+
resp.executionConfig = ExecutionConfig.fromPartial(GLOBAL_CONFIG.execution);
|
26244
|
+
return resp;
|
26245
|
+
}
|
26246
|
+
async configureHandlers(request3, context2) {
|
26247
|
+
const config = await this.instance.configureHandlers(request3, context2);
|
26248
|
+
this.patcher.patchConfig(config);
|
26249
|
+
return config;
|
26250
|
+
}
|
26251
|
+
async *processBindingsStream(requests, context2) {
|
26252
|
+
yield* this.instance.processBindingsStream(this.adjustBindingsStream(requests), context2);
|
26253
|
+
}
|
26254
|
+
async *adjustBindingsStream(requests) {
|
26255
|
+
for await (const request3 of requests) {
|
26256
|
+
this.patcher.adjustDataBinding(request3.binding);
|
26257
|
+
yield request3;
|
26258
|
+
}
|
26259
|
+
}
|
26211
26260
|
};
|
26212
26261
|
import("node:process").then((p) => p.stdout.write(""));
|
26213
26262
|
|
@@ -26436,6 +26485,158 @@ import("node:process").then((p) => p.stdout.write(""));
|
|
26436
26485
|
|
26437
26486
|
// src/processor-runner.ts
|
26438
26487
|
import path2 from "path";
|
26488
|
+
|
26489
|
+
// src/service-v3.ts
|
26490
|
+
var import_rxjs = __toESM(require_cjs(), 1);
|
26491
|
+
var { process_binding_count, process_binding_time, process_binding_error } = processMetrics;
|
26492
|
+
var ProcessorServiceImplV3 = class {
|
26493
|
+
enablePartition;
|
26494
|
+
loader;
|
26495
|
+
shutdownHandler;
|
26496
|
+
constructor(loader2, options2, shutdownHandler) {
|
26497
|
+
this.loader = loader2;
|
26498
|
+
this.shutdownHandler = shutdownHandler;
|
26499
|
+
this.enablePartition = options2?.["enable-partition"] == true;
|
26500
|
+
}
|
26501
|
+
async init(request3, context2) {
|
26502
|
+
const resp = InitResponse.fromPartial({
|
26503
|
+
chainIds: []
|
26504
|
+
});
|
26505
|
+
await PluginManager.INSTANCE.init(resp);
|
26506
|
+
resp.chainIds = Array.from(new Set(resp.chainIds));
|
26507
|
+
return resp;
|
26508
|
+
}
|
26509
|
+
async *processBindingsStream(requests, context2) {
|
26510
|
+
const subject = new import_rxjs.Subject();
|
26511
|
+
let lastBinding = void 0;
|
26512
|
+
for await (const request3 of requests) {
|
26513
|
+
try {
|
26514
|
+
if (request3.binding) {
|
26515
|
+
lastBinding = request3.binding;
|
26516
|
+
}
|
26517
|
+
this.handleRequest(request3, lastBinding, subject);
|
26518
|
+
} catch (e) {
|
26519
|
+
console.error("unexpect error during handle loop", e);
|
26520
|
+
}
|
26521
|
+
}
|
26522
|
+
yield* from(subject).pipe(withAbort(context2.signal));
|
26523
|
+
}
|
26524
|
+
contexts = new Contexts2();
|
26525
|
+
async handleRequest(request3, lastBinding, subject) {
|
26526
|
+
if (request3.binding) {
|
26527
|
+
process_binding_count.add(1);
|
26528
|
+
if (request3.binding.handlerType === HandlerType.UNKNOWN) {
|
26529
|
+
subject.next({
|
26530
|
+
processId: request3.processId,
|
26531
|
+
result: ProcessResult.create()
|
26532
|
+
});
|
26533
|
+
return;
|
26534
|
+
}
|
26535
|
+
if (this.enablePartition) {
|
26536
|
+
try {
|
26537
|
+
const partitions = await PluginManager.INSTANCE.partition(request3.binding);
|
26538
|
+
subject.next({
|
26539
|
+
processId: request3.processId,
|
26540
|
+
partitions
|
26541
|
+
});
|
26542
|
+
} catch (e) {
|
26543
|
+
console.error("Partition error:", e);
|
26544
|
+
subject.error(new Error("Partition error: " + errorString(e)));
|
26545
|
+
return;
|
26546
|
+
}
|
26547
|
+
} else {
|
26548
|
+
this.startProcess(request3.processId, request3.binding, subject);
|
26549
|
+
}
|
26550
|
+
}
|
26551
|
+
if (request3.start) {
|
26552
|
+
if (!lastBinding) {
|
26553
|
+
console.error("start request received without binding");
|
26554
|
+
subject.error(new Error("start request received without binding"));
|
26555
|
+
return;
|
26556
|
+
}
|
26557
|
+
this.startProcess(request3.processId, lastBinding, subject);
|
26558
|
+
}
|
26559
|
+
if (request3.dbResult) {
|
26560
|
+
const context2 = this.contexts.get(request3.processId);
|
26561
|
+
try {
|
26562
|
+
context2?.result(request3.dbResult);
|
26563
|
+
} catch (e) {
|
26564
|
+
subject.error(new Error("db result error, process should stop"));
|
26565
|
+
}
|
26566
|
+
}
|
26567
|
+
}
|
26568
|
+
startProcess(processId, binding, subject) {
|
26569
|
+
const context2 = this.contexts.new(processId, subject);
|
26570
|
+
const start = Date.now();
|
26571
|
+
PluginManager.INSTANCE.processBinding(binding, void 0, context2).then(async (result) => {
|
26572
|
+
await context2.awaitPendings();
|
26573
|
+
for (const ts of result.timeseriesResult) {
|
26574
|
+
subject.next({
|
26575
|
+
processId,
|
26576
|
+
tsRequest: {
|
26577
|
+
data: [ts]
|
26578
|
+
}
|
26579
|
+
});
|
26580
|
+
}
|
26581
|
+
if (result.states?.configUpdated) {
|
26582
|
+
subject.next({
|
26583
|
+
processId,
|
26584
|
+
tplRequest: {
|
26585
|
+
templates: TemplateInstanceState.INSTANCE.getValues()
|
26586
|
+
}
|
26587
|
+
});
|
26588
|
+
}
|
26589
|
+
subject.next({
|
26590
|
+
result: {
|
26591
|
+
states: result.states,
|
26592
|
+
exports: result.exports
|
26593
|
+
},
|
26594
|
+
processId
|
26595
|
+
});
|
26596
|
+
recordRuntimeInfo(result, binding.handlerType);
|
26597
|
+
}).catch((e) => {
|
26598
|
+
console.error(e, e.stack);
|
26599
|
+
context2.error(processId, e);
|
26600
|
+
process_binding_error.add(1);
|
26601
|
+
}).finally(() => {
|
26602
|
+
const cost = Date.now() - start;
|
26603
|
+
process_binding_time.add(cost);
|
26604
|
+
this.contexts.delete(processId);
|
26605
|
+
});
|
26606
|
+
}
|
26607
|
+
async configureHandlers(request3, context2) {
|
26608
|
+
await PluginManager.INSTANCE.start(
|
26609
|
+
StartRequest.fromPartial({
|
26610
|
+
templateInstances: request3.templateInstances
|
26611
|
+
})
|
26612
|
+
);
|
26613
|
+
const newConfig = ProcessConfigResponse.fromPartial({});
|
26614
|
+
await PluginManager.INSTANCE.configure(newConfig, request3.chainId);
|
26615
|
+
return {
|
26616
|
+
accountConfigs: newConfig.accountConfigs,
|
26617
|
+
contractConfigs: newConfig.contractConfigs
|
26618
|
+
};
|
26619
|
+
}
|
26620
|
+
};
|
26621
|
+
var Contexts2 = class {
|
26622
|
+
contexts = /* @__PURE__ */ new Map();
|
26623
|
+
get(processId) {
|
26624
|
+
return this.contexts.get(processId);
|
26625
|
+
}
|
26626
|
+
new(processId, subject) {
|
26627
|
+
const context2 = new DataBindingContext(processId, subject);
|
26628
|
+
this.contexts.set(processId, context2);
|
26629
|
+
return context2;
|
26630
|
+
}
|
26631
|
+
delete(processId) {
|
26632
|
+
const context2 = this.get(processId);
|
26633
|
+
context2?.close();
|
26634
|
+
this.contexts.delete(processId);
|
26635
|
+
}
|
26636
|
+
};
|
26637
|
+
import("node:process").then((p) => p.stdout.write(""));
|
26638
|
+
|
26639
|
+
// src/processor-runner.ts
|
26439
26640
|
var workerNum = 1;
|
26440
26641
|
try {
|
26441
26642
|
workerNum = parseInt(process.env["PROCESSOR_WORKER"]?.trim() ?? "1");
|
@@ -26500,6 +26701,10 @@ if (options["start-action-server"]) {
|
|
26500
26701
|
}
|
26501
26702
|
const service = new FullProcessorServiceImpl(baseService);
|
26502
26703
|
server.add(ProcessorDefinition, service);
|
26704
|
+
server.add(
|
26705
|
+
ProcessorV3Definition,
|
26706
|
+
new FullProcessorServiceV3Impl(new ProcessorServiceImplV3(loader, options, server.shutdown))
|
26707
|
+
);
|
26503
26708
|
server.listen("0.0.0.0:" + options.port);
|
26504
26709
|
console.log("Processor Server Started at:", options.port);
|
26505
26710
|
}
|