@netlify/plugin-nextjs 5.7.2 → 5.7.3
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/dist/build/content/prerendered.js +1 -1
- package/dist/build/content/server.js +1 -1
- package/dist/build/content/static.js +1 -1
- package/dist/build/functions/edge.js +24 -8
- package/dist/build/functions/server.js +1 -1
- package/dist/build/plugin-context.js +0 -3
- package/dist/build/verification.js +1 -1
- package/dist/esm-chunks/{chunk-FHR56UHE.js → chunk-KGYJQ2U2.js} +58 -48
- package/dist/esm-chunks/{package-NNKZAPVX.js → package-EEQP43EX.js} +11 -11
- package/dist/run/handlers/tracing.js +2128 -671
- package/dist/run/regional-blob-store.cjs +46 -23
- package/edge-runtime/lib/response.ts +9 -12
- package/edge-runtime/middleware.ts +0 -1
- package/package.json +1 -1
|
@@ -39215,13 +39215,13 @@ var require_package2 = __commonJS({
|
|
|
39215
39215
|
"node_modules/@grpc/grpc-js/package.json"(exports2, module2) {
|
|
39216
39216
|
module2.exports = {
|
|
39217
39217
|
name: "@grpc/grpc-js",
|
|
39218
|
-
version: "1.
|
|
39218
|
+
version: "1.11.3",
|
|
39219
39219
|
description: "gRPC Library for Node - pure JS implementation",
|
|
39220
39220
|
homepage: "https://grpc.io/",
|
|
39221
39221
|
repository: "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
|
39222
39222
|
main: "build/src/index.js",
|
|
39223
39223
|
engines: {
|
|
39224
|
-
node: "
|
|
39224
|
+
node: ">=12.10.0"
|
|
39225
39225
|
},
|
|
39226
39226
|
keywords: [],
|
|
39227
39227
|
author: {
|
|
@@ -39230,17 +39230,19 @@ var require_package2 = __commonJS({
|
|
|
39230
39230
|
types: "build/src/index.d.ts",
|
|
39231
39231
|
license: "Apache-2.0",
|
|
39232
39232
|
devDependencies: {
|
|
39233
|
-
"@
|
|
39234
|
-
"@types/gulp
|
|
39235
|
-
"@types/
|
|
39236
|
-
"@types/
|
|
39237
|
-
"@types/
|
|
39238
|
-
"@types/
|
|
39239
|
-
"@types/
|
|
39240
|
-
"@
|
|
39241
|
-
"@
|
|
39242
|
-
"@typescript-eslint/
|
|
39243
|
-
"
|
|
39233
|
+
"@grpc/proto-loader": "file:../proto-loader",
|
|
39234
|
+
"@types/gulp": "^4.0.17",
|
|
39235
|
+
"@types/gulp-mocha": "0.0.37",
|
|
39236
|
+
"@types/lodash": "^4.14.202",
|
|
39237
|
+
"@types/mocha": "^10.0.6",
|
|
39238
|
+
"@types/ncp": "^2.0.8",
|
|
39239
|
+
"@types/node": ">=20.11.20",
|
|
39240
|
+
"@types/pify": "^5.0.4",
|
|
39241
|
+
"@types/semver": "^7.5.8",
|
|
39242
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
39243
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
39244
|
+
"@typescript-eslint/typescript-estree": "^7.1.0",
|
|
39245
|
+
"clang-format": "^1.8.0",
|
|
39244
39246
|
eslint: "^8.42.0",
|
|
39245
39247
|
"eslint-config-prettier": "^8.8.0",
|
|
39246
39248
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -39248,16 +39250,16 @@ var require_package2 = __commonJS({
|
|
|
39248
39250
|
execa: "^2.0.3",
|
|
39249
39251
|
gulp: "^4.0.2",
|
|
39250
39252
|
"gulp-mocha": "^6.0.0",
|
|
39251
|
-
lodash: "^4.17.
|
|
39253
|
+
lodash: "^4.17.21",
|
|
39252
39254
|
madge: "^5.0.1",
|
|
39253
39255
|
"mocha-jenkins-reporter": "^0.4.1",
|
|
39254
39256
|
ncp: "^2.0.0",
|
|
39255
39257
|
pify: "^4.0.1",
|
|
39256
39258
|
prettier: "^2.8.8",
|
|
39257
39259
|
rimraf: "^3.0.2",
|
|
39258
|
-
semver: "^7.
|
|
39259
|
-
"ts-node": "^10.9.
|
|
39260
|
-
typescript: "^5.
|
|
39260
|
+
semver: "^7.6.0",
|
|
39261
|
+
"ts-node": "^10.9.2",
|
|
39262
|
+
typescript: "^5.3.3"
|
|
39261
39263
|
},
|
|
39262
39264
|
contributors: [
|
|
39263
39265
|
{
|
|
@@ -39280,8 +39282,8 @@ var require_package2 = __commonJS({
|
|
|
39280
39282
|
"generate-test-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto"
|
|
39281
39283
|
},
|
|
39282
39284
|
dependencies: {
|
|
39283
|
-
"@grpc/proto-loader": "^0.7.
|
|
39284
|
-
"@
|
|
39285
|
+
"@grpc/proto-loader": "^0.7.13",
|
|
39286
|
+
"@js-sdsl/ordered-map": "^4.4.2"
|
|
39285
39287
|
},
|
|
39286
39288
|
files: [
|
|
39287
39289
|
"src/**/*.ts",
|
|
@@ -40088,10 +40090,10 @@ var require_service_config = __commonJS({
|
|
|
40088
40090
|
throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");
|
|
40089
40091
|
}
|
|
40090
40092
|
if (!("initialBackoff" in obj) || typeof obj.initialBackoff !== "string" || !DURATION_REGEX.test(obj.initialBackoff)) {
|
|
40091
|
-
throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer followed by s");
|
|
40093
|
+
throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");
|
|
40092
40094
|
}
|
|
40093
40095
|
if (!("maxBackoff" in obj) || typeof obj.maxBackoff !== "string" || !DURATION_REGEX.test(obj.maxBackoff)) {
|
|
40094
|
-
throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer followed by s");
|
|
40096
|
+
throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");
|
|
40095
40097
|
}
|
|
40096
40098
|
if (!("backoffMultiplier" in obj) || typeof obj.backoffMultiplier !== "number" || obj.backoffMultiplier <= 0) {
|
|
40097
40099
|
throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");
|
|
@@ -40134,14 +40136,14 @@ var require_service_config = __commonJS({
|
|
|
40134
40136
|
for (const value of obj.nonFatalStatusCodes) {
|
|
40135
40137
|
if (typeof value === "number") {
|
|
40136
40138
|
if (!Object.values(constants_1.Status).includes(value)) {
|
|
40137
|
-
throw new Error("
|
|
40139
|
+
throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range");
|
|
40138
40140
|
}
|
|
40139
40141
|
} else if (typeof value === "string") {
|
|
40140
40142
|
if (!Object.values(constants_1.Status).includes(value.toUpperCase())) {
|
|
40141
|
-
throw new Error("
|
|
40143
|
+
throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name");
|
|
40142
40144
|
}
|
|
40143
40145
|
} else {
|
|
40144
|
-
throw new Error("
|
|
40146
|
+
throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");
|
|
40145
40147
|
}
|
|
40146
40148
|
}
|
|
40147
40149
|
}
|
|
@@ -41152,7 +41154,8 @@ var require_channel_options = __commonJS({
|
|
|
41152
41154
|
"grpc.service_config_disable_resolution": true,
|
|
41153
41155
|
"grpc.client_idle_timeout_ms": true,
|
|
41154
41156
|
"grpc-node.tls_enable_trace": true,
|
|
41155
|
-
"grpc.lb.ring_hash.ring_size_cap": true
|
|
41157
|
+
"grpc.lb.ring_hash.ring_size_cap": true,
|
|
41158
|
+
"grpc-node.retry_max_attempts_limit": true
|
|
41156
41159
|
};
|
|
41157
41160
|
function channelOptionsEqual(options1, options2) {
|
|
41158
41161
|
const keys1 = Object.keys(options1).sort();
|
|
@@ -41201,7 +41204,11 @@ var require_subchannel_address = __commonJS({
|
|
|
41201
41204
|
exports2.subchannelAddressEqual = subchannelAddressEqual;
|
|
41202
41205
|
function subchannelAddressToString(address) {
|
|
41203
41206
|
if (isTcpSubchannelAddress(address)) {
|
|
41204
|
-
|
|
41207
|
+
if ((0, net_1.isIPv6)(address.host)) {
|
|
41208
|
+
return "[" + address.host + "]:" + address.port;
|
|
41209
|
+
} else {
|
|
41210
|
+
return address.host + ":" + address.port;
|
|
41211
|
+
}
|
|
41205
41212
|
} else {
|
|
41206
41213
|
return address.path;
|
|
41207
41214
|
}
|
|
@@ -41355,6 +41362,800 @@ var require_subchannel_address = __commonJS({
|
|
|
41355
41362
|
}
|
|
41356
41363
|
});
|
|
41357
41364
|
|
|
41365
|
+
// node_modules/@js-sdsl/ordered-map/dist/cjs/index.js
|
|
41366
|
+
var require_cjs = __commonJS({
|
|
41367
|
+
"node_modules/@js-sdsl/ordered-map/dist/cjs/index.js"(exports2) {
|
|
41368
|
+
"use strict";
|
|
41369
|
+
Object.defineProperty(exports2, "t", {
|
|
41370
|
+
value: true
|
|
41371
|
+
});
|
|
41372
|
+
var TreeNode = class {
|
|
41373
|
+
constructor(t, e, s = 1) {
|
|
41374
|
+
this.i = void 0;
|
|
41375
|
+
this.h = void 0;
|
|
41376
|
+
this.o = void 0;
|
|
41377
|
+
this.u = t;
|
|
41378
|
+
this.l = e;
|
|
41379
|
+
this.p = s;
|
|
41380
|
+
}
|
|
41381
|
+
I() {
|
|
41382
|
+
let t = this;
|
|
41383
|
+
const e = t.o.o === t;
|
|
41384
|
+
if (e && t.p === 1) {
|
|
41385
|
+
t = t.h;
|
|
41386
|
+
} else if (t.i) {
|
|
41387
|
+
t = t.i;
|
|
41388
|
+
while (t.h) {
|
|
41389
|
+
t = t.h;
|
|
41390
|
+
}
|
|
41391
|
+
} else {
|
|
41392
|
+
if (e) {
|
|
41393
|
+
return t.o;
|
|
41394
|
+
}
|
|
41395
|
+
let s = t.o;
|
|
41396
|
+
while (s.i === t) {
|
|
41397
|
+
t = s;
|
|
41398
|
+
s = t.o;
|
|
41399
|
+
}
|
|
41400
|
+
t = s;
|
|
41401
|
+
}
|
|
41402
|
+
return t;
|
|
41403
|
+
}
|
|
41404
|
+
B() {
|
|
41405
|
+
let t = this;
|
|
41406
|
+
if (t.h) {
|
|
41407
|
+
t = t.h;
|
|
41408
|
+
while (t.i) {
|
|
41409
|
+
t = t.i;
|
|
41410
|
+
}
|
|
41411
|
+
return t;
|
|
41412
|
+
} else {
|
|
41413
|
+
let e = t.o;
|
|
41414
|
+
while (e.h === t) {
|
|
41415
|
+
t = e;
|
|
41416
|
+
e = t.o;
|
|
41417
|
+
}
|
|
41418
|
+
if (t.h !== e) {
|
|
41419
|
+
return e;
|
|
41420
|
+
} else return t;
|
|
41421
|
+
}
|
|
41422
|
+
}
|
|
41423
|
+
_() {
|
|
41424
|
+
const t = this.o;
|
|
41425
|
+
const e = this.h;
|
|
41426
|
+
const s = e.i;
|
|
41427
|
+
if (t.o === this) t.o = e;
|
|
41428
|
+
else if (t.i === this) t.i = e;
|
|
41429
|
+
else t.h = e;
|
|
41430
|
+
e.o = t;
|
|
41431
|
+
e.i = this;
|
|
41432
|
+
this.o = e;
|
|
41433
|
+
this.h = s;
|
|
41434
|
+
if (s) s.o = this;
|
|
41435
|
+
return e;
|
|
41436
|
+
}
|
|
41437
|
+
g() {
|
|
41438
|
+
const t = this.o;
|
|
41439
|
+
const e = this.i;
|
|
41440
|
+
const s = e.h;
|
|
41441
|
+
if (t.o === this) t.o = e;
|
|
41442
|
+
else if (t.i === this) t.i = e;
|
|
41443
|
+
else t.h = e;
|
|
41444
|
+
e.o = t;
|
|
41445
|
+
e.h = this;
|
|
41446
|
+
this.o = e;
|
|
41447
|
+
this.i = s;
|
|
41448
|
+
if (s) s.o = this;
|
|
41449
|
+
return e;
|
|
41450
|
+
}
|
|
41451
|
+
};
|
|
41452
|
+
var TreeNodeEnableIndex = class extends TreeNode {
|
|
41453
|
+
constructor() {
|
|
41454
|
+
super(...arguments);
|
|
41455
|
+
this.M = 1;
|
|
41456
|
+
}
|
|
41457
|
+
_() {
|
|
41458
|
+
const t = super._();
|
|
41459
|
+
this.O();
|
|
41460
|
+
t.O();
|
|
41461
|
+
return t;
|
|
41462
|
+
}
|
|
41463
|
+
g() {
|
|
41464
|
+
const t = super.g();
|
|
41465
|
+
this.O();
|
|
41466
|
+
t.O();
|
|
41467
|
+
return t;
|
|
41468
|
+
}
|
|
41469
|
+
O() {
|
|
41470
|
+
this.M = 1;
|
|
41471
|
+
if (this.i) {
|
|
41472
|
+
this.M += this.i.M;
|
|
41473
|
+
}
|
|
41474
|
+
if (this.h) {
|
|
41475
|
+
this.M += this.h.M;
|
|
41476
|
+
}
|
|
41477
|
+
}
|
|
41478
|
+
};
|
|
41479
|
+
var ContainerIterator = class {
|
|
41480
|
+
constructor(t = 0) {
|
|
41481
|
+
this.iteratorType = t;
|
|
41482
|
+
}
|
|
41483
|
+
equals(t) {
|
|
41484
|
+
return this.T === t.T;
|
|
41485
|
+
}
|
|
41486
|
+
};
|
|
41487
|
+
var Base = class {
|
|
41488
|
+
constructor() {
|
|
41489
|
+
this.m = 0;
|
|
41490
|
+
}
|
|
41491
|
+
get length() {
|
|
41492
|
+
return this.m;
|
|
41493
|
+
}
|
|
41494
|
+
size() {
|
|
41495
|
+
return this.m;
|
|
41496
|
+
}
|
|
41497
|
+
empty() {
|
|
41498
|
+
return this.m === 0;
|
|
41499
|
+
}
|
|
41500
|
+
};
|
|
41501
|
+
var Container = class extends Base {
|
|
41502
|
+
};
|
|
41503
|
+
function throwIteratorAccessError() {
|
|
41504
|
+
throw new RangeError("Iterator access denied!");
|
|
41505
|
+
}
|
|
41506
|
+
var TreeContainer = class extends Container {
|
|
41507
|
+
constructor(t = function(t2, e2) {
|
|
41508
|
+
if (t2 < e2) return -1;
|
|
41509
|
+
if (t2 > e2) return 1;
|
|
41510
|
+
return 0;
|
|
41511
|
+
}, e = false) {
|
|
41512
|
+
super();
|
|
41513
|
+
this.v = void 0;
|
|
41514
|
+
this.A = t;
|
|
41515
|
+
this.enableIndex = e;
|
|
41516
|
+
this.N = e ? TreeNodeEnableIndex : TreeNode;
|
|
41517
|
+
this.C = new this.N();
|
|
41518
|
+
}
|
|
41519
|
+
R(t, e) {
|
|
41520
|
+
let s = this.C;
|
|
41521
|
+
while (t) {
|
|
41522
|
+
const i = this.A(t.u, e);
|
|
41523
|
+
if (i < 0) {
|
|
41524
|
+
t = t.h;
|
|
41525
|
+
} else if (i > 0) {
|
|
41526
|
+
s = t;
|
|
41527
|
+
t = t.i;
|
|
41528
|
+
} else return t;
|
|
41529
|
+
}
|
|
41530
|
+
return s;
|
|
41531
|
+
}
|
|
41532
|
+
K(t, e) {
|
|
41533
|
+
let s = this.C;
|
|
41534
|
+
while (t) {
|
|
41535
|
+
const i = this.A(t.u, e);
|
|
41536
|
+
if (i <= 0) {
|
|
41537
|
+
t = t.h;
|
|
41538
|
+
} else {
|
|
41539
|
+
s = t;
|
|
41540
|
+
t = t.i;
|
|
41541
|
+
}
|
|
41542
|
+
}
|
|
41543
|
+
return s;
|
|
41544
|
+
}
|
|
41545
|
+
L(t, e) {
|
|
41546
|
+
let s = this.C;
|
|
41547
|
+
while (t) {
|
|
41548
|
+
const i = this.A(t.u, e);
|
|
41549
|
+
if (i < 0) {
|
|
41550
|
+
s = t;
|
|
41551
|
+
t = t.h;
|
|
41552
|
+
} else if (i > 0) {
|
|
41553
|
+
t = t.i;
|
|
41554
|
+
} else return t;
|
|
41555
|
+
}
|
|
41556
|
+
return s;
|
|
41557
|
+
}
|
|
41558
|
+
k(t, e) {
|
|
41559
|
+
let s = this.C;
|
|
41560
|
+
while (t) {
|
|
41561
|
+
const i = this.A(t.u, e);
|
|
41562
|
+
if (i < 0) {
|
|
41563
|
+
s = t;
|
|
41564
|
+
t = t.h;
|
|
41565
|
+
} else {
|
|
41566
|
+
t = t.i;
|
|
41567
|
+
}
|
|
41568
|
+
}
|
|
41569
|
+
return s;
|
|
41570
|
+
}
|
|
41571
|
+
P(t) {
|
|
41572
|
+
while (true) {
|
|
41573
|
+
const e = t.o;
|
|
41574
|
+
if (e === this.C) return;
|
|
41575
|
+
if (t.p === 1) {
|
|
41576
|
+
t.p = 0;
|
|
41577
|
+
return;
|
|
41578
|
+
}
|
|
41579
|
+
if (t === e.i) {
|
|
41580
|
+
const s = e.h;
|
|
41581
|
+
if (s.p === 1) {
|
|
41582
|
+
s.p = 0;
|
|
41583
|
+
e.p = 1;
|
|
41584
|
+
if (e === this.v) {
|
|
41585
|
+
this.v = e._();
|
|
41586
|
+
} else e._();
|
|
41587
|
+
} else {
|
|
41588
|
+
if (s.h && s.h.p === 1) {
|
|
41589
|
+
s.p = e.p;
|
|
41590
|
+
e.p = 0;
|
|
41591
|
+
s.h.p = 0;
|
|
41592
|
+
if (e === this.v) {
|
|
41593
|
+
this.v = e._();
|
|
41594
|
+
} else e._();
|
|
41595
|
+
return;
|
|
41596
|
+
} else if (s.i && s.i.p === 1) {
|
|
41597
|
+
s.p = 1;
|
|
41598
|
+
s.i.p = 0;
|
|
41599
|
+
s.g();
|
|
41600
|
+
} else {
|
|
41601
|
+
s.p = 1;
|
|
41602
|
+
t = e;
|
|
41603
|
+
}
|
|
41604
|
+
}
|
|
41605
|
+
} else {
|
|
41606
|
+
const s = e.i;
|
|
41607
|
+
if (s.p === 1) {
|
|
41608
|
+
s.p = 0;
|
|
41609
|
+
e.p = 1;
|
|
41610
|
+
if (e === this.v) {
|
|
41611
|
+
this.v = e.g();
|
|
41612
|
+
} else e.g();
|
|
41613
|
+
} else {
|
|
41614
|
+
if (s.i && s.i.p === 1) {
|
|
41615
|
+
s.p = e.p;
|
|
41616
|
+
e.p = 0;
|
|
41617
|
+
s.i.p = 0;
|
|
41618
|
+
if (e === this.v) {
|
|
41619
|
+
this.v = e.g();
|
|
41620
|
+
} else e.g();
|
|
41621
|
+
return;
|
|
41622
|
+
} else if (s.h && s.h.p === 1) {
|
|
41623
|
+
s.p = 1;
|
|
41624
|
+
s.h.p = 0;
|
|
41625
|
+
s._();
|
|
41626
|
+
} else {
|
|
41627
|
+
s.p = 1;
|
|
41628
|
+
t = e;
|
|
41629
|
+
}
|
|
41630
|
+
}
|
|
41631
|
+
}
|
|
41632
|
+
}
|
|
41633
|
+
}
|
|
41634
|
+
S(t) {
|
|
41635
|
+
if (this.m === 1) {
|
|
41636
|
+
this.clear();
|
|
41637
|
+
return;
|
|
41638
|
+
}
|
|
41639
|
+
let e = t;
|
|
41640
|
+
while (e.i || e.h) {
|
|
41641
|
+
if (e.h) {
|
|
41642
|
+
e = e.h;
|
|
41643
|
+
while (e.i) e = e.i;
|
|
41644
|
+
} else {
|
|
41645
|
+
e = e.i;
|
|
41646
|
+
}
|
|
41647
|
+
const s2 = t.u;
|
|
41648
|
+
t.u = e.u;
|
|
41649
|
+
e.u = s2;
|
|
41650
|
+
const i = t.l;
|
|
41651
|
+
t.l = e.l;
|
|
41652
|
+
e.l = i;
|
|
41653
|
+
t = e;
|
|
41654
|
+
}
|
|
41655
|
+
if (this.C.i === e) {
|
|
41656
|
+
this.C.i = e.o;
|
|
41657
|
+
} else if (this.C.h === e) {
|
|
41658
|
+
this.C.h = e.o;
|
|
41659
|
+
}
|
|
41660
|
+
this.P(e);
|
|
41661
|
+
let s = e.o;
|
|
41662
|
+
if (e === s.i) {
|
|
41663
|
+
s.i = void 0;
|
|
41664
|
+
} else s.h = void 0;
|
|
41665
|
+
this.m -= 1;
|
|
41666
|
+
this.v.p = 0;
|
|
41667
|
+
if (this.enableIndex) {
|
|
41668
|
+
while (s !== this.C) {
|
|
41669
|
+
s.M -= 1;
|
|
41670
|
+
s = s.o;
|
|
41671
|
+
}
|
|
41672
|
+
}
|
|
41673
|
+
}
|
|
41674
|
+
U(t) {
|
|
41675
|
+
const e = typeof t === "number" ? t : void 0;
|
|
41676
|
+
const s = typeof t === "function" ? t : void 0;
|
|
41677
|
+
const i = typeof t === "undefined" ? [] : void 0;
|
|
41678
|
+
let r = 0;
|
|
41679
|
+
let n = this.v;
|
|
41680
|
+
const h = [];
|
|
41681
|
+
while (h.length || n) {
|
|
41682
|
+
if (n) {
|
|
41683
|
+
h.push(n);
|
|
41684
|
+
n = n.i;
|
|
41685
|
+
} else {
|
|
41686
|
+
n = h.pop();
|
|
41687
|
+
if (r === e) return n;
|
|
41688
|
+
i && i.push(n);
|
|
41689
|
+
s && s(n, r, this);
|
|
41690
|
+
r += 1;
|
|
41691
|
+
n = n.h;
|
|
41692
|
+
}
|
|
41693
|
+
}
|
|
41694
|
+
return i;
|
|
41695
|
+
}
|
|
41696
|
+
j(t) {
|
|
41697
|
+
while (true) {
|
|
41698
|
+
const e = t.o;
|
|
41699
|
+
if (e.p === 0) return;
|
|
41700
|
+
const s = e.o;
|
|
41701
|
+
if (e === s.i) {
|
|
41702
|
+
const i = s.h;
|
|
41703
|
+
if (i && i.p === 1) {
|
|
41704
|
+
i.p = e.p = 0;
|
|
41705
|
+
if (s === this.v) return;
|
|
41706
|
+
s.p = 1;
|
|
41707
|
+
t = s;
|
|
41708
|
+
continue;
|
|
41709
|
+
} else if (t === e.h) {
|
|
41710
|
+
t.p = 0;
|
|
41711
|
+
if (t.i) {
|
|
41712
|
+
t.i.o = e;
|
|
41713
|
+
}
|
|
41714
|
+
if (t.h) {
|
|
41715
|
+
t.h.o = s;
|
|
41716
|
+
}
|
|
41717
|
+
e.h = t.i;
|
|
41718
|
+
s.i = t.h;
|
|
41719
|
+
t.i = e;
|
|
41720
|
+
t.h = s;
|
|
41721
|
+
if (s === this.v) {
|
|
41722
|
+
this.v = t;
|
|
41723
|
+
this.C.o = t;
|
|
41724
|
+
} else {
|
|
41725
|
+
const e2 = s.o;
|
|
41726
|
+
if (e2.i === s) {
|
|
41727
|
+
e2.i = t;
|
|
41728
|
+
} else e2.h = t;
|
|
41729
|
+
}
|
|
41730
|
+
t.o = s.o;
|
|
41731
|
+
e.o = t;
|
|
41732
|
+
s.o = t;
|
|
41733
|
+
s.p = 1;
|
|
41734
|
+
} else {
|
|
41735
|
+
e.p = 0;
|
|
41736
|
+
if (s === this.v) {
|
|
41737
|
+
this.v = s.g();
|
|
41738
|
+
} else s.g();
|
|
41739
|
+
s.p = 1;
|
|
41740
|
+
return;
|
|
41741
|
+
}
|
|
41742
|
+
} else {
|
|
41743
|
+
const i = s.i;
|
|
41744
|
+
if (i && i.p === 1) {
|
|
41745
|
+
i.p = e.p = 0;
|
|
41746
|
+
if (s === this.v) return;
|
|
41747
|
+
s.p = 1;
|
|
41748
|
+
t = s;
|
|
41749
|
+
continue;
|
|
41750
|
+
} else if (t === e.i) {
|
|
41751
|
+
t.p = 0;
|
|
41752
|
+
if (t.i) {
|
|
41753
|
+
t.i.o = s;
|
|
41754
|
+
}
|
|
41755
|
+
if (t.h) {
|
|
41756
|
+
t.h.o = e;
|
|
41757
|
+
}
|
|
41758
|
+
s.h = t.i;
|
|
41759
|
+
e.i = t.h;
|
|
41760
|
+
t.i = s;
|
|
41761
|
+
t.h = e;
|
|
41762
|
+
if (s === this.v) {
|
|
41763
|
+
this.v = t;
|
|
41764
|
+
this.C.o = t;
|
|
41765
|
+
} else {
|
|
41766
|
+
const e2 = s.o;
|
|
41767
|
+
if (e2.i === s) {
|
|
41768
|
+
e2.i = t;
|
|
41769
|
+
} else e2.h = t;
|
|
41770
|
+
}
|
|
41771
|
+
t.o = s.o;
|
|
41772
|
+
e.o = t;
|
|
41773
|
+
s.o = t;
|
|
41774
|
+
s.p = 1;
|
|
41775
|
+
} else {
|
|
41776
|
+
e.p = 0;
|
|
41777
|
+
if (s === this.v) {
|
|
41778
|
+
this.v = s._();
|
|
41779
|
+
} else s._();
|
|
41780
|
+
s.p = 1;
|
|
41781
|
+
return;
|
|
41782
|
+
}
|
|
41783
|
+
}
|
|
41784
|
+
if (this.enableIndex) {
|
|
41785
|
+
e.O();
|
|
41786
|
+
s.O();
|
|
41787
|
+
t.O();
|
|
41788
|
+
}
|
|
41789
|
+
return;
|
|
41790
|
+
}
|
|
41791
|
+
}
|
|
41792
|
+
q(t, e, s) {
|
|
41793
|
+
if (this.v === void 0) {
|
|
41794
|
+
this.m += 1;
|
|
41795
|
+
this.v = new this.N(t, e, 0);
|
|
41796
|
+
this.v.o = this.C;
|
|
41797
|
+
this.C.o = this.C.i = this.C.h = this.v;
|
|
41798
|
+
return this.m;
|
|
41799
|
+
}
|
|
41800
|
+
let i;
|
|
41801
|
+
const r = this.C.i;
|
|
41802
|
+
const n = this.A(r.u, t);
|
|
41803
|
+
if (n === 0) {
|
|
41804
|
+
r.l = e;
|
|
41805
|
+
return this.m;
|
|
41806
|
+
} else if (n > 0) {
|
|
41807
|
+
r.i = new this.N(t, e);
|
|
41808
|
+
r.i.o = r;
|
|
41809
|
+
i = r.i;
|
|
41810
|
+
this.C.i = i;
|
|
41811
|
+
} else {
|
|
41812
|
+
const r2 = this.C.h;
|
|
41813
|
+
const n2 = this.A(r2.u, t);
|
|
41814
|
+
if (n2 === 0) {
|
|
41815
|
+
r2.l = e;
|
|
41816
|
+
return this.m;
|
|
41817
|
+
} else if (n2 < 0) {
|
|
41818
|
+
r2.h = new this.N(t, e);
|
|
41819
|
+
r2.h.o = r2;
|
|
41820
|
+
i = r2.h;
|
|
41821
|
+
this.C.h = i;
|
|
41822
|
+
} else {
|
|
41823
|
+
if (s !== void 0) {
|
|
41824
|
+
const r3 = s.T;
|
|
41825
|
+
if (r3 !== this.C) {
|
|
41826
|
+
const s2 = this.A(r3.u, t);
|
|
41827
|
+
if (s2 === 0) {
|
|
41828
|
+
r3.l = e;
|
|
41829
|
+
return this.m;
|
|
41830
|
+
} else if (s2 > 0) {
|
|
41831
|
+
const s3 = r3.I();
|
|
41832
|
+
const n3 = this.A(s3.u, t);
|
|
41833
|
+
if (n3 === 0) {
|
|
41834
|
+
s3.l = e;
|
|
41835
|
+
return this.m;
|
|
41836
|
+
} else if (n3 < 0) {
|
|
41837
|
+
i = new this.N(t, e);
|
|
41838
|
+
if (s3.h === void 0) {
|
|
41839
|
+
s3.h = i;
|
|
41840
|
+
i.o = s3;
|
|
41841
|
+
} else {
|
|
41842
|
+
r3.i = i;
|
|
41843
|
+
i.o = r3;
|
|
41844
|
+
}
|
|
41845
|
+
}
|
|
41846
|
+
}
|
|
41847
|
+
}
|
|
41848
|
+
}
|
|
41849
|
+
if (i === void 0) {
|
|
41850
|
+
i = this.v;
|
|
41851
|
+
while (true) {
|
|
41852
|
+
const s2 = this.A(i.u, t);
|
|
41853
|
+
if (s2 > 0) {
|
|
41854
|
+
if (i.i === void 0) {
|
|
41855
|
+
i.i = new this.N(t, e);
|
|
41856
|
+
i.i.o = i;
|
|
41857
|
+
i = i.i;
|
|
41858
|
+
break;
|
|
41859
|
+
}
|
|
41860
|
+
i = i.i;
|
|
41861
|
+
} else if (s2 < 0) {
|
|
41862
|
+
if (i.h === void 0) {
|
|
41863
|
+
i.h = new this.N(t, e);
|
|
41864
|
+
i.h.o = i;
|
|
41865
|
+
i = i.h;
|
|
41866
|
+
break;
|
|
41867
|
+
}
|
|
41868
|
+
i = i.h;
|
|
41869
|
+
} else {
|
|
41870
|
+
i.l = e;
|
|
41871
|
+
return this.m;
|
|
41872
|
+
}
|
|
41873
|
+
}
|
|
41874
|
+
}
|
|
41875
|
+
}
|
|
41876
|
+
}
|
|
41877
|
+
if (this.enableIndex) {
|
|
41878
|
+
let t2 = i.o;
|
|
41879
|
+
while (t2 !== this.C) {
|
|
41880
|
+
t2.M += 1;
|
|
41881
|
+
t2 = t2.o;
|
|
41882
|
+
}
|
|
41883
|
+
}
|
|
41884
|
+
this.j(i);
|
|
41885
|
+
this.m += 1;
|
|
41886
|
+
return this.m;
|
|
41887
|
+
}
|
|
41888
|
+
H(t, e) {
|
|
41889
|
+
while (t) {
|
|
41890
|
+
const s = this.A(t.u, e);
|
|
41891
|
+
if (s < 0) {
|
|
41892
|
+
t = t.h;
|
|
41893
|
+
} else if (s > 0) {
|
|
41894
|
+
t = t.i;
|
|
41895
|
+
} else return t;
|
|
41896
|
+
}
|
|
41897
|
+
return t || this.C;
|
|
41898
|
+
}
|
|
41899
|
+
clear() {
|
|
41900
|
+
this.m = 0;
|
|
41901
|
+
this.v = void 0;
|
|
41902
|
+
this.C.o = void 0;
|
|
41903
|
+
this.C.i = this.C.h = void 0;
|
|
41904
|
+
}
|
|
41905
|
+
updateKeyByIterator(t, e) {
|
|
41906
|
+
const s = t.T;
|
|
41907
|
+
if (s === this.C) {
|
|
41908
|
+
throwIteratorAccessError();
|
|
41909
|
+
}
|
|
41910
|
+
if (this.m === 1) {
|
|
41911
|
+
s.u = e;
|
|
41912
|
+
return true;
|
|
41913
|
+
}
|
|
41914
|
+
const i = s.B().u;
|
|
41915
|
+
if (s === this.C.i) {
|
|
41916
|
+
if (this.A(i, e) > 0) {
|
|
41917
|
+
s.u = e;
|
|
41918
|
+
return true;
|
|
41919
|
+
}
|
|
41920
|
+
return false;
|
|
41921
|
+
}
|
|
41922
|
+
const r = s.I().u;
|
|
41923
|
+
if (s === this.C.h) {
|
|
41924
|
+
if (this.A(r, e) < 0) {
|
|
41925
|
+
s.u = e;
|
|
41926
|
+
return true;
|
|
41927
|
+
}
|
|
41928
|
+
return false;
|
|
41929
|
+
}
|
|
41930
|
+
if (this.A(r, e) >= 0 || this.A(i, e) <= 0) return false;
|
|
41931
|
+
s.u = e;
|
|
41932
|
+
return true;
|
|
41933
|
+
}
|
|
41934
|
+
eraseElementByPos(t) {
|
|
41935
|
+
if (t < 0 || t > this.m - 1) {
|
|
41936
|
+
throw new RangeError();
|
|
41937
|
+
}
|
|
41938
|
+
const e = this.U(t);
|
|
41939
|
+
this.S(e);
|
|
41940
|
+
return this.m;
|
|
41941
|
+
}
|
|
41942
|
+
eraseElementByKey(t) {
|
|
41943
|
+
if (this.m === 0) return false;
|
|
41944
|
+
const e = this.H(this.v, t);
|
|
41945
|
+
if (e === this.C) return false;
|
|
41946
|
+
this.S(e);
|
|
41947
|
+
return true;
|
|
41948
|
+
}
|
|
41949
|
+
eraseElementByIterator(t) {
|
|
41950
|
+
const e = t.T;
|
|
41951
|
+
if (e === this.C) {
|
|
41952
|
+
throwIteratorAccessError();
|
|
41953
|
+
}
|
|
41954
|
+
const s = e.h === void 0;
|
|
41955
|
+
const i = t.iteratorType === 0;
|
|
41956
|
+
if (i) {
|
|
41957
|
+
if (s) t.next();
|
|
41958
|
+
} else {
|
|
41959
|
+
if (!s || e.i === void 0) t.next();
|
|
41960
|
+
}
|
|
41961
|
+
this.S(e);
|
|
41962
|
+
return t;
|
|
41963
|
+
}
|
|
41964
|
+
getHeight() {
|
|
41965
|
+
if (this.m === 0) return 0;
|
|
41966
|
+
function traversal(t) {
|
|
41967
|
+
if (!t) return 0;
|
|
41968
|
+
return Math.max(traversal(t.i), traversal(t.h)) + 1;
|
|
41969
|
+
}
|
|
41970
|
+
return traversal(this.v);
|
|
41971
|
+
}
|
|
41972
|
+
};
|
|
41973
|
+
var TreeIterator = class extends ContainerIterator {
|
|
41974
|
+
constructor(t, e, s) {
|
|
41975
|
+
super(s);
|
|
41976
|
+
this.T = t;
|
|
41977
|
+
this.C = e;
|
|
41978
|
+
if (this.iteratorType === 0) {
|
|
41979
|
+
this.pre = function() {
|
|
41980
|
+
if (this.T === this.C.i) {
|
|
41981
|
+
throwIteratorAccessError();
|
|
41982
|
+
}
|
|
41983
|
+
this.T = this.T.I();
|
|
41984
|
+
return this;
|
|
41985
|
+
};
|
|
41986
|
+
this.next = function() {
|
|
41987
|
+
if (this.T === this.C) {
|
|
41988
|
+
throwIteratorAccessError();
|
|
41989
|
+
}
|
|
41990
|
+
this.T = this.T.B();
|
|
41991
|
+
return this;
|
|
41992
|
+
};
|
|
41993
|
+
} else {
|
|
41994
|
+
this.pre = function() {
|
|
41995
|
+
if (this.T === this.C.h) {
|
|
41996
|
+
throwIteratorAccessError();
|
|
41997
|
+
}
|
|
41998
|
+
this.T = this.T.B();
|
|
41999
|
+
return this;
|
|
42000
|
+
};
|
|
42001
|
+
this.next = function() {
|
|
42002
|
+
if (this.T === this.C) {
|
|
42003
|
+
throwIteratorAccessError();
|
|
42004
|
+
}
|
|
42005
|
+
this.T = this.T.I();
|
|
42006
|
+
return this;
|
|
42007
|
+
};
|
|
42008
|
+
}
|
|
42009
|
+
}
|
|
42010
|
+
get index() {
|
|
42011
|
+
let t = this.T;
|
|
42012
|
+
const e = this.C.o;
|
|
42013
|
+
if (t === this.C) {
|
|
42014
|
+
if (e) {
|
|
42015
|
+
return e.M - 1;
|
|
42016
|
+
}
|
|
42017
|
+
return 0;
|
|
42018
|
+
}
|
|
42019
|
+
let s = 0;
|
|
42020
|
+
if (t.i) {
|
|
42021
|
+
s += t.i.M;
|
|
42022
|
+
}
|
|
42023
|
+
while (t !== e) {
|
|
42024
|
+
const e2 = t.o;
|
|
42025
|
+
if (t === e2.h) {
|
|
42026
|
+
s += 1;
|
|
42027
|
+
if (e2.i) {
|
|
42028
|
+
s += e2.i.M;
|
|
42029
|
+
}
|
|
42030
|
+
}
|
|
42031
|
+
t = e2;
|
|
42032
|
+
}
|
|
42033
|
+
return s;
|
|
42034
|
+
}
|
|
42035
|
+
isAccessible() {
|
|
42036
|
+
return this.T !== this.C;
|
|
42037
|
+
}
|
|
42038
|
+
};
|
|
42039
|
+
var OrderedMapIterator = class _OrderedMapIterator extends TreeIterator {
|
|
42040
|
+
constructor(t, e, s, i) {
|
|
42041
|
+
super(t, e, i);
|
|
42042
|
+
this.container = s;
|
|
42043
|
+
}
|
|
42044
|
+
get pointer() {
|
|
42045
|
+
if (this.T === this.C) {
|
|
42046
|
+
throwIteratorAccessError();
|
|
42047
|
+
}
|
|
42048
|
+
const t = this;
|
|
42049
|
+
return new Proxy([], {
|
|
42050
|
+
get(e, s) {
|
|
42051
|
+
if (s === "0") return t.T.u;
|
|
42052
|
+
else if (s === "1") return t.T.l;
|
|
42053
|
+
e[0] = t.T.u;
|
|
42054
|
+
e[1] = t.T.l;
|
|
42055
|
+
return e[s];
|
|
42056
|
+
},
|
|
42057
|
+
set(e, s, i) {
|
|
42058
|
+
if (s !== "1") {
|
|
42059
|
+
throw new TypeError("prop must be 1");
|
|
42060
|
+
}
|
|
42061
|
+
t.T.l = i;
|
|
42062
|
+
return true;
|
|
42063
|
+
}
|
|
42064
|
+
});
|
|
42065
|
+
}
|
|
42066
|
+
copy() {
|
|
42067
|
+
return new _OrderedMapIterator(this.T, this.C, this.container, this.iteratorType);
|
|
42068
|
+
}
|
|
42069
|
+
};
|
|
42070
|
+
var OrderedMap = class extends TreeContainer {
|
|
42071
|
+
constructor(t = [], e, s) {
|
|
42072
|
+
super(e, s);
|
|
42073
|
+
const i = this;
|
|
42074
|
+
t.forEach(function(t2) {
|
|
42075
|
+
i.setElement(t2[0], t2[1]);
|
|
42076
|
+
});
|
|
42077
|
+
}
|
|
42078
|
+
begin() {
|
|
42079
|
+
return new OrderedMapIterator(this.C.i || this.C, this.C, this);
|
|
42080
|
+
}
|
|
42081
|
+
end() {
|
|
42082
|
+
return new OrderedMapIterator(this.C, this.C, this);
|
|
42083
|
+
}
|
|
42084
|
+
rBegin() {
|
|
42085
|
+
return new OrderedMapIterator(this.C.h || this.C, this.C, this, 1);
|
|
42086
|
+
}
|
|
42087
|
+
rEnd() {
|
|
42088
|
+
return new OrderedMapIterator(this.C, this.C, this, 1);
|
|
42089
|
+
}
|
|
42090
|
+
front() {
|
|
42091
|
+
if (this.m === 0) return;
|
|
42092
|
+
const t = this.C.i;
|
|
42093
|
+
return [t.u, t.l];
|
|
42094
|
+
}
|
|
42095
|
+
back() {
|
|
42096
|
+
if (this.m === 0) return;
|
|
42097
|
+
const t = this.C.h;
|
|
42098
|
+
return [t.u, t.l];
|
|
42099
|
+
}
|
|
42100
|
+
lowerBound(t) {
|
|
42101
|
+
const e = this.R(this.v, t);
|
|
42102
|
+
return new OrderedMapIterator(e, this.C, this);
|
|
42103
|
+
}
|
|
42104
|
+
upperBound(t) {
|
|
42105
|
+
const e = this.K(this.v, t);
|
|
42106
|
+
return new OrderedMapIterator(e, this.C, this);
|
|
42107
|
+
}
|
|
42108
|
+
reverseLowerBound(t) {
|
|
42109
|
+
const e = this.L(this.v, t);
|
|
42110
|
+
return new OrderedMapIterator(e, this.C, this);
|
|
42111
|
+
}
|
|
42112
|
+
reverseUpperBound(t) {
|
|
42113
|
+
const e = this.k(this.v, t);
|
|
42114
|
+
return new OrderedMapIterator(e, this.C, this);
|
|
42115
|
+
}
|
|
42116
|
+
forEach(t) {
|
|
42117
|
+
this.U(function(e, s, i) {
|
|
42118
|
+
t([e.u, e.l], s, i);
|
|
42119
|
+
});
|
|
42120
|
+
}
|
|
42121
|
+
setElement(t, e, s) {
|
|
42122
|
+
return this.q(t, e, s);
|
|
42123
|
+
}
|
|
42124
|
+
getElementByPos(t) {
|
|
42125
|
+
if (t < 0 || t > this.m - 1) {
|
|
42126
|
+
throw new RangeError();
|
|
42127
|
+
}
|
|
42128
|
+
const e = this.U(t);
|
|
42129
|
+
return [e.u, e.l];
|
|
42130
|
+
}
|
|
42131
|
+
find(t) {
|
|
42132
|
+
const e = this.H(this.v, t);
|
|
42133
|
+
return new OrderedMapIterator(e, this.C, this);
|
|
42134
|
+
}
|
|
42135
|
+
getElementByKey(t) {
|
|
42136
|
+
const e = this.H(this.v, t);
|
|
42137
|
+
return e.l;
|
|
42138
|
+
}
|
|
42139
|
+
union(t) {
|
|
42140
|
+
const e = this;
|
|
42141
|
+
t.forEach(function(t2) {
|
|
42142
|
+
e.setElement(t2[0], t2[1]);
|
|
42143
|
+
});
|
|
42144
|
+
return this.m;
|
|
42145
|
+
}
|
|
42146
|
+
*[Symbol.iterator]() {
|
|
42147
|
+
const t = this.m;
|
|
42148
|
+
const e = this.U();
|
|
42149
|
+
for (let s = 0; s < t; ++s) {
|
|
42150
|
+
const t2 = e[s];
|
|
42151
|
+
yield [t2.u, t2.l];
|
|
42152
|
+
}
|
|
42153
|
+
}
|
|
42154
|
+
};
|
|
42155
|
+
exports2.OrderedMap = OrderedMap;
|
|
42156
|
+
}
|
|
42157
|
+
});
|
|
42158
|
+
|
|
41358
42159
|
// node_modules/@grpc/grpc-js/build/src/admin.js
|
|
41359
42160
|
var require_admin = __commonJS({
|
|
41360
42161
|
"node_modules/@grpc/grpc-js/build/src/admin.js"(exports2) {
|
|
@@ -41931,7 +42732,8 @@ var require_client = __commonJS({
|
|
|
41931
42732
|
return typeof arg === "function";
|
|
41932
42733
|
}
|
|
41933
42734
|
function getErrorStackString(error) {
|
|
41934
|
-
|
|
42735
|
+
var _a;
|
|
42736
|
+
return ((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split("\n").slice(1).join("\n")) || "no stack trace available";
|
|
41935
42737
|
}
|
|
41936
42738
|
var Client = class {
|
|
41937
42739
|
constructor(address, credentials, options = {}) {
|
|
@@ -42044,7 +42846,7 @@ var require_client = __commonJS({
|
|
|
42044
42846
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42045
42847
|
onReceiveMessage(message) {
|
|
42046
42848
|
if (responseMessage !== null) {
|
|
42047
|
-
call.cancelWithStatus(constants_1.Status.
|
|
42849
|
+
call.cancelWithStatus(constants_1.Status.UNIMPLEMENTED, "Too many responses received");
|
|
42048
42850
|
}
|
|
42049
42851
|
responseMessage = message;
|
|
42050
42852
|
},
|
|
@@ -42057,7 +42859,7 @@ var require_client = __commonJS({
|
|
|
42057
42859
|
if (responseMessage === null) {
|
|
42058
42860
|
const callerStack = getErrorStackString(callerStackError);
|
|
42059
42861
|
callProperties.callback((0, call_1.callErrorFromStatus)({
|
|
42060
|
-
code: constants_1.Status.
|
|
42862
|
+
code: constants_1.Status.UNIMPLEMENTED,
|
|
42061
42863
|
details: "No message received",
|
|
42062
42864
|
metadata: status.metadata
|
|
42063
42865
|
}, callerStack));
|
|
@@ -42116,9 +42918,10 @@ var require_client = __commonJS({
|
|
|
42116
42918
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42117
42919
|
onReceiveMessage(message) {
|
|
42118
42920
|
if (responseMessage !== null) {
|
|
42119
|
-
call.cancelWithStatus(constants_1.Status.
|
|
42921
|
+
call.cancelWithStatus(constants_1.Status.UNIMPLEMENTED, "Too many responses received");
|
|
42120
42922
|
}
|
|
42121
42923
|
responseMessage = message;
|
|
42924
|
+
call.startRead();
|
|
42122
42925
|
},
|
|
42123
42926
|
onReceiveStatus(status) {
|
|
42124
42927
|
if (receivedStatus) {
|
|
@@ -42129,7 +42932,7 @@ var require_client = __commonJS({
|
|
|
42129
42932
|
if (responseMessage === null) {
|
|
42130
42933
|
const callerStack = getErrorStackString(callerStackError);
|
|
42131
42934
|
callProperties.callback((0, call_1.callErrorFromStatus)({
|
|
42132
|
-
code: constants_1.Status.
|
|
42935
|
+
code: constants_1.Status.UNIMPLEMENTED,
|
|
42133
42936
|
details: "No message received",
|
|
42134
42937
|
metadata: status.metadata
|
|
42135
42938
|
}, callerStack));
|
|
@@ -48664,7 +49467,7 @@ var require_src30 = __commonJS({
|
|
|
48664
49467
|
"node_modules/@grpc/proto-loader/build/src/index.js"(exports2) {
|
|
48665
49468
|
"use strict";
|
|
48666
49469
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
48667
|
-
exports2.loadFileDescriptorSetFromObject = exports2.loadFileDescriptorSetFromBuffer = exports2.fromJSON = exports2.loadSync = exports2.load = exports2.isAnyExtension = exports2.Long = void 0;
|
|
49470
|
+
exports2.loadFileDescriptorSetFromObject = exports2.loadFileDescriptorSetFromBuffer = exports2.fromJSON = exports2.loadSync = exports2.load = exports2.IdempotencyLevel = exports2.isAnyExtension = exports2.Long = void 0;
|
|
48668
49471
|
var camelCase = require_lodash();
|
|
48669
49472
|
var Protobuf = require_protobufjs();
|
|
48670
49473
|
var descriptor = require_descriptor2();
|
|
@@ -48675,6 +49478,12 @@ var require_src30 = __commonJS({
|
|
|
48675
49478
|
return "@type" in obj && typeof obj["@type"] === "string";
|
|
48676
49479
|
}
|
|
48677
49480
|
exports2.isAnyExtension = isAnyExtension;
|
|
49481
|
+
var IdempotencyLevel;
|
|
49482
|
+
(function(IdempotencyLevel2) {
|
|
49483
|
+
IdempotencyLevel2["IDEMPOTENCY_UNKNOWN"] = "IDEMPOTENCY_UNKNOWN";
|
|
49484
|
+
IdempotencyLevel2["NO_SIDE_EFFECTS"] = "NO_SIDE_EFFECTS";
|
|
49485
|
+
IdempotencyLevel2["IDEMPOTENT"] = "IDEMPOTENT";
|
|
49486
|
+
})(IdempotencyLevel = exports2.IdempotencyLevel || (exports2.IdempotencyLevel = {}));
|
|
48678
49487
|
var descriptorOptions = {
|
|
48679
49488
|
longs: String,
|
|
48680
49489
|
enums: String,
|
|
@@ -48723,6 +49532,24 @@ var require_src30 = __commonJS({
|
|
|
48723
49532
|
return cls.encode(message).finish();
|
|
48724
49533
|
};
|
|
48725
49534
|
}
|
|
49535
|
+
function mapMethodOptions(options) {
|
|
49536
|
+
return (options || []).reduce((obj, item) => {
|
|
49537
|
+
for (const [key, value] of Object.entries(item)) {
|
|
49538
|
+
switch (key) {
|
|
49539
|
+
case "uninterpreted_option":
|
|
49540
|
+
obj.uninterpreted_option.push(item.uninterpreted_option);
|
|
49541
|
+
break;
|
|
49542
|
+
default:
|
|
49543
|
+
obj[key] = value;
|
|
49544
|
+
}
|
|
49545
|
+
}
|
|
49546
|
+
return obj;
|
|
49547
|
+
}, {
|
|
49548
|
+
deprecated: false,
|
|
49549
|
+
idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
|
|
49550
|
+
uninterpreted_option: []
|
|
49551
|
+
});
|
|
49552
|
+
}
|
|
48726
49553
|
function createMethodDefinition(method, serviceName, options, fileDescriptors) {
|
|
48727
49554
|
const requestType = method.resolvedRequestType;
|
|
48728
49555
|
const responseType = method.resolvedResponseType;
|
|
@@ -48737,7 +49564,8 @@ var require_src30 = __commonJS({
|
|
|
48737
49564
|
// TODO(murgatroid99): Find a better way to handle this
|
|
48738
49565
|
originalName: camelCase(method.name),
|
|
48739
49566
|
requestType: createMessageDefinition(requestType, fileDescriptors),
|
|
48740
|
-
responseType: createMessageDefinition(responseType, fileDescriptors)
|
|
49567
|
+
responseType: createMessageDefinition(responseType, fileDescriptors),
|
|
49568
|
+
options: mapMethodOptions(method.parsedOptions)
|
|
48741
49569
|
};
|
|
48742
49570
|
}
|
|
48743
49571
|
function createServiceDefinition(service, name2, options, fileDescriptors) {
|
|
@@ -48827,8 +49655,9 @@ var require_channelz = __commonJS({
|
|
|
48827
49655
|
"node_modules/@grpc/grpc-js/build/src/channelz.js"(exports2) {
|
|
48828
49656
|
"use strict";
|
|
48829
49657
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
48830
|
-
exports2.setup = exports2.getChannelzServiceDefinition = exports2.getChannelzHandlers = exports2.unregisterChannelzRef = exports2.registerChannelzSocket = exports2.registerChannelzServer = exports2.registerChannelzSubchannel = exports2.registerChannelzChannel = exports2.ChannelzCallTracker = exports2.ChannelzChildrenTracker = exports2.ChannelzTrace = void 0;
|
|
49658
|
+
exports2.setup = exports2.getChannelzServiceDefinition = exports2.getChannelzHandlers = exports2.unregisterChannelzRef = exports2.registerChannelzSocket = exports2.registerChannelzServer = exports2.registerChannelzSubchannel = exports2.registerChannelzChannel = exports2.ChannelzCallTrackerStub = exports2.ChannelzCallTracker = exports2.ChannelzChildrenTrackerStub = exports2.ChannelzChildrenTracker = exports2.ChannelzTrace = exports2.ChannelzTraceStub = void 0;
|
|
48831
49659
|
var net_1 = __require("net");
|
|
49660
|
+
var ordered_map_1 = require_cjs();
|
|
48832
49661
|
var connectivity_state_1 = require_connectivity_state();
|
|
48833
49662
|
var constants_1 = require_constants8();
|
|
48834
49663
|
var subchannel_address_1 = require_subchannel_address();
|
|
@@ -48858,6 +49687,24 @@ var require_channelz = __commonJS({
|
|
|
48858
49687
|
};
|
|
48859
49688
|
}
|
|
48860
49689
|
var TARGET_RETAINED_TRACES = 32;
|
|
49690
|
+
var DEFAULT_MAX_RESULTS = 100;
|
|
49691
|
+
var ChannelzTraceStub = class {
|
|
49692
|
+
constructor() {
|
|
49693
|
+
this.events = [];
|
|
49694
|
+
this.creationTimestamp = /* @__PURE__ */ new Date();
|
|
49695
|
+
this.eventsLogged = 0;
|
|
49696
|
+
}
|
|
49697
|
+
addTrace() {
|
|
49698
|
+
}
|
|
49699
|
+
getTraceMessage() {
|
|
49700
|
+
return {
|
|
49701
|
+
creation_timestamp: dateToProtoTimestamp(this.creationTimestamp),
|
|
49702
|
+
num_events_logged: this.eventsLogged,
|
|
49703
|
+
events: []
|
|
49704
|
+
};
|
|
49705
|
+
}
|
|
49706
|
+
};
|
|
49707
|
+
exports2.ChannelzTraceStub = ChannelzTraceStub;
|
|
48861
49708
|
var ChannelzTrace = class {
|
|
48862
49709
|
constructor() {
|
|
48863
49710
|
this.events = [];
|
|
@@ -48897,99 +49744,62 @@ var require_channelz = __commonJS({
|
|
|
48897
49744
|
exports2.ChannelzTrace = ChannelzTrace;
|
|
48898
49745
|
var ChannelzChildrenTracker = class {
|
|
48899
49746
|
constructor() {
|
|
48900
|
-
this.channelChildren =
|
|
48901
|
-
this.subchannelChildren =
|
|
48902
|
-
this.socketChildren =
|
|
49747
|
+
this.channelChildren = new ordered_map_1.OrderedMap();
|
|
49748
|
+
this.subchannelChildren = new ordered_map_1.OrderedMap();
|
|
49749
|
+
this.socketChildren = new ordered_map_1.OrderedMap();
|
|
49750
|
+
this.trackerMap = {
|
|
49751
|
+
[
|
|
49752
|
+
"channel"
|
|
49753
|
+
/* EntityTypes.channel */
|
|
49754
|
+
]: this.channelChildren,
|
|
49755
|
+
[
|
|
49756
|
+
"subchannel"
|
|
49757
|
+
/* EntityTypes.subchannel */
|
|
49758
|
+
]: this.subchannelChildren,
|
|
49759
|
+
[
|
|
49760
|
+
"socket"
|
|
49761
|
+
/* EntityTypes.socket */
|
|
49762
|
+
]: this.socketChildren
|
|
49763
|
+
};
|
|
48903
49764
|
}
|
|
48904
49765
|
refChild(child) {
|
|
48905
|
-
|
|
48906
|
-
|
|
48907
|
-
|
|
48908
|
-
|
|
48909
|
-
|
|
48910
|
-
|
|
48911
|
-
|
|
48912
|
-
|
|
48913
|
-
|
|
48914
|
-
break;
|
|
48915
|
-
}
|
|
48916
|
-
case "subchannel": {
|
|
48917
|
-
const trackedChild = (_b = this.subchannelChildren.get(child.id)) !== null && _b !== void 0 ? _b : {
|
|
48918
|
-
ref: child,
|
|
48919
|
-
count: 0
|
|
48920
|
-
};
|
|
48921
|
-
trackedChild.count += 1;
|
|
48922
|
-
this.subchannelChildren.set(child.id, trackedChild);
|
|
48923
|
-
break;
|
|
48924
|
-
}
|
|
48925
|
-
case "socket": {
|
|
48926
|
-
const trackedChild = (_c = this.socketChildren.get(child.id)) !== null && _c !== void 0 ? _c : {
|
|
48927
|
-
ref: child,
|
|
48928
|
-
count: 0
|
|
48929
|
-
};
|
|
48930
|
-
trackedChild.count += 1;
|
|
48931
|
-
this.socketChildren.set(child.id, trackedChild);
|
|
48932
|
-
break;
|
|
48933
|
-
}
|
|
49766
|
+
const tracker = this.trackerMap[child.kind];
|
|
49767
|
+
const trackedChild = tracker.find(child.id);
|
|
49768
|
+
if (trackedChild.equals(tracker.end())) {
|
|
49769
|
+
tracker.setElement(child.id, {
|
|
49770
|
+
ref: child,
|
|
49771
|
+
count: 1
|
|
49772
|
+
}, trackedChild);
|
|
49773
|
+
} else {
|
|
49774
|
+
trackedChild.pointer[1].count += 1;
|
|
48934
49775
|
}
|
|
48935
49776
|
}
|
|
48936
49777
|
unrefChild(child) {
|
|
48937
|
-
|
|
48938
|
-
|
|
48939
|
-
|
|
48940
|
-
|
|
48941
|
-
|
|
48942
|
-
|
|
48943
|
-
this.channelChildren.delete(child.id);
|
|
48944
|
-
} else {
|
|
48945
|
-
this.channelChildren.set(child.id, trackedChild);
|
|
48946
|
-
}
|
|
48947
|
-
}
|
|
48948
|
-
break;
|
|
48949
|
-
}
|
|
48950
|
-
case "subchannel": {
|
|
48951
|
-
const trackedChild = this.subchannelChildren.get(child.id);
|
|
48952
|
-
if (trackedChild !== void 0) {
|
|
48953
|
-
trackedChild.count -= 1;
|
|
48954
|
-
if (trackedChild.count === 0) {
|
|
48955
|
-
this.subchannelChildren.delete(child.id);
|
|
48956
|
-
} else {
|
|
48957
|
-
this.subchannelChildren.set(child.id, trackedChild);
|
|
48958
|
-
}
|
|
48959
|
-
}
|
|
48960
|
-
break;
|
|
48961
|
-
}
|
|
48962
|
-
case "socket": {
|
|
48963
|
-
const trackedChild = this.socketChildren.get(child.id);
|
|
48964
|
-
if (trackedChild !== void 0) {
|
|
48965
|
-
trackedChild.count -= 1;
|
|
48966
|
-
if (trackedChild.count === 0) {
|
|
48967
|
-
this.socketChildren.delete(child.id);
|
|
48968
|
-
} else {
|
|
48969
|
-
this.socketChildren.set(child.id, trackedChild);
|
|
48970
|
-
}
|
|
48971
|
-
}
|
|
48972
|
-
break;
|
|
49778
|
+
const tracker = this.trackerMap[child.kind];
|
|
49779
|
+
const trackedChild = tracker.getElementByKey(child.id);
|
|
49780
|
+
if (trackedChild !== void 0) {
|
|
49781
|
+
trackedChild.count -= 1;
|
|
49782
|
+
if (trackedChild.count === 0) {
|
|
49783
|
+
tracker.eraseElementByKey(child.id);
|
|
48973
49784
|
}
|
|
48974
49785
|
}
|
|
48975
49786
|
}
|
|
48976
49787
|
getChildLists() {
|
|
48977
|
-
|
|
48978
|
-
|
|
48979
|
-
|
|
48980
|
-
|
|
48981
|
-
|
|
48982
|
-
for (const { ref } of this.subchannelChildren.values()) {
|
|
48983
|
-
subchannels2.push(ref);
|
|
48984
|
-
}
|
|
48985
|
-
const sockets2 = [];
|
|
48986
|
-
for (const { ref } of this.socketChildren.values()) {
|
|
48987
|
-
sockets2.push(ref);
|
|
48988
|
-
}
|
|
48989
|
-
return { channels: channels2, subchannels: subchannels2, sockets: sockets2 };
|
|
49788
|
+
return {
|
|
49789
|
+
channels: this.channelChildren,
|
|
49790
|
+
subchannels: this.subchannelChildren,
|
|
49791
|
+
sockets: this.socketChildren
|
|
49792
|
+
};
|
|
48990
49793
|
}
|
|
48991
49794
|
};
|
|
48992
49795
|
exports2.ChannelzChildrenTracker = ChannelzChildrenTracker;
|
|
49796
|
+
var ChannelzChildrenTrackerStub = class extends ChannelzChildrenTracker {
|
|
49797
|
+
refChild() {
|
|
49798
|
+
}
|
|
49799
|
+
unrefChild() {
|
|
49800
|
+
}
|
|
49801
|
+
};
|
|
49802
|
+
exports2.ChannelzChildrenTrackerStub = ChannelzChildrenTrackerStub;
|
|
48993
49803
|
var ChannelzCallTracker = class {
|
|
48994
49804
|
constructor() {
|
|
48995
49805
|
this.callsStarted = 0;
|
|
@@ -49009,65 +49819,66 @@ var require_channelz = __commonJS({
|
|
|
49009
49819
|
}
|
|
49010
49820
|
};
|
|
49011
49821
|
exports2.ChannelzCallTracker = ChannelzCallTracker;
|
|
49012
|
-
var
|
|
49013
|
-
|
|
49014
|
-
return nextId++;
|
|
49015
|
-
}
|
|
49016
|
-
var channels = [];
|
|
49017
|
-
var subchannels = [];
|
|
49018
|
-
var servers = [];
|
|
49019
|
-
var sockets = [];
|
|
49020
|
-
function registerChannelzChannel(name2, getInfo, channelzEnabled) {
|
|
49021
|
-
const id = getNextId();
|
|
49022
|
-
const ref = { id, name: name2, kind: "channel" };
|
|
49023
|
-
if (channelzEnabled) {
|
|
49024
|
-
channels[id] = { ref, getInfo };
|
|
49025
|
-
}
|
|
49026
|
-
return ref;
|
|
49027
|
-
}
|
|
49028
|
-
exports2.registerChannelzChannel = registerChannelzChannel;
|
|
49029
|
-
function registerChannelzSubchannel(name2, getInfo, channelzEnabled) {
|
|
49030
|
-
const id = getNextId();
|
|
49031
|
-
const ref = { id, name: name2, kind: "subchannel" };
|
|
49032
|
-
if (channelzEnabled) {
|
|
49033
|
-
subchannels[id] = { ref, getInfo };
|
|
49034
|
-
}
|
|
49035
|
-
return ref;
|
|
49036
|
-
}
|
|
49037
|
-
exports2.registerChannelzSubchannel = registerChannelzSubchannel;
|
|
49038
|
-
function registerChannelzServer(getInfo, channelzEnabled) {
|
|
49039
|
-
const id = getNextId();
|
|
49040
|
-
const ref = { id, kind: "server" };
|
|
49041
|
-
if (channelzEnabled) {
|
|
49042
|
-
servers[id] = { ref, getInfo };
|
|
49043
|
-
}
|
|
49044
|
-
return ref;
|
|
49045
|
-
}
|
|
49046
|
-
exports2.registerChannelzServer = registerChannelzServer;
|
|
49047
|
-
function registerChannelzSocket(name2, getInfo, channelzEnabled) {
|
|
49048
|
-
const id = getNextId();
|
|
49049
|
-
const ref = { id, name: name2, kind: "socket" };
|
|
49050
|
-
if (channelzEnabled) {
|
|
49051
|
-
sockets[id] = { ref, getInfo };
|
|
49052
|
-
}
|
|
49053
|
-
return ref;
|
|
49054
|
-
}
|
|
49055
|
-
exports2.registerChannelzSocket = registerChannelzSocket;
|
|
49056
|
-
function unregisterChannelzRef(ref) {
|
|
49057
|
-
switch (ref.kind) {
|
|
49058
|
-
case "channel":
|
|
49059
|
-
delete channels[ref.id];
|
|
49060
|
-
return;
|
|
49061
|
-
case "subchannel":
|
|
49062
|
-
delete subchannels[ref.id];
|
|
49063
|
-
return;
|
|
49064
|
-
case "server":
|
|
49065
|
-
delete servers[ref.id];
|
|
49066
|
-
return;
|
|
49067
|
-
case "socket":
|
|
49068
|
-
delete sockets[ref.id];
|
|
49069
|
-
return;
|
|
49822
|
+
var ChannelzCallTrackerStub = class extends ChannelzCallTracker {
|
|
49823
|
+
addCallStarted() {
|
|
49070
49824
|
}
|
|
49825
|
+
addCallSucceeded() {
|
|
49826
|
+
}
|
|
49827
|
+
addCallFailed() {
|
|
49828
|
+
}
|
|
49829
|
+
};
|
|
49830
|
+
exports2.ChannelzCallTrackerStub = ChannelzCallTrackerStub;
|
|
49831
|
+
var entityMaps = {
|
|
49832
|
+
[
|
|
49833
|
+
"channel"
|
|
49834
|
+
/* EntityTypes.channel */
|
|
49835
|
+
]: new ordered_map_1.OrderedMap(),
|
|
49836
|
+
[
|
|
49837
|
+
"subchannel"
|
|
49838
|
+
/* EntityTypes.subchannel */
|
|
49839
|
+
]: new ordered_map_1.OrderedMap(),
|
|
49840
|
+
[
|
|
49841
|
+
"server"
|
|
49842
|
+
/* EntityTypes.server */
|
|
49843
|
+
]: new ordered_map_1.OrderedMap(),
|
|
49844
|
+
[
|
|
49845
|
+
"socket"
|
|
49846
|
+
/* EntityTypes.socket */
|
|
49847
|
+
]: new ordered_map_1.OrderedMap()
|
|
49848
|
+
};
|
|
49849
|
+
var generateRegisterFn = (kind) => {
|
|
49850
|
+
let nextId = 1;
|
|
49851
|
+
function getNextId() {
|
|
49852
|
+
return nextId++;
|
|
49853
|
+
}
|
|
49854
|
+
const entityMap = entityMaps[kind];
|
|
49855
|
+
return (name2, getInfo, channelzEnabled) => {
|
|
49856
|
+
const id = getNextId();
|
|
49857
|
+
const ref = { id, name: name2, kind };
|
|
49858
|
+
if (channelzEnabled) {
|
|
49859
|
+
entityMap.setElement(id, { ref, getInfo });
|
|
49860
|
+
}
|
|
49861
|
+
return ref;
|
|
49862
|
+
};
|
|
49863
|
+
};
|
|
49864
|
+
exports2.registerChannelzChannel = generateRegisterFn(
|
|
49865
|
+
"channel"
|
|
49866
|
+
/* EntityTypes.channel */
|
|
49867
|
+
);
|
|
49868
|
+
exports2.registerChannelzSubchannel = generateRegisterFn(
|
|
49869
|
+
"subchannel"
|
|
49870
|
+
/* EntityTypes.subchannel */
|
|
49871
|
+
);
|
|
49872
|
+
exports2.registerChannelzServer = generateRegisterFn(
|
|
49873
|
+
"server"
|
|
49874
|
+
/* EntityTypes.server */
|
|
49875
|
+
);
|
|
49876
|
+
exports2.registerChannelzSocket = generateRegisterFn(
|
|
49877
|
+
"socket"
|
|
49878
|
+
/* EntityTypes.socket */
|
|
49879
|
+
);
|
|
49880
|
+
function unregisterChannelzRef(ref) {
|
|
49881
|
+
entityMaps[ref.kind].eraseElementByKey(ref.id);
|
|
49071
49882
|
}
|
|
49072
49883
|
exports2.unregisterChannelzRef = unregisterChannelzRef;
|
|
49073
49884
|
function parseIPv6Section(addressSection) {
|
|
@@ -49144,6 +49955,14 @@ var require_channelz = __commonJS({
|
|
|
49144
49955
|
}
|
|
49145
49956
|
function getChannelMessage(channelEntry) {
|
|
49146
49957
|
const resolvedInfo = channelEntry.getInfo();
|
|
49958
|
+
const channelRef = [];
|
|
49959
|
+
const subchannelRef = [];
|
|
49960
|
+
resolvedInfo.children.channels.forEach((el) => {
|
|
49961
|
+
channelRef.push(channelRefToMessage(el[1].ref));
|
|
49962
|
+
});
|
|
49963
|
+
resolvedInfo.children.subchannels.forEach((el) => {
|
|
49964
|
+
subchannelRef.push(subchannelRefToMessage(el[1].ref));
|
|
49965
|
+
});
|
|
49147
49966
|
return {
|
|
49148
49967
|
ref: channelRefToMessage(channelEntry.ref),
|
|
49149
49968
|
data: {
|
|
@@ -49155,13 +49974,16 @@ var require_channelz = __commonJS({
|
|
|
49155
49974
|
last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),
|
|
49156
49975
|
trace: resolvedInfo.trace.getTraceMessage()
|
|
49157
49976
|
},
|
|
49158
|
-
channel_ref:
|
|
49159
|
-
subchannel_ref:
|
|
49977
|
+
channel_ref: channelRef,
|
|
49978
|
+
subchannel_ref: subchannelRef
|
|
49160
49979
|
};
|
|
49161
49980
|
}
|
|
49162
49981
|
function GetChannel(call, callback) {
|
|
49163
|
-
const channelId =
|
|
49164
|
-
const channelEntry =
|
|
49982
|
+
const channelId = parseInt(call.request.channel_id, 10);
|
|
49983
|
+
const channelEntry = entityMaps[
|
|
49984
|
+
"channel"
|
|
49985
|
+
/* EntityTypes.channel */
|
|
49986
|
+
].getElementByKey(channelId);
|
|
49165
49987
|
if (channelEntry === void 0) {
|
|
49166
49988
|
callback({
|
|
49167
49989
|
code: constants_1.Status.NOT_FOUND,
|
|
@@ -49172,26 +49994,28 @@ var require_channelz = __commonJS({
|
|
|
49172
49994
|
callback(null, { channel: getChannelMessage(channelEntry) });
|
|
49173
49995
|
}
|
|
49174
49996
|
function GetTopChannels(call, callback) {
|
|
49175
|
-
const maxResults =
|
|
49997
|
+
const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS;
|
|
49176
49998
|
const resultList = [];
|
|
49177
|
-
|
|
49178
|
-
|
|
49179
|
-
|
|
49180
|
-
|
|
49181
|
-
|
|
49182
|
-
|
|
49183
|
-
|
|
49184
|
-
|
|
49185
|
-
break;
|
|
49186
|
-
}
|
|
49999
|
+
const startId = parseInt(call.request.start_channel_id, 10);
|
|
50000
|
+
const channelEntries = entityMaps[
|
|
50001
|
+
"channel"
|
|
50002
|
+
/* EntityTypes.channel */
|
|
50003
|
+
];
|
|
50004
|
+
let i;
|
|
50005
|
+
for (i = channelEntries.lowerBound(startId); !i.equals(channelEntries.end()) && resultList.length < maxResults; i = i.next()) {
|
|
50006
|
+
resultList.push(getChannelMessage(i.pointer[1]));
|
|
49187
50007
|
}
|
|
49188
50008
|
callback(null, {
|
|
49189
50009
|
channel: resultList,
|
|
49190
|
-
end: i
|
|
50010
|
+
end: i.equals(channelEntries.end())
|
|
49191
50011
|
});
|
|
49192
50012
|
}
|
|
49193
50013
|
function getServerMessage(serverEntry) {
|
|
49194
50014
|
const resolvedInfo = serverEntry.getInfo();
|
|
50015
|
+
const listenSocket = [];
|
|
50016
|
+
resolvedInfo.listenerChildren.sockets.forEach((el) => {
|
|
50017
|
+
listenSocket.push(socketRefToMessage(el[1].ref));
|
|
50018
|
+
});
|
|
49195
50019
|
return {
|
|
49196
50020
|
ref: serverRefToMessage(serverEntry.ref),
|
|
49197
50021
|
data: {
|
|
@@ -49201,12 +50025,16 @@ var require_channelz = __commonJS({
|
|
|
49201
50025
|
last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),
|
|
49202
50026
|
trace: resolvedInfo.trace.getTraceMessage()
|
|
49203
50027
|
},
|
|
49204
|
-
listen_socket:
|
|
50028
|
+
listen_socket: listenSocket
|
|
49205
50029
|
};
|
|
49206
50030
|
}
|
|
49207
50031
|
function GetServer(call, callback) {
|
|
49208
|
-
const serverId =
|
|
49209
|
-
const
|
|
50032
|
+
const serverId = parseInt(call.request.server_id, 10);
|
|
50033
|
+
const serverEntries = entityMaps[
|
|
50034
|
+
"server"
|
|
50035
|
+
/* EntityTypes.server */
|
|
50036
|
+
];
|
|
50037
|
+
const serverEntry = serverEntries.getElementByKey(serverId);
|
|
49210
50038
|
if (serverEntry === void 0) {
|
|
49211
50039
|
callback({
|
|
49212
50040
|
code: constants_1.Status.NOT_FOUND,
|
|
@@ -49217,27 +50045,28 @@ var require_channelz = __commonJS({
|
|
|
49217
50045
|
callback(null, { server: getServerMessage(serverEntry) });
|
|
49218
50046
|
}
|
|
49219
50047
|
function GetServers(call, callback) {
|
|
49220
|
-
const maxResults =
|
|
50048
|
+
const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS;
|
|
50049
|
+
const startId = parseInt(call.request.start_server_id, 10);
|
|
50050
|
+
const serverEntries = entityMaps[
|
|
50051
|
+
"server"
|
|
50052
|
+
/* EntityTypes.server */
|
|
50053
|
+
];
|
|
49221
50054
|
const resultList = [];
|
|
49222
|
-
let i
|
|
49223
|
-
for (; i
|
|
49224
|
-
|
|
49225
|
-
if (serverEntry === void 0) {
|
|
49226
|
-
continue;
|
|
49227
|
-
}
|
|
49228
|
-
resultList.push(getServerMessage(serverEntry));
|
|
49229
|
-
if (resultList.length >= maxResults) {
|
|
49230
|
-
break;
|
|
49231
|
-
}
|
|
50055
|
+
let i;
|
|
50056
|
+
for (i = serverEntries.lowerBound(startId); !i.equals(serverEntries.end()) && resultList.length < maxResults; i = i.next()) {
|
|
50057
|
+
resultList.push(getServerMessage(i.pointer[1]));
|
|
49232
50058
|
}
|
|
49233
50059
|
callback(null, {
|
|
49234
50060
|
server: resultList,
|
|
49235
|
-
end: i
|
|
50061
|
+
end: i.equals(serverEntries.end())
|
|
49236
50062
|
});
|
|
49237
50063
|
}
|
|
49238
50064
|
function GetSubchannel(call, callback) {
|
|
49239
|
-
const subchannelId =
|
|
49240
|
-
const subchannelEntry =
|
|
50065
|
+
const subchannelId = parseInt(call.request.subchannel_id, 10);
|
|
50066
|
+
const subchannelEntry = entityMaps[
|
|
50067
|
+
"subchannel"
|
|
50068
|
+
/* EntityTypes.subchannel */
|
|
50069
|
+
].getElementByKey(subchannelId);
|
|
49241
50070
|
if (subchannelEntry === void 0) {
|
|
49242
50071
|
callback({
|
|
49243
50072
|
code: constants_1.Status.NOT_FOUND,
|
|
@@ -49246,6 +50075,10 @@ var require_channelz = __commonJS({
|
|
|
49246
50075
|
return;
|
|
49247
50076
|
}
|
|
49248
50077
|
const resolvedInfo = subchannelEntry.getInfo();
|
|
50078
|
+
const listenSocket = [];
|
|
50079
|
+
resolvedInfo.children.sockets.forEach((el) => {
|
|
50080
|
+
listenSocket.push(socketRefToMessage(el[1].ref));
|
|
50081
|
+
});
|
|
49249
50082
|
const subchannelMessage = {
|
|
49250
50083
|
ref: subchannelRefToMessage(subchannelEntry.ref),
|
|
49251
50084
|
data: {
|
|
@@ -49257,7 +50090,7 @@ var require_channelz = __commonJS({
|
|
|
49257
50090
|
last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp),
|
|
49258
50091
|
trace: resolvedInfo.trace.getTraceMessage()
|
|
49259
50092
|
},
|
|
49260
|
-
socket_ref:
|
|
50093
|
+
socket_ref: listenSocket
|
|
49261
50094
|
};
|
|
49262
50095
|
callback(null, { subchannel: subchannelMessage });
|
|
49263
50096
|
}
|
|
@@ -49282,8 +50115,11 @@ var require_channelz = __commonJS({
|
|
|
49282
50115
|
}
|
|
49283
50116
|
function GetSocket(call, callback) {
|
|
49284
50117
|
var _a, _b, _c, _d, _e;
|
|
49285
|
-
const socketId =
|
|
49286
|
-
const socketEntry =
|
|
50118
|
+
const socketId = parseInt(call.request.socket_id, 10);
|
|
50119
|
+
const socketEntry = entityMaps[
|
|
50120
|
+
"socket"
|
|
50121
|
+
/* EntityTypes.socket */
|
|
50122
|
+
].getElementByKey(socketId);
|
|
49287
50123
|
if (socketEntry === void 0) {
|
|
49288
50124
|
callback({
|
|
49289
50125
|
code: constants_1.Status.NOT_FOUND,
|
|
@@ -49326,8 +50162,11 @@ var require_channelz = __commonJS({
|
|
|
49326
50162
|
callback(null, { socket: socketMessage });
|
|
49327
50163
|
}
|
|
49328
50164
|
function GetServerSockets(call, callback) {
|
|
49329
|
-
const serverId =
|
|
49330
|
-
const serverEntry =
|
|
50165
|
+
const serverId = parseInt(call.request.server_id, 10);
|
|
50166
|
+
const serverEntry = entityMaps[
|
|
50167
|
+
"server"
|
|
50168
|
+
/* EntityTypes.server */
|
|
50169
|
+
].getElementByKey(serverId);
|
|
49331
50170
|
if (serverEntry === void 0) {
|
|
49332
50171
|
callback({
|
|
49333
50172
|
code: constants_1.Status.NOT_FOUND,
|
|
@@ -49335,23 +50174,18 @@ var require_channelz = __commonJS({
|
|
|
49335
50174
|
});
|
|
49336
50175
|
return;
|
|
49337
50176
|
}
|
|
49338
|
-
const startId =
|
|
49339
|
-
const maxResults =
|
|
50177
|
+
const startId = parseInt(call.request.start_socket_id, 10);
|
|
50178
|
+
const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS;
|
|
49340
50179
|
const resolvedInfo = serverEntry.getInfo();
|
|
49341
|
-
const allSockets = resolvedInfo.sessionChildren.sockets
|
|
50180
|
+
const allSockets = resolvedInfo.sessionChildren.sockets;
|
|
49342
50181
|
const resultList = [];
|
|
49343
|
-
let i
|
|
49344
|
-
for (; i
|
|
49345
|
-
|
|
49346
|
-
resultList.push(socketRefToMessage(allSockets[i]));
|
|
49347
|
-
if (resultList.length >= maxResults) {
|
|
49348
|
-
break;
|
|
49349
|
-
}
|
|
49350
|
-
}
|
|
50182
|
+
let i;
|
|
50183
|
+
for (i = allSockets.lowerBound(startId); !i.equals(allSockets.end()) && resultList.length < maxResults; i = i.next()) {
|
|
50184
|
+
resultList.push(socketRefToMessage(i.pointer[1].ref));
|
|
49351
50185
|
}
|
|
49352
50186
|
callback(null, {
|
|
49353
50187
|
socket_ref: resultList,
|
|
49354
|
-
end: i
|
|
50188
|
+
end: i.equals(allSockets.end())
|
|
49355
50189
|
});
|
|
49356
50190
|
}
|
|
49357
50191
|
function getChannelzHandlers() {
|
|
@@ -49431,9 +50265,6 @@ var require_subchannel = __commonJS({
|
|
|
49431
50265
|
this.stateListeners = /* @__PURE__ */ new Set();
|
|
49432
50266
|
this.refcount = 0;
|
|
49433
50267
|
this.channelzEnabled = true;
|
|
49434
|
-
this.callTracker = new channelz_1.ChannelzCallTracker();
|
|
49435
|
-
this.childrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
49436
|
-
this.streamTracker = new channelz_1.ChannelzCallTracker();
|
|
49437
50268
|
const backoffOptions = {
|
|
49438
50269
|
initialDelay: options["grpc.initial_reconnect_backoff_ms"],
|
|
49439
50270
|
maxDelay: options["grpc.max_reconnect_backoff_ms"]
|
|
@@ -49446,12 +50277,18 @@ var require_subchannel = __commonJS({
|
|
|
49446
50277
|
this.keepaliveTime = (_a = options["grpc.keepalive_time_ms"]) !== null && _a !== void 0 ? _a : -1;
|
|
49447
50278
|
if (options["grpc.enable_channelz"] === 0) {
|
|
49448
50279
|
this.channelzEnabled = false;
|
|
50280
|
+
this.channelzTrace = new channelz_1.ChannelzTraceStub();
|
|
50281
|
+
this.callTracker = new channelz_1.ChannelzCallTrackerStub();
|
|
50282
|
+
this.childrenTracker = new channelz_1.ChannelzChildrenTrackerStub();
|
|
50283
|
+
this.streamTracker = new channelz_1.ChannelzCallTrackerStub();
|
|
50284
|
+
} else {
|
|
50285
|
+
this.channelzTrace = new channelz_1.ChannelzTrace();
|
|
50286
|
+
this.callTracker = new channelz_1.ChannelzCallTracker();
|
|
50287
|
+
this.childrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
50288
|
+
this.streamTracker = new channelz_1.ChannelzCallTracker();
|
|
49449
50289
|
}
|
|
49450
|
-
this.channelzTrace = new channelz_1.ChannelzTrace();
|
|
49451
50290
|
this.channelzRef = (0, channelz_1.registerChannelzSubchannel)(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled);
|
|
49452
|
-
|
|
49453
|
-
this.channelzTrace.addTrace("CT_INFO", "Subchannel created");
|
|
49454
|
-
}
|
|
50291
|
+
this.channelzTrace.addTrace("CT_INFO", "Subchannel created");
|
|
49455
50292
|
this.trace("Subchannel constructed with options " + JSON.stringify(options, void 0, 2));
|
|
49456
50293
|
}
|
|
49457
50294
|
getChannelzInfo() {
|
|
@@ -49574,12 +50411,8 @@ var require_subchannel = __commonJS({
|
|
|
49574
50411
|
this.refTrace("refcount " + this.refcount + " -> " + (this.refcount - 1));
|
|
49575
50412
|
this.refcount -= 1;
|
|
49576
50413
|
if (this.refcount === 0) {
|
|
49577
|
-
|
|
49578
|
-
|
|
49579
|
-
}
|
|
49580
|
-
if (this.channelzEnabled) {
|
|
49581
|
-
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
49582
|
-
}
|
|
50414
|
+
this.channelzTrace.addTrace("CT_INFO", "Shutting down");
|
|
50415
|
+
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
49583
50416
|
process.nextTick(() => {
|
|
49584
50417
|
this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING, connectivity_state_1.ConnectivityState.READY], connectivity_state_1.ConnectivityState.IDLE);
|
|
49585
50418
|
});
|
|
@@ -49689,6 +50522,17 @@ var require_subchannel = __commonJS({
|
|
|
49689
50522
|
}
|
|
49690
50523
|
});
|
|
49691
50524
|
|
|
50525
|
+
// node_modules/@grpc/grpc-js/build/src/environment.js
|
|
50526
|
+
var require_environment13 = __commonJS({
|
|
50527
|
+
"node_modules/@grpc/grpc-js/build/src/environment.js"(exports2) {
|
|
50528
|
+
"use strict";
|
|
50529
|
+
var _a;
|
|
50530
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50531
|
+
exports2.GRPC_NODE_USE_ALTERNATIVE_RESOLVER = void 0;
|
|
50532
|
+
exports2.GRPC_NODE_USE_ALTERNATIVE_RESOLVER = ((_a = process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) !== null && _a !== void 0 ? _a : "false") === "true";
|
|
50533
|
+
}
|
|
50534
|
+
});
|
|
50535
|
+
|
|
49692
50536
|
// node_modules/@grpc/grpc-js/build/src/resolver-dns.js
|
|
49693
50537
|
var require_resolver_dns = __commonJS({
|
|
49694
50538
|
"node_modules/@grpc/grpc-js/build/src/resolver-dns.js"(exports2) {
|
|
@@ -49696,8 +50540,7 @@ var require_resolver_dns = __commonJS({
|
|
|
49696
50540
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
49697
50541
|
exports2.setup = exports2.DEFAULT_PORT = void 0;
|
|
49698
50542
|
var resolver_1 = require_resolver();
|
|
49699
|
-
var
|
|
49700
|
-
var util = __require("util");
|
|
50543
|
+
var dns_1 = __require("dns");
|
|
49701
50544
|
var service_config_1 = require_service_config();
|
|
49702
50545
|
var constants_1 = require_constants8();
|
|
49703
50546
|
var metadata_1 = require_metadata();
|
|
@@ -49706,14 +50549,13 @@ var require_resolver_dns = __commonJS({
|
|
|
49706
50549
|
var uri_parser_1 = require_uri_parser();
|
|
49707
50550
|
var net_1 = __require("net");
|
|
49708
50551
|
var backoff_timeout_1 = require_backoff_timeout();
|
|
50552
|
+
var environment_1 = require_environment13();
|
|
49709
50553
|
var TRACER_NAME = "dns_resolver";
|
|
49710
50554
|
function trace(text) {
|
|
49711
50555
|
logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text);
|
|
49712
50556
|
}
|
|
49713
50557
|
exports2.DEFAULT_PORT = 443;
|
|
49714
50558
|
var DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS = 3e4;
|
|
49715
|
-
var resolveTxtPromise = util.promisify(dns.resolveTxt);
|
|
49716
|
-
var dnsLookupPromise = util.promisify(dns.lookup);
|
|
49717
50559
|
var DnsResolver = class {
|
|
49718
50560
|
constructor(target, listener, channelOptions) {
|
|
49719
50561
|
var _a, _b, _c;
|
|
@@ -49728,7 +50570,11 @@ var require_resolver_dns = __commonJS({
|
|
|
49728
50570
|
this.isNextResolutionTimerRunning = false;
|
|
49729
50571
|
this.isServiceConfigEnabled = true;
|
|
49730
50572
|
this.returnedIpResult = false;
|
|
50573
|
+
this.alternativeResolver = new dns_1.promises.Resolver();
|
|
49731
50574
|
trace("Resolver constructed for target " + (0, uri_parser_1.uriToString)(target));
|
|
50575
|
+
if (target.authority) {
|
|
50576
|
+
this.alternativeResolver.setServers([target.authority]);
|
|
50577
|
+
}
|
|
49732
50578
|
const hostPort = (0, uri_parser_1.splitHostPort)(target.path);
|
|
49733
50579
|
if (hostPort === null) {
|
|
49734
50580
|
this.ipResult = null;
|
|
@@ -49813,7 +50659,7 @@ var require_resolver_dns = __commonJS({
|
|
|
49813
50659
|
trace("Looking up DNS hostname " + this.dnsHostname);
|
|
49814
50660
|
this.latestLookupResult = null;
|
|
49815
50661
|
const hostname = this.dnsHostname;
|
|
49816
|
-
this.pendingLookupPromise =
|
|
50662
|
+
this.pendingLookupPromise = this.lookup(hostname);
|
|
49817
50663
|
this.pendingLookupPromise.then((addressList) => {
|
|
49818
50664
|
if (this.pendingLookupPromise === null) {
|
|
49819
50665
|
return;
|
|
@@ -49821,11 +50667,10 @@ var require_resolver_dns = __commonJS({
|
|
|
49821
50667
|
this.pendingLookupPromise = null;
|
|
49822
50668
|
this.backoff.reset();
|
|
49823
50669
|
this.backoff.stop();
|
|
49824
|
-
|
|
49825
|
-
this.latestLookupResult = subchannelAddresses.map((address) => ({
|
|
50670
|
+
this.latestLookupResult = addressList.map((address) => ({
|
|
49826
50671
|
addresses: [address]
|
|
49827
50672
|
}));
|
|
49828
|
-
const allAddressesString = "[" +
|
|
50673
|
+
const allAddressesString = "[" + addressList.map((addr) => addr.host + ":" + addr.port).join(",") + "]";
|
|
49829
50674
|
trace("Resolved addresses for target " + (0, uri_parser_1.uriToString)(this.target) + ": " + allAddressesString);
|
|
49830
50675
|
if (this.latestLookupResult.length === 0) {
|
|
49831
50676
|
this.listener.onError(this.defaultResolutionError);
|
|
@@ -49842,7 +50687,7 @@ var require_resolver_dns = __commonJS({
|
|
|
49842
50687
|
this.listener.onError(this.defaultResolutionError);
|
|
49843
50688
|
});
|
|
49844
50689
|
if (this.isServiceConfigEnabled && this.pendingTxtPromise === null) {
|
|
49845
|
-
this.pendingTxtPromise =
|
|
50690
|
+
this.pendingTxtPromise = this.resolveTxt(hostname);
|
|
49846
50691
|
this.pendingTxtPromise.then((txtRecord) => {
|
|
49847
50692
|
if (this.pendingTxtPromise === null) {
|
|
49848
50693
|
return;
|
|
@@ -49865,15 +50710,43 @@ var require_resolver_dns = __commonJS({
|
|
|
49865
50710
|
}
|
|
49866
50711
|
}
|
|
49867
50712
|
}
|
|
50713
|
+
async lookup(hostname) {
|
|
50714
|
+
if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) {
|
|
50715
|
+
trace("Using alternative DNS resolver.");
|
|
50716
|
+
const records = await Promise.allSettled([
|
|
50717
|
+
this.alternativeResolver.resolve4(hostname),
|
|
50718
|
+
this.alternativeResolver.resolve6(hostname)
|
|
50719
|
+
]);
|
|
50720
|
+
if (records.every((result) => result.status === "rejected")) {
|
|
50721
|
+
throw new Error(records[0].reason);
|
|
50722
|
+
}
|
|
50723
|
+
return records.reduce((acc, result) => {
|
|
50724
|
+
return result.status === "fulfilled" ? [...acc, ...result.value] : acc;
|
|
50725
|
+
}, []).map((addr) => ({
|
|
50726
|
+
host: addr,
|
|
50727
|
+
port: +this.port
|
|
50728
|
+
}));
|
|
50729
|
+
}
|
|
50730
|
+
const addressList = await dns_1.promises.lookup(hostname, { all: true });
|
|
50731
|
+
return addressList.map((addr) => ({ host: addr.address, port: +this.port }));
|
|
50732
|
+
}
|
|
50733
|
+
async resolveTxt(hostname) {
|
|
50734
|
+
if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) {
|
|
50735
|
+
trace("Using alternative DNS resolver.");
|
|
50736
|
+
return this.alternativeResolver.resolveTxt(hostname);
|
|
50737
|
+
}
|
|
50738
|
+
return dns_1.promises.resolveTxt(hostname);
|
|
50739
|
+
}
|
|
49868
50740
|
startNextResolutionTimer() {
|
|
49869
50741
|
var _a, _b;
|
|
49870
50742
|
clearTimeout(this.nextResolutionTimer);
|
|
49871
|
-
this.nextResolutionTimer =
|
|
50743
|
+
this.nextResolutionTimer = setTimeout(() => {
|
|
49872
50744
|
this.stopNextResolutionTimer();
|
|
49873
50745
|
if (this.continueResolving) {
|
|
49874
50746
|
this.startResolutionWithBackoff();
|
|
49875
50747
|
}
|
|
49876
|
-
}, this.minTimeBetweenResolutionsMs)
|
|
50748
|
+
}, this.minTimeBetweenResolutionsMs);
|
|
50749
|
+
(_b = (_a = this.nextResolutionTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
49877
50750
|
this.isNextResolutionTimerRunning = true;
|
|
49878
50751
|
}
|
|
49879
50752
|
stopNextResolutionTimer() {
|
|
@@ -49986,7 +50859,7 @@ var require_http_proxy = __commonJS({
|
|
|
49986
50859
|
if (proxyUrl.username) {
|
|
49987
50860
|
if (proxyUrl.password) {
|
|
49988
50861
|
(0, logging_1.log)(constants_1.LogVerbosity.INFO, "userinfo found in proxy URI");
|
|
49989
|
-
userCred = `${proxyUrl.username}:${proxyUrl.password}
|
|
50862
|
+
userCred = decodeURIComponent(`${proxyUrl.username}:${proxyUrl.password}`);
|
|
49990
50863
|
} else {
|
|
49991
50864
|
userCred = proxyUrl.username;
|
|
49992
50865
|
}
|
|
@@ -50103,6 +50976,9 @@ var require_http_proxy = __commonJS({
|
|
|
50103
50976
|
socket.removeAllListeners();
|
|
50104
50977
|
if (res.statusCode === 200) {
|
|
50105
50978
|
trace("Successfully connected to " + options.path + " through proxy " + proxyAddressString);
|
|
50979
|
+
if (head.length > 0) {
|
|
50980
|
+
socket.unshift(head);
|
|
50981
|
+
}
|
|
50106
50982
|
if ("secureContext" in connectionOptions) {
|
|
50107
50983
|
const targetPath = (0, resolver_1.getDefaultAuthority)(parsedTarget);
|
|
50108
50984
|
const hostPort2 = (0, uri_parser_1.splitHostPort)(targetPath);
|
|
@@ -50152,7 +51028,8 @@ var require_stream_decoder = __commonJS({
|
|
|
50152
51028
|
ReadState2[ReadState2["READING_MESSAGE"] = 2] = "READING_MESSAGE";
|
|
50153
51029
|
})(ReadState || (ReadState = {}));
|
|
50154
51030
|
var StreamDecoder = class {
|
|
50155
|
-
constructor() {
|
|
51031
|
+
constructor(maxReadMessageLength) {
|
|
51032
|
+
this.maxReadMessageLength = maxReadMessageLength;
|
|
50156
51033
|
this.readState = ReadState.NO_DATA;
|
|
50157
51034
|
this.readCompressFlag = Buffer.alloc(1);
|
|
50158
51035
|
this.readPartialSize = Buffer.alloc(4);
|
|
@@ -50184,6 +51061,9 @@ var require_stream_decoder = __commonJS({
|
|
|
50184
51061
|
readHead += toRead;
|
|
50185
51062
|
if (this.readSizeRemaining === 0) {
|
|
50186
51063
|
this.readMessageSize = this.readPartialSize.readUInt32BE(0);
|
|
51064
|
+
if (this.maxReadMessageLength !== -1 && this.readMessageSize > this.maxReadMessageLength) {
|
|
51065
|
+
throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);
|
|
51066
|
+
}
|
|
50187
51067
|
this.readMessageRemaining = this.readMessageSize;
|
|
50188
51068
|
if (this.readMessageRemaining > 0) {
|
|
50189
51069
|
this.readState = ReadState.READING_MESSAGE;
|
|
@@ -50242,52 +51122,64 @@ var require_subchannel_call = __commonJS({
|
|
|
50242
51122
|
}
|
|
50243
51123
|
return "Unknown system error " + errno;
|
|
50244
51124
|
}
|
|
51125
|
+
function mapHttpStatusCode(code) {
|
|
51126
|
+
const details = `Received HTTP status code ${code}`;
|
|
51127
|
+
let mappedStatusCode;
|
|
51128
|
+
switch (code) {
|
|
51129
|
+
// TODO(murgatroid99): handle 100 and 101
|
|
51130
|
+
case 400:
|
|
51131
|
+
mappedStatusCode = constants_1.Status.INTERNAL;
|
|
51132
|
+
break;
|
|
51133
|
+
case 401:
|
|
51134
|
+
mappedStatusCode = constants_1.Status.UNAUTHENTICATED;
|
|
51135
|
+
break;
|
|
51136
|
+
case 403:
|
|
51137
|
+
mappedStatusCode = constants_1.Status.PERMISSION_DENIED;
|
|
51138
|
+
break;
|
|
51139
|
+
case 404:
|
|
51140
|
+
mappedStatusCode = constants_1.Status.UNIMPLEMENTED;
|
|
51141
|
+
break;
|
|
51142
|
+
case 429:
|
|
51143
|
+
case 502:
|
|
51144
|
+
case 503:
|
|
51145
|
+
case 504:
|
|
51146
|
+
mappedStatusCode = constants_1.Status.UNAVAILABLE;
|
|
51147
|
+
break;
|
|
51148
|
+
default:
|
|
51149
|
+
mappedStatusCode = constants_1.Status.UNKNOWN;
|
|
51150
|
+
}
|
|
51151
|
+
return {
|
|
51152
|
+
code: mappedStatusCode,
|
|
51153
|
+
details,
|
|
51154
|
+
metadata: new metadata_1.Metadata()
|
|
51155
|
+
};
|
|
51156
|
+
}
|
|
50245
51157
|
var Http2SubchannelCall = class {
|
|
50246
51158
|
constructor(http2Stream, callEventTracker, listener, transport, callId) {
|
|
51159
|
+
var _a;
|
|
50247
51160
|
this.http2Stream = http2Stream;
|
|
50248
51161
|
this.callEventTracker = callEventTracker;
|
|
50249
51162
|
this.listener = listener;
|
|
50250
51163
|
this.transport = transport;
|
|
50251
51164
|
this.callId = callId;
|
|
50252
|
-
this.decoder = new stream_decoder_1.StreamDecoder();
|
|
50253
51165
|
this.isReadFilterPending = false;
|
|
50254
51166
|
this.isPushPending = false;
|
|
50255
51167
|
this.canPush = false;
|
|
50256
51168
|
this.readsClosed = false;
|
|
50257
51169
|
this.statusOutput = false;
|
|
50258
51170
|
this.unpushedReadMessages = [];
|
|
50259
|
-
this.mappedStatusCode = constants_1.Status.UNKNOWN;
|
|
50260
51171
|
this.finalStatus = null;
|
|
50261
51172
|
this.internalError = null;
|
|
51173
|
+
this.serverEndedCall = false;
|
|
51174
|
+
const maxReceiveMessageLength = (_a = transport.getOptions()["grpc.max_receive_message_length"]) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;
|
|
51175
|
+
this.decoder = new stream_decoder_1.StreamDecoder(maxReceiveMessageLength);
|
|
50262
51176
|
http2Stream.on("response", (headers, flags) => {
|
|
50263
51177
|
let headersString = "";
|
|
50264
51178
|
for (const header of Object.keys(headers)) {
|
|
50265
51179
|
headersString += " " + header + ": " + headers[header] + "\n";
|
|
50266
51180
|
}
|
|
50267
51181
|
this.trace("Received server headers:\n" + headersString);
|
|
50268
|
-
|
|
50269
|
-
// TODO(murgatroid99): handle 100 and 101
|
|
50270
|
-
case 400:
|
|
50271
|
-
this.mappedStatusCode = constants_1.Status.INTERNAL;
|
|
50272
|
-
break;
|
|
50273
|
-
case 401:
|
|
50274
|
-
this.mappedStatusCode = constants_1.Status.UNAUTHENTICATED;
|
|
50275
|
-
break;
|
|
50276
|
-
case 403:
|
|
50277
|
-
this.mappedStatusCode = constants_1.Status.PERMISSION_DENIED;
|
|
50278
|
-
break;
|
|
50279
|
-
case 404:
|
|
50280
|
-
this.mappedStatusCode = constants_1.Status.UNIMPLEMENTED;
|
|
50281
|
-
break;
|
|
50282
|
-
case 429:
|
|
50283
|
-
case 502:
|
|
50284
|
-
case 503:
|
|
50285
|
-
case 504:
|
|
50286
|
-
this.mappedStatusCode = constants_1.Status.UNAVAILABLE;
|
|
50287
|
-
break;
|
|
50288
|
-
default:
|
|
50289
|
-
this.mappedStatusCode = constants_1.Status.UNKNOWN;
|
|
50290
|
-
}
|
|
51182
|
+
this.httpStatusCode = headers[":status"];
|
|
50291
51183
|
if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) {
|
|
50292
51184
|
this.handleTrailers(headers);
|
|
50293
51185
|
} else {
|
|
@@ -50313,7 +51205,13 @@ var require_subchannel_call = __commonJS({
|
|
|
50313
51205
|
return;
|
|
50314
51206
|
}
|
|
50315
51207
|
this.trace("receive HTTP/2 data frame of length " + data.length);
|
|
50316
|
-
|
|
51208
|
+
let messages;
|
|
51209
|
+
try {
|
|
51210
|
+
messages = this.decoder.write(data);
|
|
51211
|
+
} catch (e) {
|
|
51212
|
+
this.cancelWithStatus(constants_1.Status.RESOURCE_EXHAUSTED, e.message);
|
|
51213
|
+
return;
|
|
51214
|
+
}
|
|
50317
51215
|
for (const message of messages) {
|
|
50318
51216
|
this.trace("parsed message of length " + message.length);
|
|
50319
51217
|
this.callEventTracker.addMessageReceived();
|
|
@@ -50325,10 +51223,11 @@ var require_subchannel_call = __commonJS({
|
|
|
50325
51223
|
this.maybeOutputStatus();
|
|
50326
51224
|
});
|
|
50327
51225
|
http2Stream.on("close", () => {
|
|
51226
|
+
this.serverEndedCall = true;
|
|
50328
51227
|
process.nextTick(() => {
|
|
50329
|
-
var
|
|
51228
|
+
var _a2;
|
|
50330
51229
|
this.trace("HTTP/2 stream closed with code " + http2Stream.rstCode);
|
|
50331
|
-
if (((
|
|
51230
|
+
if (((_a2 = this.finalStatus) === null || _a2 === void 0 ? void 0 : _a2.code) === constants_1.Status.OK) {
|
|
50332
51231
|
return;
|
|
50333
51232
|
}
|
|
50334
51233
|
let code;
|
|
@@ -50338,8 +51237,14 @@ var require_subchannel_call = __commonJS({
|
|
|
50338
51237
|
if (this.finalStatus !== null) {
|
|
50339
51238
|
return;
|
|
50340
51239
|
}
|
|
50341
|
-
|
|
50342
|
-
|
|
51240
|
+
if (this.httpStatusCode && this.httpStatusCode !== 200) {
|
|
51241
|
+
const mappedStatus = mapHttpStatusCode(this.httpStatusCode);
|
|
51242
|
+
code = mappedStatus.code;
|
|
51243
|
+
details = mappedStatus.details;
|
|
51244
|
+
} else {
|
|
51245
|
+
code = constants_1.Status.INTERNAL;
|
|
51246
|
+
details = `Received RST_STREAM with code ${http2Stream.rstCode} (Call ended without gRPC status)`;
|
|
51247
|
+
}
|
|
50343
51248
|
break;
|
|
50344
51249
|
case http2.constants.NGHTTP2_REFUSED_STREAM:
|
|
50345
51250
|
code = constants_1.Status.UNAVAILABLE;
|
|
@@ -50390,6 +51295,9 @@ var require_subchannel_call = __commonJS({
|
|
|
50390
51295
|
this.callEventTracker.onStreamEnd(false);
|
|
50391
51296
|
});
|
|
50392
51297
|
}
|
|
51298
|
+
getDeadlineInfo() {
|
|
51299
|
+
return [`remote_addr=${this.getPeer()}`];
|
|
51300
|
+
}
|
|
50393
51301
|
onDisconnect() {
|
|
50394
51302
|
this.endCall({
|
|
50395
51303
|
code: constants_1.Status.UNAVAILABLE,
|
|
@@ -50453,6 +51361,7 @@ var require_subchannel_call = __commonJS({
|
|
|
50453
51361
|
}
|
|
50454
51362
|
}
|
|
50455
51363
|
handleTrailers(headers) {
|
|
51364
|
+
this.serverEndedCall = true;
|
|
50456
51365
|
this.callEventTracker.onStreamEnd(true);
|
|
50457
51366
|
let headersString = "";
|
|
50458
51367
|
for (const header of Object.keys(headers)) {
|
|
@@ -50466,31 +51375,46 @@ var require_subchannel_call = __commonJS({
|
|
|
50466
51375
|
metadata = new metadata_1.Metadata();
|
|
50467
51376
|
}
|
|
50468
51377
|
const metadataMap = metadata.getMap();
|
|
50469
|
-
let
|
|
50470
|
-
if (
|
|
51378
|
+
let status;
|
|
51379
|
+
if (typeof metadataMap["grpc-status"] === "string") {
|
|
50471
51380
|
const receivedStatus = Number(metadataMap["grpc-status"]);
|
|
50472
|
-
|
|
50473
|
-
code = receivedStatus;
|
|
50474
|
-
this.trace("received status code " + receivedStatus + " from server");
|
|
50475
|
-
}
|
|
51381
|
+
this.trace("received status code " + receivedStatus + " from server");
|
|
50476
51382
|
metadata.remove("grpc-status");
|
|
50477
|
-
|
|
50478
|
-
|
|
50479
|
-
|
|
50480
|
-
|
|
50481
|
-
|
|
50482
|
-
|
|
50483
|
-
|
|
51383
|
+
let details = "";
|
|
51384
|
+
if (typeof metadataMap["grpc-message"] === "string") {
|
|
51385
|
+
try {
|
|
51386
|
+
details = decodeURI(metadataMap["grpc-message"]);
|
|
51387
|
+
} catch (e) {
|
|
51388
|
+
details = metadataMap["grpc-message"];
|
|
51389
|
+
}
|
|
51390
|
+
metadata.remove("grpc-message");
|
|
51391
|
+
this.trace('received status details string "' + details + '" from server');
|
|
50484
51392
|
}
|
|
50485
|
-
|
|
50486
|
-
|
|
51393
|
+
status = {
|
|
51394
|
+
code: receivedStatus,
|
|
51395
|
+
details,
|
|
51396
|
+
metadata
|
|
51397
|
+
};
|
|
51398
|
+
} else if (this.httpStatusCode) {
|
|
51399
|
+
status = mapHttpStatusCode(this.httpStatusCode);
|
|
51400
|
+
status.metadata = metadata;
|
|
51401
|
+
} else {
|
|
51402
|
+
status = {
|
|
51403
|
+
code: constants_1.Status.UNKNOWN,
|
|
51404
|
+
details: "No status information received",
|
|
51405
|
+
metadata
|
|
51406
|
+
};
|
|
50487
51407
|
}
|
|
50488
|
-
const status = { code, details, metadata };
|
|
50489
51408
|
this.endCall(status);
|
|
50490
51409
|
}
|
|
50491
51410
|
destroyHttp2Stream() {
|
|
50492
51411
|
var _a;
|
|
50493
|
-
if (
|
|
51412
|
+
if (this.http2Stream.destroyed) {
|
|
51413
|
+
return;
|
|
51414
|
+
}
|
|
51415
|
+
if (this.serverEndedCall) {
|
|
51416
|
+
this.http2Stream.end();
|
|
51417
|
+
} else {
|
|
50494
51418
|
let code;
|
|
50495
51419
|
if (((_a = this.finalStatus) === null || _a === void 0 ? void 0 : _a.code) === constants_1.Status.OK) {
|
|
50496
51420
|
code = http2.constants.NGHTTP2_NO_ERROR;
|
|
@@ -50606,18 +51530,14 @@ var require_transport = __commonJS({
|
|
|
50606
51530
|
var Http2Transport = class {
|
|
50607
51531
|
constructor(session, subchannelAddress, options, remoteName) {
|
|
50608
51532
|
this.session = session;
|
|
51533
|
+
this.options = options;
|
|
50609
51534
|
this.remoteName = remoteName;
|
|
50610
|
-
this.
|
|
50611
|
-
this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS;
|
|
50612
|
-
this.keepaliveTimerId = null;
|
|
51535
|
+
this.keepaliveTimer = null;
|
|
50613
51536
|
this.pendingSendKeepalivePing = false;
|
|
50614
|
-
this.keepaliveTimeoutId = null;
|
|
50615
|
-
this.keepaliveWithoutCalls = false;
|
|
50616
51537
|
this.activeCalls = /* @__PURE__ */ new Set();
|
|
50617
51538
|
this.disconnectListeners = [];
|
|
50618
51539
|
this.disconnectHandled = false;
|
|
50619
51540
|
this.channelzEnabled = true;
|
|
50620
|
-
this.streamTracker = new channelz_1.ChannelzCallTracker();
|
|
50621
51541
|
this.keepalivesSent = 0;
|
|
50622
51542
|
this.messagesSent = 0;
|
|
50623
51543
|
this.messagesReceived = 0;
|
|
@@ -50626,6 +51546,9 @@ var require_transport = __commonJS({
|
|
|
50626
51546
|
this.subchannelAddressString = (0, subchannel_address_1.subchannelAddressToString)(subchannelAddress);
|
|
50627
51547
|
if (options["grpc.enable_channelz"] === 0) {
|
|
50628
51548
|
this.channelzEnabled = false;
|
|
51549
|
+
this.streamTracker = new channelz_1.ChannelzCallTrackerStub();
|
|
51550
|
+
} else {
|
|
51551
|
+
this.streamTracker = new channelz_1.ChannelzCallTracker();
|
|
50629
51552
|
}
|
|
50630
51553
|
this.channelzRef = (0, channelz_1.registerChannelzSocket)(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled);
|
|
50631
51554
|
this.userAgent = [
|
|
@@ -50635,9 +51558,13 @@ var require_transport = __commonJS({
|
|
|
50635
51558
|
].filter((e) => e).join(" ");
|
|
50636
51559
|
if ("grpc.keepalive_time_ms" in options) {
|
|
50637
51560
|
this.keepaliveTimeMs = options["grpc.keepalive_time_ms"];
|
|
51561
|
+
} else {
|
|
51562
|
+
this.keepaliveTimeMs = -1;
|
|
50638
51563
|
}
|
|
50639
51564
|
if ("grpc.keepalive_timeout_ms" in options) {
|
|
50640
51565
|
this.keepaliveTimeoutMs = options["grpc.keepalive_timeout_ms"];
|
|
51566
|
+
} else {
|
|
51567
|
+
this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS;
|
|
50641
51568
|
}
|
|
50642
51569
|
if ("grpc.keepalive_permit_without_calls" in options) {
|
|
50643
51570
|
this.keepaliveWithoutCalls = options["grpc.keepalive_permit_without_calls"] === 1;
|
|
@@ -50646,7 +51573,6 @@ var require_transport = __commonJS({
|
|
|
50646
51573
|
}
|
|
50647
51574
|
session.once("close", () => {
|
|
50648
51575
|
this.trace("session closed");
|
|
50649
|
-
this.stopKeepalivePings();
|
|
50650
51576
|
this.handleDisconnect();
|
|
50651
51577
|
});
|
|
50652
51578
|
session.once("goaway", (errorCode, lastStreamID, opaqueData) => {
|
|
@@ -50659,6 +51585,7 @@ var require_transport = __commonJS({
|
|
|
50659
51585
|
});
|
|
50660
51586
|
session.once("error", (error) => {
|
|
50661
51587
|
this.trace("connection closed with error " + error.message);
|
|
51588
|
+
this.handleDisconnect();
|
|
50662
51589
|
});
|
|
50663
51590
|
if (logging.isTracerEnabled(TRACER_NAME)) {
|
|
50664
51591
|
session.on("remoteSettings", (settings) => {
|
|
@@ -50744,62 +51671,64 @@ var require_transport = __commonJS({
|
|
|
50744
51671
|
* Handle connection drops, but not GOAWAYs.
|
|
50745
51672
|
*/
|
|
50746
51673
|
handleDisconnect() {
|
|
51674
|
+
if (this.disconnectHandled) {
|
|
51675
|
+
return;
|
|
51676
|
+
}
|
|
51677
|
+
this.clearKeepaliveTimeout();
|
|
50747
51678
|
this.reportDisconnectToOwner(false);
|
|
50748
51679
|
setImmediate(() => {
|
|
50749
51680
|
for (const call of this.activeCalls) {
|
|
50750
51681
|
call.onDisconnect();
|
|
50751
51682
|
}
|
|
51683
|
+
this.session.destroy();
|
|
50752
51684
|
});
|
|
50753
51685
|
}
|
|
50754
51686
|
addDisconnectListener(listener) {
|
|
50755
51687
|
this.disconnectListeners.push(listener);
|
|
50756
51688
|
}
|
|
50757
|
-
clearKeepaliveTimer() {
|
|
50758
|
-
if (!this.keepaliveTimerId) {
|
|
50759
|
-
return;
|
|
50760
|
-
}
|
|
50761
|
-
clearTimeout(this.keepaliveTimerId);
|
|
50762
|
-
this.keepaliveTimerId = null;
|
|
50763
|
-
}
|
|
50764
|
-
clearKeepaliveTimeout() {
|
|
50765
|
-
if (!this.keepaliveTimeoutId) {
|
|
50766
|
-
return;
|
|
50767
|
-
}
|
|
50768
|
-
clearTimeout(this.keepaliveTimeoutId);
|
|
50769
|
-
this.keepaliveTimeoutId = null;
|
|
50770
|
-
}
|
|
50771
51689
|
canSendPing() {
|
|
50772
|
-
return this.keepaliveTimeMs > 0 && (this.keepaliveWithoutCalls || this.activeCalls.size > 0);
|
|
51690
|
+
return !this.session.destroyed && this.keepaliveTimeMs > 0 && (this.keepaliveWithoutCalls || this.activeCalls.size > 0);
|
|
50773
51691
|
}
|
|
50774
51692
|
maybeSendPing() {
|
|
50775
51693
|
var _a, _b;
|
|
50776
|
-
this.clearKeepaliveTimer();
|
|
50777
51694
|
if (!this.canSendPing()) {
|
|
50778
51695
|
this.pendingSendKeepalivePing = true;
|
|
50779
51696
|
return;
|
|
50780
51697
|
}
|
|
51698
|
+
if (this.keepaliveTimer) {
|
|
51699
|
+
console.error("keepaliveTimeout is not null");
|
|
51700
|
+
return;
|
|
51701
|
+
}
|
|
50781
51702
|
if (this.channelzEnabled) {
|
|
50782
51703
|
this.keepalivesSent += 1;
|
|
50783
51704
|
}
|
|
50784
51705
|
this.keepaliveTrace("Sending ping with timeout " + this.keepaliveTimeoutMs + "ms");
|
|
50785
|
-
|
|
50786
|
-
this.
|
|
50787
|
-
|
|
50788
|
-
|
|
50789
|
-
|
|
50790
|
-
|
|
50791
|
-
|
|
51706
|
+
this.keepaliveTimer = setTimeout(() => {
|
|
51707
|
+
this.keepaliveTimer = null;
|
|
51708
|
+
this.keepaliveTrace("Ping timeout passed without response");
|
|
51709
|
+
this.handleDisconnect();
|
|
51710
|
+
}, this.keepaliveTimeoutMs);
|
|
51711
|
+
(_b = (_a = this.keepaliveTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
51712
|
+
let pingSendError = "";
|
|
50792
51713
|
try {
|
|
50793
|
-
this.session.ping((err, duration, payload) => {
|
|
51714
|
+
const pingSentSuccessfully = this.session.ping((err, duration, payload) => {
|
|
51715
|
+
this.clearKeepaliveTimeout();
|
|
50794
51716
|
if (err) {
|
|
50795
51717
|
this.keepaliveTrace("Ping failed with error " + err.message);
|
|
50796
51718
|
this.handleDisconnect();
|
|
51719
|
+
} else {
|
|
51720
|
+
this.keepaliveTrace("Received ping response");
|
|
51721
|
+
this.maybeStartKeepalivePingTimer();
|
|
50797
51722
|
}
|
|
50798
|
-
this.keepaliveTrace("Received ping response");
|
|
50799
|
-
this.clearKeepaliveTimeout();
|
|
50800
|
-
this.maybeStartKeepalivePingTimer();
|
|
50801
51723
|
});
|
|
51724
|
+
if (!pingSentSuccessfully) {
|
|
51725
|
+
pingSendError = "Ping returned false";
|
|
51726
|
+
}
|
|
50802
51727
|
} catch (e) {
|
|
51728
|
+
pingSendError = (e instanceof Error ? e.message : "") || "Unknown error";
|
|
51729
|
+
}
|
|
51730
|
+
if (pingSendError) {
|
|
51731
|
+
this.keepaliveTrace("Ping send failed: " + pingSendError);
|
|
50803
51732
|
this.handleDisconnect();
|
|
50804
51733
|
}
|
|
50805
51734
|
}
|
|
@@ -50817,19 +51746,23 @@ var require_transport = __commonJS({
|
|
|
50817
51746
|
if (this.pendingSendKeepalivePing) {
|
|
50818
51747
|
this.pendingSendKeepalivePing = false;
|
|
50819
51748
|
this.maybeSendPing();
|
|
50820
|
-
} else if (!this.
|
|
51749
|
+
} else if (!this.keepaliveTimer) {
|
|
50821
51750
|
this.keepaliveTrace("Starting keepalive timer for " + this.keepaliveTimeMs + "ms");
|
|
50822
|
-
this.
|
|
51751
|
+
this.keepaliveTimer = setTimeout(() => {
|
|
51752
|
+
this.keepaliveTimer = null;
|
|
50823
51753
|
this.maybeSendPing();
|
|
50824
|
-
}, this.keepaliveTimeMs)
|
|
51754
|
+
}, this.keepaliveTimeMs);
|
|
51755
|
+
(_b = (_a = this.keepaliveTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
50825
51756
|
}
|
|
50826
51757
|
}
|
|
50827
|
-
|
|
50828
|
-
|
|
50829
|
-
|
|
50830
|
-
|
|
51758
|
+
/**
|
|
51759
|
+
* Clears whichever keepalive timeout is currently active, if any.
|
|
51760
|
+
*/
|
|
51761
|
+
clearKeepaliveTimeout() {
|
|
51762
|
+
if (this.keepaliveTimer) {
|
|
51763
|
+
clearTimeout(this.keepaliveTimer);
|
|
51764
|
+
this.keepaliveTimer = null;
|
|
50831
51765
|
}
|
|
50832
|
-
this.clearKeepaliveTimeout();
|
|
50833
51766
|
}
|
|
50834
51767
|
removeActiveCall(call) {
|
|
50835
51768
|
this.activeCalls.delete(call);
|
|
@@ -50926,6 +51859,9 @@ var require_transport = __commonJS({
|
|
|
50926
51859
|
getPeerName() {
|
|
50927
51860
|
return this.subchannelAddressString;
|
|
50928
51861
|
}
|
|
51862
|
+
getOptions() {
|
|
51863
|
+
return this.options;
|
|
51864
|
+
}
|
|
50929
51865
|
shutdown() {
|
|
50930
51866
|
this.session.close();
|
|
50931
51867
|
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
@@ -50945,7 +51881,7 @@ var require_transport = __commonJS({
|
|
|
50945
51881
|
return Promise.reject();
|
|
50946
51882
|
}
|
|
50947
51883
|
return new Promise((resolve, reject) => {
|
|
50948
|
-
var _a, _b, _c;
|
|
51884
|
+
var _a, _b, _c, _d;
|
|
50949
51885
|
let remoteName;
|
|
50950
51886
|
if (proxyConnectionResult.realTarget) {
|
|
50951
51887
|
remoteName = (0, uri_parser_1.uriToString)(proxyConnectionResult.realTarget);
|
|
@@ -50967,12 +51903,13 @@ var require_transport = __commonJS({
|
|
|
50967
51903
|
addressScheme = "https://";
|
|
50968
51904
|
if (options["grpc.ssl_target_name_override"]) {
|
|
50969
51905
|
const sslTargetNameOverride = options["grpc.ssl_target_name_override"];
|
|
51906
|
+
const originalCheckServerIdentity = (_b = connectionOptions.checkServerIdentity) !== null && _b !== void 0 ? _b : tls_1.checkServerIdentity;
|
|
50970
51907
|
connectionOptions.checkServerIdentity = (host, cert) => {
|
|
50971
|
-
return (
|
|
51908
|
+
return originalCheckServerIdentity(sslTargetNameOverride, cert);
|
|
50972
51909
|
};
|
|
50973
51910
|
connectionOptions.servername = sslTargetNameOverride;
|
|
50974
51911
|
} else {
|
|
50975
|
-
const authorityHostname = (
|
|
51912
|
+
const authorityHostname = (_d = (_c = (0, uri_parser_1.splitHostPort)(targetAuthority)) === null || _c === void 0 ? void 0 : _c.host) !== null && _d !== void 0 ? _d : "localhost";
|
|
50976
51913
|
connectionOptions.servername = authorityHostname;
|
|
50977
51914
|
}
|
|
50978
51915
|
if (proxyConnectionResult.socket) {
|
|
@@ -50993,6 +51930,7 @@ var require_transport = __commonJS({
|
|
|
50993
51930
|
const session = http2.connect(addressScheme + targetAuthority, connectionOptions);
|
|
50994
51931
|
this.session = session;
|
|
50995
51932
|
let errorMessage = "Failed to connect";
|
|
51933
|
+
let reportedError = false;
|
|
50996
51934
|
session.unref();
|
|
50997
51935
|
session.once("connect", () => {
|
|
50998
51936
|
session.removeAllListeners();
|
|
@@ -51002,17 +51940,24 @@ var require_transport = __commonJS({
|
|
|
51002
51940
|
session.once("close", () => {
|
|
51003
51941
|
this.session = null;
|
|
51004
51942
|
setImmediate(() => {
|
|
51005
|
-
|
|
51943
|
+
if (!reportedError) {
|
|
51944
|
+
reportedError = true;
|
|
51945
|
+
reject(`${errorMessage} (${(/* @__PURE__ */ new Date()).toISOString()})`);
|
|
51946
|
+
}
|
|
51006
51947
|
});
|
|
51007
51948
|
});
|
|
51008
51949
|
session.once("error", (error) => {
|
|
51009
51950
|
errorMessage = error.message;
|
|
51010
51951
|
this.trace("connection failed with error " + errorMessage);
|
|
51952
|
+
if (!reportedError) {
|
|
51953
|
+
reportedError = true;
|
|
51954
|
+
reject(`${errorMessage} (${(/* @__PURE__ */ new Date()).toISOString()})`);
|
|
51955
|
+
}
|
|
51011
51956
|
});
|
|
51012
51957
|
});
|
|
51013
51958
|
}
|
|
51014
51959
|
connect(address, credentials, options) {
|
|
51015
|
-
var _a, _b;
|
|
51960
|
+
var _a, _b, _c;
|
|
51016
51961
|
if (this.isShutdown) {
|
|
51017
51962
|
return Promise.reject();
|
|
51018
51963
|
}
|
|
@@ -51021,17 +51966,18 @@ var require_transport = __commonJS({
|
|
|
51021
51966
|
connectionOptions.ALPNProtocols = ["h2"];
|
|
51022
51967
|
if (options["grpc.ssl_target_name_override"]) {
|
|
51023
51968
|
const sslTargetNameOverride = options["grpc.ssl_target_name_override"];
|
|
51969
|
+
const originalCheckServerIdentity = (_a = connectionOptions.checkServerIdentity) !== null && _a !== void 0 ? _a : tls_1.checkServerIdentity;
|
|
51024
51970
|
connectionOptions.checkServerIdentity = (host, cert) => {
|
|
51025
|
-
return (
|
|
51971
|
+
return originalCheckServerIdentity(sslTargetNameOverride, cert);
|
|
51026
51972
|
};
|
|
51027
51973
|
connectionOptions.servername = sslTargetNameOverride;
|
|
51028
51974
|
} else {
|
|
51029
51975
|
if ("grpc.http_connect_target" in options) {
|
|
51030
|
-
const targetPath = (0, resolver_1.getDefaultAuthority)((
|
|
51976
|
+
const targetPath = (0, resolver_1.getDefaultAuthority)((_b = (0, uri_parser_1.parseUri)(options["grpc.http_connect_target"])) !== null && _b !== void 0 ? _b : {
|
|
51031
51977
|
path: "localhost"
|
|
51032
51978
|
});
|
|
51033
51979
|
const hostPort = (0, uri_parser_1.splitHostPort)(targetPath);
|
|
51034
|
-
connectionOptions.servername = (
|
|
51980
|
+
connectionOptions.servername = (_c = hostPort === null || hostPort === void 0 ? void 0 : hostPort.host) !== null && _c !== void 0 ? _c : targetPath;
|
|
51035
51981
|
}
|
|
51036
51982
|
}
|
|
51037
51983
|
if (options["grpc-node.tls_enable_trace"]) {
|
|
@@ -51322,6 +52268,10 @@ var require_compression_filter = __commonJS({
|
|
|
51322
52268
|
}
|
|
51323
52269
|
};
|
|
51324
52270
|
var DeflateHandler = class extends CompressionHandler {
|
|
52271
|
+
constructor(maxRecvMessageLength) {
|
|
52272
|
+
super();
|
|
52273
|
+
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
52274
|
+
}
|
|
51325
52275
|
compressMessage(message) {
|
|
51326
52276
|
return new Promise((resolve, reject) => {
|
|
51327
52277
|
zlib.deflate(message, (err, output) => {
|
|
@@ -51335,17 +52285,33 @@ var require_compression_filter = __commonJS({
|
|
|
51335
52285
|
}
|
|
51336
52286
|
decompressMessage(message) {
|
|
51337
52287
|
return new Promise((resolve, reject) => {
|
|
51338
|
-
|
|
51339
|
-
|
|
51340
|
-
|
|
51341
|
-
|
|
51342
|
-
|
|
52288
|
+
let totalLength = 0;
|
|
52289
|
+
const messageParts = [];
|
|
52290
|
+
const decompresser = zlib.createInflate();
|
|
52291
|
+
decompresser.on("data", (chunk) => {
|
|
52292
|
+
messageParts.push(chunk);
|
|
52293
|
+
totalLength += chunk.byteLength;
|
|
52294
|
+
if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) {
|
|
52295
|
+
decompresser.destroy();
|
|
52296
|
+
reject({
|
|
52297
|
+
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
52298
|
+
details: `Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`
|
|
52299
|
+
});
|
|
51343
52300
|
}
|
|
51344
52301
|
});
|
|
52302
|
+
decompresser.on("end", () => {
|
|
52303
|
+
resolve(Buffer.concat(messageParts));
|
|
52304
|
+
});
|
|
52305
|
+
decompresser.write(message);
|
|
52306
|
+
decompresser.end();
|
|
51345
52307
|
});
|
|
51346
52308
|
}
|
|
51347
52309
|
};
|
|
51348
52310
|
var GzipHandler = class extends CompressionHandler {
|
|
52311
|
+
constructor(maxRecvMessageLength) {
|
|
52312
|
+
super();
|
|
52313
|
+
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
52314
|
+
}
|
|
51349
52315
|
compressMessage(message) {
|
|
51350
52316
|
return new Promise((resolve, reject) => {
|
|
51351
52317
|
zlib.gzip(message, (err, output) => {
|
|
@@ -51359,13 +52325,25 @@ var require_compression_filter = __commonJS({
|
|
|
51359
52325
|
}
|
|
51360
52326
|
decompressMessage(message) {
|
|
51361
52327
|
return new Promise((resolve, reject) => {
|
|
51362
|
-
|
|
51363
|
-
|
|
51364
|
-
|
|
51365
|
-
|
|
51366
|
-
|
|
52328
|
+
let totalLength = 0;
|
|
52329
|
+
const messageParts = [];
|
|
52330
|
+
const decompresser = zlib.createGunzip();
|
|
52331
|
+
decompresser.on("data", (chunk) => {
|
|
52332
|
+
messageParts.push(chunk);
|
|
52333
|
+
totalLength += chunk.byteLength;
|
|
52334
|
+
if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) {
|
|
52335
|
+
decompresser.destroy();
|
|
52336
|
+
reject({
|
|
52337
|
+
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
52338
|
+
details: `Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`
|
|
52339
|
+
});
|
|
51367
52340
|
}
|
|
51368
52341
|
});
|
|
52342
|
+
decompresser.on("end", () => {
|
|
52343
|
+
resolve(Buffer.concat(messageParts));
|
|
52344
|
+
});
|
|
52345
|
+
decompresser.write(message);
|
|
52346
|
+
decompresser.end();
|
|
51369
52347
|
});
|
|
51370
52348
|
}
|
|
51371
52349
|
};
|
|
@@ -51381,34 +52359,36 @@ var require_compression_filter = __commonJS({
|
|
|
51381
52359
|
return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`));
|
|
51382
52360
|
}
|
|
51383
52361
|
};
|
|
51384
|
-
function getCompressionHandler(compressionName) {
|
|
52362
|
+
function getCompressionHandler(compressionName, maxReceiveMessageSize) {
|
|
51385
52363
|
switch (compressionName) {
|
|
51386
52364
|
case "identity":
|
|
51387
52365
|
return new IdentityHandler();
|
|
51388
52366
|
case "deflate":
|
|
51389
|
-
return new DeflateHandler();
|
|
52367
|
+
return new DeflateHandler(maxReceiveMessageSize);
|
|
51390
52368
|
case "gzip":
|
|
51391
|
-
return new GzipHandler();
|
|
52369
|
+
return new GzipHandler(maxReceiveMessageSize);
|
|
51392
52370
|
default:
|
|
51393
52371
|
return new UnknownHandler(compressionName);
|
|
51394
52372
|
}
|
|
51395
52373
|
}
|
|
51396
52374
|
var CompressionFilter = class extends filter_1.BaseFilter {
|
|
51397
52375
|
constructor(channelOptions, sharedFilterConfig) {
|
|
51398
|
-
var _a;
|
|
52376
|
+
var _a, _b, _c;
|
|
51399
52377
|
super();
|
|
51400
52378
|
this.sharedFilterConfig = sharedFilterConfig;
|
|
51401
52379
|
this.sendCompression = new IdentityHandler();
|
|
51402
52380
|
this.receiveCompression = new IdentityHandler();
|
|
51403
52381
|
this.currentCompressionAlgorithm = "identity";
|
|
51404
52382
|
const compressionAlgorithmKey = channelOptions["grpc.default_compression_algorithm"];
|
|
52383
|
+
this.maxReceiveMessageLength = (_a = channelOptions["grpc.max_receive_message_length"]) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;
|
|
52384
|
+
this.maxSendMessageLength = (_b = channelOptions["grpc.max_send_message_length"]) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH;
|
|
51405
52385
|
if (compressionAlgorithmKey !== void 0) {
|
|
51406
52386
|
if (isCompressionAlgorithmKey(compressionAlgorithmKey)) {
|
|
51407
52387
|
const clientSelectedEncoding = compression_algorithms_1.CompressionAlgorithms[compressionAlgorithmKey];
|
|
51408
|
-
const serverSupportedEncodings = (
|
|
52388
|
+
const serverSupportedEncodings = (_c = sharedFilterConfig.serverSupportedEncodingHeader) === null || _c === void 0 ? void 0 : _c.split(",");
|
|
51409
52389
|
if (!serverSupportedEncodings || serverSupportedEncodings.includes(clientSelectedEncoding)) {
|
|
51410
52390
|
this.currentCompressionAlgorithm = clientSelectedEncoding;
|
|
51411
|
-
this.sendCompression = getCompressionHandler(this.currentCompressionAlgorithm);
|
|
52391
|
+
this.sendCompression = getCompressionHandler(this.currentCompressionAlgorithm, -1);
|
|
51412
52392
|
}
|
|
51413
52393
|
} else {
|
|
51414
52394
|
logging.log(constants_1.LogVerbosity.ERROR, `Invalid value provided for grpc.default_compression_algorithm option: ${compressionAlgorithmKey}`);
|
|
@@ -51431,7 +52411,7 @@ var require_compression_filter = __commonJS({
|
|
|
51431
52411
|
if (receiveEncoding.length > 0) {
|
|
51432
52412
|
const encoding = receiveEncoding[0];
|
|
51433
52413
|
if (typeof encoding === "string") {
|
|
51434
|
-
this.receiveCompression = getCompressionHandler(encoding);
|
|
52414
|
+
this.receiveCompression = getCompressionHandler(encoding, this.maxReceiveMessageLength);
|
|
51435
52415
|
}
|
|
51436
52416
|
}
|
|
51437
52417
|
metadata.remove("grpc-encoding");
|
|
@@ -51450,6 +52430,12 @@ var require_compression_filter = __commonJS({
|
|
|
51450
52430
|
async sendMessage(message) {
|
|
51451
52431
|
var _a;
|
|
51452
52432
|
const resolvedMessage = await message;
|
|
52433
|
+
if (this.maxSendMessageLength !== -1 && resolvedMessage.message.length > this.maxSendMessageLength) {
|
|
52434
|
+
throw {
|
|
52435
|
+
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
52436
|
+
details: `Attempted to send message with a size larger than ${this.maxSendMessageLength}`
|
|
52437
|
+
};
|
|
52438
|
+
}
|
|
51453
52439
|
let compress;
|
|
51454
52440
|
if (this.sendCompression instanceof IdentityHandler) {
|
|
51455
52441
|
compress = false;
|
|
@@ -51479,79 +52465,12 @@ var require_compression_filter = __commonJS({
|
|
|
51479
52465
|
}
|
|
51480
52466
|
});
|
|
51481
52467
|
|
|
51482
|
-
// node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js
|
|
51483
|
-
var require_max_message_size_filter = __commonJS({
|
|
51484
|
-
"node_modules/@grpc/grpc-js/build/src/max-message-size-filter.js"(exports2) {
|
|
51485
|
-
"use strict";
|
|
51486
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
51487
|
-
exports2.MaxMessageSizeFilterFactory = exports2.MaxMessageSizeFilter = void 0;
|
|
51488
|
-
var filter_1 = require_filter();
|
|
51489
|
-
var constants_1 = require_constants8();
|
|
51490
|
-
var metadata_1 = require_metadata();
|
|
51491
|
-
var MaxMessageSizeFilter = class extends filter_1.BaseFilter {
|
|
51492
|
-
constructor(options) {
|
|
51493
|
-
super();
|
|
51494
|
-
this.maxSendMessageSize = constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH;
|
|
51495
|
-
this.maxReceiveMessageSize = constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;
|
|
51496
|
-
if ("grpc.max_send_message_length" in options) {
|
|
51497
|
-
this.maxSendMessageSize = options["grpc.max_send_message_length"];
|
|
51498
|
-
}
|
|
51499
|
-
if ("grpc.max_receive_message_length" in options) {
|
|
51500
|
-
this.maxReceiveMessageSize = options["grpc.max_receive_message_length"];
|
|
51501
|
-
}
|
|
51502
|
-
}
|
|
51503
|
-
async sendMessage(message) {
|
|
51504
|
-
if (this.maxSendMessageSize === -1) {
|
|
51505
|
-
return message;
|
|
51506
|
-
} else {
|
|
51507
|
-
const concreteMessage = await message;
|
|
51508
|
-
if (concreteMessage.message.length > this.maxSendMessageSize) {
|
|
51509
|
-
throw {
|
|
51510
|
-
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
51511
|
-
details: `Sent message larger than max (${concreteMessage.message.length} vs. ${this.maxSendMessageSize})`,
|
|
51512
|
-
metadata: new metadata_1.Metadata()
|
|
51513
|
-
};
|
|
51514
|
-
} else {
|
|
51515
|
-
return concreteMessage;
|
|
51516
|
-
}
|
|
51517
|
-
}
|
|
51518
|
-
}
|
|
51519
|
-
async receiveMessage(message) {
|
|
51520
|
-
if (this.maxReceiveMessageSize === -1) {
|
|
51521
|
-
return message;
|
|
51522
|
-
} else {
|
|
51523
|
-
const concreteMessage = await message;
|
|
51524
|
-
if (concreteMessage.length > this.maxReceiveMessageSize) {
|
|
51525
|
-
throw {
|
|
51526
|
-
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
51527
|
-
details: `Received message larger than max (${concreteMessage.length} vs. ${this.maxReceiveMessageSize})`,
|
|
51528
|
-
metadata: new metadata_1.Metadata()
|
|
51529
|
-
};
|
|
51530
|
-
} else {
|
|
51531
|
-
return concreteMessage;
|
|
51532
|
-
}
|
|
51533
|
-
}
|
|
51534
|
-
}
|
|
51535
|
-
};
|
|
51536
|
-
exports2.MaxMessageSizeFilter = MaxMessageSizeFilter;
|
|
51537
|
-
var MaxMessageSizeFilterFactory = class {
|
|
51538
|
-
constructor(options) {
|
|
51539
|
-
this.options = options;
|
|
51540
|
-
}
|
|
51541
|
-
createFilter() {
|
|
51542
|
-
return new MaxMessageSizeFilter(this.options);
|
|
51543
|
-
}
|
|
51544
|
-
};
|
|
51545
|
-
exports2.MaxMessageSizeFilterFactory = MaxMessageSizeFilterFactory;
|
|
51546
|
-
}
|
|
51547
|
-
});
|
|
51548
|
-
|
|
51549
52468
|
// node_modules/@grpc/grpc-js/build/src/deadline.js
|
|
51550
52469
|
var require_deadline = __commonJS({
|
|
51551
52470
|
"node_modules/@grpc/grpc-js/build/src/deadline.js"(exports2) {
|
|
51552
52471
|
"use strict";
|
|
51553
52472
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
51554
|
-
exports2.deadlineToString = exports2.getRelativeTimeout = exports2.getDeadlineTimeoutString = exports2.minDeadline = void 0;
|
|
52473
|
+
exports2.formatDateDifference = exports2.deadlineToString = exports2.getRelativeTimeout = exports2.getDeadlineTimeoutString = exports2.minDeadline = void 0;
|
|
51555
52474
|
function minDeadline(...deadlineList) {
|
|
51556
52475
|
let minValue = Infinity;
|
|
51557
52476
|
for (const deadline of deadlineList) {
|
|
@@ -51611,6 +52530,10 @@ var require_deadline = __commonJS({
|
|
|
51611
52530
|
}
|
|
51612
52531
|
}
|
|
51613
52532
|
exports2.deadlineToString = deadlineToString;
|
|
52533
|
+
function formatDateDifference(startDate, endDate) {
|
|
52534
|
+
return ((endDate.getTime() - startDate.getTime()) / 1e3).toFixed(3) + "s";
|
|
52535
|
+
}
|
|
52536
|
+
exports2.formatDateDifference = formatDateDifference;
|
|
51614
52537
|
}
|
|
51615
52538
|
});
|
|
51616
52539
|
|
|
@@ -51679,6 +52602,7 @@ var require_load_balancing_call = __commonJS({
|
|
|
51679
52602
|
this.metadata = null;
|
|
51680
52603
|
this.listener = null;
|
|
51681
52604
|
this.onCallEnded = null;
|
|
52605
|
+
this.childStartTime = null;
|
|
51682
52606
|
const splitPath = this.methodName.split("/");
|
|
51683
52607
|
let serviceName = "";
|
|
51684
52608
|
if (splitPath.length >= 2) {
|
|
@@ -51686,6 +52610,27 @@ var require_load_balancing_call = __commonJS({
|
|
|
51686
52610
|
}
|
|
51687
52611
|
const hostname = (_b = (_a = (0, uri_parser_1.splitHostPort)(this.host)) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : "localhost";
|
|
51688
52612
|
this.serviceUrl = `https://${hostname}/${serviceName}`;
|
|
52613
|
+
this.startTime = /* @__PURE__ */ new Date();
|
|
52614
|
+
}
|
|
52615
|
+
getDeadlineInfo() {
|
|
52616
|
+
var _a, _b;
|
|
52617
|
+
const deadlineInfo = [];
|
|
52618
|
+
if (this.childStartTime) {
|
|
52619
|
+
if (this.childStartTime > this.startTime) {
|
|
52620
|
+
if ((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.getOptions().waitForReady) {
|
|
52621
|
+
deadlineInfo.push("wait_for_ready");
|
|
52622
|
+
}
|
|
52623
|
+
deadlineInfo.push(`LB pick: ${(0, deadline_1.formatDateDifference)(this.startTime, this.childStartTime)}`);
|
|
52624
|
+
}
|
|
52625
|
+
deadlineInfo.push(...this.child.getDeadlineInfo());
|
|
52626
|
+
return deadlineInfo;
|
|
52627
|
+
} else {
|
|
52628
|
+
if ((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.getOptions().waitForReady) {
|
|
52629
|
+
deadlineInfo.push("wait_for_ready");
|
|
52630
|
+
}
|
|
52631
|
+
deadlineInfo.push("Waiting for LB pick");
|
|
52632
|
+
}
|
|
52633
|
+
return deadlineInfo;
|
|
51689
52634
|
}
|
|
51690
52635
|
trace(text) {
|
|
51691
52636
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text);
|
|
@@ -51694,7 +52639,7 @@ var require_load_balancing_call = __commonJS({
|
|
|
51694
52639
|
var _a, _b;
|
|
51695
52640
|
if (!this.ended) {
|
|
51696
52641
|
this.ended = true;
|
|
51697
|
-
this.trace("ended with status: code=" + status.code + ' details="' + status.details + '"');
|
|
52642
|
+
this.trace("ended with status: code=" + status.code + ' details="' + status.details + '" start time=' + this.startTime.toISOString());
|
|
51698
52643
|
const finalStatus = Object.assign(Object.assign({}, status), { progress });
|
|
51699
52644
|
(_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveStatus(finalStatus);
|
|
51700
52645
|
(_b = this.onCallEnded) === null || _b === void 0 ? void 0 : _b.call(this, finalStatus.code);
|
|
@@ -51756,6 +52701,7 @@ var require_load_balancing_call = __commonJS({
|
|
|
51756
52701
|
}
|
|
51757
52702
|
}
|
|
51758
52703
|
});
|
|
52704
|
+
this.childStartTime = /* @__PURE__ */ new Date();
|
|
51759
52705
|
} catch (error) {
|
|
51760
52706
|
this.trace("Failed to start call on picked subchannel " + subchannelString + " with error " + error.message);
|
|
51761
52707
|
this.outputStatus({
|
|
@@ -51891,6 +52837,9 @@ var require_resolving_call = __commonJS({
|
|
|
51891
52837
|
this.deadlineTimer = setTimeout(() => {
|
|
51892
52838
|
}, 0);
|
|
51893
52839
|
this.filterStack = null;
|
|
52840
|
+
this.deadlineStartTime = null;
|
|
52841
|
+
this.configReceivedTime = null;
|
|
52842
|
+
this.childStartTime = null;
|
|
51894
52843
|
this.deadline = options.deadline;
|
|
51895
52844
|
this.host = options.host;
|
|
51896
52845
|
if (options.parentCall) {
|
|
@@ -51912,12 +52861,37 @@ var require_resolving_call = __commonJS({
|
|
|
51912
52861
|
}
|
|
51913
52862
|
runDeadlineTimer() {
|
|
51914
52863
|
clearTimeout(this.deadlineTimer);
|
|
52864
|
+
this.deadlineStartTime = /* @__PURE__ */ new Date();
|
|
51915
52865
|
this.trace("Deadline: " + (0, deadline_1.deadlineToString)(this.deadline));
|
|
51916
52866
|
const timeout = (0, deadline_1.getRelativeTimeout)(this.deadline);
|
|
51917
52867
|
if (timeout !== Infinity) {
|
|
51918
52868
|
this.trace("Deadline will be reached in " + timeout + "ms");
|
|
51919
52869
|
const handleDeadline = () => {
|
|
51920
|
-
this.
|
|
52870
|
+
if (!this.deadlineStartTime) {
|
|
52871
|
+
this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, "Deadline exceeded");
|
|
52872
|
+
return;
|
|
52873
|
+
}
|
|
52874
|
+
const deadlineInfo = [];
|
|
52875
|
+
const deadlineEndTime = /* @__PURE__ */ new Date();
|
|
52876
|
+
deadlineInfo.push(`Deadline exceeded after ${(0, deadline_1.formatDateDifference)(this.deadlineStartTime, deadlineEndTime)}`);
|
|
52877
|
+
if (this.configReceivedTime) {
|
|
52878
|
+
if (this.configReceivedTime > this.deadlineStartTime) {
|
|
52879
|
+
deadlineInfo.push(`name resolution: ${(0, deadline_1.formatDateDifference)(this.deadlineStartTime, this.configReceivedTime)}`);
|
|
52880
|
+
}
|
|
52881
|
+
if (this.childStartTime) {
|
|
52882
|
+
if (this.childStartTime > this.configReceivedTime) {
|
|
52883
|
+
deadlineInfo.push(`metadata filters: ${(0, deadline_1.formatDateDifference)(this.configReceivedTime, this.childStartTime)}`);
|
|
52884
|
+
}
|
|
52885
|
+
} else {
|
|
52886
|
+
deadlineInfo.push("waiting for metadata filters");
|
|
52887
|
+
}
|
|
52888
|
+
} else {
|
|
52889
|
+
deadlineInfo.push("waiting for name resolution");
|
|
52890
|
+
}
|
|
52891
|
+
if (this.child) {
|
|
52892
|
+
deadlineInfo.push(...this.child.getDeadlineInfo());
|
|
52893
|
+
}
|
|
52894
|
+
this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, deadlineInfo.join(","));
|
|
51921
52895
|
};
|
|
51922
52896
|
if (timeout <= 0) {
|
|
51923
52897
|
process.nextTick(handleDeadline);
|
|
@@ -51977,6 +52951,7 @@ var require_resolving_call = __commonJS({
|
|
|
51977
52951
|
}
|
|
51978
52952
|
return;
|
|
51979
52953
|
}
|
|
52954
|
+
this.configReceivedTime = /* @__PURE__ */ new Date();
|
|
51980
52955
|
const config = configResult.config;
|
|
51981
52956
|
if (config.status !== constants_1.Status.OK) {
|
|
51982
52957
|
const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(config.status, "Failed to route call to method " + this.method);
|
|
@@ -51999,6 +52974,7 @@ var require_resolving_call = __commonJS({
|
|
|
51999
52974
|
this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then((filteredMetadata) => {
|
|
52000
52975
|
this.child = this.channel.createInnerCall(config, this.method, this.host, this.credentials, this.deadline);
|
|
52001
52976
|
this.trace("Created child [" + this.child.getCallNumber() + "]");
|
|
52977
|
+
this.childStartTime = /* @__PURE__ */ new Date();
|
|
52002
52978
|
this.child.start(filteredMetadata, {
|
|
52003
52979
|
onReceiveMetadata: (metadata) => {
|
|
52004
52980
|
this.trace("Received metadata");
|
|
@@ -52112,6 +53088,7 @@ var require_retrying_call = __commonJS({
|
|
|
52112
53088
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
52113
53089
|
exports2.RetryingCall = exports2.MessageBufferTracker = exports2.RetryThrottler = void 0;
|
|
52114
53090
|
var constants_1 = require_constants8();
|
|
53091
|
+
var deadline_1 = require_deadline();
|
|
52115
53092
|
var metadata_1 = require_metadata();
|
|
52116
53093
|
var logging = require_logging();
|
|
52117
53094
|
var TRACER_NAME = "retrying_call";
|
|
@@ -52177,8 +53154,10 @@ var require_retrying_call = __commonJS({
|
|
|
52177
53154
|
};
|
|
52178
53155
|
exports2.MessageBufferTracker = MessageBufferTracker;
|
|
52179
53156
|
var PREVIONS_RPC_ATTEMPTS_METADATA_KEY = "grpc-previous-rpc-attempts";
|
|
53157
|
+
var DEFAULT_MAX_ATTEMPTS_LIMIT = 5;
|
|
52180
53158
|
var RetryingCall = class {
|
|
52181
53159
|
constructor(channel, callConfig, methodName, host, credentials, deadline, callNumber, bufferTracker, retryThrottler) {
|
|
53160
|
+
var _a;
|
|
52182
53161
|
this.channel = channel;
|
|
52183
53162
|
this.callConfig = callConfig;
|
|
52184
53163
|
this.methodName = methodName;
|
|
@@ -52200,15 +53179,35 @@ var require_retrying_call = __commonJS({
|
|
|
52200
53179
|
this.committedCallIndex = null;
|
|
52201
53180
|
this.initialRetryBackoffSec = 0;
|
|
52202
53181
|
this.nextRetryBackoffSec = 0;
|
|
53182
|
+
const maxAttemptsLimit = (_a = channel.getOptions()["grpc-node.retry_max_attempts_limit"]) !== null && _a !== void 0 ? _a : DEFAULT_MAX_ATTEMPTS_LIMIT;
|
|
52203
53183
|
if (callConfig.methodConfig.retryPolicy) {
|
|
52204
53184
|
this.state = "RETRY";
|
|
52205
53185
|
const retryPolicy = callConfig.methodConfig.retryPolicy;
|
|
52206
53186
|
this.nextRetryBackoffSec = this.initialRetryBackoffSec = Number(retryPolicy.initialBackoff.substring(0, retryPolicy.initialBackoff.length - 1));
|
|
53187
|
+
this.maxAttempts = Math.min(retryPolicy.maxAttempts, maxAttemptsLimit);
|
|
52207
53188
|
} else if (callConfig.methodConfig.hedgingPolicy) {
|
|
52208
53189
|
this.state = "HEDGING";
|
|
53190
|
+
this.maxAttempts = Math.min(callConfig.methodConfig.hedgingPolicy.maxAttempts, maxAttemptsLimit);
|
|
52209
53191
|
} else {
|
|
52210
53192
|
this.state = "TRANSPARENT_ONLY";
|
|
53193
|
+
this.maxAttempts = 1;
|
|
53194
|
+
}
|
|
53195
|
+
this.startTime = /* @__PURE__ */ new Date();
|
|
53196
|
+
}
|
|
53197
|
+
getDeadlineInfo() {
|
|
53198
|
+
if (this.underlyingCalls.length === 0) {
|
|
53199
|
+
return [];
|
|
53200
|
+
}
|
|
53201
|
+
const deadlineInfo = [];
|
|
53202
|
+
const latestCall = this.underlyingCalls[this.underlyingCalls.length - 1];
|
|
53203
|
+
if (this.underlyingCalls.length > 1) {
|
|
53204
|
+
deadlineInfo.push(`previous attempts: ${this.underlyingCalls.length - 1}`);
|
|
52211
53205
|
}
|
|
53206
|
+
if (latestCall.startTime > this.startTime) {
|
|
53207
|
+
deadlineInfo.push(`time to current attempt start: ${(0, deadline_1.formatDateDifference)(this.startTime, latestCall.startTime)}`);
|
|
53208
|
+
}
|
|
53209
|
+
deadlineInfo.push(...latestCall.call.getDeadlineInfo());
|
|
53210
|
+
return deadlineInfo;
|
|
52212
53211
|
}
|
|
52213
53212
|
getCallNumber() {
|
|
52214
53213
|
return this.callNumber;
|
|
@@ -52217,7 +53216,7 @@ var require_retrying_call = __commonJS({
|
|
|
52217
53216
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text);
|
|
52218
53217
|
}
|
|
52219
53218
|
reportStatus(statusObject) {
|
|
52220
|
-
this.trace("ended with status: code=" + statusObject.code + ' details="' + statusObject.details + '"');
|
|
53219
|
+
this.trace("ended with status: code=" + statusObject.code + ' details="' + statusObject.details + '" start time=' + this.startTime.toISOString());
|
|
52221
53220
|
this.bufferTracker.freeAll(this.callNumber);
|
|
52222
53221
|
this.writeBufferOffset = this.writeBufferOffset + this.writeBuffer.length;
|
|
52223
53222
|
this.writeBuffer = [];
|
|
@@ -52309,7 +53308,10 @@ var require_retrying_call = __commonJS({
|
|
|
52309
53308
|
}
|
|
52310
53309
|
}
|
|
52311
53310
|
isStatusCodeInList(list, code) {
|
|
52312
|
-
return list.some((value) =>
|
|
53311
|
+
return list.some((value) => {
|
|
53312
|
+
var _a;
|
|
53313
|
+
return value === code || value.toString().toLowerCase() === ((_a = constants_1.Status[code]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
53314
|
+
});
|
|
52313
53315
|
}
|
|
52314
53316
|
getNextRetryBackoffMs() {
|
|
52315
53317
|
var _a;
|
|
@@ -52327,8 +53329,7 @@ var require_retrying_call = __commonJS({
|
|
|
52327
53329
|
callback(false);
|
|
52328
53330
|
return;
|
|
52329
53331
|
}
|
|
52330
|
-
|
|
52331
|
-
if (this.attempts >= Math.min(retryPolicy.maxAttempts, 5)) {
|
|
53332
|
+
if (this.attempts >= this.maxAttempts) {
|
|
52332
53333
|
callback(false);
|
|
52333
53334
|
return;
|
|
52334
53335
|
}
|
|
@@ -52472,8 +53473,7 @@ var require_retrying_call = __commonJS({
|
|
|
52472
53473
|
if (!this.callConfig.methodConfig.hedgingPolicy) {
|
|
52473
53474
|
return;
|
|
52474
53475
|
}
|
|
52475
|
-
|
|
52476
|
-
if (this.attempts >= Math.min(hedgingPolicy.maxAttempts, 5)) {
|
|
53476
|
+
if (this.attempts >= this.maxAttempts) {
|
|
52477
53477
|
return;
|
|
52478
53478
|
}
|
|
52479
53479
|
this.attempts += 1;
|
|
@@ -52492,7 +53492,7 @@ var require_retrying_call = __commonJS({
|
|
|
52492
53492
|
return;
|
|
52493
53493
|
}
|
|
52494
53494
|
const hedgingPolicy = this.callConfig.methodConfig.hedgingPolicy;
|
|
52495
|
-
if (this.attempts >=
|
|
53495
|
+
if (this.attempts >= this.maxAttempts) {
|
|
52496
53496
|
return;
|
|
52497
53497
|
}
|
|
52498
53498
|
const hedgingDelayString = (_a = hedgingPolicy.hedgingDelay) !== null && _a !== void 0 ? _a : "0s";
|
|
@@ -52509,7 +53509,8 @@ var require_retrying_call = __commonJS({
|
|
|
52509
53509
|
this.underlyingCalls.push({
|
|
52510
53510
|
state: "ACTIVE",
|
|
52511
53511
|
call: child,
|
|
52512
|
-
nextMessageToSend: 0
|
|
53512
|
+
nextMessageToSend: 0,
|
|
53513
|
+
startTime: /* @__PURE__ */ new Date()
|
|
52513
53514
|
});
|
|
52514
53515
|
const previousAttempts = this.attempts - 1;
|
|
52515
53516
|
const initialMetadata = this.initialMetadata.clone();
|
|
@@ -52755,12 +53756,12 @@ var require_internal_channel = __commonJS({
|
|
|
52755
53756
|
var resolving_load_balancer_1 = require_resolving_load_balancer();
|
|
52756
53757
|
var subchannel_pool_1 = require_subchannel_pool();
|
|
52757
53758
|
var picker_1 = require_picker();
|
|
53759
|
+
var metadata_1 = require_metadata();
|
|
52758
53760
|
var constants_1 = require_constants8();
|
|
52759
53761
|
var filter_stack_1 = require_filter_stack();
|
|
52760
53762
|
var compression_filter_1 = require_compression_filter();
|
|
52761
53763
|
var resolver_1 = require_resolver();
|
|
52762
53764
|
var logging_1 = require_logging();
|
|
52763
|
-
var max_message_size_filter_1 = require_max_message_size_filter();
|
|
52764
53765
|
var http_proxy_1 = require_http_proxy();
|
|
52765
53766
|
var uri_parser_1 = require_uri_parser();
|
|
52766
53767
|
var connectivity_state_1 = require_connectivity_state();
|
|
@@ -52801,6 +53802,21 @@ var require_internal_channel = __commonJS({
|
|
|
52801
53802
|
}
|
|
52802
53803
|
}
|
|
52803
53804
|
};
|
|
53805
|
+
var ShutdownPicker = class {
|
|
53806
|
+
pick(pickArgs) {
|
|
53807
|
+
return {
|
|
53808
|
+
pickResultType: picker_1.PickResultType.DROP,
|
|
53809
|
+
status: {
|
|
53810
|
+
code: constants_1.Status.UNAVAILABLE,
|
|
53811
|
+
details: "Channel closed before call started",
|
|
53812
|
+
metadata: new metadata_1.Metadata()
|
|
53813
|
+
},
|
|
53814
|
+
subchannel: null,
|
|
53815
|
+
onCallStarted: null,
|
|
53816
|
+
onCallEnded: null
|
|
53817
|
+
};
|
|
53818
|
+
}
|
|
53819
|
+
};
|
|
52804
53820
|
var InternalChannel = class {
|
|
52805
53821
|
constructor(target, credentials, options) {
|
|
52806
53822
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -52941,12 +53957,13 @@ var require_internal_channel = __commonJS({
|
|
|
52941
53957
|
}
|
|
52942
53958
|
});
|
|
52943
53959
|
this.filterStackFactory = new filter_stack_1.FilterStackFactory([
|
|
52944
|
-
new max_message_size_filter_1.MaxMessageSizeFilterFactory(this.options),
|
|
52945
53960
|
new compression_filter_1.CompressionFilterFactory(this, this.options)
|
|
52946
53961
|
]);
|
|
52947
53962
|
this.trace("Channel constructed with options " + JSON.stringify(options, void 0, 2));
|
|
52948
53963
|
const error = new Error();
|
|
52949
|
-
(0, logging_1.
|
|
53964
|
+
if ((0, logging_1.isTracerEnabled)("channel_stacktrace")) {
|
|
53965
|
+
(0, logging_1.trace)(constants_1.LogVerbosity.DEBUG, "channel_stacktrace", "(" + this.channelzRef.id + ") Channel constructed \n" + ((_h = error.stack) === null || _h === void 0 ? void 0 : _h.substring(error.stack.indexOf("\n") + 1)));
|
|
53966
|
+
}
|
|
52950
53967
|
this.lastActivityTimestamp = /* @__PURE__ */ new Date();
|
|
52951
53968
|
}
|
|
52952
53969
|
getChannelzInfo() {
|
|
@@ -53023,7 +54040,9 @@ var require_internal_channel = __commonJS({
|
|
|
53023
54040
|
this.callRefTimerRef();
|
|
53024
54041
|
}
|
|
53025
54042
|
getConfig(method, metadata) {
|
|
53026
|
-
this.
|
|
54043
|
+
if (this.connectivityState !== connectivity_state_1.ConnectivityState.SHUTDOWN) {
|
|
54044
|
+
this.resolvingLoadBalancer.exitIdle();
|
|
54045
|
+
}
|
|
53027
54046
|
if (this.configSelector) {
|
|
53028
54047
|
return {
|
|
53029
54048
|
type: "SUCCESS",
|
|
@@ -53132,6 +54151,15 @@ var require_internal_channel = __commonJS({
|
|
|
53132
54151
|
close() {
|
|
53133
54152
|
this.resolvingLoadBalancer.destroy();
|
|
53134
54153
|
this.updateState(connectivity_state_1.ConnectivityState.SHUTDOWN);
|
|
54154
|
+
this.currentPicker = new ShutdownPicker();
|
|
54155
|
+
for (const call of this.configSelectionQueue) {
|
|
54156
|
+
call.cancelWithStatus(constants_1.Status.UNAVAILABLE, "Channel closed before call started");
|
|
54157
|
+
}
|
|
54158
|
+
this.configSelectionQueue = [];
|
|
54159
|
+
for (const call of this.pickQueue) {
|
|
54160
|
+
call.cancelWithStatus(constants_1.Status.UNAVAILABLE, "Channel closed before call started");
|
|
54161
|
+
}
|
|
54162
|
+
this.pickQueue = [];
|
|
53135
54163
|
clearInterval(this.callRefTimer);
|
|
53136
54164
|
if (this.idleTimer) {
|
|
53137
54165
|
clearTimeout(this.idleTimer);
|
|
@@ -53197,6 +54225,9 @@ var require_internal_channel = __commonJS({
|
|
|
53197
54225
|
}
|
|
53198
54226
|
return this.createResolvingCall(method, deadline, host, parentCall, propagateFlags);
|
|
53199
54227
|
}
|
|
54228
|
+
getOptions() {
|
|
54229
|
+
return this.options;
|
|
54230
|
+
}
|
|
53200
54231
|
};
|
|
53201
54232
|
exports2.InternalChannel = InternalChannel;
|
|
53202
54233
|
}
|
|
@@ -53306,6 +54337,9 @@ var require_server_call = __commonJS({
|
|
|
53306
54337
|
getPath() {
|
|
53307
54338
|
return this.path;
|
|
53308
54339
|
}
|
|
54340
|
+
getHost() {
|
|
54341
|
+
return this.call.getHost();
|
|
54342
|
+
}
|
|
53309
54343
|
};
|
|
53310
54344
|
exports2.ServerUnaryCallImpl = ServerUnaryCallImpl;
|
|
53311
54345
|
var ServerReadableStreamImpl = class extends stream_1.Readable {
|
|
@@ -53331,6 +54365,9 @@ var require_server_call = __commonJS({
|
|
|
53331
54365
|
getPath() {
|
|
53332
54366
|
return this.path;
|
|
53333
54367
|
}
|
|
54368
|
+
getHost() {
|
|
54369
|
+
return this.call.getHost();
|
|
54370
|
+
}
|
|
53334
54371
|
};
|
|
53335
54372
|
exports2.ServerReadableStreamImpl = ServerReadableStreamImpl;
|
|
53336
54373
|
var ServerWritableStreamImpl = class extends stream_1.Writable {
|
|
@@ -53363,13 +54400,16 @@ var require_server_call = __commonJS({
|
|
|
53363
54400
|
getPath() {
|
|
53364
54401
|
return this.path;
|
|
53365
54402
|
}
|
|
54403
|
+
getHost() {
|
|
54404
|
+
return this.call.getHost();
|
|
54405
|
+
}
|
|
53366
54406
|
_write(chunk, encoding, callback) {
|
|
53367
54407
|
this.call.sendMessage(chunk, callback);
|
|
53368
54408
|
}
|
|
53369
54409
|
_final(callback) {
|
|
53370
54410
|
var _a;
|
|
53371
|
-
this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata }));
|
|
53372
54411
|
callback(null);
|
|
54412
|
+
this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata }));
|
|
53373
54413
|
}
|
|
53374
54414
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53375
54415
|
end(metadata) {
|
|
@@ -53409,6 +54449,9 @@ var require_server_call = __commonJS({
|
|
|
53409
54449
|
getPath() {
|
|
53410
54450
|
return this.path;
|
|
53411
54451
|
}
|
|
54452
|
+
getHost() {
|
|
54453
|
+
return this.call.getHost();
|
|
54454
|
+
}
|
|
53412
54455
|
_read(size) {
|
|
53413
54456
|
this.call.startRead();
|
|
53414
54457
|
}
|
|
@@ -53417,8 +54460,8 @@ var require_server_call = __commonJS({
|
|
|
53417
54460
|
}
|
|
53418
54461
|
_final(callback) {
|
|
53419
54462
|
var _a;
|
|
53420
|
-
this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata }));
|
|
53421
54463
|
callback(null);
|
|
54464
|
+
this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata }));
|
|
53422
54465
|
}
|
|
53423
54466
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53424
54467
|
end(metadata) {
|
|
@@ -53437,9 +54480,35 @@ var require_server_credentials = __commonJS({
|
|
|
53437
54480
|
"node_modules/@grpc/grpc-js/build/src/server-credentials.js"(exports2) {
|
|
53438
54481
|
"use strict";
|
|
53439
54482
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
53440
|
-
exports2.ServerCredentials = void 0;
|
|
54483
|
+
exports2.createServerCredentialsWithInterceptors = exports2.ServerCredentials = void 0;
|
|
53441
54484
|
var tls_helpers_1 = require_tls_helpers();
|
|
53442
54485
|
var ServerCredentials = class {
|
|
54486
|
+
constructor() {
|
|
54487
|
+
this.watchers = /* @__PURE__ */ new Set();
|
|
54488
|
+
this.latestContextOptions = null;
|
|
54489
|
+
}
|
|
54490
|
+
_addWatcher(watcher) {
|
|
54491
|
+
this.watchers.add(watcher);
|
|
54492
|
+
}
|
|
54493
|
+
_removeWatcher(watcher) {
|
|
54494
|
+
this.watchers.delete(watcher);
|
|
54495
|
+
}
|
|
54496
|
+
updateSecureContextOptions(options) {
|
|
54497
|
+
if (options) {
|
|
54498
|
+
this.latestContextOptions = options;
|
|
54499
|
+
} else {
|
|
54500
|
+
this.latestContextOptions = null;
|
|
54501
|
+
}
|
|
54502
|
+
for (const watcher of this.watchers) {
|
|
54503
|
+
watcher(this.latestContextOptions);
|
|
54504
|
+
}
|
|
54505
|
+
}
|
|
54506
|
+
_getSettings() {
|
|
54507
|
+
return this.latestContextOptions;
|
|
54508
|
+
}
|
|
54509
|
+
_getInterceptors() {
|
|
54510
|
+
return [];
|
|
54511
|
+
}
|
|
53443
54512
|
static createInsecure() {
|
|
53444
54513
|
return new InsecureServerCredentials();
|
|
53445
54514
|
}
|
|
@@ -53574,6 +54643,46 @@ var require_server_credentials = __commonJS({
|
|
|
53574
54643
|
return true;
|
|
53575
54644
|
}
|
|
53576
54645
|
};
|
|
54646
|
+
var InterceptorServerCredentials = class _InterceptorServerCredentials extends ServerCredentials {
|
|
54647
|
+
constructor(childCredentials, interceptors) {
|
|
54648
|
+
super();
|
|
54649
|
+
this.childCredentials = childCredentials;
|
|
54650
|
+
this.interceptors = interceptors;
|
|
54651
|
+
}
|
|
54652
|
+
_isSecure() {
|
|
54653
|
+
return this.childCredentials._isSecure();
|
|
54654
|
+
}
|
|
54655
|
+
_equals(other) {
|
|
54656
|
+
if (!(other instanceof _InterceptorServerCredentials)) {
|
|
54657
|
+
return false;
|
|
54658
|
+
}
|
|
54659
|
+
if (!this.childCredentials._equals(other.childCredentials)) {
|
|
54660
|
+
return false;
|
|
54661
|
+
}
|
|
54662
|
+
if (this.interceptors.length !== other.interceptors.length) {
|
|
54663
|
+
return false;
|
|
54664
|
+
}
|
|
54665
|
+
for (let i = 0; i < this.interceptors.length; i++) {
|
|
54666
|
+
if (this.interceptors[i] !== other.interceptors[i]) {
|
|
54667
|
+
return false;
|
|
54668
|
+
}
|
|
54669
|
+
}
|
|
54670
|
+
return true;
|
|
54671
|
+
}
|
|
54672
|
+
_getInterceptors() {
|
|
54673
|
+
return this.interceptors;
|
|
54674
|
+
}
|
|
54675
|
+
_addWatcher(watcher) {
|
|
54676
|
+
this.childCredentials._addWatcher(watcher);
|
|
54677
|
+
}
|
|
54678
|
+
_removeWatcher(watcher) {
|
|
54679
|
+
this.childCredentials._removeWatcher(watcher);
|
|
54680
|
+
}
|
|
54681
|
+
};
|
|
54682
|
+
function createServerCredentialsWithInterceptors(credentials, interceptors) {
|
|
54683
|
+
return new InterceptorServerCredentials(credentials, interceptors);
|
|
54684
|
+
}
|
|
54685
|
+
exports2.createServerCredentialsWithInterceptors = createServerCredentialsWithInterceptors;
|
|
53577
54686
|
}
|
|
53578
54687
|
});
|
|
53579
54688
|
|
|
@@ -53588,11 +54697,8 @@ var require_server_interceptors = __commonJS({
|
|
|
53588
54697
|
var http2 = __require("http2");
|
|
53589
54698
|
var error_1 = require_error();
|
|
53590
54699
|
var zlib = __require("zlib");
|
|
53591
|
-
var util_1 = __require("util");
|
|
53592
54700
|
var stream_decoder_1 = require_stream_decoder();
|
|
53593
54701
|
var logging = require_logging();
|
|
53594
|
-
var unzip = (0, util_1.promisify)(zlib.unzip);
|
|
53595
|
-
var inflate = (0, util_1.promisify)(zlib.inflate);
|
|
53596
54702
|
var TRACER_NAME = "server_call";
|
|
53597
54703
|
function trace(text) {
|
|
53598
54704
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text);
|
|
@@ -53775,13 +54881,19 @@ var require_server_interceptors = __commonJS({
|
|
|
53775
54881
|
};
|
|
53776
54882
|
var ServerInterceptingCall = class {
|
|
53777
54883
|
constructor(nextCall, responder) {
|
|
54884
|
+
var _a, _b, _c, _d;
|
|
53778
54885
|
this.nextCall = nextCall;
|
|
53779
54886
|
this.processingMetadata = false;
|
|
53780
54887
|
this.processingMessage = false;
|
|
53781
54888
|
this.pendingMessage = null;
|
|
53782
54889
|
this.pendingMessageCallback = null;
|
|
53783
54890
|
this.pendingStatus = null;
|
|
53784
|
-
this.responder =
|
|
54891
|
+
this.responder = {
|
|
54892
|
+
start: (_a = responder === null || responder === void 0 ? void 0 : responder.start) !== null && _a !== void 0 ? _a : defaultResponder.start,
|
|
54893
|
+
sendMetadata: (_b = responder === null || responder === void 0 ? void 0 : responder.sendMetadata) !== null && _b !== void 0 ? _b : defaultResponder.sendMetadata,
|
|
54894
|
+
sendMessage: (_c = responder === null || responder === void 0 ? void 0 : responder.sendMessage) !== null && _c !== void 0 ? _c : defaultResponder.sendMessage,
|
|
54895
|
+
sendStatus: (_d = responder === null || responder === void 0 ? void 0 : responder.sendStatus) !== null && _d !== void 0 ? _d : defaultResponder.sendStatus
|
|
54896
|
+
};
|
|
53785
54897
|
}
|
|
53786
54898
|
processPendingMessage() {
|
|
53787
54899
|
if (this.pendingMessageCallback) {
|
|
@@ -53798,7 +54910,13 @@ var require_server_interceptors = __commonJS({
|
|
|
53798
54910
|
}
|
|
53799
54911
|
start(listener) {
|
|
53800
54912
|
this.responder.start((interceptedListener) => {
|
|
53801
|
-
|
|
54913
|
+
var _a, _b, _c, _d;
|
|
54914
|
+
const fullInterceptedListener = {
|
|
54915
|
+
onReceiveMetadata: (_a = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveMetadata) !== null && _a !== void 0 ? _a : defaultServerListener.onReceiveMetadata,
|
|
54916
|
+
onReceiveMessage: (_b = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveMessage) !== null && _b !== void 0 ? _b : defaultServerListener.onReceiveMessage,
|
|
54917
|
+
onReceiveHalfClose: (_c = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveHalfClose) !== null && _c !== void 0 ? _c : defaultServerListener.onReceiveHalfClose,
|
|
54918
|
+
onCancel: (_d = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onCancel) !== null && _d !== void 0 ? _d : defaultServerListener.onCancel
|
|
54919
|
+
};
|
|
53802
54920
|
const finalInterceptingListener = new InterceptingServerListenerImpl(fullInterceptedListener, listener);
|
|
53803
54921
|
this.nextCall.start(finalInterceptingListener);
|
|
53804
54922
|
});
|
|
@@ -53842,6 +54960,9 @@ var require_server_interceptors = __commonJS({
|
|
|
53842
54960
|
getDeadline() {
|
|
53843
54961
|
return this.nextCall.getDeadline();
|
|
53844
54962
|
}
|
|
54963
|
+
getHost() {
|
|
54964
|
+
return this.nextCall.getHost();
|
|
54965
|
+
}
|
|
53845
54966
|
};
|
|
53846
54967
|
exports2.ServerInterceptingCall = ServerInterceptingCall;
|
|
53847
54968
|
var GRPC_ACCEPT_ENCODING_HEADER = "grpc-accept-encoding";
|
|
@@ -53873,6 +54994,7 @@ var require_server_interceptors = __commonJS({
|
|
|
53873
54994
|
};
|
|
53874
54995
|
var BaseServerInterceptingCall = class {
|
|
53875
54996
|
constructor(stream, headers, callEventTracker, handler, options) {
|
|
54997
|
+
var _a;
|
|
53876
54998
|
this.stream = stream;
|
|
53877
54999
|
this.callEventTracker = callEventTracker;
|
|
53878
55000
|
this.handler = handler;
|
|
@@ -53886,7 +55008,6 @@ var require_server_interceptors = __commonJS({
|
|
|
53886
55008
|
this.wantTrailers = false;
|
|
53887
55009
|
this.cancelNotified = false;
|
|
53888
55010
|
this.incomingEncoding = "identity";
|
|
53889
|
-
this.decoder = new stream_decoder_1.StreamDecoder();
|
|
53890
55011
|
this.readQueue = [];
|
|
53891
55012
|
this.isReadPending = false;
|
|
53892
55013
|
this.receivedHalfClose = false;
|
|
@@ -53894,8 +55015,8 @@ var require_server_interceptors = __commonJS({
|
|
|
53894
55015
|
this.stream.once("error", (err) => {
|
|
53895
55016
|
});
|
|
53896
55017
|
this.stream.once("close", () => {
|
|
53897
|
-
var
|
|
53898
|
-
trace("Request to method " + ((
|
|
55018
|
+
var _a2;
|
|
55019
|
+
trace("Request to method " + ((_a2 = this.handler) === null || _a2 === void 0 ? void 0 : _a2.path) + " stream closed with rstCode " + this.stream.rstCode);
|
|
53899
55020
|
if (this.callEventTracker && !this.streamEnded) {
|
|
53900
55021
|
this.streamEnded = true;
|
|
53901
55022
|
this.callEventTracker.onStreamEnd(false);
|
|
@@ -53920,6 +55041,8 @@ var require_server_interceptors = __commonJS({
|
|
|
53920
55041
|
if ("grpc.max_receive_message_length" in options) {
|
|
53921
55042
|
this.maxReceiveMessageSize = options["grpc.max_receive_message_length"];
|
|
53922
55043
|
}
|
|
55044
|
+
this.host = (_a = headers[":authority"]) !== null && _a !== void 0 ? _a : headers.host;
|
|
55045
|
+
this.decoder = new stream_decoder_1.StreamDecoder(this.maxReceiveMessageSize);
|
|
53923
55046
|
const metadata = metadata_1.Metadata.fromHttp2Headers(headers);
|
|
53924
55047
|
if (logging.isTracerEnabled(TRACER_NAME)) {
|
|
53925
55048
|
trace("Request to " + this.handler.path + " received headers " + JSON.stringify(metadata.toJSON()));
|
|
@@ -54012,18 +55135,41 @@ var require_server_interceptors = __commonJS({
|
|
|
54012
55135
|
return output;
|
|
54013
55136
|
}
|
|
54014
55137
|
decompressMessage(message, encoding) {
|
|
54015
|
-
|
|
54016
|
-
|
|
54017
|
-
|
|
54018
|
-
|
|
54019
|
-
|
|
54020
|
-
|
|
54021
|
-
|
|
54022
|
-
|
|
54023
|
-
|
|
54024
|
-
|
|
54025
|
-
|
|
55138
|
+
const messageContents = message.subarray(5);
|
|
55139
|
+
if (encoding === "identity") {
|
|
55140
|
+
return messageContents;
|
|
55141
|
+
} else if (encoding === "deflate" || encoding === "gzip") {
|
|
55142
|
+
let decompresser;
|
|
55143
|
+
if (encoding === "deflate") {
|
|
55144
|
+
decompresser = zlib.createInflate();
|
|
55145
|
+
} else {
|
|
55146
|
+
decompresser = zlib.createGunzip();
|
|
55147
|
+
}
|
|
55148
|
+
return new Promise((resolve, reject) => {
|
|
55149
|
+
let totalLength = 0;
|
|
55150
|
+
const messageParts = [];
|
|
55151
|
+
decompresser.on("data", (chunk) => {
|
|
55152
|
+
messageParts.push(chunk);
|
|
55153
|
+
totalLength += chunk.byteLength;
|
|
55154
|
+
if (this.maxReceiveMessageSize !== -1 && totalLength > this.maxReceiveMessageSize) {
|
|
55155
|
+
decompresser.destroy();
|
|
55156
|
+
reject({
|
|
55157
|
+
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
55158
|
+
details: `Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`
|
|
55159
|
+
});
|
|
55160
|
+
}
|
|
55161
|
+
});
|
|
55162
|
+
decompresser.on("end", () => {
|
|
55163
|
+
resolve(Buffer.concat(messageParts));
|
|
54026
55164
|
});
|
|
55165
|
+
decompresser.write(messageContents);
|
|
55166
|
+
decompresser.end();
|
|
55167
|
+
});
|
|
55168
|
+
} else {
|
|
55169
|
+
return Promise.reject({
|
|
55170
|
+
code: constants_1.Status.UNIMPLEMENTED,
|
|
55171
|
+
details: `Received message compressed with unsupported encoding "${encoding}"`
|
|
55172
|
+
});
|
|
54027
55173
|
}
|
|
54028
55174
|
}
|
|
54029
55175
|
async decompressAndMaybePush(queueEntry) {
|
|
@@ -54032,7 +55178,13 @@ var require_server_interceptors = __commonJS({
|
|
|
54032
55178
|
}
|
|
54033
55179
|
const compressed = queueEntry.compressedMessage.readUInt8(0) === 1;
|
|
54034
55180
|
const compressedMessageEncoding = compressed ? this.incomingEncoding : "identity";
|
|
54035
|
-
|
|
55181
|
+
let decompressedMessage;
|
|
55182
|
+
try {
|
|
55183
|
+
decompressedMessage = await this.decompressMessage(queueEntry.compressedMessage, compressedMessageEncoding);
|
|
55184
|
+
} catch (err) {
|
|
55185
|
+
this.sendStatus(err);
|
|
55186
|
+
return;
|
|
55187
|
+
}
|
|
54036
55188
|
try {
|
|
54037
55189
|
queueEntry.parsedMessage = this.handler.deserialize(decompressedMessage);
|
|
54038
55190
|
} catch (err) {
|
|
@@ -54062,17 +55214,15 @@ var require_server_interceptors = __commonJS({
|
|
|
54062
55214
|
return;
|
|
54063
55215
|
}
|
|
54064
55216
|
trace("Request to " + this.handler.path + " received data frame of size " + data.length);
|
|
54065
|
-
|
|
55217
|
+
let rawMessages;
|
|
55218
|
+
try {
|
|
55219
|
+
rawMessages = this.decoder.write(data);
|
|
55220
|
+
} catch (e) {
|
|
55221
|
+
this.sendStatus({ code: constants_1.Status.RESOURCE_EXHAUSTED, details: e.message });
|
|
55222
|
+
return;
|
|
55223
|
+
}
|
|
54066
55224
|
for (const messageBytes of rawMessages) {
|
|
54067
55225
|
this.stream.pause();
|
|
54068
|
-
if (this.maxReceiveMessageSize !== -1 && messageBytes.length - 5 > this.maxReceiveMessageSize) {
|
|
54069
|
-
this.sendStatus({
|
|
54070
|
-
code: constants_1.Status.RESOURCE_EXHAUSTED,
|
|
54071
|
-
details: `Received message larger than max (${messageBytes.length - 5} vs. ${this.maxReceiveMessageSize})`,
|
|
54072
|
-
metadata: null
|
|
54073
|
-
});
|
|
54074
|
-
return;
|
|
54075
|
-
}
|
|
54076
55226
|
const queueEntry = {
|
|
54077
55227
|
type: "COMPRESSED",
|
|
54078
55228
|
compressedMessage: messageBytes,
|
|
@@ -54156,9 +55306,8 @@ var require_server_interceptors = __commonJS({
|
|
|
54156
55306
|
if (this.checkCancelled()) {
|
|
54157
55307
|
return;
|
|
54158
55308
|
}
|
|
54159
|
-
this.notifyOnCancel();
|
|
54160
55309
|
trace("Request to method " + ((_a = this.handler) === null || _a === void 0 ? void 0 : _a.path) + " ended with status code: " + constants_1.Status[status.code] + " details: " + status.details);
|
|
54161
|
-
if (this.
|
|
55310
|
+
if (this.metadataSent) {
|
|
54162
55311
|
if (!this.wantTrailers) {
|
|
54163
55312
|
this.wantTrailers = true;
|
|
54164
55313
|
this.stream.once("wantTrailers", () => {
|
|
@@ -54170,8 +55319,11 @@ var require_server_interceptors = __commonJS({
|
|
|
54170
55319
|
}
|
|
54171
55320
|
const trailersToSend = Object.assign({ [GRPC_STATUS_HEADER]: status.code, [GRPC_MESSAGE_HEADER]: encodeURI(status.details) }, (_a2 = status.metadata) === null || _a2 === void 0 ? void 0 : _a2.toHttp2Headers());
|
|
54172
55321
|
this.stream.sendTrailers(trailersToSend);
|
|
55322
|
+
this.notifyOnCancel();
|
|
54173
55323
|
});
|
|
54174
55324
|
this.stream.end();
|
|
55325
|
+
} else {
|
|
55326
|
+
this.notifyOnCancel();
|
|
54175
55327
|
}
|
|
54176
55328
|
} else {
|
|
54177
55329
|
if (this.callEventTracker && !this.streamEnded) {
|
|
@@ -54181,6 +55333,7 @@ var require_server_interceptors = __commonJS({
|
|
|
54181
55333
|
}
|
|
54182
55334
|
const trailersToSend = Object.assign(Object.assign({ [GRPC_STATUS_HEADER]: status.code, [GRPC_MESSAGE_HEADER]: encodeURI(status.details) }, defaultResponseHeaders), (_b = status.metadata) === null || _b === void 0 ? void 0 : _b.toHttp2Headers());
|
|
54183
55335
|
this.stream.respond(trailersToSend, { endStream: true });
|
|
55336
|
+
this.notifyOnCancel();
|
|
54184
55337
|
}
|
|
54185
55338
|
}
|
|
54186
55339
|
startRead() {
|
|
@@ -54213,6 +55366,9 @@ var require_server_interceptors = __commonJS({
|
|
|
54213
55366
|
getDeadline() {
|
|
54214
55367
|
return this.deadline;
|
|
54215
55368
|
}
|
|
55369
|
+
getHost() {
|
|
55370
|
+
return this.host;
|
|
55371
|
+
}
|
|
54216
55372
|
};
|
|
54217
55373
|
exports2.BaseServerInterceptingCall = BaseServerInterceptingCall;
|
|
54218
55374
|
function getServerInterceptingCall(interceptors, stream, headers, callEventTracker, handler, options) {
|
|
@@ -54291,8 +55447,10 @@ var require_server = __commonJS({
|
|
|
54291
55447
|
var UNLIMITED_CONNECTION_AGE_MS = ~(1 << 31);
|
|
54292
55448
|
var KEEPALIVE_MAX_TIME_MS = ~(1 << 31);
|
|
54293
55449
|
var KEEPALIVE_TIMEOUT_MS = 2e4;
|
|
55450
|
+
var MAX_CONNECTION_IDLE_MS = ~(1 << 31);
|
|
54294
55451
|
var { HTTP2_HEADER_PATH } = http2.constants;
|
|
54295
55452
|
var TRACER_NAME = "server";
|
|
55453
|
+
var kMaxAge = Buffer.from("max_age");
|
|
54296
55454
|
function noop() {
|
|
54297
55455
|
}
|
|
54298
55456
|
function deprecate(message) {
|
|
@@ -54335,31 +55493,36 @@ var require_server = __commonJS({
|
|
|
54335
55493
|
let _start_decorators;
|
|
54336
55494
|
return _a = class Server {
|
|
54337
55495
|
constructor(options) {
|
|
54338
|
-
var _b, _c, _d, _e, _f;
|
|
55496
|
+
var _b, _c, _d, _e, _f, _g;
|
|
54339
55497
|
this.boundPorts = (__runInitializers(this, _instanceExtraInitializers), /* @__PURE__ */ new Map());
|
|
54340
55498
|
this.http2Servers = /* @__PURE__ */ new Map();
|
|
55499
|
+
this.sessionIdleTimeouts = /* @__PURE__ */ new Map();
|
|
54341
55500
|
this.handlers = /* @__PURE__ */ new Map();
|
|
54342
55501
|
this.sessions = /* @__PURE__ */ new Map();
|
|
54343
55502
|
this.started = false;
|
|
54344
55503
|
this.shutdown = false;
|
|
54345
55504
|
this.serverAddressString = "null";
|
|
54346
55505
|
this.channelzEnabled = true;
|
|
54347
|
-
this.channelzTrace = new channelz_1.ChannelzTrace();
|
|
54348
|
-
this.callTracker = new channelz_1.ChannelzCallTracker();
|
|
54349
|
-
this.listenerChildrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
54350
|
-
this.sessionChildrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
54351
55506
|
this.options = options !== null && options !== void 0 ? options : {};
|
|
54352
55507
|
if (this.options["grpc.enable_channelz"] === 0) {
|
|
54353
55508
|
this.channelzEnabled = false;
|
|
55509
|
+
this.channelzTrace = new channelz_1.ChannelzTraceStub();
|
|
55510
|
+
this.callTracker = new channelz_1.ChannelzCallTrackerStub();
|
|
55511
|
+
this.listenerChildrenTracker = new channelz_1.ChannelzChildrenTrackerStub();
|
|
55512
|
+
this.sessionChildrenTracker = new channelz_1.ChannelzChildrenTrackerStub();
|
|
55513
|
+
} else {
|
|
55514
|
+
this.channelzTrace = new channelz_1.ChannelzTrace();
|
|
55515
|
+
this.callTracker = new channelz_1.ChannelzCallTracker();
|
|
55516
|
+
this.listenerChildrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
55517
|
+
this.sessionChildrenTracker = new channelz_1.ChannelzChildrenTracker();
|
|
54354
55518
|
}
|
|
54355
|
-
this.channelzRef = (0, channelz_1.registerChannelzServer)(() => this.getChannelzInfo(), this.channelzEnabled);
|
|
54356
|
-
|
|
54357
|
-
this.channelzTrace.addTrace("CT_INFO", "Server created");
|
|
54358
|
-
}
|
|
55519
|
+
this.channelzRef = (0, channelz_1.registerChannelzServer)("server", () => this.getChannelzInfo(), this.channelzEnabled);
|
|
55520
|
+
this.channelzTrace.addTrace("CT_INFO", "Server created");
|
|
54359
55521
|
this.maxConnectionAgeMs = (_b = this.options["grpc.max_connection_age_ms"]) !== null && _b !== void 0 ? _b : UNLIMITED_CONNECTION_AGE_MS;
|
|
54360
55522
|
this.maxConnectionAgeGraceMs = (_c = this.options["grpc.max_connection_age_grace_ms"]) !== null && _c !== void 0 ? _c : UNLIMITED_CONNECTION_AGE_MS;
|
|
54361
55523
|
this.keepaliveTimeMs = (_d = this.options["grpc.keepalive_time_ms"]) !== null && _d !== void 0 ? _d : KEEPALIVE_MAX_TIME_MS;
|
|
54362
55524
|
this.keepaliveTimeoutMs = (_e = this.options["grpc.keepalive_timeout_ms"]) !== null && _e !== void 0 ? _e : KEEPALIVE_TIMEOUT_MS;
|
|
55525
|
+
this.sessionIdleTimeout = (_f = this.options["grpc.max_connection_idle_ms"]) !== null && _f !== void 0 ? _f : MAX_CONNECTION_IDLE_MS;
|
|
54363
55526
|
this.commonServerOptions = {
|
|
54364
55527
|
maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER
|
|
54365
55528
|
};
|
|
@@ -54373,7 +55536,7 @@ var require_server = __commonJS({
|
|
|
54373
55536
|
maxConcurrentStreams: this.options["grpc.max_concurrent_streams"]
|
|
54374
55537
|
};
|
|
54375
55538
|
}
|
|
54376
|
-
this.interceptors = (
|
|
55539
|
+
this.interceptors = (_g = this.options.interceptors) !== null && _g !== void 0 ? _g : [];
|
|
54377
55540
|
this.trace("Server constructed");
|
|
54378
55541
|
}
|
|
54379
55542
|
getChannelzInfo() {
|
|
@@ -54384,52 +55547,53 @@ var require_server = __commonJS({
|
|
|
54384
55547
|
sessionChildren: this.sessionChildrenTracker.getChildLists()
|
|
54385
55548
|
};
|
|
54386
55549
|
}
|
|
54387
|
-
|
|
54388
|
-
|
|
54389
|
-
|
|
54390
|
-
|
|
54391
|
-
|
|
54392
|
-
|
|
54393
|
-
|
|
54394
|
-
|
|
54395
|
-
|
|
54396
|
-
|
|
54397
|
-
|
|
54398
|
-
|
|
54399
|
-
|
|
54400
|
-
|
|
54401
|
-
|
|
54402
|
-
|
|
54403
|
-
|
|
54404
|
-
remoteCertificate: peerCertificate && "raw" in peerCertificate ? peerCertificate.raw : null
|
|
54405
|
-
};
|
|
54406
|
-
} else {
|
|
54407
|
-
tlsInfo = null;
|
|
54408
|
-
}
|
|
54409
|
-
const socketInfo = {
|
|
54410
|
-
remoteAddress,
|
|
54411
|
-
localAddress,
|
|
54412
|
-
security: tlsInfo,
|
|
54413
|
-
remoteName: null,
|
|
54414
|
-
streamsStarted: sessionInfo.streamTracker.callsStarted,
|
|
54415
|
-
streamsSucceeded: sessionInfo.streamTracker.callsSucceeded,
|
|
54416
|
-
streamsFailed: sessionInfo.streamTracker.callsFailed,
|
|
54417
|
-
messagesSent: sessionInfo.messagesSent,
|
|
54418
|
-
messagesReceived: sessionInfo.messagesReceived,
|
|
54419
|
-
keepAlivesSent: 0,
|
|
54420
|
-
lastLocalStreamCreatedTimestamp: null,
|
|
54421
|
-
lastRemoteStreamCreatedTimestamp: sessionInfo.streamTracker.lastCallStartedTimestamp,
|
|
54422
|
-
lastMessageSentTimestamp: sessionInfo.lastMessageSentTimestamp,
|
|
54423
|
-
lastMessageReceivedTimestamp: sessionInfo.lastMessageReceivedTimestamp,
|
|
54424
|
-
localFlowControlWindow: (_c = session.state.localWindowSize) !== null && _c !== void 0 ? _c : null,
|
|
54425
|
-
remoteFlowControlWindow: (_d = session.state.remoteWindowSize) !== null && _d !== void 0 ? _d : null
|
|
55550
|
+
getChannelzSessionInfo(session) {
|
|
55551
|
+
var _b, _c, _d;
|
|
55552
|
+
const sessionInfo = this.sessions.get(session);
|
|
55553
|
+
const sessionSocket = session.socket;
|
|
55554
|
+
const remoteAddress = sessionSocket.remoteAddress ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.remoteAddress, sessionSocket.remotePort) : null;
|
|
55555
|
+
const localAddress = sessionSocket.localAddress ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.localAddress, sessionSocket.localPort) : null;
|
|
55556
|
+
let tlsInfo;
|
|
55557
|
+
if (session.encrypted) {
|
|
55558
|
+
const tlsSocket = sessionSocket;
|
|
55559
|
+
const cipherInfo = tlsSocket.getCipher();
|
|
55560
|
+
const certificate = tlsSocket.getCertificate();
|
|
55561
|
+
const peerCertificate = tlsSocket.getPeerCertificate();
|
|
55562
|
+
tlsInfo = {
|
|
55563
|
+
cipherSuiteStandardName: (_b = cipherInfo.standardName) !== null && _b !== void 0 ? _b : null,
|
|
55564
|
+
cipherSuiteOtherName: cipherInfo.standardName ? null : cipherInfo.name,
|
|
55565
|
+
localCertificate: certificate && "raw" in certificate ? certificate.raw : null,
|
|
55566
|
+
remoteCertificate: peerCertificate && "raw" in peerCertificate ? peerCertificate.raw : null
|
|
54426
55567
|
};
|
|
54427
|
-
|
|
55568
|
+
} else {
|
|
55569
|
+
tlsInfo = null;
|
|
55570
|
+
}
|
|
55571
|
+
const socketInfo = {
|
|
55572
|
+
remoteAddress,
|
|
55573
|
+
localAddress,
|
|
55574
|
+
security: tlsInfo,
|
|
55575
|
+
remoteName: null,
|
|
55576
|
+
streamsStarted: sessionInfo.streamTracker.callsStarted,
|
|
55577
|
+
streamsSucceeded: sessionInfo.streamTracker.callsSucceeded,
|
|
55578
|
+
streamsFailed: sessionInfo.streamTracker.callsFailed,
|
|
55579
|
+
messagesSent: sessionInfo.messagesSent,
|
|
55580
|
+
messagesReceived: sessionInfo.messagesReceived,
|
|
55581
|
+
keepAlivesSent: sessionInfo.keepAlivesSent,
|
|
55582
|
+
lastLocalStreamCreatedTimestamp: null,
|
|
55583
|
+
lastRemoteStreamCreatedTimestamp: sessionInfo.streamTracker.lastCallStartedTimestamp,
|
|
55584
|
+
lastMessageSentTimestamp: sessionInfo.lastMessageSentTimestamp,
|
|
55585
|
+
lastMessageReceivedTimestamp: sessionInfo.lastMessageReceivedTimestamp,
|
|
55586
|
+
localFlowControlWindow: (_c = session.state.localWindowSize) !== null && _c !== void 0 ? _c : null,
|
|
55587
|
+
remoteFlowControlWindow: (_d = session.state.remoteWindowSize) !== null && _d !== void 0 ? _d : null
|
|
54428
55588
|
};
|
|
55589
|
+
return socketInfo;
|
|
54429
55590
|
}
|
|
54430
55591
|
trace(text) {
|
|
54431
55592
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + text);
|
|
54432
55593
|
}
|
|
55594
|
+
keepaliveTrace(text) {
|
|
55595
|
+
logging.trace(constants_1.LogVerbosity.DEBUG, "keepalive", "(" + this.channelzRef.id + ") " + text);
|
|
55596
|
+
}
|
|
54433
55597
|
addProtoService() {
|
|
54434
55598
|
throw new Error("Not implemented. Use addService() instead");
|
|
54435
55599
|
}
|
|
@@ -54511,19 +55675,35 @@ var require_server = __commonJS({
|
|
|
54511
55675
|
createHttp2Server(credentials) {
|
|
54512
55676
|
let http2Server;
|
|
54513
55677
|
if (credentials._isSecure()) {
|
|
54514
|
-
const
|
|
54515
|
-
secureServerOptions
|
|
55678
|
+
const credentialsSettings = credentials._getSettings();
|
|
55679
|
+
const secureServerOptions = Object.assign(Object.assign(Object.assign({}, this.commonServerOptions), credentialsSettings), { enableTrace: this.options["grpc-node.tls_enable_trace"] === 1 });
|
|
55680
|
+
let areCredentialsValid = credentialsSettings !== null;
|
|
54516
55681
|
http2Server = http2.createSecureServer(secureServerOptions);
|
|
55682
|
+
http2Server.on("connection", (socket) => {
|
|
55683
|
+
if (!areCredentialsValid) {
|
|
55684
|
+
socket.destroy();
|
|
55685
|
+
}
|
|
55686
|
+
});
|
|
54517
55687
|
http2Server.on("secureConnection", (socket) => {
|
|
54518
55688
|
socket.on("error", (e) => {
|
|
54519
55689
|
this.trace("An incoming TLS connection closed with error: " + e.message);
|
|
54520
55690
|
});
|
|
54521
55691
|
});
|
|
55692
|
+
const credsWatcher = (options) => {
|
|
55693
|
+
if (options) {
|
|
55694
|
+
http2Server.setSecureContext(options);
|
|
55695
|
+
}
|
|
55696
|
+
areCredentialsValid = options !== null;
|
|
55697
|
+
};
|
|
55698
|
+
credentials._addWatcher(credsWatcher);
|
|
55699
|
+
http2Server.on("close", () => {
|
|
55700
|
+
credentials._removeWatcher(credsWatcher);
|
|
55701
|
+
});
|
|
54522
55702
|
} else {
|
|
54523
55703
|
http2Server = http2.createServer(this.commonServerOptions);
|
|
54524
55704
|
}
|
|
54525
55705
|
http2Server.setTimeout(0, noop);
|
|
54526
|
-
this._setupHandlers(http2Server);
|
|
55706
|
+
this._setupHandlers(http2Server, credentials._getInterceptors());
|
|
54527
55707
|
return http2Server;
|
|
54528
55708
|
}
|
|
54529
55709
|
bindOneAddress(address, boundPortObject) {
|
|
@@ -54552,9 +55732,7 @@ var require_server = __commonJS({
|
|
|
54552
55732
|
};
|
|
54553
55733
|
}
|
|
54554
55734
|
const channelzRef = this.registerListenerToChannelz(boundSubchannelAddress);
|
|
54555
|
-
|
|
54556
|
-
this.listenerChildrenTracker.refChild(channelzRef);
|
|
54557
|
-
}
|
|
55735
|
+
this.listenerChildrenTracker.refChild(channelzRef);
|
|
54558
55736
|
this.http2Servers.set(http2Server, {
|
|
54559
55737
|
channelzRef,
|
|
54560
55738
|
sessions: /* @__PURE__ */ new Set()
|
|
@@ -54601,12 +55779,7 @@ var require_server = __commonJS({
|
|
|
54601
55779
|
}
|
|
54602
55780
|
}
|
|
54603
55781
|
async bindAddressList(addressList, boundPortObject) {
|
|
54604
|
-
|
|
54605
|
-
try {
|
|
54606
|
-
bindResult = await this.bindManyPorts(addressList, boundPortObject);
|
|
54607
|
-
} catch (error) {
|
|
54608
|
-
throw error;
|
|
54609
|
-
}
|
|
55782
|
+
const bindResult = await this.bindManyPorts(addressList, boundPortObject);
|
|
54610
55783
|
if (bindResult.count > 0) {
|
|
54611
55784
|
if (bindResult.count < addressList.length) {
|
|
54612
55785
|
logging.log(constants_1.LogVerbosity.INFO, `WARNING Only ${bindResult.count} addresses added out of total ${addressList.length} resolved`);
|
|
@@ -54733,11 +55906,70 @@ var require_server = __commonJS({
|
|
|
54733
55906
|
});
|
|
54734
55907
|
}
|
|
54735
55908
|
}
|
|
55909
|
+
registerInjectorToChannelz() {
|
|
55910
|
+
return (0, channelz_1.registerChannelzSocket)("injector", () => {
|
|
55911
|
+
return {
|
|
55912
|
+
localAddress: null,
|
|
55913
|
+
remoteAddress: null,
|
|
55914
|
+
security: null,
|
|
55915
|
+
remoteName: null,
|
|
55916
|
+
streamsStarted: 0,
|
|
55917
|
+
streamsSucceeded: 0,
|
|
55918
|
+
streamsFailed: 0,
|
|
55919
|
+
messagesSent: 0,
|
|
55920
|
+
messagesReceived: 0,
|
|
55921
|
+
keepAlivesSent: 0,
|
|
55922
|
+
lastLocalStreamCreatedTimestamp: null,
|
|
55923
|
+
lastRemoteStreamCreatedTimestamp: null,
|
|
55924
|
+
lastMessageSentTimestamp: null,
|
|
55925
|
+
lastMessageReceivedTimestamp: null,
|
|
55926
|
+
localFlowControlWindow: null,
|
|
55927
|
+
remoteFlowControlWindow: null
|
|
55928
|
+
};
|
|
55929
|
+
}, this.channelzEnabled);
|
|
55930
|
+
}
|
|
55931
|
+
createConnectionInjector(credentials) {
|
|
55932
|
+
if (credentials === null || !(credentials instanceof server_credentials_1.ServerCredentials)) {
|
|
55933
|
+
throw new TypeError("creds must be a ServerCredentials object");
|
|
55934
|
+
}
|
|
55935
|
+
const server = this.createHttp2Server(credentials);
|
|
55936
|
+
const channelzRef = this.registerInjectorToChannelz();
|
|
55937
|
+
if (this.channelzEnabled) {
|
|
55938
|
+
this.listenerChildrenTracker.refChild(channelzRef);
|
|
55939
|
+
}
|
|
55940
|
+
const sessionsSet = /* @__PURE__ */ new Set();
|
|
55941
|
+
this.http2Servers.set(server, {
|
|
55942
|
+
channelzRef,
|
|
55943
|
+
sessions: sessionsSet
|
|
55944
|
+
});
|
|
55945
|
+
return {
|
|
55946
|
+
injectConnection: (connection) => {
|
|
55947
|
+
server.emit("connection", connection);
|
|
55948
|
+
},
|
|
55949
|
+
drain: (graceTimeMs) => {
|
|
55950
|
+
var _b, _c;
|
|
55951
|
+
for (const session of sessionsSet) {
|
|
55952
|
+
this.closeSession(session);
|
|
55953
|
+
}
|
|
55954
|
+
(_c = (_b = setTimeout(() => {
|
|
55955
|
+
for (const session of sessionsSet) {
|
|
55956
|
+
session.destroy(http2.constants.NGHTTP2_CANCEL);
|
|
55957
|
+
}
|
|
55958
|
+
}, graceTimeMs)).unref) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
55959
|
+
},
|
|
55960
|
+
destroy: () => {
|
|
55961
|
+
this.closeServer(server);
|
|
55962
|
+
for (const session of sessionsSet) {
|
|
55963
|
+
this.closeSession(session);
|
|
55964
|
+
}
|
|
55965
|
+
}
|
|
55966
|
+
};
|
|
55967
|
+
}
|
|
54736
55968
|
closeServer(server, callback) {
|
|
54737
55969
|
this.trace("Closing server with address " + JSON.stringify(server.address()));
|
|
54738
55970
|
const serverInfo = this.http2Servers.get(server);
|
|
54739
55971
|
server.close(() => {
|
|
54740
|
-
if (
|
|
55972
|
+
if (serverInfo) {
|
|
54741
55973
|
this.listenerChildrenTracker.unrefChild(serverInfo.channelzRef);
|
|
54742
55974
|
(0, channelz_1.unregisterChannelzRef)(serverInfo.channelzRef);
|
|
54743
55975
|
}
|
|
@@ -54750,15 +55982,14 @@ var require_server = __commonJS({
|
|
|
54750
55982
|
this.trace("Closing session initiated by " + ((_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress));
|
|
54751
55983
|
const sessionInfo = this.sessions.get(session);
|
|
54752
55984
|
const closeCallback = () => {
|
|
54753
|
-
if (
|
|
55985
|
+
if (sessionInfo) {
|
|
54754
55986
|
this.sessionChildrenTracker.unrefChild(sessionInfo.ref);
|
|
54755
55987
|
(0, channelz_1.unregisterChannelzRef)(sessionInfo.ref);
|
|
54756
55988
|
}
|
|
54757
|
-
this.sessions.delete(session);
|
|
54758
55989
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
54759
55990
|
};
|
|
54760
55991
|
if (session.closed) {
|
|
54761
|
-
|
|
55992
|
+
queueMicrotask(closeCallback);
|
|
54762
55993
|
} else {
|
|
54763
55994
|
session.close(closeCallback);
|
|
54764
55995
|
}
|
|
@@ -54827,14 +56058,13 @@ var require_server = __commonJS({
|
|
|
54827
56058
|
const allSessions = /* @__PURE__ */ new Set();
|
|
54828
56059
|
for (const http2Server of boundPortObject.listeningServers) {
|
|
54829
56060
|
const serverEntry = this.http2Servers.get(http2Server);
|
|
54830
|
-
if (
|
|
54831
|
-
|
|
54832
|
-
|
|
54833
|
-
|
|
54834
|
-
|
|
54835
|
-
|
|
54836
|
-
|
|
54837
|
-
});
|
|
56061
|
+
if (serverEntry) {
|
|
56062
|
+
for (const session of serverEntry.sessions) {
|
|
56063
|
+
allSessions.add(session);
|
|
56064
|
+
this.closeSession(session, () => {
|
|
56065
|
+
allSessions.delete(session);
|
|
56066
|
+
});
|
|
56067
|
+
}
|
|
54838
56068
|
}
|
|
54839
56069
|
}
|
|
54840
56070
|
(_c = (_b = setTimeout(() => {
|
|
@@ -54856,9 +56086,7 @@ var require_server = __commonJS({
|
|
|
54856
56086
|
session.destroy(http2.constants.NGHTTP2_CANCEL);
|
|
54857
56087
|
});
|
|
54858
56088
|
this.sessions.clear();
|
|
54859
|
-
|
|
54860
|
-
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
54861
|
-
}
|
|
56089
|
+
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
54862
56090
|
this.shutdown = true;
|
|
54863
56091
|
}
|
|
54864
56092
|
register(name2, handler, serialize, deserialize, type) {
|
|
@@ -54892,9 +56120,7 @@ var require_server = __commonJS({
|
|
|
54892
56120
|
tryShutdown(callback) {
|
|
54893
56121
|
var _b;
|
|
54894
56122
|
const wrappedCallback = (error) => {
|
|
54895
|
-
|
|
54896
|
-
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
54897
|
-
}
|
|
56123
|
+
(0, channelz_1.unregisterChannelzRef)(this.channelzRef);
|
|
54898
56124
|
callback(error);
|
|
54899
56125
|
};
|
|
54900
56126
|
let pendingChecks = 0;
|
|
@@ -54905,23 +56131,23 @@ var require_server = __commonJS({
|
|
|
54905
56131
|
}
|
|
54906
56132
|
}
|
|
54907
56133
|
this.shutdown = true;
|
|
54908
|
-
for (const server of this.http2Servers.
|
|
56134
|
+
for (const [serverKey, server] of this.http2Servers.entries()) {
|
|
54909
56135
|
pendingChecks++;
|
|
54910
|
-
const serverString =
|
|
56136
|
+
const serverString = server.channelzRef.name;
|
|
54911
56137
|
this.trace("Waiting for server " + serverString + " to close");
|
|
54912
|
-
this.closeServer(
|
|
56138
|
+
this.closeServer(serverKey, () => {
|
|
54913
56139
|
this.trace("Server " + serverString + " finished closing");
|
|
54914
56140
|
maybeCallback();
|
|
54915
56141
|
});
|
|
54916
|
-
|
|
54917
|
-
|
|
54918
|
-
|
|
54919
|
-
|
|
54920
|
-
|
|
54921
|
-
|
|
54922
|
-
|
|
54923
|
-
|
|
54924
|
-
}
|
|
56142
|
+
for (const session of server.sessions.keys()) {
|
|
56143
|
+
pendingChecks++;
|
|
56144
|
+
const sessionString = (_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress;
|
|
56145
|
+
this.trace("Waiting for session " + sessionString + " to close");
|
|
56146
|
+
this.closeSession(session, () => {
|
|
56147
|
+
this.trace("Session " + sessionString + " finished closing");
|
|
56148
|
+
maybeCallback();
|
|
56149
|
+
});
|
|
56150
|
+
}
|
|
54925
56151
|
}
|
|
54926
56152
|
if (pendingChecks === 0) {
|
|
54927
56153
|
wrappedCallback();
|
|
@@ -54961,12 +56187,11 @@ var require_server = __commonJS({
|
|
|
54961
56187
|
var _b, _c;
|
|
54962
56188
|
const trailersToSend = Object.assign({ "grpc-status": (_b = err.code) !== null && _b !== void 0 ? _b : constants_1.Status.INTERNAL, "grpc-message": err.details, [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_OK, [http2.constants.HTTP2_HEADER_CONTENT_TYPE]: "application/grpc+proto" }, (_c = err.metadata) === null || _c === void 0 ? void 0 : _c.toHttp2Headers());
|
|
54963
56189
|
stream.respond(trailersToSend, { endStream: true });
|
|
54964
|
-
|
|
54965
|
-
|
|
54966
|
-
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed();
|
|
54967
|
-
}
|
|
56190
|
+
this.callTracker.addCallFailed();
|
|
56191
|
+
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed();
|
|
54968
56192
|
}
|
|
54969
|
-
_channelzHandler(stream, headers) {
|
|
56193
|
+
_channelzHandler(extraInterceptors, stream, headers) {
|
|
56194
|
+
this.onStreamOpened(stream);
|
|
54970
56195
|
const channelzSessionInfo = this.sessions.get(stream.session);
|
|
54971
56196
|
this.callTracker.addCallStarted();
|
|
54972
56197
|
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallStarted();
|
|
@@ -54981,7 +56206,7 @@ var require_server = __commonJS({
|
|
|
54981
56206
|
this._respondWithError(getUnimplementedStatusResponse(path), stream, channelzSessionInfo);
|
|
54982
56207
|
return;
|
|
54983
56208
|
}
|
|
54984
|
-
|
|
56209
|
+
const callEventTracker = {
|
|
54985
56210
|
addMessageSent: () => {
|
|
54986
56211
|
if (channelzSessionInfo) {
|
|
54987
56212
|
channelzSessionInfo.messagesSent += 1;
|
|
@@ -55011,7 +56236,7 @@ var require_server = __commonJS({
|
|
|
55011
56236
|
}
|
|
55012
56237
|
}
|
|
55013
56238
|
};
|
|
55014
|
-
const call = (0, server_interceptors_1.getServerInterceptingCall)(this.interceptors, stream, headers, callEventTracker, handler, this.options);
|
|
56239
|
+
const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, callEventTracker, handler, this.options);
|
|
55015
56240
|
if (!this._runHandlerForCall(call, handler)) {
|
|
55016
56241
|
this.callTracker.addCallFailed();
|
|
55017
56242
|
channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed();
|
|
@@ -55021,7 +56246,8 @@ var require_server = __commonJS({
|
|
|
55021
56246
|
});
|
|
55022
56247
|
}
|
|
55023
56248
|
}
|
|
55024
|
-
_streamHandler(stream, headers) {
|
|
56249
|
+
_streamHandler(extraInterceptors, stream, headers) {
|
|
56250
|
+
this.onStreamOpened(stream);
|
|
55025
56251
|
if (this._verifyContentType(stream, headers) !== true) {
|
|
55026
56252
|
return;
|
|
55027
56253
|
}
|
|
@@ -55031,7 +56257,7 @@ var require_server = __commonJS({
|
|
|
55031
56257
|
this._respondWithError(getUnimplementedStatusResponse(path), stream, null);
|
|
55032
56258
|
return;
|
|
55033
56259
|
}
|
|
55034
|
-
const call = (0, server_interceptors_1.getServerInterceptingCall)(this.interceptors, stream, headers, null, handler, this.options);
|
|
56260
|
+
const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, null, handler, this.options);
|
|
55035
56261
|
if (!this._runHandlerForCall(call, handler)) {
|
|
55036
56262
|
call.sendStatus({
|
|
55037
56263
|
code: constants_1.Status.INTERNAL,
|
|
@@ -55054,7 +56280,7 @@ var require_server = __commonJS({
|
|
|
55054
56280
|
}
|
|
55055
56281
|
return true;
|
|
55056
56282
|
}
|
|
55057
|
-
_setupHandlers(http2Server) {
|
|
56283
|
+
_setupHandlers(http2Server, extraInterceptors) {
|
|
55058
56284
|
if (http2Server === null) {
|
|
55059
56285
|
return;
|
|
55060
56286
|
}
|
|
@@ -55069,90 +56295,310 @@ var require_server = __commonJS({
|
|
|
55069
56295
|
}
|
|
55070
56296
|
this.serverAddressString = serverAddressString;
|
|
55071
56297
|
const handler = this.channelzEnabled ? this._channelzHandler : this._streamHandler;
|
|
55072
|
-
|
|
55073
|
-
http2Server.on("
|
|
55074
|
-
|
|
55075
|
-
|
|
56298
|
+
const sessionHandler = this.channelzEnabled ? this._channelzSessionHandler(http2Server) : this._sessionHandler(http2Server);
|
|
56299
|
+
http2Server.on("stream", handler.bind(this, extraInterceptors));
|
|
56300
|
+
http2Server.on("session", sessionHandler);
|
|
56301
|
+
}
|
|
56302
|
+
_sessionHandler(http2Server) {
|
|
56303
|
+
return (session) => {
|
|
56304
|
+
var _b, _c;
|
|
56305
|
+
(_b = this.http2Servers.get(http2Server)) === null || _b === void 0 ? void 0 : _b.sessions.add(session);
|
|
56306
|
+
let connectionAgeTimer = null;
|
|
56307
|
+
let connectionAgeGraceTimer = null;
|
|
56308
|
+
let keepaliveTimer = null;
|
|
56309
|
+
let sessionClosedByServer = false;
|
|
56310
|
+
const idleTimeoutObj = this.enableIdleTimeout(session);
|
|
56311
|
+
if (this.maxConnectionAgeMs !== UNLIMITED_CONNECTION_AGE_MS) {
|
|
56312
|
+
const jitterMagnitude = this.maxConnectionAgeMs / 10;
|
|
56313
|
+
const jitter = Math.random() * jitterMagnitude * 2 - jitterMagnitude;
|
|
56314
|
+
connectionAgeTimer = setTimeout(() => {
|
|
56315
|
+
var _b2, _c2;
|
|
56316
|
+
sessionClosedByServer = true;
|
|
56317
|
+
this.trace("Connection dropped by max connection age: " + ((_b2 = session.socket) === null || _b2 === void 0 ? void 0 : _b2.remoteAddress));
|
|
56318
|
+
try {
|
|
56319
|
+
session.goaway(http2.constants.NGHTTP2_NO_ERROR, ~(1 << 31), kMaxAge);
|
|
56320
|
+
} catch (e) {
|
|
56321
|
+
session.destroy();
|
|
56322
|
+
return;
|
|
56323
|
+
}
|
|
56324
|
+
session.close();
|
|
56325
|
+
if (this.maxConnectionAgeGraceMs !== UNLIMITED_CONNECTION_AGE_MS) {
|
|
56326
|
+
connectionAgeGraceTimer = setTimeout(() => {
|
|
56327
|
+
session.destroy();
|
|
56328
|
+
}, this.maxConnectionAgeGraceMs);
|
|
56329
|
+
(_c2 = connectionAgeGraceTimer.unref) === null || _c2 === void 0 ? void 0 : _c2.call(connectionAgeGraceTimer);
|
|
56330
|
+
}
|
|
56331
|
+
}, this.maxConnectionAgeMs + jitter);
|
|
56332
|
+
(_c = connectionAgeTimer.unref) === null || _c === void 0 ? void 0 : _c.call(connectionAgeTimer);
|
|
56333
|
+
}
|
|
56334
|
+
const clearKeepaliveTimeout = () => {
|
|
56335
|
+
if (keepaliveTimer) {
|
|
56336
|
+
clearTimeout(keepaliveTimer);
|
|
56337
|
+
keepaliveTimer = null;
|
|
56338
|
+
}
|
|
56339
|
+
};
|
|
56340
|
+
const canSendPing = () => {
|
|
56341
|
+
return !session.destroyed && this.keepaliveTimeMs < KEEPALIVE_MAX_TIME_MS && this.keepaliveTimeMs > 0;
|
|
56342
|
+
};
|
|
56343
|
+
let sendPing;
|
|
56344
|
+
const maybeStartKeepalivePingTimer = () => {
|
|
56345
|
+
var _b2;
|
|
56346
|
+
if (!canSendPing()) {
|
|
56347
|
+
return;
|
|
56348
|
+
}
|
|
56349
|
+
this.keepaliveTrace("Starting keepalive timer for " + this.keepaliveTimeMs + "ms");
|
|
56350
|
+
keepaliveTimer = setTimeout(() => {
|
|
56351
|
+
clearKeepaliveTimeout();
|
|
56352
|
+
sendPing();
|
|
56353
|
+
}, this.keepaliveTimeMs);
|
|
56354
|
+
(_b2 = keepaliveTimer.unref) === null || _b2 === void 0 ? void 0 : _b2.call(keepaliveTimer);
|
|
56355
|
+
};
|
|
56356
|
+
sendPing = () => {
|
|
56357
|
+
var _b2;
|
|
56358
|
+
if (!canSendPing()) {
|
|
56359
|
+
return;
|
|
56360
|
+
}
|
|
56361
|
+
this.keepaliveTrace("Sending ping with timeout " + this.keepaliveTimeoutMs + "ms");
|
|
56362
|
+
let pingSendError = "";
|
|
56363
|
+
try {
|
|
56364
|
+
const pingSentSuccessfully = session.ping((err, duration, payload) => {
|
|
56365
|
+
clearKeepaliveTimeout();
|
|
56366
|
+
if (err) {
|
|
56367
|
+
this.keepaliveTrace("Ping failed with error: " + err.message);
|
|
56368
|
+
sessionClosedByServer = true;
|
|
56369
|
+
session.close();
|
|
56370
|
+
} else {
|
|
56371
|
+
this.keepaliveTrace("Received ping response");
|
|
56372
|
+
maybeStartKeepalivePingTimer();
|
|
56373
|
+
}
|
|
56374
|
+
});
|
|
56375
|
+
if (!pingSentSuccessfully) {
|
|
56376
|
+
pingSendError = "Ping returned false";
|
|
56377
|
+
}
|
|
56378
|
+
} catch (e) {
|
|
56379
|
+
pingSendError = (e instanceof Error ? e.message : "") || "Unknown error";
|
|
56380
|
+
}
|
|
56381
|
+
if (pingSendError) {
|
|
56382
|
+
this.keepaliveTrace("Ping send failed: " + pingSendError);
|
|
56383
|
+
this.trace("Connection dropped due to ping send error: " + pingSendError);
|
|
56384
|
+
sessionClosedByServer = true;
|
|
56385
|
+
session.close();
|
|
56386
|
+
return;
|
|
56387
|
+
}
|
|
56388
|
+
keepaliveTimer = setTimeout(() => {
|
|
56389
|
+
clearKeepaliveTimeout();
|
|
56390
|
+
this.keepaliveTrace("Ping timeout passed without response");
|
|
56391
|
+
this.trace("Connection dropped by keepalive timeout");
|
|
56392
|
+
sessionClosedByServer = true;
|
|
56393
|
+
session.close();
|
|
56394
|
+
}, this.keepaliveTimeoutMs);
|
|
56395
|
+
(_b2 = keepaliveTimer.unref) === null || _b2 === void 0 ? void 0 : _b2.call(keepaliveTimer);
|
|
56396
|
+
};
|
|
56397
|
+
maybeStartKeepalivePingTimer();
|
|
56398
|
+
session.on("close", () => {
|
|
56399
|
+
var _b2, _c2;
|
|
56400
|
+
if (!sessionClosedByServer) {
|
|
56401
|
+
this.trace(`Connection dropped by client ${(_b2 = session.socket) === null || _b2 === void 0 ? void 0 : _b2.remoteAddress}`);
|
|
56402
|
+
}
|
|
56403
|
+
if (connectionAgeTimer) {
|
|
56404
|
+
clearTimeout(connectionAgeTimer);
|
|
56405
|
+
}
|
|
56406
|
+
if (connectionAgeGraceTimer) {
|
|
56407
|
+
clearTimeout(connectionAgeGraceTimer);
|
|
56408
|
+
}
|
|
56409
|
+
clearKeepaliveTimeout();
|
|
56410
|
+
if (idleTimeoutObj !== null) {
|
|
56411
|
+
clearTimeout(idleTimeoutObj.timeout);
|
|
56412
|
+
this.sessionIdleTimeouts.delete(session);
|
|
56413
|
+
}
|
|
56414
|
+
(_c2 = this.http2Servers.get(http2Server)) === null || _c2 === void 0 ? void 0 : _c2.sessions.delete(session);
|
|
56415
|
+
});
|
|
56416
|
+
};
|
|
56417
|
+
}
|
|
56418
|
+
_channelzSessionHandler(http2Server) {
|
|
56419
|
+
return (session) => {
|
|
56420
|
+
var _b, _c, _d, _e;
|
|
56421
|
+
const channelzRef = (0, channelz_1.registerChannelzSocket)((_c = (_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress) !== null && _c !== void 0 ? _c : "unknown", this.getChannelzSessionInfo.bind(this, session), this.channelzEnabled);
|
|
55076
56422
|
const channelzSessionInfo = {
|
|
55077
56423
|
ref: channelzRef,
|
|
55078
56424
|
streamTracker: new channelz_1.ChannelzCallTracker(),
|
|
55079
56425
|
messagesSent: 0,
|
|
55080
56426
|
messagesReceived: 0,
|
|
56427
|
+
keepAlivesSent: 0,
|
|
55081
56428
|
lastMessageSentTimestamp: null,
|
|
55082
56429
|
lastMessageReceivedTimestamp: null
|
|
55083
56430
|
};
|
|
55084
|
-
(
|
|
56431
|
+
(_d = this.http2Servers.get(http2Server)) === null || _d === void 0 ? void 0 : _d.sessions.add(session);
|
|
55085
56432
|
this.sessions.set(session, channelzSessionInfo);
|
|
55086
|
-
const clientAddress = session.socket.remoteAddress
|
|
55087
|
-
|
|
55088
|
-
|
|
55089
|
-
|
|
55090
|
-
}
|
|
56433
|
+
const clientAddress = `${session.socket.remoteAddress}:${session.socket.remotePort}`;
|
|
56434
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection established by client " + clientAddress);
|
|
56435
|
+
this.trace("Connection established by client " + clientAddress);
|
|
56436
|
+
this.sessionChildrenTracker.refChild(channelzRef);
|
|
55091
56437
|
let connectionAgeTimer = null;
|
|
55092
56438
|
let connectionAgeGraceTimer = null;
|
|
56439
|
+
let keepaliveTimeout = null;
|
|
55093
56440
|
let sessionClosedByServer = false;
|
|
56441
|
+
const idleTimeoutObj = this.enableIdleTimeout(session);
|
|
55094
56442
|
if (this.maxConnectionAgeMs !== UNLIMITED_CONNECTION_AGE_MS) {
|
|
55095
56443
|
const jitterMagnitude = this.maxConnectionAgeMs / 10;
|
|
55096
56444
|
const jitter = Math.random() * jitterMagnitude * 2 - jitterMagnitude;
|
|
55097
|
-
connectionAgeTimer =
|
|
55098
|
-
var _b2
|
|
56445
|
+
connectionAgeTimer = setTimeout(() => {
|
|
56446
|
+
var _b2;
|
|
55099
56447
|
sessionClosedByServer = true;
|
|
55100
|
-
|
|
55101
|
-
this.channelzTrace.addTrace("CT_INFO", "Connection dropped by max connection age from " + clientAddress);
|
|
55102
|
-
}
|
|
56448
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection dropped by max connection age from " + clientAddress);
|
|
55103
56449
|
try {
|
|
55104
|
-
session.goaway(http2.constants.NGHTTP2_NO_ERROR, ~(1 << 31),
|
|
56450
|
+
session.goaway(http2.constants.NGHTTP2_NO_ERROR, ~(1 << 31), kMaxAge);
|
|
55105
56451
|
} catch (e) {
|
|
55106
56452
|
session.destroy();
|
|
55107
56453
|
return;
|
|
55108
56454
|
}
|
|
55109
56455
|
session.close();
|
|
55110
56456
|
if (this.maxConnectionAgeGraceMs !== UNLIMITED_CONNECTION_AGE_MS) {
|
|
55111
|
-
connectionAgeGraceTimer =
|
|
56457
|
+
connectionAgeGraceTimer = setTimeout(() => {
|
|
55112
56458
|
session.destroy();
|
|
55113
|
-
}, this.maxConnectionAgeGraceMs)
|
|
56459
|
+
}, this.maxConnectionAgeGraceMs);
|
|
56460
|
+
(_b2 = connectionAgeGraceTimer.unref) === null || _b2 === void 0 ? void 0 : _b2.call(connectionAgeGraceTimer);
|
|
55114
56461
|
}
|
|
55115
|
-
}, this.maxConnectionAgeMs + jitter)
|
|
56462
|
+
}, this.maxConnectionAgeMs + jitter);
|
|
56463
|
+
(_e = connectionAgeTimer.unref) === null || _e === void 0 ? void 0 : _e.call(connectionAgeTimer);
|
|
55116
56464
|
}
|
|
55117
|
-
const
|
|
55118
|
-
|
|
55119
|
-
|
|
55120
|
-
|
|
55121
|
-
|
|
55122
|
-
|
|
55123
|
-
|
|
55124
|
-
|
|
55125
|
-
|
|
56465
|
+
const clearKeepaliveTimeout = () => {
|
|
56466
|
+
if (keepaliveTimeout) {
|
|
56467
|
+
clearTimeout(keepaliveTimeout);
|
|
56468
|
+
keepaliveTimeout = null;
|
|
56469
|
+
}
|
|
56470
|
+
};
|
|
56471
|
+
const canSendPing = () => {
|
|
56472
|
+
return !session.destroyed && this.keepaliveTimeMs < KEEPALIVE_MAX_TIME_MS && this.keepaliveTimeMs > 0;
|
|
56473
|
+
};
|
|
56474
|
+
let sendPing;
|
|
56475
|
+
const maybeStartKeepalivePingTimer = () => {
|
|
56476
|
+
var _b2;
|
|
56477
|
+
if (!canSendPing()) {
|
|
56478
|
+
return;
|
|
56479
|
+
}
|
|
56480
|
+
this.keepaliveTrace("Starting keepalive timer for " + this.keepaliveTimeMs + "ms");
|
|
56481
|
+
keepaliveTimeout = setTimeout(() => {
|
|
56482
|
+
clearKeepaliveTimeout();
|
|
56483
|
+
sendPing();
|
|
56484
|
+
}, this.keepaliveTimeMs);
|
|
56485
|
+
(_b2 = keepaliveTimeout.unref) === null || _b2 === void 0 ? void 0 : _b2.call(keepaliveTimeout);
|
|
56486
|
+
};
|
|
56487
|
+
sendPing = () => {
|
|
56488
|
+
var _b2;
|
|
56489
|
+
if (!canSendPing()) {
|
|
56490
|
+
return;
|
|
56491
|
+
}
|
|
56492
|
+
this.keepaliveTrace("Sending ping with timeout " + this.keepaliveTimeoutMs + "ms");
|
|
56493
|
+
let pingSendError = "";
|
|
55126
56494
|
try {
|
|
55127
|
-
session.ping((err, duration, payload) => {
|
|
55128
|
-
|
|
56495
|
+
const pingSentSuccessfully = session.ping((err, duration, payload) => {
|
|
56496
|
+
clearKeepaliveTimeout();
|
|
56497
|
+
if (err) {
|
|
56498
|
+
this.keepaliveTrace("Ping failed with error: " + err.message);
|
|
56499
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection dropped due to error of a ping frame " + err.message + " return in " + duration);
|
|
56500
|
+
sessionClosedByServer = true;
|
|
56501
|
+
session.close();
|
|
56502
|
+
} else {
|
|
56503
|
+
this.keepaliveTrace("Received ping response");
|
|
56504
|
+
maybeStartKeepalivePingTimer();
|
|
56505
|
+
}
|
|
55129
56506
|
});
|
|
56507
|
+
if (!pingSentSuccessfully) {
|
|
56508
|
+
pingSendError = "Ping returned false";
|
|
56509
|
+
}
|
|
55130
56510
|
} catch (e) {
|
|
55131
|
-
|
|
56511
|
+
pingSendError = (e instanceof Error ? e.message : "") || "Unknown error";
|
|
56512
|
+
}
|
|
56513
|
+
if (pingSendError) {
|
|
56514
|
+
this.keepaliveTrace("Ping send failed: " + pingSendError);
|
|
56515
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection dropped due to ping send error: " + pingSendError);
|
|
56516
|
+
sessionClosedByServer = true;
|
|
56517
|
+
session.close();
|
|
56518
|
+
return;
|
|
55132
56519
|
}
|
|
55133
|
-
|
|
56520
|
+
channelzSessionInfo.keepAlivesSent += 1;
|
|
56521
|
+
keepaliveTimeout = setTimeout(() => {
|
|
56522
|
+
clearKeepaliveTimeout();
|
|
56523
|
+
this.keepaliveTrace("Ping timeout passed without response");
|
|
56524
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection dropped by keepalive timeout from " + clientAddress);
|
|
56525
|
+
sessionClosedByServer = true;
|
|
56526
|
+
session.close();
|
|
56527
|
+
}, this.keepaliveTimeoutMs);
|
|
56528
|
+
(_b2 = keepaliveTimeout.unref) === null || _b2 === void 0 ? void 0 : _b2.call(keepaliveTimeout);
|
|
56529
|
+
};
|
|
56530
|
+
maybeStartKeepalivePingTimer();
|
|
55134
56531
|
session.on("close", () => {
|
|
55135
56532
|
var _b2;
|
|
55136
|
-
if (
|
|
55137
|
-
|
|
55138
|
-
this.channelzTrace.addTrace("CT_INFO", "Connection dropped by client " + clientAddress);
|
|
55139
|
-
}
|
|
55140
|
-
this.sessionChildrenTracker.unrefChild(channelzRef);
|
|
55141
|
-
(0, channelz_1.unregisterChannelzRef)(channelzRef);
|
|
56533
|
+
if (!sessionClosedByServer) {
|
|
56534
|
+
this.channelzTrace.addTrace("CT_INFO", "Connection dropped by client " + clientAddress);
|
|
55142
56535
|
}
|
|
56536
|
+
this.sessionChildrenTracker.unrefChild(channelzRef);
|
|
56537
|
+
(0, channelz_1.unregisterChannelzRef)(channelzRef);
|
|
55143
56538
|
if (connectionAgeTimer) {
|
|
55144
56539
|
clearTimeout(connectionAgeTimer);
|
|
55145
56540
|
}
|
|
55146
56541
|
if (connectionAgeGraceTimer) {
|
|
55147
56542
|
clearTimeout(connectionAgeGraceTimer);
|
|
55148
56543
|
}
|
|
55149
|
-
|
|
55150
|
-
|
|
56544
|
+
clearKeepaliveTimeout();
|
|
56545
|
+
if (idleTimeoutObj !== null) {
|
|
56546
|
+
clearTimeout(idleTimeoutObj.timeout);
|
|
56547
|
+
this.sessionIdleTimeouts.delete(session);
|
|
55151
56548
|
}
|
|
55152
56549
|
(_b2 = this.http2Servers.get(http2Server)) === null || _b2 === void 0 ? void 0 : _b2.sessions.delete(session);
|
|
55153
56550
|
this.sessions.delete(session);
|
|
55154
56551
|
});
|
|
55155
|
-
}
|
|
56552
|
+
};
|
|
56553
|
+
}
|
|
56554
|
+
enableIdleTimeout(session) {
|
|
56555
|
+
var _b, _c;
|
|
56556
|
+
if (this.sessionIdleTimeout >= MAX_CONNECTION_IDLE_MS) {
|
|
56557
|
+
return null;
|
|
56558
|
+
}
|
|
56559
|
+
const idleTimeoutObj = {
|
|
56560
|
+
activeStreams: 0,
|
|
56561
|
+
lastIdle: Date.now(),
|
|
56562
|
+
onClose: this.onStreamClose.bind(this, session),
|
|
56563
|
+
timeout: setTimeout(this.onIdleTimeout, this.sessionIdleTimeout, this, session)
|
|
56564
|
+
};
|
|
56565
|
+
(_c = (_b = idleTimeoutObj.timeout).unref) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
56566
|
+
this.sessionIdleTimeouts.set(session, idleTimeoutObj);
|
|
56567
|
+
const { socket } = session;
|
|
56568
|
+
this.trace("Enable idle timeout for " + socket.remoteAddress + ":" + socket.remotePort);
|
|
56569
|
+
return idleTimeoutObj;
|
|
56570
|
+
}
|
|
56571
|
+
onIdleTimeout(ctx, session) {
|
|
56572
|
+
const { socket } = session;
|
|
56573
|
+
const sessionInfo = ctx.sessionIdleTimeouts.get(session);
|
|
56574
|
+
if (sessionInfo !== void 0 && sessionInfo.activeStreams === 0) {
|
|
56575
|
+
if (Date.now() - sessionInfo.lastIdle >= ctx.sessionIdleTimeout) {
|
|
56576
|
+
ctx.trace("Session idle timeout triggered for " + (socket === null || socket === void 0 ? void 0 : socket.remoteAddress) + ":" + (socket === null || socket === void 0 ? void 0 : socket.remotePort) + " last idle at " + sessionInfo.lastIdle);
|
|
56577
|
+
ctx.closeSession(session);
|
|
56578
|
+
} else {
|
|
56579
|
+
sessionInfo.timeout.refresh();
|
|
56580
|
+
}
|
|
56581
|
+
}
|
|
56582
|
+
}
|
|
56583
|
+
onStreamOpened(stream) {
|
|
56584
|
+
const session = stream.session;
|
|
56585
|
+
const idleTimeoutObj = this.sessionIdleTimeouts.get(session);
|
|
56586
|
+
if (idleTimeoutObj) {
|
|
56587
|
+
idleTimeoutObj.activeStreams += 1;
|
|
56588
|
+
stream.once("close", idleTimeoutObj.onClose);
|
|
56589
|
+
}
|
|
56590
|
+
}
|
|
56591
|
+
onStreamClose(session) {
|
|
56592
|
+
var _b, _c;
|
|
56593
|
+
const idleTimeoutObj = this.sessionIdleTimeouts.get(session);
|
|
56594
|
+
if (idleTimeoutObj) {
|
|
56595
|
+
idleTimeoutObj.activeStreams -= 1;
|
|
56596
|
+
if (idleTimeoutObj.activeStreams === 0) {
|
|
56597
|
+
idleTimeoutObj.lastIdle = Date.now();
|
|
56598
|
+
idleTimeoutObj.timeout.refresh();
|
|
56599
|
+
this.trace("Session onStreamClose" + ((_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress) + ":" + ((_c = session.socket) === null || _c === void 0 ? void 0 : _c.remotePort) + " at " + idleTimeoutObj.lastIdle);
|
|
56600
|
+
}
|
|
56601
|
+
}
|
|
55156
56602
|
}
|
|
55157
56603
|
}, (() => {
|
|
55158
56604
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
|
|
@@ -55437,9 +56883,10 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55437
56883
|
var load_balancer_1 = require_load_balancer();
|
|
55438
56884
|
var connectivity_state_1 = require_connectivity_state();
|
|
55439
56885
|
var picker_1 = require_picker();
|
|
56886
|
+
var subchannel_address_1 = require_subchannel_address();
|
|
55440
56887
|
var logging = require_logging();
|
|
55441
56888
|
var constants_1 = require_constants8();
|
|
55442
|
-
var
|
|
56889
|
+
var subchannel_address_2 = require_subchannel_address();
|
|
55443
56890
|
var net_1 = __require("net");
|
|
55444
56891
|
var TRACER_NAME = "pick_first";
|
|
55445
56892
|
function trace(text) {
|
|
@@ -55502,9 +56949,9 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55502
56949
|
const result = [];
|
|
55503
56950
|
const ipv6Addresses = [];
|
|
55504
56951
|
const ipv4Addresses = [];
|
|
55505
|
-
const ipv6First = (0,
|
|
56952
|
+
const ipv6First = (0, subchannel_address_2.isTcpSubchannelAddress)(addressList[0]) && (0, net_1.isIPv6)(addressList[0].host);
|
|
55506
56953
|
for (const address of addressList) {
|
|
55507
|
-
if ((0,
|
|
56954
|
+
if ((0, subchannel_address_2.isTcpSubchannelAddress)(address) && (0, net_1.isIPv6)(address.host)) {
|
|
55508
56955
|
ipv6Addresses.push(address);
|
|
55509
56956
|
} else {
|
|
55510
56957
|
ipv4Addresses.push(address);
|
|
@@ -55541,9 +56988,7 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55541
56988
|
this.onSubchannelStateUpdate(subchannel, previousState, newState, errorMessage);
|
|
55542
56989
|
};
|
|
55543
56990
|
this.pickedSubchannelHealthListener = () => this.calculateAndReportNewState();
|
|
55544
|
-
this.triedAllSubchannels = false;
|
|
55545
56991
|
this.stickyTransientFailureMode = false;
|
|
55546
|
-
this.requestedResolutionSinceLastUpdate = false;
|
|
55547
56992
|
this.lastError = null;
|
|
55548
56993
|
this.latestAddressList = null;
|
|
55549
56994
|
this.connectionDelayTimeout = setTimeout(() => {
|
|
@@ -55554,6 +56999,9 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55554
56999
|
allChildrenHaveReportedTF() {
|
|
55555
57000
|
return this.children.every((child) => child.hasReportedTransientFailure);
|
|
55556
57001
|
}
|
|
57002
|
+
resetChildrenReportedTF() {
|
|
57003
|
+
this.children.every((child) => child.hasReportedTransientFailure = false);
|
|
57004
|
+
}
|
|
55557
57005
|
calculateAndReportNewState() {
|
|
55558
57006
|
if (this.currentPick) {
|
|
55559
57007
|
if (this.reportHealthStatus && !this.currentPick.isHealthy()) {
|
|
@@ -55567,23 +57015,23 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55567
57015
|
this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this));
|
|
55568
57016
|
} else {
|
|
55569
57017
|
if (this.stickyTransientFailureMode) {
|
|
55570
|
-
this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({
|
|
57018
|
+
this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({
|
|
57019
|
+
details: `No connection established. Last error: ${this.lastError}`
|
|
57020
|
+
}));
|
|
55571
57021
|
} else {
|
|
55572
57022
|
this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this));
|
|
55573
57023
|
}
|
|
55574
57024
|
}
|
|
55575
57025
|
}
|
|
55576
57026
|
requestReresolution() {
|
|
55577
|
-
this.requestedResolutionSinceLastUpdate = true;
|
|
55578
57027
|
this.channelControlHelper.requestReresolution();
|
|
55579
57028
|
}
|
|
55580
57029
|
maybeEnterStickyTransientFailureMode() {
|
|
55581
57030
|
if (!this.allChildrenHaveReportedTF()) {
|
|
55582
57031
|
return;
|
|
55583
57032
|
}
|
|
55584
|
-
|
|
55585
|
-
|
|
55586
|
-
}
|
|
57033
|
+
this.requestReresolution();
|
|
57034
|
+
this.resetChildrenReportedTF();
|
|
55587
57035
|
if (this.stickyTransientFailureMode) {
|
|
55588
57036
|
return;
|
|
55589
57037
|
}
|
|
@@ -55595,14 +57043,11 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55595
57043
|
}
|
|
55596
57044
|
removeCurrentPick() {
|
|
55597
57045
|
if (this.currentPick !== null) {
|
|
55598
|
-
|
|
57046
|
+
this.currentPick.removeConnectivityStateListener(this.subchannelStateListener);
|
|
57047
|
+
this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef());
|
|
57048
|
+
this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener);
|
|
57049
|
+
this.currentPick.unref();
|
|
55599
57050
|
this.currentPick = null;
|
|
55600
|
-
currentPick.unref();
|
|
55601
|
-
currentPick.removeConnectivityStateListener(this.subchannelStateListener);
|
|
55602
|
-
this.channelControlHelper.removeChannelzChild(currentPick.getChannelzRef());
|
|
55603
|
-
if (this.reportHealthStatus) {
|
|
55604
|
-
currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener);
|
|
55605
|
-
}
|
|
55606
57051
|
}
|
|
55607
57052
|
}
|
|
55608
57053
|
onSubchannelStateUpdate(subchannel, previousState, newState, errorMessage) {
|
|
@@ -55611,7 +57056,6 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55611
57056
|
if (newState !== connectivity_state_1.ConnectivityState.READY) {
|
|
55612
57057
|
this.removeCurrentPick();
|
|
55613
57058
|
this.calculateAndReportNewState();
|
|
55614
|
-
this.requestReresolution();
|
|
55615
57059
|
}
|
|
55616
57060
|
return;
|
|
55617
57061
|
}
|
|
@@ -55637,9 +57081,6 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55637
57081
|
}
|
|
55638
57082
|
startNextSubchannelConnecting(startIndex) {
|
|
55639
57083
|
clearTimeout(this.connectionDelayTimeout);
|
|
55640
|
-
if (this.triedAllSubchannels) {
|
|
55641
|
-
return;
|
|
55642
|
-
}
|
|
55643
57084
|
for (const [index, child] of this.children.entries()) {
|
|
55644
57085
|
if (index >= startIndex) {
|
|
55645
57086
|
const subchannelState = child.subchannel.getConnectivityState();
|
|
@@ -55649,7 +57090,6 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55649
57090
|
}
|
|
55650
57091
|
}
|
|
55651
57092
|
}
|
|
55652
|
-
this.triedAllSubchannels = true;
|
|
55653
57093
|
this.maybeEnterStickyTransientFailureMode();
|
|
55654
57094
|
}
|
|
55655
57095
|
/**
|
|
@@ -55667,24 +57107,28 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55667
57107
|
(_a2 = this.children[subchannelIndex]) === null || _a2 === void 0 ? void 0 : _a2.subchannel.startConnecting();
|
|
55668
57108
|
});
|
|
55669
57109
|
}
|
|
55670
|
-
this.connectionDelayTimeout =
|
|
57110
|
+
this.connectionDelayTimeout = setTimeout(() => {
|
|
55671
57111
|
this.startNextSubchannelConnecting(subchannelIndex + 1);
|
|
55672
|
-
}, CONNECTION_DELAY_INTERVAL_MS)
|
|
57112
|
+
}, CONNECTION_DELAY_INTERVAL_MS);
|
|
57113
|
+
(_b = (_a = this.connectionDelayTimeout).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
55673
57114
|
}
|
|
57115
|
+
/**
|
|
57116
|
+
* Declare that the specified subchannel should be used to make requests.
|
|
57117
|
+
* This functions the same independent of whether subchannel is a member of
|
|
57118
|
+
* this.children and whether it is equal to this.currentPick.
|
|
57119
|
+
* Prerequisite: subchannel.getConnectivityState() === READY.
|
|
57120
|
+
* @param subchannel
|
|
57121
|
+
*/
|
|
55674
57122
|
pickSubchannel(subchannel) {
|
|
55675
|
-
if (this.currentPick && subchannel.realSubchannelEquals(this.currentPick)) {
|
|
55676
|
-
return;
|
|
55677
|
-
}
|
|
55678
57123
|
trace("Pick subchannel with address " + subchannel.getAddress());
|
|
55679
57124
|
this.stickyTransientFailureMode = false;
|
|
55680
|
-
this.removeCurrentPick();
|
|
55681
|
-
this.currentPick = subchannel;
|
|
55682
57125
|
subchannel.ref();
|
|
55683
|
-
if (this.reportHealthStatus) {
|
|
55684
|
-
subchannel.addHealthStateWatcher(this.pickedSubchannelHealthListener);
|
|
55685
|
-
}
|
|
55686
57126
|
this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef());
|
|
57127
|
+
this.removeCurrentPick();
|
|
55687
57128
|
this.resetSubchannelList();
|
|
57129
|
+
subchannel.addConnectivityStateListener(this.subchannelStateListener);
|
|
57130
|
+
subchannel.addHealthStateWatcher(this.pickedSubchannelHealthListener);
|
|
57131
|
+
this.currentPick = subchannel;
|
|
55688
57132
|
clearTimeout(this.connectionDelayTimeout);
|
|
55689
57133
|
this.calculateAndReportNewState();
|
|
55690
57134
|
}
|
|
@@ -55695,22 +57139,25 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55695
57139
|
}
|
|
55696
57140
|
resetSubchannelList() {
|
|
55697
57141
|
for (const child of this.children) {
|
|
55698
|
-
|
|
55699
|
-
child.subchannel.removeConnectivityStateListener(this.subchannelStateListener);
|
|
55700
|
-
}
|
|
57142
|
+
child.subchannel.removeConnectivityStateListener(this.subchannelStateListener);
|
|
55701
57143
|
child.subchannel.unref();
|
|
55702
57144
|
this.channelControlHelper.removeChannelzChild(child.subchannel.getChannelzRef());
|
|
55703
57145
|
}
|
|
55704
57146
|
this.currentSubchannelIndex = 0;
|
|
55705
57147
|
this.children = [];
|
|
55706
|
-
this.triedAllSubchannels = false;
|
|
55707
|
-
this.requestedResolutionSinceLastUpdate = false;
|
|
55708
57148
|
}
|
|
55709
57149
|
connectToAddressList(addressList) {
|
|
57150
|
+
trace("connectToAddressList([" + addressList.map((address) => (0, subchannel_address_1.subchannelAddressToString)(address)) + "])");
|
|
55710
57151
|
const newChildrenList = addressList.map((address) => ({
|
|
55711
57152
|
subchannel: this.channelControlHelper.createSubchannel(address, {}),
|
|
55712
57153
|
hasReportedTransientFailure: false
|
|
55713
57154
|
}));
|
|
57155
|
+
for (const { subchannel } of newChildrenList) {
|
|
57156
|
+
if (subchannel.getConnectivityState() === connectivity_state_1.ConnectivityState.READY) {
|
|
57157
|
+
this.pickSubchannel(subchannel);
|
|
57158
|
+
return;
|
|
57159
|
+
}
|
|
57160
|
+
}
|
|
55714
57161
|
for (const { subchannel } of newChildrenList) {
|
|
55715
57162
|
subchannel.ref();
|
|
55716
57163
|
this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef());
|
|
@@ -55719,10 +57166,6 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55719
57166
|
this.children = newChildrenList;
|
|
55720
57167
|
for (const { subchannel } of this.children) {
|
|
55721
57168
|
subchannel.addConnectivityStateListener(this.subchannelStateListener);
|
|
55722
|
-
if (subchannel.getConnectivityState() === connectivity_state_1.ConnectivityState.READY) {
|
|
55723
|
-
this.pickSubchannel(subchannel);
|
|
55724
|
-
return;
|
|
55725
|
-
}
|
|
55726
57169
|
}
|
|
55727
57170
|
for (const child of this.children) {
|
|
55728
57171
|
if (child.subchannel.getConnectivityState() === connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) {
|
|
@@ -55740,6 +57183,7 @@ var require_load_balancer_pick_first = __commonJS({
|
|
|
55740
57183
|
endpointList = shuffled(endpointList);
|
|
55741
57184
|
}
|
|
55742
57185
|
const rawAddressList = [].concat(...endpointList.map((endpoint) => endpoint.addresses));
|
|
57186
|
+
trace("updateAddressList([" + rawAddressList.map((address) => (0, subchannel_address_1.subchannelAddressToString)(address)) + "])");
|
|
55743
57187
|
if (rawAddressList.length === 0) {
|
|
55744
57188
|
throw new Error("No addresses in endpoint list passed to pick_first");
|
|
55745
57189
|
}
|
|
@@ -55823,7 +57267,7 @@ var require_experimental = __commonJS({
|
|
|
55823
57267
|
"node_modules/@grpc/grpc-js/build/src/experimental.js"(exports2) {
|
|
55824
57268
|
"use strict";
|
|
55825
57269
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
55826
|
-
exports2.BaseSubchannelWrapper = exports2.registerAdminService = exports2.FilterStackFactory = exports2.BaseFilter = exports2.PickResultType = exports2.QueuePicker = exports2.UnavailablePicker = exports2.ChildLoadBalancerHandler = exports2.EndpointMap = exports2.endpointHasAddress = exports2.endpointToString = exports2.subchannelAddressToString = exports2.LeafLoadBalancer = exports2.isLoadBalancerNameRegistered = exports2.parseLoadBalancingConfig = exports2.selectLbConfigFromList = exports2.registerLoadBalancerType = exports2.createChildChannelControlHelper = exports2.BackoffTimeout = exports2.durationToMs = exports2.uriToString = exports2.createResolver = exports2.registerResolver = exports2.log = exports2.trace = void 0;
|
|
57270
|
+
exports2.createServerCredentialsWithInterceptors = exports2.BaseSubchannelWrapper = exports2.registerAdminService = exports2.FilterStackFactory = exports2.BaseFilter = exports2.PickResultType = exports2.QueuePicker = exports2.UnavailablePicker = exports2.ChildLoadBalancerHandler = exports2.EndpointMap = exports2.endpointHasAddress = exports2.endpointToString = exports2.subchannelAddressToString = exports2.LeafLoadBalancer = exports2.isLoadBalancerNameRegistered = exports2.parseLoadBalancingConfig = exports2.selectLbConfigFromList = exports2.registerLoadBalancerType = exports2.createChildChannelControlHelper = exports2.BackoffTimeout = exports2.durationToMs = exports2.splitHostPort = exports2.uriToString = exports2.createResolver = exports2.registerResolver = exports2.log = exports2.trace = void 0;
|
|
55827
57271
|
var logging_1 = require_logging();
|
|
55828
57272
|
Object.defineProperty(exports2, "trace", { enumerable: true, get: function() {
|
|
55829
57273
|
return logging_1.trace;
|
|
@@ -55842,6 +57286,9 @@ var require_experimental = __commonJS({
|
|
|
55842
57286
|
Object.defineProperty(exports2, "uriToString", { enumerable: true, get: function() {
|
|
55843
57287
|
return uri_parser_1.uriToString;
|
|
55844
57288
|
} });
|
|
57289
|
+
Object.defineProperty(exports2, "splitHostPort", { enumerable: true, get: function() {
|
|
57290
|
+
return uri_parser_1.splitHostPort;
|
|
57291
|
+
} });
|
|
55845
57292
|
var duration_1 = require_duration();
|
|
55846
57293
|
Object.defineProperty(exports2, "durationToMs", { enumerable: true, get: function() {
|
|
55847
57294
|
return duration_1.durationToMs;
|
|
@@ -55913,6 +57360,10 @@ var require_experimental = __commonJS({
|
|
|
55913
57360
|
Object.defineProperty(exports2, "BaseSubchannelWrapper", { enumerable: true, get: function() {
|
|
55914
57361
|
return subchannel_interface_1.BaseSubchannelWrapper;
|
|
55915
57362
|
} });
|
|
57363
|
+
var server_credentials_1 = require_server_credentials();
|
|
57364
|
+
Object.defineProperty(exports2, "createServerCredentialsWithInterceptors", { enumerable: true, get: function() {
|
|
57365
|
+
return server_credentials_1.createServerCredentialsWithInterceptors;
|
|
57366
|
+
} });
|
|
55916
57367
|
}
|
|
55917
57368
|
});
|
|
55918
57369
|
|
|
@@ -55943,6 +57394,7 @@ var require_resolver_uds = __commonJS({
|
|
|
55943
57394
|
}
|
|
55944
57395
|
}
|
|
55945
57396
|
destroy() {
|
|
57397
|
+
this.hasReturnedResult = false;
|
|
55946
57398
|
}
|
|
55947
57399
|
static getDefaultAuthority(target) {
|
|
55948
57400
|
return "localhost";
|
|
@@ -56109,6 +57561,9 @@ var require_load_balancer_round_robin = __commonJS({
|
|
|
56109
57561
|
this.lastError = null;
|
|
56110
57562
|
this.childChannelControlHelper = (0, load_balancer_1.createChildChannelControlHelper)(channelControlHelper, {
|
|
56111
57563
|
updateState: (connectivityState, picker) => {
|
|
57564
|
+
if (this.currentState === connectivity_state_1.ConnectivityState.READY && connectivityState !== connectivity_state_1.ConnectivityState.READY) {
|
|
57565
|
+
this.channelControlHelper.requestReresolution();
|
|
57566
|
+
}
|
|
56112
57567
|
this.calculateAndUpdateState();
|
|
56113
57568
|
}
|
|
56114
57569
|
});
|
|
@@ -56137,7 +57592,9 @@ var require_load_balancer_round_robin = __commonJS({
|
|
|
56137
57592
|
} else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.CONNECTING) > 0) {
|
|
56138
57593
|
this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this));
|
|
56139
57594
|
} else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) > 0) {
|
|
56140
|
-
this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({
|
|
57595
|
+
this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({
|
|
57596
|
+
details: `No connection established. Last error: ${this.lastError}`
|
|
57597
|
+
}));
|
|
56141
57598
|
} else {
|
|
56142
57599
|
this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this));
|
|
56143
57600
|
}
|
|
@@ -65377,7 +66834,7 @@ var require_sampling7 = __commonJS({
|
|
|
65377
66834
|
});
|
|
65378
66835
|
|
|
65379
66836
|
// node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/core/build/src/utils/environment.js
|
|
65380
|
-
var
|
|
66837
|
+
var require_environment14 = __commonJS({
|
|
65381
66838
|
"node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/core/build/src/utils/environment.js"(exports2) {
|
|
65382
66839
|
"use strict";
|
|
65383
66840
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -65582,12 +67039,12 @@ var require_environment13 = __commonJS({
|
|
|
65582
67039
|
});
|
|
65583
67040
|
|
|
65584
67041
|
// node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/core/build/src/platform/node/environment.js
|
|
65585
|
-
var
|
|
67042
|
+
var require_environment15 = __commonJS({
|
|
65586
67043
|
"node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/core/build/src/platform/node/environment.js"(exports2) {
|
|
65587
67044
|
"use strict";
|
|
65588
67045
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
65589
67046
|
exports2.getEnvWithoutDefaults = exports2.getEnv = void 0;
|
|
65590
|
-
var environment_1 =
|
|
67047
|
+
var environment_1 = require_environment14();
|
|
65591
67048
|
function getEnv() {
|
|
65592
67049
|
const processEnv = (0, environment_1.parseEnvironment)(process.env);
|
|
65593
67050
|
return Object.assign({}, environment_1.DEFAULT_ENVIRONMENT, processEnv);
|
|
@@ -65756,7 +67213,7 @@ var require_node21 = __commonJS({
|
|
|
65756
67213
|
};
|
|
65757
67214
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
65758
67215
|
exports2.getEnv = exports2.getEnvWithoutDefaults = void 0;
|
|
65759
|
-
var environment_1 =
|
|
67216
|
+
var environment_1 = require_environment15();
|
|
65760
67217
|
Object.defineProperty(exports2, "getEnvWithoutDefaults", { enumerable: true, get: function() {
|
|
65761
67218
|
return environment_1.getEnvWithoutDefaults;
|
|
65762
67219
|
} });
|
|
@@ -66682,7 +68139,7 @@ var require_src34 = __commonJS({
|
|
|
66682
68139
|
__exportStar(require_TraceIdRatioBasedSampler9(), exports2);
|
|
66683
68140
|
__exportStar(require_suppress_tracing7(), exports2);
|
|
66684
68141
|
__exportStar(require_TraceState7(), exports2);
|
|
66685
|
-
__exportStar(
|
|
68142
|
+
__exportStar(require_environment14(), exports2);
|
|
66686
68143
|
__exportStar(require_merge7(), exports2);
|
|
66687
68144
|
__exportStar(require_sampling7(), exports2);
|
|
66688
68145
|
__exportStar(require_timeout7(), exports2);
|
|
@@ -67409,7 +68866,7 @@ var import_semantic_conventions = __toESM(require_src(), 1);
|
|
|
67409
68866
|
import { getLogger } from "./request-context.cjs";
|
|
67410
68867
|
var {
|
|
67411
68868
|
default: { version, name }
|
|
67412
|
-
} = await import("../../esm-chunks/package-
|
|
68869
|
+
} = await import("../../esm-chunks/package-EEQP43EX.js");
|
|
67413
68870
|
var sdk = new import_sdk_node.NodeSDK({
|
|
67414
68871
|
resource: new import_resources.Resource({
|
|
67415
68872
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|