@sentio/runtime 3.1.0-rc.2 → 3.1.0-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/{chunk-Z33FXCEF.js → chunk-TYDHN4Z6.js} +487 -473
- package/lib/{chunk-Z33FXCEF.js.map → chunk-TYDHN4Z6.js.map} +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.js +136 -138
- package/lib/processor-runner.js.map +1 -1
- package/package.json +2 -2
- package/src/full-service.ts +1 -25
- package/src/processor-runner.ts +64 -46
- package/src/utils.ts +16 -0
package/lib/processor-runner.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
errorString,
|
|
11
11
|
freezeGlobalConfig,
|
|
12
12
|
from,
|
|
13
|
+
locatePackageJson,
|
|
13
14
|
parseSemver,
|
|
14
15
|
processMetrics,
|
|
15
16
|
recordRuntimeInfo,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
require_lib3,
|
|
20
21
|
require_src,
|
|
21
22
|
withAbort
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-TYDHN4Z6.js";
|
|
23
24
|
import {
|
|
24
25
|
ExecutionConfig,
|
|
25
26
|
HandlerType,
|
|
@@ -7726,15 +7727,15 @@ var require_route = __commonJS({
|
|
|
7726
7727
|
};
|
|
7727
7728
|
}
|
|
7728
7729
|
function wrapConversion(toModel, graph) {
|
|
7729
|
-
var
|
|
7730
|
+
var path = [graph[toModel].parent, toModel];
|
|
7730
7731
|
var fn = conversions[graph[toModel].parent][toModel];
|
|
7731
7732
|
var cur = graph[toModel].parent;
|
|
7732
7733
|
while (graph[cur].parent) {
|
|
7733
|
-
|
|
7734
|
+
path.unshift(graph[cur].parent);
|
|
7734
7735
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
7735
7736
|
cur = graph[cur].parent;
|
|
7736
7737
|
}
|
|
7737
|
-
fn.conversion =
|
|
7738
|
+
fn.conversion = path;
|
|
7738
7739
|
return fn;
|
|
7739
7740
|
}
|
|
7740
7741
|
module.exports = function(fromModel) {
|
|
@@ -8393,7 +8394,7 @@ var require_node2 = __commonJS({
|
|
|
8393
8394
|
var require_tail_file = __commonJS({
|
|
8394
8395
|
"../../node_modules/.pnpm/winston@3.13.0/node_modules/winston/lib/winston/tail-file.js"(exports, module) {
|
|
8395
8396
|
"use strict";
|
|
8396
|
-
var
|
|
8397
|
+
var fs2 = __require("fs");
|
|
8397
8398
|
var { StringDecoder } = __require("string_decoder");
|
|
8398
8399
|
var { Stream } = require_readable();
|
|
8399
8400
|
function noop() {
|
|
@@ -8414,7 +8415,7 @@ var require_tail_file = __commonJS({
|
|
|
8414
8415
|
stream.emit("end");
|
|
8415
8416
|
stream.emit("close");
|
|
8416
8417
|
};
|
|
8417
|
-
|
|
8418
|
+
fs2.open(options2.file, "a+", "0644", (err, fd) => {
|
|
8418
8419
|
if (err) {
|
|
8419
8420
|
if (!iter) {
|
|
8420
8421
|
stream.emit("error", err);
|
|
@@ -8426,10 +8427,10 @@ var require_tail_file = __commonJS({
|
|
|
8426
8427
|
}
|
|
8427
8428
|
(function read() {
|
|
8428
8429
|
if (stream.destroyed) {
|
|
8429
|
-
|
|
8430
|
+
fs2.close(fd, noop);
|
|
8430
8431
|
return;
|
|
8431
8432
|
}
|
|
8432
|
-
return
|
|
8433
|
+
return fs2.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
|
|
8433
8434
|
if (error) {
|
|
8434
8435
|
if (!iter) {
|
|
8435
8436
|
stream.emit("error", error);
|
|
@@ -8488,8 +8489,8 @@ var require_tail_file = __commonJS({
|
|
|
8488
8489
|
var require_file = __commonJS({
|
|
8489
8490
|
"../../node_modules/.pnpm/winston@3.13.0/node_modules/winston/lib/winston/transports/file.js"(exports, module) {
|
|
8490
8491
|
"use strict";
|
|
8491
|
-
var
|
|
8492
|
-
var
|
|
8492
|
+
var fs2 = __require("fs");
|
|
8493
|
+
var path = __require("path");
|
|
8493
8494
|
var asyncSeries = require_series();
|
|
8494
8495
|
var zlib2 = __require("zlib");
|
|
8495
8496
|
var { MESSAGE } = require_triple_beam();
|
|
@@ -8519,14 +8520,14 @@ var require_file = __commonJS({
|
|
|
8519
8520
|
this._onError = this._onError.bind(this);
|
|
8520
8521
|
if (options2.filename || options2.dirname) {
|
|
8521
8522
|
throwIf("filename or dirname", "stream");
|
|
8522
|
-
this._basename = this.filename = options2.filename ?
|
|
8523
|
-
this.dirname = options2.dirname ||
|
|
8523
|
+
this._basename = this.filename = options2.filename ? path.basename(options2.filename) : "winston.log";
|
|
8524
|
+
this.dirname = options2.dirname || path.dirname(options2.filename);
|
|
8524
8525
|
this.options = options2.options || { flags: "a" };
|
|
8525
8526
|
} else if (options2.stream) {
|
|
8526
8527
|
console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream");
|
|
8527
8528
|
throwIf("stream", "filename", "maxsize");
|
|
8528
8529
|
this._dest = this._stream.pipe(this._setupStream(options2.stream));
|
|
8529
|
-
this.dirname =
|
|
8530
|
+
this.dirname = path.dirname(this._dest.path);
|
|
8530
8531
|
} else {
|
|
8531
8532
|
throw new Error("Cannot log to file without filename or stream.");
|
|
8532
8533
|
}
|
|
@@ -8667,11 +8668,11 @@ var require_file = __commonJS({
|
|
|
8667
8668
|
options2 = {};
|
|
8668
8669
|
}
|
|
8669
8670
|
options2 = normalizeQuery(options2);
|
|
8670
|
-
const file =
|
|
8671
|
+
const file = path.join(this.dirname, this.filename);
|
|
8671
8672
|
let buff = "";
|
|
8672
8673
|
let results = [];
|
|
8673
8674
|
let row = 0;
|
|
8674
|
-
const stream =
|
|
8675
|
+
const stream = fs2.createReadStream(file, {
|
|
8675
8676
|
encoding: "utf8"
|
|
8676
8677
|
});
|
|
8677
8678
|
stream.on("error", (err) => {
|
|
@@ -8772,7 +8773,7 @@ var require_file = __commonJS({
|
|
|
8772
8773
|
* TODO: Refactor me.
|
|
8773
8774
|
*/
|
|
8774
8775
|
stream(options2 = {}) {
|
|
8775
|
-
const file =
|
|
8776
|
+
const file = path.join(this.dirname, this.filename);
|
|
8776
8777
|
const stream = new Stream();
|
|
8777
8778
|
const tail = {
|
|
8778
8779
|
file,
|
|
@@ -8824,8 +8825,8 @@ var require_file = __commonJS({
|
|
|
8824
8825
|
*/
|
|
8825
8826
|
stat(callback) {
|
|
8826
8827
|
const target = this._getFile();
|
|
8827
|
-
const fullpath =
|
|
8828
|
-
|
|
8828
|
+
const fullpath = path.join(this.dirname, target);
|
|
8829
|
+
fs2.stat(fullpath, (err, stat) => {
|
|
8829
8830
|
if (err && err.code === "ENOENT") {
|
|
8830
8831
|
debug("ENOENT\xA0ok", fullpath);
|
|
8831
8832
|
this.filename = target;
|
|
@@ -8928,9 +8929,9 @@ var require_file = __commonJS({
|
|
|
8928
8929
|
* @returns {WritableStream} Stream that writes to disk for the active file.
|
|
8929
8930
|
*/
|
|
8930
8931
|
_createStream(source) {
|
|
8931
|
-
const fullpath =
|
|
8932
|
+
const fullpath = path.join(this.dirname, this.filename);
|
|
8932
8933
|
debug("create stream start", fullpath, this.options);
|
|
8933
|
-
const dest =
|
|
8934
|
+
const dest = fs2.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
|
|
8934
8935
|
debug("file open ok", fullpath);
|
|
8935
8936
|
this.emit("open", fullpath);
|
|
8936
8937
|
source.pipe(dest);
|
|
@@ -8953,16 +8954,16 @@ var require_file = __commonJS({
|
|
|
8953
8954
|
*/
|
|
8954
8955
|
_incFile(callback) {
|
|
8955
8956
|
debug("_incFile", this.filename);
|
|
8956
|
-
const ext =
|
|
8957
|
-
const basename =
|
|
8957
|
+
const ext = path.extname(this._basename);
|
|
8958
|
+
const basename = path.basename(this._basename, ext);
|
|
8958
8959
|
const tasks = [];
|
|
8959
8960
|
if (this.zippedArchive) {
|
|
8960
8961
|
tasks.push(
|
|
8961
8962
|
function(cb) {
|
|
8962
8963
|
const num = this._created > 0 && !this.tailable ? this._created : "";
|
|
8963
8964
|
this._compressFile(
|
|
8964
|
-
|
|
8965
|
-
|
|
8965
|
+
path.join(this.dirname, `${basename}${num}${ext}`),
|
|
8966
|
+
path.join(this.dirname, `${basename}${num}${ext}.gz`),
|
|
8966
8967
|
cb
|
|
8967
8968
|
);
|
|
8968
8969
|
}.bind(this)
|
|
@@ -8987,8 +8988,8 @@ var require_file = __commonJS({
|
|
|
8987
8988
|
* @private
|
|
8988
8989
|
*/
|
|
8989
8990
|
_getFile() {
|
|
8990
|
-
const ext =
|
|
8991
|
-
const basename =
|
|
8991
|
+
const ext = path.extname(this._basename);
|
|
8992
|
+
const basename = path.basename(this._basename, ext);
|
|
8992
8993
|
const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
|
|
8993
8994
|
return !this.tailable && this._created ? `${basename}${isRotation}${ext}` : `${basename}${ext}`;
|
|
8994
8995
|
}
|
|
@@ -9008,8 +9009,8 @@ var require_file = __commonJS({
|
|
|
9008
9009
|
const isOldest = oldest !== 0 ? oldest : "";
|
|
9009
9010
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
9010
9011
|
const filePath = `${basename}${isOldest}${ext}${isZipped}`;
|
|
9011
|
-
const target =
|
|
9012
|
-
|
|
9012
|
+
const target = path.join(this.dirname, filePath);
|
|
9013
|
+
fs2.unlink(target, callback);
|
|
9013
9014
|
}
|
|
9014
9015
|
/**
|
|
9015
9016
|
* Roll files forward based on integer, up to maxFiles. e.g. if base if
|
|
@@ -9031,20 +9032,20 @@ var require_file = __commonJS({
|
|
|
9031
9032
|
for (let x = this.maxFiles - 1; x > 1; x--) {
|
|
9032
9033
|
tasks.push(function(i, cb) {
|
|
9033
9034
|
let fileName = `${basename}${i - 1}${ext}${isZipped}`;
|
|
9034
|
-
const tmppath =
|
|
9035
|
-
|
|
9035
|
+
const tmppath = path.join(this.dirname, fileName);
|
|
9036
|
+
fs2.exists(tmppath, (exists) => {
|
|
9036
9037
|
if (!exists) {
|
|
9037
9038
|
return cb(null);
|
|
9038
9039
|
}
|
|
9039
9040
|
fileName = `${basename}${i}${ext}${isZipped}`;
|
|
9040
|
-
|
|
9041
|
+
fs2.rename(tmppath, path.join(this.dirname, fileName), cb);
|
|
9041
9042
|
});
|
|
9042
9043
|
}.bind(this, x));
|
|
9043
9044
|
}
|
|
9044
9045
|
asyncSeries(tasks, () => {
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9046
|
+
fs2.rename(
|
|
9047
|
+
path.join(this.dirname, `${basename}${ext}${isZipped}`),
|
|
9048
|
+
path.join(this.dirname, `${basename}1${ext}${isZipped}`),
|
|
9048
9049
|
callback
|
|
9049
9050
|
);
|
|
9050
9051
|
});
|
|
@@ -9058,22 +9059,22 @@ var require_file = __commonJS({
|
|
|
9058
9059
|
* @private
|
|
9059
9060
|
*/
|
|
9060
9061
|
_compressFile(src, dest, callback) {
|
|
9061
|
-
|
|
9062
|
+
fs2.access(src, fs2.F_OK, (err) => {
|
|
9062
9063
|
if (err) {
|
|
9063
9064
|
return callback();
|
|
9064
9065
|
}
|
|
9065
9066
|
var gzip = zlib2.createGzip();
|
|
9066
|
-
var inp =
|
|
9067
|
-
var out =
|
|
9067
|
+
var inp = fs2.createReadStream(src);
|
|
9068
|
+
var out = fs2.createWriteStream(dest);
|
|
9068
9069
|
out.on("finish", () => {
|
|
9069
|
-
|
|
9070
|
+
fs2.unlink(src, callback);
|
|
9070
9071
|
});
|
|
9071
9072
|
inp.pipe(gzip).pipe(out);
|
|
9072
9073
|
});
|
|
9073
9074
|
}
|
|
9074
9075
|
_createLogDirIfNotExist(dirPath) {
|
|
9075
|
-
if (!
|
|
9076
|
-
|
|
9076
|
+
if (!fs2.existsSync(dirPath)) {
|
|
9077
|
+
fs2.mkdirSync(dirPath, { recursive: true });
|
|
9077
9078
|
}
|
|
9078
9079
|
}
|
|
9079
9080
|
};
|
|
@@ -9157,9 +9158,9 @@ var require_http = __commonJS({
|
|
|
9157
9158
|
};
|
|
9158
9159
|
const auth = options2.params.auth || null;
|
|
9159
9160
|
delete options2.params.auth;
|
|
9160
|
-
const
|
|
9161
|
+
const path = options2.params.path || null;
|
|
9161
9162
|
delete options2.params.path;
|
|
9162
|
-
this._request(options2, auth,
|
|
9163
|
+
this._request(options2, auth, path, (err, res, body) => {
|
|
9163
9164
|
if (res && res.statusCode !== 200) {
|
|
9164
9165
|
err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`);
|
|
9165
9166
|
}
|
|
@@ -9187,12 +9188,12 @@ var require_http = __commonJS({
|
|
|
9187
9188
|
method: "stream",
|
|
9188
9189
|
params: options2
|
|
9189
9190
|
};
|
|
9190
|
-
const
|
|
9191
|
+
const path = options2.params.path || null;
|
|
9191
9192
|
delete options2.params.path;
|
|
9192
9193
|
const auth = options2.params.auth || null;
|
|
9193
9194
|
delete options2.params.auth;
|
|
9194
9195
|
let buff = "";
|
|
9195
|
-
const req = this._request(options2, auth,
|
|
9196
|
+
const req = this._request(options2, auth, path);
|
|
9196
9197
|
stream.destroy = () => req.destroy();
|
|
9197
9198
|
req.on("data", (data) => {
|
|
9198
9199
|
data = (buff + data).split(/\n+/);
|
|
@@ -9218,14 +9219,14 @@ var require_http = __commonJS({
|
|
|
9218
9219
|
* @param {string} path - request path
|
|
9219
9220
|
* @param {function} callback - Continuation to respond to when complete.
|
|
9220
9221
|
*/
|
|
9221
|
-
_request(options2, auth,
|
|
9222
|
+
_request(options2, auth, path, callback) {
|
|
9222
9223
|
options2 = options2 || {};
|
|
9223
9224
|
auth = auth || this.auth;
|
|
9224
|
-
|
|
9225
|
+
path = path || this.path || "";
|
|
9225
9226
|
if (this.batch) {
|
|
9226
|
-
this._doBatch(options2, callback, auth,
|
|
9227
|
+
this._doBatch(options2, callback, auth, path);
|
|
9227
9228
|
} else {
|
|
9228
|
-
this._doRequest(options2, callback, auth,
|
|
9229
|
+
this._doRequest(options2, callback, auth, path);
|
|
9229
9230
|
}
|
|
9230
9231
|
}
|
|
9231
9232
|
/**
|
|
@@ -9235,18 +9236,18 @@ var require_http = __commonJS({
|
|
|
9235
9236
|
* @param {Object?} auth - authentication options
|
|
9236
9237
|
* @param {string} path - request path
|
|
9237
9238
|
*/
|
|
9238
|
-
_doBatch(options2, callback, auth,
|
|
9239
|
+
_doBatch(options2, callback, auth, path) {
|
|
9239
9240
|
this.batchOptions.push(options2);
|
|
9240
9241
|
if (this.batchOptions.length === 1) {
|
|
9241
9242
|
const me = this;
|
|
9242
9243
|
this.batchCallback = callback;
|
|
9243
9244
|
this.batchTimeoutID = setTimeout(function() {
|
|
9244
9245
|
me.batchTimeoutID = -1;
|
|
9245
|
-
me._doBatchRequest(me.batchCallback, auth,
|
|
9246
|
+
me._doBatchRequest(me.batchCallback, auth, path);
|
|
9246
9247
|
}, this.batchInterval);
|
|
9247
9248
|
}
|
|
9248
9249
|
if (this.batchOptions.length === this.batchCount) {
|
|
9249
|
-
this._doBatchRequest(this.batchCallback, auth,
|
|
9250
|
+
this._doBatchRequest(this.batchCallback, auth, path);
|
|
9250
9251
|
}
|
|
9251
9252
|
}
|
|
9252
9253
|
/**
|
|
@@ -9255,14 +9256,14 @@ var require_http = __commonJS({
|
|
|
9255
9256
|
* @param {Object?} auth - authentication options
|
|
9256
9257
|
* @param {string} path - request path
|
|
9257
9258
|
*/
|
|
9258
|
-
_doBatchRequest(callback, auth,
|
|
9259
|
+
_doBatchRequest(callback, auth, path) {
|
|
9259
9260
|
if (this.batchTimeoutID > 0) {
|
|
9260
9261
|
clearTimeout(this.batchTimeoutID);
|
|
9261
9262
|
this.batchTimeoutID = -1;
|
|
9262
9263
|
}
|
|
9263
9264
|
const batchOptionsCopy = this.batchOptions.slice();
|
|
9264
9265
|
this.batchOptions = [];
|
|
9265
|
-
this._doRequest(batchOptionsCopy, callback, auth,
|
|
9266
|
+
this._doRequest(batchOptionsCopy, callback, auth, path);
|
|
9266
9267
|
}
|
|
9267
9268
|
/**
|
|
9268
9269
|
* Make a request to a winstond server or any http server which can
|
|
@@ -9272,7 +9273,7 @@ var require_http = __commonJS({
|
|
|
9272
9273
|
* @param {Object?} auth - authentication options
|
|
9273
9274
|
* @param {string} path - request path
|
|
9274
9275
|
*/
|
|
9275
|
-
_doRequest(options2, callback, auth,
|
|
9276
|
+
_doRequest(options2, callback, auth, path) {
|
|
9276
9277
|
const headers = Object.assign({}, this.headers);
|
|
9277
9278
|
if (auth && auth.bearer) {
|
|
9278
9279
|
headers.Authorization = `Bearer ${auth.bearer}`;
|
|
@@ -9282,7 +9283,7 @@ var require_http = __commonJS({
|
|
|
9282
9283
|
method: "POST",
|
|
9283
9284
|
host: this.host,
|
|
9284
9285
|
port: this.port,
|
|
9285
|
-
path: `/${
|
|
9286
|
+
path: `/${path.replace(/^\//, "")}`,
|
|
9286
9287
|
headers,
|
|
9287
9288
|
auth: auth && auth.username && auth.password ? `${auth.username}:${auth.password}` : "",
|
|
9288
9289
|
agent: this.agent
|
|
@@ -25390,7 +25391,7 @@ function appendRootPathToUrlIfNeeded(url) {
|
|
|
25390
25391
|
return void 0;
|
|
25391
25392
|
}
|
|
25392
25393
|
}
|
|
25393
|
-
function appendResourcePathToUrl(url,
|
|
25394
|
+
function appendResourcePathToUrl(url, path) {
|
|
25394
25395
|
try {
|
|
25395
25396
|
new URL(url);
|
|
25396
25397
|
} catch {
|
|
@@ -25400,11 +25401,11 @@ function appendResourcePathToUrl(url, path2) {
|
|
|
25400
25401
|
if (!url.endsWith("/")) {
|
|
25401
25402
|
url = url + "/";
|
|
25402
25403
|
}
|
|
25403
|
-
url +=
|
|
25404
|
+
url += path;
|
|
25404
25405
|
try {
|
|
25405
25406
|
new URL(url);
|
|
25406
25407
|
} catch {
|
|
25407
|
-
diag.warn(`Configuration: Provided URL appended with '${
|
|
25408
|
+
diag.warn(`Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
25408
25409
|
return void 0;
|
|
25409
25410
|
}
|
|
25410
25411
|
return url;
|
|
@@ -25562,10 +25563,10 @@ var require_create_service_client_constructor = __commonJS({
|
|
|
25562
25563
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25563
25564
|
exports.createServiceClientConstructor = void 0;
|
|
25564
25565
|
var grpc = require_src();
|
|
25565
|
-
function createServiceClientConstructor(
|
|
25566
|
+
function createServiceClientConstructor(path, name) {
|
|
25566
25567
|
const serviceDefinition = {
|
|
25567
25568
|
export: {
|
|
25568
|
-
path
|
|
25569
|
+
path,
|
|
25569
25570
|
requestStream: false,
|
|
25570
25571
|
responseStream: false,
|
|
25571
25572
|
requestSerialize: (arg) => {
|
|
@@ -25789,8 +25790,8 @@ var require_otlp_grpc_env_configuration = __commonJS({
|
|
|
25789
25790
|
var core_1 = (init_esm3(), __toCommonJS(esm_exports2));
|
|
25790
25791
|
var grpc_exporter_transport_1 = require_grpc_exporter_transport();
|
|
25791
25792
|
var node_http_1 = (init_index_node_http(), __toCommonJS(index_node_http_exports));
|
|
25792
|
-
var
|
|
25793
|
-
var
|
|
25793
|
+
var fs2 = __require("fs");
|
|
25794
|
+
var path = __require("path");
|
|
25794
25795
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
25795
25796
|
function fallbackIfNullishOrBlank(signalSpecific, nonSignalSpecific) {
|
|
25796
25797
|
if (signalSpecific != null && signalSpecific !== "") {
|
|
@@ -25839,7 +25840,7 @@ var require_otlp_grpc_env_configuration = __commonJS({
|
|
|
25839
25840
|
const filePath = fallbackIfNullishOrBlank(signalSpecificPath, nonSignalSpecificPath);
|
|
25840
25841
|
if (filePath != null) {
|
|
25841
25842
|
try {
|
|
25842
|
-
return
|
|
25843
|
+
return fs2.readFileSync(path.resolve(process.cwd(), filePath));
|
|
25843
25844
|
} catch {
|
|
25844
25845
|
api_1.diag.warn(warningMessage);
|
|
25845
25846
|
return void 0;
|
|
@@ -27545,8 +27546,8 @@ var require_command = __commonJS({
|
|
|
27545
27546
|
"use strict";
|
|
27546
27547
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
27547
27548
|
var childProcess = __require("node:child_process");
|
|
27548
|
-
var
|
|
27549
|
-
var
|
|
27549
|
+
var path = __require("node:path");
|
|
27550
|
+
var fs2 = __require("node:fs");
|
|
27550
27551
|
var process2 = __require("node:process");
|
|
27551
27552
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
27552
27553
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -28541,7 +28542,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
28541
28542
|
* @param {string} subcommandName
|
|
28542
28543
|
*/
|
|
28543
28544
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
28544
|
-
if (
|
|
28545
|
+
if (fs2.existsSync(executableFile)) return;
|
|
28545
28546
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
28546
28547
|
const executableMissing = `'${executableFile}' does not exist
|
|
28547
28548
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -28559,11 +28560,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
28559
28560
|
let launchWithNode = false;
|
|
28560
28561
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
28561
28562
|
function findFile(baseDir, baseName) {
|
|
28562
|
-
const localBin =
|
|
28563
|
-
if (
|
|
28564
|
-
if (sourceExt.includes(
|
|
28563
|
+
const localBin = path.resolve(baseDir, baseName);
|
|
28564
|
+
if (fs2.existsSync(localBin)) return localBin;
|
|
28565
|
+
if (sourceExt.includes(path.extname(baseName))) return void 0;
|
|
28565
28566
|
const foundExt = sourceExt.find(
|
|
28566
|
-
(ext) =>
|
|
28567
|
+
(ext) => fs2.existsSync(`${localBin}${ext}`)
|
|
28567
28568
|
);
|
|
28568
28569
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
28569
28570
|
return void 0;
|
|
@@ -28575,21 +28576,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
28575
28576
|
if (this._scriptPath) {
|
|
28576
28577
|
let resolvedScriptPath;
|
|
28577
28578
|
try {
|
|
28578
|
-
resolvedScriptPath =
|
|
28579
|
+
resolvedScriptPath = fs2.realpathSync(this._scriptPath);
|
|
28579
28580
|
} catch {
|
|
28580
28581
|
resolvedScriptPath = this._scriptPath;
|
|
28581
28582
|
}
|
|
28582
|
-
executableDir =
|
|
28583
|
-
|
|
28583
|
+
executableDir = path.resolve(
|
|
28584
|
+
path.dirname(resolvedScriptPath),
|
|
28584
28585
|
executableDir
|
|
28585
28586
|
);
|
|
28586
28587
|
}
|
|
28587
28588
|
if (executableDir) {
|
|
28588
28589
|
let localFile = findFile(executableDir, executableFile);
|
|
28589
28590
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
28590
|
-
const legacyName =
|
|
28591
|
+
const legacyName = path.basename(
|
|
28591
28592
|
this._scriptPath,
|
|
28592
|
-
|
|
28593
|
+
path.extname(this._scriptPath)
|
|
28593
28594
|
);
|
|
28594
28595
|
if (legacyName !== this._name) {
|
|
28595
28596
|
localFile = findFile(
|
|
@@ -28600,7 +28601,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
28600
28601
|
}
|
|
28601
28602
|
executableFile = localFile || executableFile;
|
|
28602
28603
|
}
|
|
28603
|
-
launchWithNode = sourceExt.includes(
|
|
28604
|
+
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
28604
28605
|
let proc;
|
|
28605
28606
|
if (process2.platform !== "win32") {
|
|
28606
28607
|
if (launchWithNode) {
|
|
@@ -29516,7 +29517,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
29516
29517
|
* @return {Command}
|
|
29517
29518
|
*/
|
|
29518
29519
|
nameFromFilename(filename) {
|
|
29519
|
-
this._name =
|
|
29520
|
+
this._name = path.basename(filename, path.extname(filename));
|
|
29520
29521
|
return this;
|
|
29521
29522
|
}
|
|
29522
29523
|
/**
|
|
@@ -29530,9 +29531,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
29530
29531
|
* @param {string} [path]
|
|
29531
29532
|
* @return {(string|null|Command)}
|
|
29532
29533
|
*/
|
|
29533
|
-
executableDir(
|
|
29534
|
-
if (
|
|
29535
|
-
this._executableDir =
|
|
29534
|
+
executableDir(path2) {
|
|
29535
|
+
if (path2 === void 0) return this._executableDir;
|
|
29536
|
+
this._executableDir = path2;
|
|
29536
29537
|
return this;
|
|
29537
29538
|
}
|
|
29538
29539
|
/**
|
|
@@ -29832,7 +29833,7 @@ var require_extra_typings = __commonJS({
|
|
|
29832
29833
|
});
|
|
29833
29834
|
|
|
29834
29835
|
// src/processor-runner.ts
|
|
29835
|
-
var
|
|
29836
|
+
var import_fs_extra = __toESM(require_lib(), 1);
|
|
29836
29837
|
var import_nice_grpc2 = __toESM(require_lib2(), 1);
|
|
29837
29838
|
var import_nice_grpc_error_details = __toESM(require_lib3(), 1);
|
|
29838
29839
|
import http from "http";
|
|
@@ -29841,12 +29842,8 @@ import { fork } from "child_process";
|
|
|
29841
29842
|
import { fileURLToPath } from "url";
|
|
29842
29843
|
|
|
29843
29844
|
// src/full-service.ts
|
|
29844
|
-
import { createRequire } from "module";
|
|
29845
|
-
var import_fs_extra = __toESM(require_lib(), 1);
|
|
29846
|
-
import path from "path";
|
|
29847
29845
|
import os from "os";
|
|
29848
29846
|
import { createHash } from "crypto";
|
|
29849
|
-
var require2 = createRequire(import.meta.url);
|
|
29850
29847
|
var FUEL_PROTO_UPDATE_VERSION = parseSemver("2.54.0-rc.7");
|
|
29851
29848
|
var FUEL_PROTO_NO_FUEL_TRANSACTION_AS_CALL_VERSION = parseSemver("2.55.0-rc.1");
|
|
29852
29849
|
var MOVE_USE_RAW_VERSION = parseSemver("2.55.0-rc.1");
|
|
@@ -29870,21 +29867,10 @@ function getParsedData(rawData) {
|
|
|
29870
29867
|
}
|
|
29871
29868
|
return parsedData;
|
|
29872
29869
|
}
|
|
29873
|
-
function locatePackageJson(pkgId) {
|
|
29874
|
-
const m = require2.resolve(pkgId);
|
|
29875
|
-
let dir = path.dirname(m);
|
|
29876
|
-
while (!import_fs_extra.default.existsSync(path.join(dir, "package.json"))) {
|
|
29877
|
-
dir = path.dirname(dir);
|
|
29878
|
-
}
|
|
29879
|
-
const content = import_fs_extra.default.readFileSync(path.join(dir, "package.json"), "utf-8");
|
|
29880
|
-
return JSON.parse(content);
|
|
29881
|
-
}
|
|
29882
29870
|
var RuntimeServicePatcher = class {
|
|
29883
29871
|
sdkVersion;
|
|
29884
29872
|
constructor() {
|
|
29885
29873
|
const sdkPackageJson = locatePackageJson("@sentio/sdk");
|
|
29886
|
-
const runtimePackageJson = locatePackageJson("@sentio/runtime");
|
|
29887
|
-
console.log("Runtime version:", runtimePackageJson.version, "SDK version:", sdkPackageJson.version);
|
|
29888
29874
|
this.sdkVersion = parseSemver(sdkPackageJson.version);
|
|
29889
29875
|
}
|
|
29890
29876
|
adjustDataBinding(dataBinding) {
|
|
@@ -30058,8 +30044,6 @@ var FullProcessorServiceImpl = class {
|
|
|
30058
30044
|
constructor(instance) {
|
|
30059
30045
|
this.instance = instance;
|
|
30060
30046
|
const sdkPackageJson = locatePackageJson("@sentio/sdk");
|
|
30061
|
-
const runtimePackageJson = locatePackageJson("@sentio/runtime");
|
|
30062
|
-
console.log("Runtime version:", runtimePackageJson.version, "SDK version:", sdkPackageJson.version);
|
|
30063
30047
|
this.sdkVersion = parseSemver(sdkPackageJson.version);
|
|
30064
30048
|
}
|
|
30065
30049
|
instance;
|
|
@@ -30477,39 +30461,12 @@ await setupOTLP(options.otlpDebug);
|
|
|
30477
30461
|
Error.stackTraceLimit = 20;
|
|
30478
30462
|
configureEndpoints(options);
|
|
30479
30463
|
console.debug("Starting Server", options);
|
|
30480
|
-
var isChildProcess = process.env["
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
const
|
|
30484
|
-
|
|
30485
|
-
for (let i = 1; i < options.worker; i++) {
|
|
30486
|
-
const childPort = basePort + i;
|
|
30487
|
-
const child = fork(fileURLToPath(import.meta.url), process.argv.slice(2), {
|
|
30488
|
-
env: {
|
|
30489
|
-
...process.env,
|
|
30490
|
-
SENTIO_MULTI_SERVER_CHILD: "true",
|
|
30491
|
-
SENTIO_CHILD_SERVER_PORT: String(childPort)
|
|
30492
|
-
},
|
|
30493
|
-
stdio: "inherit"
|
|
30494
|
-
});
|
|
30495
|
-
child.on("error", (err) => {
|
|
30496
|
-
console.error(`Child process on port ${childPort} error:`, err);
|
|
30497
|
-
});
|
|
30498
|
-
child.on("exit", (code) => {
|
|
30499
|
-
console.log(`Child process on port ${childPort} exited with code ${code}`);
|
|
30500
|
-
});
|
|
30501
|
-
childProcesses.push(child);
|
|
30502
|
-
console.log(`Spawned child server process for port ${childPort}`);
|
|
30503
|
-
}
|
|
30504
|
-
const shutdownChildren = () => {
|
|
30505
|
-
for (const child of childProcesses) {
|
|
30506
|
-
child.kill("SIGINT");
|
|
30507
|
-
}
|
|
30508
|
-
};
|
|
30509
|
-
process.on("SIGINT", shutdownChildren);
|
|
30510
|
-
process.on("SIGTERM", shutdownChildren);
|
|
30464
|
+
var isChildProcess = process.env["IS_CHILD"] === "true";
|
|
30465
|
+
if (!isChildProcess) {
|
|
30466
|
+
const sdkPackageJson = locatePackageJson("@sentio/sdk");
|
|
30467
|
+
const runtimePackageJson = locatePackageJson("@sentio/runtime");
|
|
30468
|
+
console.log("Runtime version:", runtimePackageJson.version, "SDK version:", sdkPackageJson.version);
|
|
30511
30469
|
}
|
|
30512
|
-
var actualPort = isChildProcess && childServerPort ? childServerPort : options.port;
|
|
30513
30470
|
var server;
|
|
30514
30471
|
var baseService;
|
|
30515
30472
|
var httpServer;
|
|
@@ -30520,7 +30477,7 @@ var loader = async () => {
|
|
|
30520
30477
|
};
|
|
30521
30478
|
if (options.startActionServer) {
|
|
30522
30479
|
server = new ActionServer(loader);
|
|
30523
|
-
server.listen(
|
|
30480
|
+
server.listen(options.port);
|
|
30524
30481
|
} else {
|
|
30525
30482
|
server = (0, import_nice_grpc2.createServer)({
|
|
30526
30483
|
"grpc.max_send_message_length": 768 * 1024 * 1024,
|
|
@@ -30534,8 +30491,8 @@ if (options.startActionServer) {
|
|
|
30534
30491
|
ProcessorV3Definition,
|
|
30535
30492
|
new FullProcessorServiceV3Impl(new ProcessorServiceImplV3(loader, options, server.shutdown))
|
|
30536
30493
|
);
|
|
30537
|
-
server.listen("0.0.0.0:" +
|
|
30538
|
-
console.log("Processor Server Started at:",
|
|
30494
|
+
server.listen("0.0.0.0:" + options.port);
|
|
30495
|
+
console.log("Processor Server Started at:", options.port);
|
|
30539
30496
|
}
|
|
30540
30497
|
if (!isChildProcess) {
|
|
30541
30498
|
const metricsPort = 4040;
|
|
@@ -30552,7 +30509,7 @@ if (!isChildProcess) {
|
|
|
30552
30509
|
try {
|
|
30553
30510
|
const file = "/tmp/" + Date.now() + ".heapsnapshot";
|
|
30554
30511
|
await dumpHeap(file);
|
|
30555
|
-
const readStream =
|
|
30512
|
+
const readStream = import_fs_extra.default.createReadStream(file);
|
|
30556
30513
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
30557
30514
|
readStream.pipe(res);
|
|
30558
30515
|
res.end();
|
|
@@ -30624,18 +30581,18 @@ process.on("SIGINT", function() {
|
|
|
30624
30581
|
async function dumpHeap(file) {
|
|
30625
30582
|
console.log("Heap dumping to", file);
|
|
30626
30583
|
const session = new Session();
|
|
30627
|
-
|
|
30628
|
-
const fd =
|
|
30584
|
+
import_fs_extra.default.mkdirSync(dirname(file), { recursive: true });
|
|
30585
|
+
const fd = import_fs_extra.default.openSync(file, "w");
|
|
30629
30586
|
try {
|
|
30630
30587
|
session.connect();
|
|
30631
30588
|
session.on("HeapProfiler.addHeapSnapshotChunk", (m) => {
|
|
30632
|
-
|
|
30589
|
+
import_fs_extra.default.writeSync(fd, m.params.chunk);
|
|
30633
30590
|
});
|
|
30634
30591
|
await session.post("HeapProfiler.takeHeapSnapshot");
|
|
30635
30592
|
console.log("Heap dumped to", file);
|
|
30636
30593
|
} finally {
|
|
30637
30594
|
session.disconnect();
|
|
30638
|
-
|
|
30595
|
+
import_fs_extra.default.closeSync(fd);
|
|
30639
30596
|
}
|
|
30640
30597
|
}
|
|
30641
30598
|
function shutdownServers(exitCode) {
|
|
@@ -30650,6 +30607,47 @@ function shutdownServers(exitCode) {
|
|
|
30650
30607
|
process.exit(exitCode);
|
|
30651
30608
|
}
|
|
30652
30609
|
}
|
|
30610
|
+
if (options.worker > 1 && !isChildProcess) {
|
|
30611
|
+
const childProcesses = [];
|
|
30612
|
+
const basePort = parseInt(options.port);
|
|
30613
|
+
for (let i = 1; i < options.worker; i++) {
|
|
30614
|
+
const childPort = basePort + i;
|
|
30615
|
+
const args = process.argv.slice(2);
|
|
30616
|
+
const childArgs = ["--port=" + String(childPort)];
|
|
30617
|
+
for (let j = 0; j < args.length; j++) {
|
|
30618
|
+
const arg = args[j];
|
|
30619
|
+
if (arg === "-p" || arg === "--port") {
|
|
30620
|
+
j++;
|
|
30621
|
+
continue;
|
|
30622
|
+
} else if (arg.startsWith("--port=") || arg.startsWith("--inspect=")) {
|
|
30623
|
+
continue;
|
|
30624
|
+
}
|
|
30625
|
+
childArgs.push(arg);
|
|
30626
|
+
}
|
|
30627
|
+
const child = fork(fileURLToPath(import.meta.url), childArgs, {
|
|
30628
|
+
env: {
|
|
30629
|
+
...process.env,
|
|
30630
|
+
IS_CHILD: "true"
|
|
30631
|
+
},
|
|
30632
|
+
stdio: "inherit"
|
|
30633
|
+
});
|
|
30634
|
+
child.on("error", (err) => {
|
|
30635
|
+
console.error(`Child process on port ${childPort} error:`, err);
|
|
30636
|
+
});
|
|
30637
|
+
child.on("exit", (code) => {
|
|
30638
|
+
console.log(`Child process on port ${childPort} exited with code ${code}`);
|
|
30639
|
+
});
|
|
30640
|
+
childProcesses.push(child);
|
|
30641
|
+
console.log(`Spawned child server process for port ${childPort}`);
|
|
30642
|
+
}
|
|
30643
|
+
const shutdownChildren = () => {
|
|
30644
|
+
for (const child of childProcesses) {
|
|
30645
|
+
child.kill("SIGINT");
|
|
30646
|
+
}
|
|
30647
|
+
};
|
|
30648
|
+
process.on("SIGINT", shutdownChildren);
|
|
30649
|
+
process.on("SIGTERM", shutdownChildren);
|
|
30650
|
+
}
|
|
30653
30651
|
import("node:process").then((p) => p.stdout.write(""));
|
|
30654
30652
|
/*! Bundled license information:
|
|
30655
30653
|
|