@kodama-run/sdk 0.2.1 → 0.3.1
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/bin/cli.js +2973 -3
- package/bin/mcp.js +3121 -5
- package/package.json +1 -1
- package/src/adapters/mcp.ts +2 -2
- package/src/room.ts +9 -3
package/bin/mcp.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
2
3
|
// @bun
|
|
4
|
+
import { createRequire } from "node:module";
|
|
3
5
|
var __create = Object.create;
|
|
4
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __defProp = Object.defineProperty;
|
|
@@ -44,14 +46,18 @@ var __export = (target, all) => {
|
|
|
44
46
|
set: __exportSetter.bind(all, name)
|
|
45
47
|
});
|
|
46
48
|
};
|
|
49
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
50
|
+
|
|
47
51
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js
|
|
48
52
|
var require_code = __commonJS((exports) => {
|
|
49
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
54
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = undefined;
|
|
55
|
+
|
|
51
56
|
class _CodeOrName {
|
|
52
57
|
}
|
|
53
58
|
exports._CodeOrName = _CodeOrName;
|
|
54
59
|
exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
60
|
+
|
|
55
61
|
class Name extends _CodeOrName {
|
|
56
62
|
constructor(s) {
|
|
57
63
|
super();
|
|
@@ -70,6 +76,7 @@ var require_code = __commonJS((exports) => {
|
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
exports.Name = Name;
|
|
79
|
+
|
|
73
80
|
class _Code extends _CodeOrName {
|
|
74
81
|
constructor(code) {
|
|
75
82
|
super();
|
|
@@ -194,11 +201,13 @@ var require_code = __commonJS((exports) => {
|
|
|
194
201
|
}
|
|
195
202
|
exports.regexpCode = regexpCode;
|
|
196
203
|
});
|
|
204
|
+
|
|
197
205
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js
|
|
198
206
|
var require_scope = __commonJS((exports) => {
|
|
199
207
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
200
208
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = undefined;
|
|
201
209
|
var code_1 = require_code();
|
|
210
|
+
|
|
202
211
|
class ValueError extends Error {
|
|
203
212
|
constructor(name) {
|
|
204
213
|
super(`CodeGen: "code" for ${name} not defined`);
|
|
@@ -215,6 +224,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
215
224
|
let: new code_1.Name("let"),
|
|
216
225
|
var: new code_1.Name("var")
|
|
217
226
|
};
|
|
227
|
+
|
|
218
228
|
class Scope {
|
|
219
229
|
constructor({ prefixes, parent } = {}) {
|
|
220
230
|
this._names = {};
|
|
@@ -240,6 +250,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
240
250
|
}
|
|
241
251
|
}
|
|
242
252
|
exports.Scope = Scope;
|
|
253
|
+
|
|
243
254
|
class ValueScopeName extends code_1.Name {
|
|
244
255
|
constructor(prefix, nameStr) {
|
|
245
256
|
super(nameStr);
|
|
@@ -252,6 +263,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
252
263
|
}
|
|
253
264
|
exports.ValueScopeName = ValueScopeName;
|
|
254
265
|
var line = (0, code_1._)`\n`;
|
|
266
|
+
|
|
255
267
|
class ValueScope extends Scope {
|
|
256
268
|
constructor(opts) {
|
|
257
269
|
super(opts);
|
|
@@ -335,6 +347,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
335
347
|
}
|
|
336
348
|
exports.ValueScope = ValueScope;
|
|
337
349
|
});
|
|
350
|
+
|
|
338
351
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js
|
|
339
352
|
var require_codegen = __commonJS((exports) => {
|
|
340
353
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -391,6 +404,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
391
404
|
AND: new code_1._Code("&&"),
|
|
392
405
|
ADD: new code_1._Code("+")
|
|
393
406
|
};
|
|
407
|
+
|
|
394
408
|
class Node {
|
|
395
409
|
optimizeNodes() {
|
|
396
410
|
return this;
|
|
@@ -399,6 +413,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
399
413
|
return this;
|
|
400
414
|
}
|
|
401
415
|
}
|
|
416
|
+
|
|
402
417
|
class Def extends Node {
|
|
403
418
|
constructor(varKind, name, rhs) {
|
|
404
419
|
super();
|
|
@@ -422,6 +437,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
422
437
|
return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
|
|
423
438
|
}
|
|
424
439
|
}
|
|
440
|
+
|
|
425
441
|
class Assign extends Node {
|
|
426
442
|
constructor(lhs, rhs, sideEffects) {
|
|
427
443
|
super();
|
|
@@ -443,6 +459,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
443
459
|
return addExprNames(names, this.rhs);
|
|
444
460
|
}
|
|
445
461
|
}
|
|
462
|
+
|
|
446
463
|
class AssignOp extends Assign {
|
|
447
464
|
constructor(lhs, op, rhs, sideEffects) {
|
|
448
465
|
super(lhs, rhs, sideEffects);
|
|
@@ -452,6 +469,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
452
469
|
return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
|
|
453
470
|
}
|
|
454
471
|
}
|
|
472
|
+
|
|
455
473
|
class Label extends Node {
|
|
456
474
|
constructor(label) {
|
|
457
475
|
super();
|
|
@@ -462,6 +480,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
462
480
|
return `${this.label}:` + _n;
|
|
463
481
|
}
|
|
464
482
|
}
|
|
483
|
+
|
|
465
484
|
class Break extends Node {
|
|
466
485
|
constructor(label) {
|
|
467
486
|
super();
|
|
@@ -473,6 +492,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
473
492
|
return `break${label};` + _n;
|
|
474
493
|
}
|
|
475
494
|
}
|
|
495
|
+
|
|
476
496
|
class Throw extends Node {
|
|
477
497
|
constructor(error48) {
|
|
478
498
|
super();
|
|
@@ -485,6 +505,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
485
505
|
return this.error.names;
|
|
486
506
|
}
|
|
487
507
|
}
|
|
508
|
+
|
|
488
509
|
class AnyCode extends Node {
|
|
489
510
|
constructor(code) {
|
|
490
511
|
super();
|
|
@@ -504,6 +525,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
504
525
|
return this.code instanceof code_1._CodeOrName ? this.code.names : {};
|
|
505
526
|
}
|
|
506
527
|
}
|
|
528
|
+
|
|
507
529
|
class ParentNode extends Node {
|
|
508
530
|
constructor(nodes = []) {
|
|
509
531
|
super();
|
|
@@ -542,16 +564,20 @@ var require_codegen = __commonJS((exports) => {
|
|
|
542
564
|
return this.nodes.reduce((names, n) => addNames(names, n.names), {});
|
|
543
565
|
}
|
|
544
566
|
}
|
|
567
|
+
|
|
545
568
|
class BlockNode extends ParentNode {
|
|
546
569
|
render(opts) {
|
|
547
570
|
return "{" + opts._n + super.render(opts) + "}" + opts._n;
|
|
548
571
|
}
|
|
549
572
|
}
|
|
573
|
+
|
|
550
574
|
class Root extends ParentNode {
|
|
551
575
|
}
|
|
576
|
+
|
|
552
577
|
class Else extends BlockNode {
|
|
553
578
|
}
|
|
554
579
|
Else.kind = "else";
|
|
580
|
+
|
|
555
581
|
class If extends BlockNode {
|
|
556
582
|
constructor(condition, nodes) {
|
|
557
583
|
super(nodes);
|
|
@@ -601,9 +627,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
601
627
|
}
|
|
602
628
|
}
|
|
603
629
|
If.kind = "if";
|
|
630
|
+
|
|
604
631
|
class For extends BlockNode {
|
|
605
632
|
}
|
|
606
633
|
For.kind = "for";
|
|
634
|
+
|
|
607
635
|
class ForLoop extends For {
|
|
608
636
|
constructor(iteration) {
|
|
609
637
|
super();
|
|
@@ -622,6 +650,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
622
650
|
return addNames(super.names, this.iteration.names);
|
|
623
651
|
}
|
|
624
652
|
}
|
|
653
|
+
|
|
625
654
|
class ForRange extends For {
|
|
626
655
|
constructor(varKind, name, from, to) {
|
|
627
656
|
super();
|
|
@@ -640,6 +669,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
640
669
|
return addExprNames(names, this.to);
|
|
641
670
|
}
|
|
642
671
|
}
|
|
672
|
+
|
|
643
673
|
class ForIter extends For {
|
|
644
674
|
constructor(loop, varKind, name, iterable) {
|
|
645
675
|
super();
|
|
@@ -661,6 +691,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
661
691
|
return addNames(super.names, this.iterable.names);
|
|
662
692
|
}
|
|
663
693
|
}
|
|
694
|
+
|
|
664
695
|
class Func extends BlockNode {
|
|
665
696
|
constructor(name, args, async) {
|
|
666
697
|
super();
|
|
@@ -674,12 +705,14 @@ var require_codegen = __commonJS((exports) => {
|
|
|
674
705
|
}
|
|
675
706
|
}
|
|
676
707
|
Func.kind = "func";
|
|
708
|
+
|
|
677
709
|
class Return extends ParentNode {
|
|
678
710
|
render(opts) {
|
|
679
711
|
return "return " + super.render(opts);
|
|
680
712
|
}
|
|
681
713
|
}
|
|
682
714
|
Return.kind = "return";
|
|
715
|
+
|
|
683
716
|
class Try extends BlockNode {
|
|
684
717
|
render(opts) {
|
|
685
718
|
let code = "try" + super.render(opts);
|
|
@@ -712,6 +745,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
712
745
|
return names;
|
|
713
746
|
}
|
|
714
747
|
}
|
|
748
|
+
|
|
715
749
|
class Catch extends BlockNode {
|
|
716
750
|
constructor(error48) {
|
|
717
751
|
super();
|
|
@@ -722,12 +756,14 @@ var require_codegen = __commonJS((exports) => {
|
|
|
722
756
|
}
|
|
723
757
|
}
|
|
724
758
|
Catch.kind = "catch";
|
|
759
|
+
|
|
725
760
|
class Finally extends BlockNode {
|
|
726
761
|
render(opts) {
|
|
727
762
|
return "finally" + super.render(opts);
|
|
728
763
|
}
|
|
729
764
|
}
|
|
730
765
|
Finally.kind = "finally";
|
|
766
|
+
|
|
731
767
|
class CodeGen {
|
|
732
768
|
constructor(extScope, opts = {}) {
|
|
733
769
|
this._values = {};
|
|
@@ -1021,6 +1057,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
1021
1057
|
return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`;
|
|
1022
1058
|
}
|
|
1023
1059
|
});
|
|
1060
|
+
|
|
1024
1061
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js
|
|
1025
1062
|
var require_util = __commonJS((exports) => {
|
|
1026
1063
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1184,6 +1221,7 @@ var require_util = __commonJS((exports) => {
|
|
|
1184
1221
|
}
|
|
1185
1222
|
exports.checkStrictMode = checkStrictMode;
|
|
1186
1223
|
});
|
|
1224
|
+
|
|
1187
1225
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js
|
|
1188
1226
|
var require_names = __commonJS((exports) => {
|
|
1189
1227
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1208,6 +1246,7 @@ var require_names = __commonJS((exports) => {
|
|
|
1208
1246
|
};
|
|
1209
1247
|
exports.default = names;
|
|
1210
1248
|
});
|
|
1249
|
+
|
|
1211
1250
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js
|
|
1212
1251
|
var require_errors = __commonJS((exports) => {
|
|
1213
1252
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1325,6 +1364,7 @@ var require_errors = __commonJS((exports) => {
|
|
|
1325
1364
|
keyValues.push([E.propertyName, propertyName]);
|
|
1326
1365
|
}
|
|
1327
1366
|
});
|
|
1367
|
+
|
|
1328
1368
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
1329
1369
|
var require_boolSchema = __commonJS((exports) => {
|
|
1330
1370
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1372,6 +1412,7 @@ var require_boolSchema = __commonJS((exports) => {
|
|
|
1372
1412
|
(0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors);
|
|
1373
1413
|
}
|
|
1374
1414
|
});
|
|
1415
|
+
|
|
1375
1416
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js
|
|
1376
1417
|
var require_rules = __commonJS((exports) => {
|
|
1377
1418
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1399,6 +1440,7 @@ var require_rules = __commonJS((exports) => {
|
|
|
1399
1440
|
}
|
|
1400
1441
|
exports.getRules = getRules;
|
|
1401
1442
|
});
|
|
1443
|
+
|
|
1402
1444
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js
|
|
1403
1445
|
var require_applicability = __commonJS((exports) => {
|
|
1404
1446
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1418,6 +1460,7 @@ var require_applicability = __commonJS((exports) => {
|
|
|
1418
1460
|
}
|
|
1419
1461
|
exports.shouldUseRule = shouldUseRule;
|
|
1420
1462
|
});
|
|
1463
|
+
|
|
1421
1464
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js
|
|
1422
1465
|
var require_dataType = __commonJS((exports) => {
|
|
1423
1466
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1598,6 +1641,7 @@ var require_dataType = __commonJS((exports) => {
|
|
|
1598
1641
|
};
|
|
1599
1642
|
}
|
|
1600
1643
|
});
|
|
1644
|
+
|
|
1601
1645
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js
|
|
1602
1646
|
var require_defaults = __commonJS((exports) => {
|
|
1603
1647
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1631,6 +1675,7 @@ var require_defaults = __commonJS((exports) => {
|
|
|
1631
1675
|
gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
|
1632
1676
|
}
|
|
1633
1677
|
});
|
|
1678
|
+
|
|
1634
1679
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js
|
|
1635
1680
|
var require_code2 = __commonJS((exports) => {
|
|
1636
1681
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1759,6 +1804,7 @@ var require_code2 = __commonJS((exports) => {
|
|
|
1759
1804
|
}
|
|
1760
1805
|
exports.validateUnion = validateUnion;
|
|
1761
1806
|
});
|
|
1807
|
+
|
|
1762
1808
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js
|
|
1763
1809
|
var require_keyword = __commonJS((exports) => {
|
|
1764
1810
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1873,6 +1919,7 @@ var require_keyword = __commonJS((exports) => {
|
|
|
1873
1919
|
}
|
|
1874
1920
|
exports.validateKeywordUsage = validateKeywordUsage;
|
|
1875
1921
|
});
|
|
1922
|
+
|
|
1876
1923
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js
|
|
1877
1924
|
var require_subschema = __commonJS((exports) => {
|
|
1878
1925
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1952,6 +1999,7 @@ var require_subschema = __commonJS((exports) => {
|
|
|
1952
1999
|
}
|
|
1953
2000
|
exports.extendSubschemaMode = extendSubschemaMode;
|
|
1954
2001
|
});
|
|
2002
|
+
|
|
1955
2003
|
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
1956
2004
|
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
1957
2005
|
module.exports = function equal(a, b) {
|
|
@@ -1993,6 +2041,7 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
|
1993
2041
|
return a !== a && b !== b;
|
|
1994
2042
|
};
|
|
1995
2043
|
});
|
|
2044
|
+
|
|
1996
2045
|
// ../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js
|
|
1997
2046
|
var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
1998
2047
|
var traverse = module.exports = function(schema, opts, cb) {
|
|
@@ -2075,6 +2124,7 @@ var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
|
2075
2124
|
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2076
2125
|
}
|
|
2077
2126
|
});
|
|
2127
|
+
|
|
2078
2128
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js
|
|
2079
2129
|
var require_resolve = __commonJS((exports) => {
|
|
2080
2130
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2227,6 +2277,7 @@ var require_resolve = __commonJS((exports) => {
|
|
|
2227
2277
|
}
|
|
2228
2278
|
exports.getSchemaRefs = getSchemaRefs;
|
|
2229
2279
|
});
|
|
2280
|
+
|
|
2230
2281
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js
|
|
2231
2282
|
var require_validate = __commonJS((exports) => {
|
|
2232
2283
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2504,6 +2555,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
2504
2555
|
msg += ` at "${schemaPath}" (strictTypes)`;
|
|
2505
2556
|
(0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
|
|
2506
2557
|
}
|
|
2558
|
+
|
|
2507
2559
|
class KeywordCxt {
|
|
2508
2560
|
constructor(it, def, keyword) {
|
|
2509
2561
|
(0, keyword_1.validateKeywordUsage)(it, def, keyword);
|
|
@@ -2730,9 +2782,11 @@ var require_validate = __commonJS((exports) => {
|
|
|
2730
2782
|
}
|
|
2731
2783
|
exports.getData = getData;
|
|
2732
2784
|
});
|
|
2785
|
+
|
|
2733
2786
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js
|
|
2734
2787
|
var require_validation_error = __commonJS((exports) => {
|
|
2735
2788
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2789
|
+
|
|
2736
2790
|
class ValidationError extends Error {
|
|
2737
2791
|
constructor(errors3) {
|
|
2738
2792
|
super("validation failed");
|
|
@@ -2742,10 +2796,12 @@ var require_validation_error = __commonJS((exports) => {
|
|
|
2742
2796
|
}
|
|
2743
2797
|
exports.default = ValidationError;
|
|
2744
2798
|
});
|
|
2799
|
+
|
|
2745
2800
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js
|
|
2746
2801
|
var require_ref_error = __commonJS((exports) => {
|
|
2747
2802
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2748
2803
|
var resolve_1 = require_resolve();
|
|
2804
|
+
|
|
2749
2805
|
class MissingRefError extends Error {
|
|
2750
2806
|
constructor(resolver, baseId, ref, msg) {
|
|
2751
2807
|
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
|
@@ -2755,6 +2811,7 @@ var require_ref_error = __commonJS((exports) => {
|
|
|
2755
2811
|
}
|
|
2756
2812
|
exports.default = MissingRefError;
|
|
2757
2813
|
});
|
|
2814
|
+
|
|
2758
2815
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js
|
|
2759
2816
|
var require_compile = __commonJS((exports) => {
|
|
2760
2817
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2765,6 +2822,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
2765
2822
|
var resolve_1 = require_resolve();
|
|
2766
2823
|
var util_1 = require_util();
|
|
2767
2824
|
var validate_1 = require_validate();
|
|
2825
|
+
|
|
2768
2826
|
class SchemaEnv {
|
|
2769
2827
|
constructor(env) {
|
|
2770
2828
|
var _a2;
|
|
@@ -2974,6 +3032,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
2974
3032
|
return;
|
|
2975
3033
|
}
|
|
2976
3034
|
});
|
|
3035
|
+
|
|
2977
3036
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json
|
|
2978
3037
|
var require_data = __commonJS((exports, module) => {
|
|
2979
3038
|
module.exports = {
|
|
@@ -2990,6 +3049,7 @@ var require_data = __commonJS((exports, module) => {
|
|
|
2990
3049
|
additionalProperties: false
|
|
2991
3050
|
};
|
|
2992
3051
|
});
|
|
3052
|
+
|
|
2993
3053
|
// ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js
|
|
2994
3054
|
var require_utils = __commonJS((exports, module) => {
|
|
2995
3055
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
@@ -3244,6 +3304,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
3244
3304
|
stringArrayToHexStripped
|
|
3245
3305
|
};
|
|
3246
3306
|
});
|
|
3307
|
+
|
|
3247
3308
|
// ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js
|
|
3248
3309
|
var require_schemes = __commonJS((exports, module) => {
|
|
3249
3310
|
var { isUUID } = require_utils();
|
|
@@ -3417,6 +3478,7 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
3417
3478
|
getSchemeHandler
|
|
3418
3479
|
};
|
|
3419
3480
|
});
|
|
3481
|
+
|
|
3420
3482
|
// ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js
|
|
3421
3483
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
3422
3484
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
|
|
@@ -3667,6 +3729,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
3667
3729
|
module.exports.default = fastUri;
|
|
3668
3730
|
module.exports.fastUri = fastUri;
|
|
3669
3731
|
});
|
|
3732
|
+
|
|
3670
3733
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js
|
|
3671
3734
|
var require_uri = __commonJS((exports) => {
|
|
3672
3735
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -3674,6 +3737,7 @@ var require_uri = __commonJS((exports) => {
|
|
|
3674
3737
|
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
3675
3738
|
exports.default = uri;
|
|
3676
3739
|
});
|
|
3740
|
+
|
|
3677
3741
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js
|
|
3678
3742
|
var require_core = __commonJS((exports) => {
|
|
3679
3743
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -3780,6 +3844,7 @@ var require_core = __commonJS((exports) => {
|
|
|
3780
3844
|
uriResolver
|
|
3781
3845
|
};
|
|
3782
3846
|
}
|
|
3847
|
+
|
|
3783
3848
|
class Ajv {
|
|
3784
3849
|
constructor(opts = {}) {
|
|
3785
3850
|
this.schemas = {};
|
|
@@ -4265,6 +4330,7 @@ var require_core = __commonJS((exports) => {
|
|
|
4265
4330
|
return { anyOf: [schema, $dataRef] };
|
|
4266
4331
|
}
|
|
4267
4332
|
});
|
|
4333
|
+
|
|
4268
4334
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js
|
|
4269
4335
|
var require_id = __commonJS((exports) => {
|
|
4270
4336
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4276,6 +4342,7 @@ var require_id = __commonJS((exports) => {
|
|
|
4276
4342
|
};
|
|
4277
4343
|
exports.default = def;
|
|
4278
4344
|
});
|
|
4345
|
+
|
|
4279
4346
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js
|
|
4280
4347
|
var require_ref = __commonJS((exports) => {
|
|
4281
4348
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4394,6 +4461,7 @@ var require_ref = __commonJS((exports) => {
|
|
|
4394
4461
|
exports.callRef = callRef;
|
|
4395
4462
|
exports.default = def;
|
|
4396
4463
|
});
|
|
4464
|
+
|
|
4397
4465
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js
|
|
4398
4466
|
var require_core2 = __commonJS((exports) => {
|
|
4399
4467
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4411,6 +4479,7 @@ var require_core2 = __commonJS((exports) => {
|
|
|
4411
4479
|
];
|
|
4412
4480
|
exports.default = core2;
|
|
4413
4481
|
});
|
|
4482
|
+
|
|
4414
4483
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js
|
|
4415
4484
|
var require_limitNumber = __commonJS((exports) => {
|
|
4416
4485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4439,6 +4508,7 @@ var require_limitNumber = __commonJS((exports) => {
|
|
|
4439
4508
|
};
|
|
4440
4509
|
exports.default = def;
|
|
4441
4510
|
});
|
|
4511
|
+
|
|
4442
4512
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js
|
|
4443
4513
|
var require_multipleOf = __commonJS((exports) => {
|
|
4444
4514
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4463,6 +4533,7 @@ var require_multipleOf = __commonJS((exports) => {
|
|
|
4463
4533
|
};
|
|
4464
4534
|
exports.default = def;
|
|
4465
4535
|
});
|
|
4536
|
+
|
|
4466
4537
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js
|
|
4467
4538
|
var require_ucs2length = __commonJS((exports) => {
|
|
4468
4539
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4485,6 +4556,7 @@ var require_ucs2length = __commonJS((exports) => {
|
|
|
4485
4556
|
exports.default = ucs2length;
|
|
4486
4557
|
ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
|
|
4487
4558
|
});
|
|
4559
|
+
|
|
4488
4560
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js
|
|
4489
4561
|
var require_limitLength = __commonJS((exports) => {
|
|
4490
4562
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4513,6 +4585,7 @@ var require_limitLength = __commonJS((exports) => {
|
|
|
4513
4585
|
};
|
|
4514
4586
|
exports.default = def;
|
|
4515
4587
|
});
|
|
4588
|
+
|
|
4516
4589
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js
|
|
4517
4590
|
var require_pattern = __commonJS((exports) => {
|
|
4518
4591
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4546,6 +4619,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
4546
4619
|
};
|
|
4547
4620
|
exports.default = def;
|
|
4548
4621
|
});
|
|
4622
|
+
|
|
4549
4623
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js
|
|
4550
4624
|
var require_limitProperties = __commonJS((exports) => {
|
|
4551
4625
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4571,6 +4645,7 @@ var require_limitProperties = __commonJS((exports) => {
|
|
|
4571
4645
|
};
|
|
4572
4646
|
exports.default = def;
|
|
4573
4647
|
});
|
|
4648
|
+
|
|
4574
4649
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js
|
|
4575
4650
|
var require_required = __commonJS((exports) => {
|
|
4576
4651
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4649,6 +4724,7 @@ var require_required = __commonJS((exports) => {
|
|
|
4649
4724
|
};
|
|
4650
4725
|
exports.default = def;
|
|
4651
4726
|
});
|
|
4727
|
+
|
|
4652
4728
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js
|
|
4653
4729
|
var require_limitItems = __commonJS((exports) => {
|
|
4654
4730
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4674,6 +4750,7 @@ var require_limitItems = __commonJS((exports) => {
|
|
|
4674
4750
|
};
|
|
4675
4751
|
exports.default = def;
|
|
4676
4752
|
});
|
|
4753
|
+
|
|
4677
4754
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js
|
|
4678
4755
|
var require_equal = __commonJS((exports) => {
|
|
4679
4756
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4681,6 +4758,7 @@ var require_equal = __commonJS((exports) => {
|
|
|
4681
4758
|
equal.code = 'require("ajv/dist/runtime/equal").default';
|
|
4682
4759
|
exports.default = equal;
|
|
4683
4760
|
});
|
|
4761
|
+
|
|
4684
4762
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
|
|
4685
4763
|
var require_uniqueItems = __commonJS((exports) => {
|
|
4686
4764
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4744,6 +4822,7 @@ var require_uniqueItems = __commonJS((exports) => {
|
|
|
4744
4822
|
};
|
|
4745
4823
|
exports.default = def;
|
|
4746
4824
|
});
|
|
4825
|
+
|
|
4747
4826
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js
|
|
4748
4827
|
var require_const = __commonJS((exports) => {
|
|
4749
4828
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4769,6 +4848,7 @@ var require_const = __commonJS((exports) => {
|
|
|
4769
4848
|
};
|
|
4770
4849
|
exports.default = def;
|
|
4771
4850
|
});
|
|
4851
|
+
|
|
4772
4852
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js
|
|
4773
4853
|
var require_enum = __commonJS((exports) => {
|
|
4774
4854
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4814,6 +4894,7 @@ var require_enum = __commonJS((exports) => {
|
|
|
4814
4894
|
};
|
|
4815
4895
|
exports.default = def;
|
|
4816
4896
|
});
|
|
4897
|
+
|
|
4817
4898
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js
|
|
4818
4899
|
var require_validation = __commonJS((exports) => {
|
|
4819
4900
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4843,6 +4924,7 @@ var require_validation = __commonJS((exports) => {
|
|
|
4843
4924
|
];
|
|
4844
4925
|
exports.default = validation;
|
|
4845
4926
|
});
|
|
4927
|
+
|
|
4846
4928
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
|
|
4847
4929
|
var require_additionalItems = __commonJS((exports) => {
|
|
4848
4930
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4892,6 +4974,7 @@ var require_additionalItems = __commonJS((exports) => {
|
|
|
4892
4974
|
exports.validateAdditionalItems = validateAdditionalItems;
|
|
4893
4975
|
exports.default = def;
|
|
4894
4976
|
});
|
|
4977
|
+
|
|
4895
4978
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js
|
|
4896
4979
|
var require_items = __commonJS((exports) => {
|
|
4897
4980
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4945,6 +5028,7 @@ var require_items = __commonJS((exports) => {
|
|
|
4945
5028
|
exports.validateTuple = validateTuple;
|
|
4946
5029
|
exports.default = def;
|
|
4947
5030
|
});
|
|
5031
|
+
|
|
4948
5032
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
|
|
4949
5033
|
var require_prefixItems = __commonJS((exports) => {
|
|
4950
5034
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4958,6 +5042,7 @@ var require_prefixItems = __commonJS((exports) => {
|
|
|
4958
5042
|
};
|
|
4959
5043
|
exports.default = def;
|
|
4960
5044
|
});
|
|
5045
|
+
|
|
4961
5046
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js
|
|
4962
5047
|
var require_items2020 = __commonJS((exports) => {
|
|
4963
5048
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4989,6 +5074,7 @@ var require_items2020 = __commonJS((exports) => {
|
|
|
4989
5074
|
};
|
|
4990
5075
|
exports.default = def;
|
|
4991
5076
|
});
|
|
5077
|
+
|
|
4992
5078
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js
|
|
4993
5079
|
var require_contains = __commonJS((exports) => {
|
|
4994
5080
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5079,6 +5165,7 @@ var require_contains = __commonJS((exports) => {
|
|
|
5079
5165
|
};
|
|
5080
5166
|
exports.default = def;
|
|
5081
5167
|
});
|
|
5168
|
+
|
|
5082
5169
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js
|
|
5083
5170
|
var require_dependencies = __commonJS((exports) => {
|
|
5084
5171
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5163,6 +5250,7 @@ var require_dependencies = __commonJS((exports) => {
|
|
|
5163
5250
|
exports.validateSchemaDeps = validateSchemaDeps;
|
|
5164
5251
|
exports.default = def;
|
|
5165
5252
|
});
|
|
5253
|
+
|
|
5166
5254
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
|
|
5167
5255
|
var require_propertyNames = __commonJS((exports) => {
|
|
5168
5256
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5202,6 +5290,7 @@ var require_propertyNames = __commonJS((exports) => {
|
|
|
5202
5290
|
};
|
|
5203
5291
|
exports.default = def;
|
|
5204
5292
|
});
|
|
5293
|
+
|
|
5205
5294
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
|
|
5206
5295
|
var require_additionalProperties = __commonJS((exports) => {
|
|
5207
5296
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5304,6 +5393,7 @@ var require_additionalProperties = __commonJS((exports) => {
|
|
|
5304
5393
|
};
|
|
5305
5394
|
exports.default = def;
|
|
5306
5395
|
});
|
|
5396
|
+
|
|
5307
5397
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js
|
|
5308
5398
|
var require_properties = __commonJS((exports) => {
|
|
5309
5399
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5358,6 +5448,7 @@ var require_properties = __commonJS((exports) => {
|
|
|
5358
5448
|
};
|
|
5359
5449
|
exports.default = def;
|
|
5360
5450
|
});
|
|
5451
|
+
|
|
5361
5452
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
|
|
5362
5453
|
var require_patternProperties = __commonJS((exports) => {
|
|
5363
5454
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5428,6 +5519,7 @@ var require_patternProperties = __commonJS((exports) => {
|
|
|
5428
5519
|
};
|
|
5429
5520
|
exports.default = def;
|
|
5430
5521
|
});
|
|
5522
|
+
|
|
5431
5523
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js
|
|
5432
5524
|
var require_not = __commonJS((exports) => {
|
|
5433
5525
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5455,6 +5547,7 @@ var require_not = __commonJS((exports) => {
|
|
|
5455
5547
|
};
|
|
5456
5548
|
exports.default = def;
|
|
5457
5549
|
});
|
|
5550
|
+
|
|
5458
5551
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js
|
|
5459
5552
|
var require_anyOf = __commonJS((exports) => {
|
|
5460
5553
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5468,6 +5561,7 @@ var require_anyOf = __commonJS((exports) => {
|
|
|
5468
5561
|
};
|
|
5469
5562
|
exports.default = def;
|
|
5470
5563
|
});
|
|
5564
|
+
|
|
5471
5565
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js
|
|
5472
5566
|
var require_oneOf = __commonJS((exports) => {
|
|
5473
5567
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5522,6 +5616,7 @@ var require_oneOf = __commonJS((exports) => {
|
|
|
5522
5616
|
};
|
|
5523
5617
|
exports.default = def;
|
|
5524
5618
|
});
|
|
5619
|
+
|
|
5525
5620
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js
|
|
5526
5621
|
var require_allOf = __commonJS((exports) => {
|
|
5527
5622
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5545,6 +5640,7 @@ var require_allOf = __commonJS((exports) => {
|
|
|
5545
5640
|
};
|
|
5546
5641
|
exports.default = def;
|
|
5547
5642
|
});
|
|
5643
|
+
|
|
5548
5644
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js
|
|
5549
5645
|
var require_if = __commonJS((exports) => {
|
|
5550
5646
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5610,6 +5706,7 @@ var require_if = __commonJS((exports) => {
|
|
|
5610
5706
|
}
|
|
5611
5707
|
exports.default = def;
|
|
5612
5708
|
});
|
|
5709
|
+
|
|
5613
5710
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js
|
|
5614
5711
|
var require_thenElse = __commonJS((exports) => {
|
|
5615
5712
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5624,6 +5721,7 @@ var require_thenElse = __commonJS((exports) => {
|
|
|
5624
5721
|
};
|
|
5625
5722
|
exports.default = def;
|
|
5626
5723
|
});
|
|
5724
|
+
|
|
5627
5725
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js
|
|
5628
5726
|
var require_applicator = __commonJS((exports) => {
|
|
5629
5727
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5666,6 +5764,7 @@ var require_applicator = __commonJS((exports) => {
|
|
|
5666
5764
|
}
|
|
5667
5765
|
exports.default = getApplicator;
|
|
5668
5766
|
});
|
|
5767
|
+
|
|
5669
5768
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js
|
|
5670
5769
|
var require_format = __commonJS((exports) => {
|
|
5671
5770
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5752,6 +5851,7 @@ var require_format = __commonJS((exports) => {
|
|
|
5752
5851
|
};
|
|
5753
5852
|
exports.default = def;
|
|
5754
5853
|
});
|
|
5854
|
+
|
|
5755
5855
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js
|
|
5756
5856
|
var require_format2 = __commonJS((exports) => {
|
|
5757
5857
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5759,6 +5859,7 @@ var require_format2 = __commonJS((exports) => {
|
|
|
5759
5859
|
var format = [format_1.default];
|
|
5760
5860
|
exports.default = format;
|
|
5761
5861
|
});
|
|
5862
|
+
|
|
5762
5863
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js
|
|
5763
5864
|
var require_metadata = __commonJS((exports) => {
|
|
5764
5865
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5778,6 +5879,7 @@ var require_metadata = __commonJS((exports) => {
|
|
|
5778
5879
|
"contentSchema"
|
|
5779
5880
|
];
|
|
5780
5881
|
});
|
|
5882
|
+
|
|
5781
5883
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js
|
|
5782
5884
|
var require_draft7 = __commonJS((exports) => {
|
|
5783
5885
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5796,6 +5898,7 @@ var require_draft7 = __commonJS((exports) => {
|
|
|
5796
5898
|
];
|
|
5797
5899
|
exports.default = draft7Vocabularies;
|
|
5798
5900
|
});
|
|
5901
|
+
|
|
5799
5902
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js
|
|
5800
5903
|
var require_types = __commonJS((exports) => {
|
|
5801
5904
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5806,6 +5909,7 @@ var require_types = __commonJS((exports) => {
|
|
|
5806
5909
|
DiscrError2["Mapping"] = "mapping";
|
|
5807
5910
|
})(DiscrError || (exports.DiscrError = DiscrError = {}));
|
|
5808
5911
|
});
|
|
5912
|
+
|
|
5809
5913
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js
|
|
5810
5914
|
var require_discriminator = __commonJS((exports) => {
|
|
5811
5915
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5907,6 +6011,7 @@ var require_discriminator = __commonJS((exports) => {
|
|
|
5907
6011
|
};
|
|
5908
6012
|
exports.default = def;
|
|
5909
6013
|
});
|
|
6014
|
+
|
|
5910
6015
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
5911
6016
|
var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
5912
6017
|
module.exports = {
|
|
@@ -6061,6 +6166,7 @@ var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
|
6061
6166
|
default: true
|
|
6062
6167
|
};
|
|
6063
6168
|
});
|
|
6169
|
+
|
|
6064
6170
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js
|
|
6065
6171
|
var require_ajv = __commonJS((exports, module) => {
|
|
6066
6172
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6071,6 +6177,7 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
6071
6177
|
var draft7MetaSchema = require_json_schema_draft_07();
|
|
6072
6178
|
var META_SUPPORT_DATA = ["/properties"];
|
|
6073
6179
|
var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
6180
|
+
|
|
6074
6181
|
class Ajv extends core_1.default {
|
|
6075
6182
|
_addVocabularies() {
|
|
6076
6183
|
super._addVocabularies();
|
|
@@ -6127,6 +6234,7 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
6127
6234
|
return ref_error_1.default;
|
|
6128
6235
|
} });
|
|
6129
6236
|
});
|
|
6237
|
+
|
|
6130
6238
|
// ../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js
|
|
6131
6239
|
var require_formats = __commonJS((exports) => {
|
|
6132
6240
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6303,6 +6411,7 @@ var require_formats = __commonJS((exports) => {
|
|
|
6303
6411
|
}
|
|
6304
6412
|
}
|
|
6305
6413
|
});
|
|
6414
|
+
|
|
6306
6415
|
// ../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js
|
|
6307
6416
|
var require_limit = __commonJS((exports) => {
|
|
6308
6417
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6371,6 +6480,7 @@ var require_limit = __commonJS((exports) => {
|
|
|
6371
6480
|
};
|
|
6372
6481
|
exports.default = formatLimitPlugin;
|
|
6373
6482
|
});
|
|
6483
|
+
|
|
6374
6484
|
// ../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js
|
|
6375
6485
|
var require_dist = __commonJS((exports, module) => {
|
|
6376
6486
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6409,6 +6519,2881 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6409
6519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6410
6520
|
exports.default = formatsPlugin;
|
|
6411
6521
|
});
|
|
6522
|
+
|
|
6523
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js
|
|
6524
|
+
var require_constants = __commonJS((exports, module) => {
|
|
6525
|
+
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
6526
|
+
var hasBlob = typeof Blob !== "undefined";
|
|
6527
|
+
if (hasBlob)
|
|
6528
|
+
BINARY_TYPES.push("blob");
|
|
6529
|
+
module.exports = {
|
|
6530
|
+
BINARY_TYPES,
|
|
6531
|
+
CLOSE_TIMEOUT: 30000,
|
|
6532
|
+
EMPTY_BUFFER: Buffer.alloc(0),
|
|
6533
|
+
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
6534
|
+
hasBlob,
|
|
6535
|
+
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
6536
|
+
kListener: Symbol("kListener"),
|
|
6537
|
+
kStatusCode: Symbol("status-code"),
|
|
6538
|
+
kWebSocket: Symbol("websocket"),
|
|
6539
|
+
NOOP: () => {}
|
|
6540
|
+
};
|
|
6541
|
+
});
|
|
6542
|
+
|
|
6543
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js
|
|
6544
|
+
var require_buffer_util = __commonJS((exports, module) => {
|
|
6545
|
+
var { EMPTY_BUFFER } = require_constants();
|
|
6546
|
+
var FastBuffer = Buffer[Symbol.species];
|
|
6547
|
+
function concat(list, totalLength) {
|
|
6548
|
+
if (list.length === 0)
|
|
6549
|
+
return EMPTY_BUFFER;
|
|
6550
|
+
if (list.length === 1)
|
|
6551
|
+
return list[0];
|
|
6552
|
+
const target = Buffer.allocUnsafe(totalLength);
|
|
6553
|
+
let offset = 0;
|
|
6554
|
+
for (let i = 0;i < list.length; i++) {
|
|
6555
|
+
const buf = list[i];
|
|
6556
|
+
target.set(buf, offset);
|
|
6557
|
+
offset += buf.length;
|
|
6558
|
+
}
|
|
6559
|
+
if (offset < totalLength) {
|
|
6560
|
+
return new FastBuffer(target.buffer, target.byteOffset, offset);
|
|
6561
|
+
}
|
|
6562
|
+
return target;
|
|
6563
|
+
}
|
|
6564
|
+
function _mask(source, mask, output, offset, length) {
|
|
6565
|
+
for (let i = 0;i < length; i++) {
|
|
6566
|
+
output[offset + i] = source[i] ^ mask[i & 3];
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
function _unmask(buffer, mask) {
|
|
6570
|
+
for (let i = 0;i < buffer.length; i++) {
|
|
6571
|
+
buffer[i] ^= mask[i & 3];
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
function toArrayBuffer(buf) {
|
|
6575
|
+
if (buf.length === buf.buffer.byteLength) {
|
|
6576
|
+
return buf.buffer;
|
|
6577
|
+
}
|
|
6578
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
6579
|
+
}
|
|
6580
|
+
function toBuffer(data) {
|
|
6581
|
+
toBuffer.readOnly = true;
|
|
6582
|
+
if (Buffer.isBuffer(data))
|
|
6583
|
+
return data;
|
|
6584
|
+
let buf;
|
|
6585
|
+
if (data instanceof ArrayBuffer) {
|
|
6586
|
+
buf = new FastBuffer(data);
|
|
6587
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
6588
|
+
buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
|
|
6589
|
+
} else {
|
|
6590
|
+
buf = Buffer.from(data);
|
|
6591
|
+
toBuffer.readOnly = false;
|
|
6592
|
+
}
|
|
6593
|
+
return buf;
|
|
6594
|
+
}
|
|
6595
|
+
module.exports = {
|
|
6596
|
+
concat,
|
|
6597
|
+
mask: _mask,
|
|
6598
|
+
toArrayBuffer,
|
|
6599
|
+
toBuffer,
|
|
6600
|
+
unmask: _unmask
|
|
6601
|
+
};
|
|
6602
|
+
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
6603
|
+
try {
|
|
6604
|
+
const bufferUtil = (()=>{throw new Error("Cannot require module "+"bufferutil");})();
|
|
6605
|
+
module.exports.mask = function(source, mask, output, offset, length) {
|
|
6606
|
+
if (length < 48)
|
|
6607
|
+
_mask(source, mask, output, offset, length);
|
|
6608
|
+
else
|
|
6609
|
+
bufferUtil.mask(source, mask, output, offset, length);
|
|
6610
|
+
};
|
|
6611
|
+
module.exports.unmask = function(buffer, mask) {
|
|
6612
|
+
if (buffer.length < 32)
|
|
6613
|
+
_unmask(buffer, mask);
|
|
6614
|
+
else
|
|
6615
|
+
bufferUtil.unmask(buffer, mask);
|
|
6616
|
+
};
|
|
6617
|
+
} catch (e) {}
|
|
6618
|
+
}
|
|
6619
|
+
});
|
|
6620
|
+
|
|
6621
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js
|
|
6622
|
+
var require_limiter = __commonJS((exports, module) => {
|
|
6623
|
+
var kDone = Symbol("kDone");
|
|
6624
|
+
var kRun = Symbol("kRun");
|
|
6625
|
+
|
|
6626
|
+
class Limiter {
|
|
6627
|
+
constructor(concurrency) {
|
|
6628
|
+
this[kDone] = () => {
|
|
6629
|
+
this.pending--;
|
|
6630
|
+
this[kRun]();
|
|
6631
|
+
};
|
|
6632
|
+
this.concurrency = concurrency || Infinity;
|
|
6633
|
+
this.jobs = [];
|
|
6634
|
+
this.pending = 0;
|
|
6635
|
+
}
|
|
6636
|
+
add(job) {
|
|
6637
|
+
this.jobs.push(job);
|
|
6638
|
+
this[kRun]();
|
|
6639
|
+
}
|
|
6640
|
+
[kRun]() {
|
|
6641
|
+
if (this.pending === this.concurrency)
|
|
6642
|
+
return;
|
|
6643
|
+
if (this.jobs.length) {
|
|
6644
|
+
const job = this.jobs.shift();
|
|
6645
|
+
this.pending++;
|
|
6646
|
+
job(this[kDone]);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
module.exports = Limiter;
|
|
6651
|
+
});
|
|
6652
|
+
|
|
6653
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js
|
|
6654
|
+
var require_permessage_deflate = __commonJS((exports, module) => {
|
|
6655
|
+
var zlib = __require("zlib");
|
|
6656
|
+
var bufferUtil = require_buffer_util();
|
|
6657
|
+
var Limiter = require_limiter();
|
|
6658
|
+
var { kStatusCode } = require_constants();
|
|
6659
|
+
var FastBuffer = Buffer[Symbol.species];
|
|
6660
|
+
var TRAILER = Buffer.from([0, 0, 255, 255]);
|
|
6661
|
+
var kPerMessageDeflate = Symbol("permessage-deflate");
|
|
6662
|
+
var kTotalLength = Symbol("total-length");
|
|
6663
|
+
var kCallback = Symbol("callback");
|
|
6664
|
+
var kBuffers = Symbol("buffers");
|
|
6665
|
+
var kError = Symbol("error");
|
|
6666
|
+
var zlibLimiter;
|
|
6667
|
+
|
|
6668
|
+
class PerMessageDeflate {
|
|
6669
|
+
constructor(options) {
|
|
6670
|
+
this._options = options || {};
|
|
6671
|
+
this._threshold = this._options.threshold !== undefined ? this._options.threshold : 1024;
|
|
6672
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
6673
|
+
this._isServer = !!this._options.isServer;
|
|
6674
|
+
this._deflate = null;
|
|
6675
|
+
this._inflate = null;
|
|
6676
|
+
this.params = null;
|
|
6677
|
+
if (!zlibLimiter) {
|
|
6678
|
+
const concurrency = this._options.concurrencyLimit !== undefined ? this._options.concurrencyLimit : 10;
|
|
6679
|
+
zlibLimiter = new Limiter(concurrency);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
static get extensionName() {
|
|
6683
|
+
return "permessage-deflate";
|
|
6684
|
+
}
|
|
6685
|
+
offer() {
|
|
6686
|
+
const params = {};
|
|
6687
|
+
if (this._options.serverNoContextTakeover) {
|
|
6688
|
+
params.server_no_context_takeover = true;
|
|
6689
|
+
}
|
|
6690
|
+
if (this._options.clientNoContextTakeover) {
|
|
6691
|
+
params.client_no_context_takeover = true;
|
|
6692
|
+
}
|
|
6693
|
+
if (this._options.serverMaxWindowBits) {
|
|
6694
|
+
params.server_max_window_bits = this._options.serverMaxWindowBits;
|
|
6695
|
+
}
|
|
6696
|
+
if (this._options.clientMaxWindowBits) {
|
|
6697
|
+
params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
6698
|
+
} else if (this._options.clientMaxWindowBits == null) {
|
|
6699
|
+
params.client_max_window_bits = true;
|
|
6700
|
+
}
|
|
6701
|
+
return params;
|
|
6702
|
+
}
|
|
6703
|
+
accept(configurations) {
|
|
6704
|
+
configurations = this.normalizeParams(configurations);
|
|
6705
|
+
this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations);
|
|
6706
|
+
return this.params;
|
|
6707
|
+
}
|
|
6708
|
+
cleanup() {
|
|
6709
|
+
if (this._inflate) {
|
|
6710
|
+
this._inflate.close();
|
|
6711
|
+
this._inflate = null;
|
|
6712
|
+
}
|
|
6713
|
+
if (this._deflate) {
|
|
6714
|
+
const callback = this._deflate[kCallback];
|
|
6715
|
+
this._deflate.close();
|
|
6716
|
+
this._deflate = null;
|
|
6717
|
+
if (callback) {
|
|
6718
|
+
callback(new Error("The deflate stream was closed while data was being processed"));
|
|
6719
|
+
}
|
|
6720
|
+
}
|
|
6721
|
+
}
|
|
6722
|
+
acceptAsServer(offers) {
|
|
6723
|
+
const opts = this._options;
|
|
6724
|
+
const accepted = offers.find((params) => {
|
|
6725
|
+
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
|
|
6726
|
+
return false;
|
|
6727
|
+
}
|
|
6728
|
+
return true;
|
|
6729
|
+
});
|
|
6730
|
+
if (!accepted) {
|
|
6731
|
+
throw new Error("None of the extension offers can be accepted");
|
|
6732
|
+
}
|
|
6733
|
+
if (opts.serverNoContextTakeover) {
|
|
6734
|
+
accepted.server_no_context_takeover = true;
|
|
6735
|
+
}
|
|
6736
|
+
if (opts.clientNoContextTakeover) {
|
|
6737
|
+
accepted.client_no_context_takeover = true;
|
|
6738
|
+
}
|
|
6739
|
+
if (typeof opts.serverMaxWindowBits === "number") {
|
|
6740
|
+
accepted.server_max_window_bits = opts.serverMaxWindowBits;
|
|
6741
|
+
}
|
|
6742
|
+
if (typeof opts.clientMaxWindowBits === "number") {
|
|
6743
|
+
accepted.client_max_window_bits = opts.clientMaxWindowBits;
|
|
6744
|
+
} else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) {
|
|
6745
|
+
delete accepted.client_max_window_bits;
|
|
6746
|
+
}
|
|
6747
|
+
return accepted;
|
|
6748
|
+
}
|
|
6749
|
+
acceptAsClient(response) {
|
|
6750
|
+
const params = response[0];
|
|
6751
|
+
if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) {
|
|
6752
|
+
throw new Error('Unexpected parameter "client_no_context_takeover"');
|
|
6753
|
+
}
|
|
6754
|
+
if (!params.client_max_window_bits) {
|
|
6755
|
+
if (typeof this._options.clientMaxWindowBits === "number") {
|
|
6756
|
+
params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
6757
|
+
}
|
|
6758
|
+
} else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) {
|
|
6759
|
+
throw new Error('Unexpected or invalid parameter "client_max_window_bits"');
|
|
6760
|
+
}
|
|
6761
|
+
return params;
|
|
6762
|
+
}
|
|
6763
|
+
normalizeParams(configurations) {
|
|
6764
|
+
configurations.forEach((params) => {
|
|
6765
|
+
Object.keys(params).forEach((key) => {
|
|
6766
|
+
let value = params[key];
|
|
6767
|
+
if (value.length > 1) {
|
|
6768
|
+
throw new Error(`Parameter "${key}" must have only a single value`);
|
|
6769
|
+
}
|
|
6770
|
+
value = value[0];
|
|
6771
|
+
if (key === "client_max_window_bits") {
|
|
6772
|
+
if (value !== true) {
|
|
6773
|
+
const num = +value;
|
|
6774
|
+
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
6775
|
+
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
6776
|
+
}
|
|
6777
|
+
value = num;
|
|
6778
|
+
} else if (!this._isServer) {
|
|
6779
|
+
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
6780
|
+
}
|
|
6781
|
+
} else if (key === "server_max_window_bits") {
|
|
6782
|
+
const num = +value;
|
|
6783
|
+
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
6784
|
+
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
6785
|
+
}
|
|
6786
|
+
value = num;
|
|
6787
|
+
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
6788
|
+
if (value !== true) {
|
|
6789
|
+
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
6790
|
+
}
|
|
6791
|
+
} else {
|
|
6792
|
+
throw new Error(`Unknown parameter "${key}"`);
|
|
6793
|
+
}
|
|
6794
|
+
params[key] = value;
|
|
6795
|
+
});
|
|
6796
|
+
});
|
|
6797
|
+
return configurations;
|
|
6798
|
+
}
|
|
6799
|
+
decompress(data, fin, callback) {
|
|
6800
|
+
zlibLimiter.add((done) => {
|
|
6801
|
+
this._decompress(data, fin, (err, result) => {
|
|
6802
|
+
done();
|
|
6803
|
+
callback(err, result);
|
|
6804
|
+
});
|
|
6805
|
+
});
|
|
6806
|
+
}
|
|
6807
|
+
compress(data, fin, callback) {
|
|
6808
|
+
zlibLimiter.add((done) => {
|
|
6809
|
+
this._compress(data, fin, (err, result) => {
|
|
6810
|
+
done();
|
|
6811
|
+
callback(err, result);
|
|
6812
|
+
});
|
|
6813
|
+
});
|
|
6814
|
+
}
|
|
6815
|
+
_decompress(data, fin, callback) {
|
|
6816
|
+
const endpoint = this._isServer ? "client" : "server";
|
|
6817
|
+
if (!this._inflate) {
|
|
6818
|
+
const key = `${endpoint}_max_window_bits`;
|
|
6819
|
+
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
6820
|
+
this._inflate = zlib.createInflateRaw({
|
|
6821
|
+
...this._options.zlibInflateOptions,
|
|
6822
|
+
windowBits
|
|
6823
|
+
});
|
|
6824
|
+
this._inflate[kPerMessageDeflate] = this;
|
|
6825
|
+
this._inflate[kTotalLength] = 0;
|
|
6826
|
+
this._inflate[kBuffers] = [];
|
|
6827
|
+
this._inflate.on("error", inflateOnError);
|
|
6828
|
+
this._inflate.on("data", inflateOnData);
|
|
6829
|
+
}
|
|
6830
|
+
this._inflate[kCallback] = callback;
|
|
6831
|
+
this._inflate.write(data);
|
|
6832
|
+
if (fin)
|
|
6833
|
+
this._inflate.write(TRAILER);
|
|
6834
|
+
this._inflate.flush(() => {
|
|
6835
|
+
const err = this._inflate[kError];
|
|
6836
|
+
if (err) {
|
|
6837
|
+
this._inflate.close();
|
|
6838
|
+
this._inflate = null;
|
|
6839
|
+
callback(err);
|
|
6840
|
+
return;
|
|
6841
|
+
}
|
|
6842
|
+
const data2 = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
|
|
6843
|
+
if (this._inflate._readableState.endEmitted) {
|
|
6844
|
+
this._inflate.close();
|
|
6845
|
+
this._inflate = null;
|
|
6846
|
+
} else {
|
|
6847
|
+
this._inflate[kTotalLength] = 0;
|
|
6848
|
+
this._inflate[kBuffers] = [];
|
|
6849
|
+
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
6850
|
+
this._inflate.reset();
|
|
6851
|
+
}
|
|
6852
|
+
}
|
|
6853
|
+
callback(null, data2);
|
|
6854
|
+
});
|
|
6855
|
+
}
|
|
6856
|
+
_compress(data, fin, callback) {
|
|
6857
|
+
const endpoint = this._isServer ? "server" : "client";
|
|
6858
|
+
if (!this._deflate) {
|
|
6859
|
+
const key = `${endpoint}_max_window_bits`;
|
|
6860
|
+
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
6861
|
+
this._deflate = zlib.createDeflateRaw({
|
|
6862
|
+
...this._options.zlibDeflateOptions,
|
|
6863
|
+
windowBits
|
|
6864
|
+
});
|
|
6865
|
+
this._deflate[kTotalLength] = 0;
|
|
6866
|
+
this._deflate[kBuffers] = [];
|
|
6867
|
+
this._deflate.on("data", deflateOnData);
|
|
6868
|
+
}
|
|
6869
|
+
this._deflate[kCallback] = callback;
|
|
6870
|
+
this._deflate.write(data);
|
|
6871
|
+
this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
|
|
6872
|
+
if (!this._deflate) {
|
|
6873
|
+
return;
|
|
6874
|
+
}
|
|
6875
|
+
let data2 = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
|
|
6876
|
+
if (fin) {
|
|
6877
|
+
data2 = new FastBuffer(data2.buffer, data2.byteOffset, data2.length - 4);
|
|
6878
|
+
}
|
|
6879
|
+
this._deflate[kCallback] = null;
|
|
6880
|
+
this._deflate[kTotalLength] = 0;
|
|
6881
|
+
this._deflate[kBuffers] = [];
|
|
6882
|
+
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
6883
|
+
this._deflate.reset();
|
|
6884
|
+
}
|
|
6885
|
+
callback(null, data2);
|
|
6886
|
+
});
|
|
6887
|
+
}
|
|
6888
|
+
}
|
|
6889
|
+
module.exports = PerMessageDeflate;
|
|
6890
|
+
function deflateOnData(chunk) {
|
|
6891
|
+
this[kBuffers].push(chunk);
|
|
6892
|
+
this[kTotalLength] += chunk.length;
|
|
6893
|
+
}
|
|
6894
|
+
function inflateOnData(chunk) {
|
|
6895
|
+
this[kTotalLength] += chunk.length;
|
|
6896
|
+
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
6897
|
+
this[kBuffers].push(chunk);
|
|
6898
|
+
return;
|
|
6899
|
+
}
|
|
6900
|
+
this[kError] = new RangeError("Max payload size exceeded");
|
|
6901
|
+
this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
|
|
6902
|
+
this[kError][kStatusCode] = 1009;
|
|
6903
|
+
this.removeListener("data", inflateOnData);
|
|
6904
|
+
this.reset();
|
|
6905
|
+
}
|
|
6906
|
+
function inflateOnError(err) {
|
|
6907
|
+
this[kPerMessageDeflate]._inflate = null;
|
|
6908
|
+
if (this[kError]) {
|
|
6909
|
+
this[kCallback](this[kError]);
|
|
6910
|
+
return;
|
|
6911
|
+
}
|
|
6912
|
+
err[kStatusCode] = 1007;
|
|
6913
|
+
this[kCallback](err);
|
|
6914
|
+
}
|
|
6915
|
+
});
|
|
6916
|
+
|
|
6917
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js
|
|
6918
|
+
var require_validation2 = __commonJS((exports, module) => {
|
|
6919
|
+
var { isUtf8 } = __require("buffer");
|
|
6920
|
+
var { hasBlob } = require_constants();
|
|
6921
|
+
var tokenChars = [
|
|
6922
|
+
0,
|
|
6923
|
+
0,
|
|
6924
|
+
0,
|
|
6925
|
+
0,
|
|
6926
|
+
0,
|
|
6927
|
+
0,
|
|
6928
|
+
0,
|
|
6929
|
+
0,
|
|
6930
|
+
0,
|
|
6931
|
+
0,
|
|
6932
|
+
0,
|
|
6933
|
+
0,
|
|
6934
|
+
0,
|
|
6935
|
+
0,
|
|
6936
|
+
0,
|
|
6937
|
+
0,
|
|
6938
|
+
0,
|
|
6939
|
+
0,
|
|
6940
|
+
0,
|
|
6941
|
+
0,
|
|
6942
|
+
0,
|
|
6943
|
+
0,
|
|
6944
|
+
0,
|
|
6945
|
+
0,
|
|
6946
|
+
0,
|
|
6947
|
+
0,
|
|
6948
|
+
0,
|
|
6949
|
+
0,
|
|
6950
|
+
0,
|
|
6951
|
+
0,
|
|
6952
|
+
0,
|
|
6953
|
+
0,
|
|
6954
|
+
0,
|
|
6955
|
+
1,
|
|
6956
|
+
0,
|
|
6957
|
+
1,
|
|
6958
|
+
1,
|
|
6959
|
+
1,
|
|
6960
|
+
1,
|
|
6961
|
+
1,
|
|
6962
|
+
0,
|
|
6963
|
+
0,
|
|
6964
|
+
1,
|
|
6965
|
+
1,
|
|
6966
|
+
0,
|
|
6967
|
+
1,
|
|
6968
|
+
1,
|
|
6969
|
+
0,
|
|
6970
|
+
1,
|
|
6971
|
+
1,
|
|
6972
|
+
1,
|
|
6973
|
+
1,
|
|
6974
|
+
1,
|
|
6975
|
+
1,
|
|
6976
|
+
1,
|
|
6977
|
+
1,
|
|
6978
|
+
1,
|
|
6979
|
+
1,
|
|
6980
|
+
0,
|
|
6981
|
+
0,
|
|
6982
|
+
0,
|
|
6983
|
+
0,
|
|
6984
|
+
0,
|
|
6985
|
+
0,
|
|
6986
|
+
0,
|
|
6987
|
+
1,
|
|
6988
|
+
1,
|
|
6989
|
+
1,
|
|
6990
|
+
1,
|
|
6991
|
+
1,
|
|
6992
|
+
1,
|
|
6993
|
+
1,
|
|
6994
|
+
1,
|
|
6995
|
+
1,
|
|
6996
|
+
1,
|
|
6997
|
+
1,
|
|
6998
|
+
1,
|
|
6999
|
+
1,
|
|
7000
|
+
1,
|
|
7001
|
+
1,
|
|
7002
|
+
1,
|
|
7003
|
+
1,
|
|
7004
|
+
1,
|
|
7005
|
+
1,
|
|
7006
|
+
1,
|
|
7007
|
+
1,
|
|
7008
|
+
1,
|
|
7009
|
+
1,
|
|
7010
|
+
1,
|
|
7011
|
+
1,
|
|
7012
|
+
1,
|
|
7013
|
+
0,
|
|
7014
|
+
0,
|
|
7015
|
+
0,
|
|
7016
|
+
1,
|
|
7017
|
+
1,
|
|
7018
|
+
1,
|
|
7019
|
+
1,
|
|
7020
|
+
1,
|
|
7021
|
+
1,
|
|
7022
|
+
1,
|
|
7023
|
+
1,
|
|
7024
|
+
1,
|
|
7025
|
+
1,
|
|
7026
|
+
1,
|
|
7027
|
+
1,
|
|
7028
|
+
1,
|
|
7029
|
+
1,
|
|
7030
|
+
1,
|
|
7031
|
+
1,
|
|
7032
|
+
1,
|
|
7033
|
+
1,
|
|
7034
|
+
1,
|
|
7035
|
+
1,
|
|
7036
|
+
1,
|
|
7037
|
+
1,
|
|
7038
|
+
1,
|
|
7039
|
+
1,
|
|
7040
|
+
1,
|
|
7041
|
+
1,
|
|
7042
|
+
1,
|
|
7043
|
+
1,
|
|
7044
|
+
1,
|
|
7045
|
+
0,
|
|
7046
|
+
1,
|
|
7047
|
+
0,
|
|
7048
|
+
1,
|
|
7049
|
+
0
|
|
7050
|
+
];
|
|
7051
|
+
function isValidStatusCode(code) {
|
|
7052
|
+
return code >= 1000 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3000 && code <= 4999;
|
|
7053
|
+
}
|
|
7054
|
+
function _isValidUTF8(buf) {
|
|
7055
|
+
const len = buf.length;
|
|
7056
|
+
let i = 0;
|
|
7057
|
+
while (i < len) {
|
|
7058
|
+
if ((buf[i] & 128) === 0) {
|
|
7059
|
+
i++;
|
|
7060
|
+
} else if ((buf[i] & 224) === 192) {
|
|
7061
|
+
if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) {
|
|
7062
|
+
return false;
|
|
7063
|
+
}
|
|
7064
|
+
i += 2;
|
|
7065
|
+
} else if ((buf[i] & 240) === 224) {
|
|
7066
|
+
if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || buf[i] === 237 && (buf[i + 1] & 224) === 160) {
|
|
7067
|
+
return false;
|
|
7068
|
+
}
|
|
7069
|
+
i += 3;
|
|
7070
|
+
} else if ((buf[i] & 248) === 240) {
|
|
7071
|
+
if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) {
|
|
7072
|
+
return false;
|
|
7073
|
+
}
|
|
7074
|
+
i += 4;
|
|
7075
|
+
} else {
|
|
7076
|
+
return false;
|
|
7077
|
+
}
|
|
7078
|
+
}
|
|
7079
|
+
return true;
|
|
7080
|
+
}
|
|
7081
|
+
function isBlob(value) {
|
|
7082
|
+
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
7083
|
+
}
|
|
7084
|
+
module.exports = {
|
|
7085
|
+
isBlob,
|
|
7086
|
+
isValidStatusCode,
|
|
7087
|
+
isValidUTF8: _isValidUTF8,
|
|
7088
|
+
tokenChars
|
|
7089
|
+
};
|
|
7090
|
+
if (isUtf8) {
|
|
7091
|
+
module.exports.isValidUTF8 = function(buf) {
|
|
7092
|
+
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
7093
|
+
};
|
|
7094
|
+
} else if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
7095
|
+
try {
|
|
7096
|
+
const isValidUTF8 = (()=>{throw new Error("Cannot require module "+"utf-8-validate");})();
|
|
7097
|
+
module.exports.isValidUTF8 = function(buf) {
|
|
7098
|
+
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
7099
|
+
};
|
|
7100
|
+
} catch (e) {}
|
|
7101
|
+
}
|
|
7102
|
+
});
|
|
7103
|
+
|
|
7104
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js
|
|
7105
|
+
var require_receiver = __commonJS((exports, module) => {
|
|
7106
|
+
var { Writable } = __require("stream");
|
|
7107
|
+
var PerMessageDeflate = require_permessage_deflate();
|
|
7108
|
+
var {
|
|
7109
|
+
BINARY_TYPES,
|
|
7110
|
+
EMPTY_BUFFER,
|
|
7111
|
+
kStatusCode,
|
|
7112
|
+
kWebSocket
|
|
7113
|
+
} = require_constants();
|
|
7114
|
+
var { concat, toArrayBuffer, unmask } = require_buffer_util();
|
|
7115
|
+
var { isValidStatusCode, isValidUTF8 } = require_validation2();
|
|
7116
|
+
var FastBuffer = Buffer[Symbol.species];
|
|
7117
|
+
var GET_INFO = 0;
|
|
7118
|
+
var GET_PAYLOAD_LENGTH_16 = 1;
|
|
7119
|
+
var GET_PAYLOAD_LENGTH_64 = 2;
|
|
7120
|
+
var GET_MASK = 3;
|
|
7121
|
+
var GET_DATA = 4;
|
|
7122
|
+
var INFLATING = 5;
|
|
7123
|
+
var DEFER_EVENT = 6;
|
|
7124
|
+
|
|
7125
|
+
class Receiver extends Writable {
|
|
7126
|
+
constructor(options = {}) {
|
|
7127
|
+
super();
|
|
7128
|
+
this._allowSynchronousEvents = options.allowSynchronousEvents !== undefined ? options.allowSynchronousEvents : true;
|
|
7129
|
+
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
7130
|
+
this._extensions = options.extensions || {};
|
|
7131
|
+
this._isServer = !!options.isServer;
|
|
7132
|
+
this._maxPayload = options.maxPayload | 0;
|
|
7133
|
+
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
7134
|
+
this[kWebSocket] = undefined;
|
|
7135
|
+
this._bufferedBytes = 0;
|
|
7136
|
+
this._buffers = [];
|
|
7137
|
+
this._compressed = false;
|
|
7138
|
+
this._payloadLength = 0;
|
|
7139
|
+
this._mask = undefined;
|
|
7140
|
+
this._fragmented = 0;
|
|
7141
|
+
this._masked = false;
|
|
7142
|
+
this._fin = false;
|
|
7143
|
+
this._opcode = 0;
|
|
7144
|
+
this._totalPayloadLength = 0;
|
|
7145
|
+
this._messageLength = 0;
|
|
7146
|
+
this._fragments = [];
|
|
7147
|
+
this._errored = false;
|
|
7148
|
+
this._loop = false;
|
|
7149
|
+
this._state = GET_INFO;
|
|
7150
|
+
}
|
|
7151
|
+
_write(chunk, encoding, cb) {
|
|
7152
|
+
if (this._opcode === 8 && this._state == GET_INFO)
|
|
7153
|
+
return cb();
|
|
7154
|
+
this._bufferedBytes += chunk.length;
|
|
7155
|
+
this._buffers.push(chunk);
|
|
7156
|
+
this.startLoop(cb);
|
|
7157
|
+
}
|
|
7158
|
+
consume(n) {
|
|
7159
|
+
this._bufferedBytes -= n;
|
|
7160
|
+
if (n === this._buffers[0].length)
|
|
7161
|
+
return this._buffers.shift();
|
|
7162
|
+
if (n < this._buffers[0].length) {
|
|
7163
|
+
const buf = this._buffers[0];
|
|
7164
|
+
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
7165
|
+
return new FastBuffer(buf.buffer, buf.byteOffset, n);
|
|
7166
|
+
}
|
|
7167
|
+
const dst = Buffer.allocUnsafe(n);
|
|
7168
|
+
do {
|
|
7169
|
+
const buf = this._buffers[0];
|
|
7170
|
+
const offset = dst.length - n;
|
|
7171
|
+
if (n >= buf.length) {
|
|
7172
|
+
dst.set(this._buffers.shift(), offset);
|
|
7173
|
+
} else {
|
|
7174
|
+
dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
|
|
7175
|
+
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
7176
|
+
}
|
|
7177
|
+
n -= buf.length;
|
|
7178
|
+
} while (n > 0);
|
|
7179
|
+
return dst;
|
|
7180
|
+
}
|
|
7181
|
+
startLoop(cb) {
|
|
7182
|
+
this._loop = true;
|
|
7183
|
+
do {
|
|
7184
|
+
switch (this._state) {
|
|
7185
|
+
case GET_INFO:
|
|
7186
|
+
this.getInfo(cb);
|
|
7187
|
+
break;
|
|
7188
|
+
case GET_PAYLOAD_LENGTH_16:
|
|
7189
|
+
this.getPayloadLength16(cb);
|
|
7190
|
+
break;
|
|
7191
|
+
case GET_PAYLOAD_LENGTH_64:
|
|
7192
|
+
this.getPayloadLength64(cb);
|
|
7193
|
+
break;
|
|
7194
|
+
case GET_MASK:
|
|
7195
|
+
this.getMask();
|
|
7196
|
+
break;
|
|
7197
|
+
case GET_DATA:
|
|
7198
|
+
this.getData(cb);
|
|
7199
|
+
break;
|
|
7200
|
+
case INFLATING:
|
|
7201
|
+
case DEFER_EVENT:
|
|
7202
|
+
this._loop = false;
|
|
7203
|
+
return;
|
|
7204
|
+
}
|
|
7205
|
+
} while (this._loop);
|
|
7206
|
+
if (!this._errored)
|
|
7207
|
+
cb();
|
|
7208
|
+
}
|
|
7209
|
+
getInfo(cb) {
|
|
7210
|
+
if (this._bufferedBytes < 2) {
|
|
7211
|
+
this._loop = false;
|
|
7212
|
+
return;
|
|
7213
|
+
}
|
|
7214
|
+
const buf = this.consume(2);
|
|
7215
|
+
if ((buf[0] & 48) !== 0) {
|
|
7216
|
+
const error48 = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
|
|
7217
|
+
cb(error48);
|
|
7218
|
+
return;
|
|
7219
|
+
}
|
|
7220
|
+
const compressed = (buf[0] & 64) === 64;
|
|
7221
|
+
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
7222
|
+
const error48 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
7223
|
+
cb(error48);
|
|
7224
|
+
return;
|
|
7225
|
+
}
|
|
7226
|
+
this._fin = (buf[0] & 128) === 128;
|
|
7227
|
+
this._opcode = buf[0] & 15;
|
|
7228
|
+
this._payloadLength = buf[1] & 127;
|
|
7229
|
+
if (this._opcode === 0) {
|
|
7230
|
+
if (compressed) {
|
|
7231
|
+
const error48 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
7232
|
+
cb(error48);
|
|
7233
|
+
return;
|
|
7234
|
+
}
|
|
7235
|
+
if (!this._fragmented) {
|
|
7236
|
+
const error48 = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
7237
|
+
cb(error48);
|
|
7238
|
+
return;
|
|
7239
|
+
}
|
|
7240
|
+
this._opcode = this._fragmented;
|
|
7241
|
+
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
7242
|
+
if (this._fragmented) {
|
|
7243
|
+
const error48 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
7244
|
+
cb(error48);
|
|
7245
|
+
return;
|
|
7246
|
+
}
|
|
7247
|
+
this._compressed = compressed;
|
|
7248
|
+
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
7249
|
+
if (!this._fin) {
|
|
7250
|
+
const error48 = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
|
|
7251
|
+
cb(error48);
|
|
7252
|
+
return;
|
|
7253
|
+
}
|
|
7254
|
+
if (compressed) {
|
|
7255
|
+
const error48 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
7256
|
+
cb(error48);
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7259
|
+
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
7260
|
+
const error48 = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
|
|
7261
|
+
cb(error48);
|
|
7262
|
+
return;
|
|
7263
|
+
}
|
|
7264
|
+
} else {
|
|
7265
|
+
const error48 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
7266
|
+
cb(error48);
|
|
7267
|
+
return;
|
|
7268
|
+
}
|
|
7269
|
+
if (!this._fin && !this._fragmented)
|
|
7270
|
+
this._fragmented = this._opcode;
|
|
7271
|
+
this._masked = (buf[1] & 128) === 128;
|
|
7272
|
+
if (this._isServer) {
|
|
7273
|
+
if (!this._masked) {
|
|
7274
|
+
const error48 = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
|
|
7275
|
+
cb(error48);
|
|
7276
|
+
return;
|
|
7277
|
+
}
|
|
7278
|
+
} else if (this._masked) {
|
|
7279
|
+
const error48 = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
|
|
7280
|
+
cb(error48);
|
|
7281
|
+
return;
|
|
7282
|
+
}
|
|
7283
|
+
if (this._payloadLength === 126)
|
|
7284
|
+
this._state = GET_PAYLOAD_LENGTH_16;
|
|
7285
|
+
else if (this._payloadLength === 127)
|
|
7286
|
+
this._state = GET_PAYLOAD_LENGTH_64;
|
|
7287
|
+
else
|
|
7288
|
+
this.haveLength(cb);
|
|
7289
|
+
}
|
|
7290
|
+
getPayloadLength16(cb) {
|
|
7291
|
+
if (this._bufferedBytes < 2) {
|
|
7292
|
+
this._loop = false;
|
|
7293
|
+
return;
|
|
7294
|
+
}
|
|
7295
|
+
this._payloadLength = this.consume(2).readUInt16BE(0);
|
|
7296
|
+
this.haveLength(cb);
|
|
7297
|
+
}
|
|
7298
|
+
getPayloadLength64(cb) {
|
|
7299
|
+
if (this._bufferedBytes < 8) {
|
|
7300
|
+
this._loop = false;
|
|
7301
|
+
return;
|
|
7302
|
+
}
|
|
7303
|
+
const buf = this.consume(8);
|
|
7304
|
+
const num = buf.readUInt32BE(0);
|
|
7305
|
+
if (num > Math.pow(2, 53 - 32) - 1) {
|
|
7306
|
+
const error48 = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
|
|
7307
|
+
cb(error48);
|
|
7308
|
+
return;
|
|
7309
|
+
}
|
|
7310
|
+
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
7311
|
+
this.haveLength(cb);
|
|
7312
|
+
}
|
|
7313
|
+
haveLength(cb) {
|
|
7314
|
+
if (this._payloadLength && this._opcode < 8) {
|
|
7315
|
+
this._totalPayloadLength += this._payloadLength;
|
|
7316
|
+
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
7317
|
+
const error48 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
7318
|
+
cb(error48);
|
|
7319
|
+
return;
|
|
7320
|
+
}
|
|
7321
|
+
}
|
|
7322
|
+
if (this._masked)
|
|
7323
|
+
this._state = GET_MASK;
|
|
7324
|
+
else
|
|
7325
|
+
this._state = GET_DATA;
|
|
7326
|
+
}
|
|
7327
|
+
getMask() {
|
|
7328
|
+
if (this._bufferedBytes < 4) {
|
|
7329
|
+
this._loop = false;
|
|
7330
|
+
return;
|
|
7331
|
+
}
|
|
7332
|
+
this._mask = this.consume(4);
|
|
7333
|
+
this._state = GET_DATA;
|
|
7334
|
+
}
|
|
7335
|
+
getData(cb) {
|
|
7336
|
+
let data = EMPTY_BUFFER;
|
|
7337
|
+
if (this._payloadLength) {
|
|
7338
|
+
if (this._bufferedBytes < this._payloadLength) {
|
|
7339
|
+
this._loop = false;
|
|
7340
|
+
return;
|
|
7341
|
+
}
|
|
7342
|
+
data = this.consume(this._payloadLength);
|
|
7343
|
+
if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) {
|
|
7344
|
+
unmask(data, this._mask);
|
|
7345
|
+
}
|
|
7346
|
+
}
|
|
7347
|
+
if (this._opcode > 7) {
|
|
7348
|
+
this.controlMessage(data, cb);
|
|
7349
|
+
return;
|
|
7350
|
+
}
|
|
7351
|
+
if (this._compressed) {
|
|
7352
|
+
this._state = INFLATING;
|
|
7353
|
+
this.decompress(data, cb);
|
|
7354
|
+
return;
|
|
7355
|
+
}
|
|
7356
|
+
if (data.length) {
|
|
7357
|
+
this._messageLength = this._totalPayloadLength;
|
|
7358
|
+
this._fragments.push(data);
|
|
7359
|
+
}
|
|
7360
|
+
this.dataMessage(cb);
|
|
7361
|
+
}
|
|
7362
|
+
decompress(data, cb) {
|
|
7363
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
7364
|
+
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
7365
|
+
if (err)
|
|
7366
|
+
return cb(err);
|
|
7367
|
+
if (buf.length) {
|
|
7368
|
+
this._messageLength += buf.length;
|
|
7369
|
+
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
7370
|
+
const error48 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
7371
|
+
cb(error48);
|
|
7372
|
+
return;
|
|
7373
|
+
}
|
|
7374
|
+
this._fragments.push(buf);
|
|
7375
|
+
}
|
|
7376
|
+
this.dataMessage(cb);
|
|
7377
|
+
if (this._state === GET_INFO)
|
|
7378
|
+
this.startLoop(cb);
|
|
7379
|
+
});
|
|
7380
|
+
}
|
|
7381
|
+
dataMessage(cb) {
|
|
7382
|
+
if (!this._fin) {
|
|
7383
|
+
this._state = GET_INFO;
|
|
7384
|
+
return;
|
|
7385
|
+
}
|
|
7386
|
+
const messageLength = this._messageLength;
|
|
7387
|
+
const fragments = this._fragments;
|
|
7388
|
+
this._totalPayloadLength = 0;
|
|
7389
|
+
this._messageLength = 0;
|
|
7390
|
+
this._fragmented = 0;
|
|
7391
|
+
this._fragments = [];
|
|
7392
|
+
if (this._opcode === 2) {
|
|
7393
|
+
let data;
|
|
7394
|
+
if (this._binaryType === "nodebuffer") {
|
|
7395
|
+
data = concat(fragments, messageLength);
|
|
7396
|
+
} else if (this._binaryType === "arraybuffer") {
|
|
7397
|
+
data = toArrayBuffer(concat(fragments, messageLength));
|
|
7398
|
+
} else if (this._binaryType === "blob") {
|
|
7399
|
+
data = new Blob(fragments);
|
|
7400
|
+
} else {
|
|
7401
|
+
data = fragments;
|
|
7402
|
+
}
|
|
7403
|
+
if (this._allowSynchronousEvents) {
|
|
7404
|
+
this.emit("message", data, true);
|
|
7405
|
+
this._state = GET_INFO;
|
|
7406
|
+
} else {
|
|
7407
|
+
this._state = DEFER_EVENT;
|
|
7408
|
+
setImmediate(() => {
|
|
7409
|
+
this.emit("message", data, true);
|
|
7410
|
+
this._state = GET_INFO;
|
|
7411
|
+
this.startLoop(cb);
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7414
|
+
} else {
|
|
7415
|
+
const buf = concat(fragments, messageLength);
|
|
7416
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
7417
|
+
const error48 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
7418
|
+
cb(error48);
|
|
7419
|
+
return;
|
|
7420
|
+
}
|
|
7421
|
+
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
7422
|
+
this.emit("message", buf, false);
|
|
7423
|
+
this._state = GET_INFO;
|
|
7424
|
+
} else {
|
|
7425
|
+
this._state = DEFER_EVENT;
|
|
7426
|
+
setImmediate(() => {
|
|
7427
|
+
this.emit("message", buf, false);
|
|
7428
|
+
this._state = GET_INFO;
|
|
7429
|
+
this.startLoop(cb);
|
|
7430
|
+
});
|
|
7431
|
+
}
|
|
7432
|
+
}
|
|
7433
|
+
}
|
|
7434
|
+
controlMessage(data, cb) {
|
|
7435
|
+
if (this._opcode === 8) {
|
|
7436
|
+
if (data.length === 0) {
|
|
7437
|
+
this._loop = false;
|
|
7438
|
+
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
7439
|
+
this.end();
|
|
7440
|
+
} else {
|
|
7441
|
+
const code = data.readUInt16BE(0);
|
|
7442
|
+
if (!isValidStatusCode(code)) {
|
|
7443
|
+
const error48 = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
|
|
7444
|
+
cb(error48);
|
|
7445
|
+
return;
|
|
7446
|
+
}
|
|
7447
|
+
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
7448
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
7449
|
+
const error48 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
7450
|
+
cb(error48);
|
|
7451
|
+
return;
|
|
7452
|
+
}
|
|
7453
|
+
this._loop = false;
|
|
7454
|
+
this.emit("conclude", code, buf);
|
|
7455
|
+
this.end();
|
|
7456
|
+
}
|
|
7457
|
+
this._state = GET_INFO;
|
|
7458
|
+
return;
|
|
7459
|
+
}
|
|
7460
|
+
if (this._allowSynchronousEvents) {
|
|
7461
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
7462
|
+
this._state = GET_INFO;
|
|
7463
|
+
} else {
|
|
7464
|
+
this._state = DEFER_EVENT;
|
|
7465
|
+
setImmediate(() => {
|
|
7466
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
7467
|
+
this._state = GET_INFO;
|
|
7468
|
+
this.startLoop(cb);
|
|
7469
|
+
});
|
|
7470
|
+
}
|
|
7471
|
+
}
|
|
7472
|
+
createError(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
7473
|
+
this._loop = false;
|
|
7474
|
+
this._errored = true;
|
|
7475
|
+
const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
|
|
7476
|
+
Error.captureStackTrace(err, this.createError);
|
|
7477
|
+
err.code = errorCode;
|
|
7478
|
+
err[kStatusCode] = statusCode;
|
|
7479
|
+
return err;
|
|
7480
|
+
}
|
|
7481
|
+
}
|
|
7482
|
+
module.exports = Receiver;
|
|
7483
|
+
});
|
|
7484
|
+
|
|
7485
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js
|
|
7486
|
+
var require_sender = __commonJS((exports, module) => {
|
|
7487
|
+
var { Duplex } = __require("stream");
|
|
7488
|
+
var { randomFillSync } = __require("crypto");
|
|
7489
|
+
var PerMessageDeflate = require_permessage_deflate();
|
|
7490
|
+
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
7491
|
+
var { isBlob, isValidStatusCode } = require_validation2();
|
|
7492
|
+
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
7493
|
+
var kByteLength = Symbol("kByteLength");
|
|
7494
|
+
var maskBuffer = Buffer.alloc(4);
|
|
7495
|
+
var RANDOM_POOL_SIZE = 8 * 1024;
|
|
7496
|
+
var randomPool;
|
|
7497
|
+
var randomPoolPointer = RANDOM_POOL_SIZE;
|
|
7498
|
+
var DEFAULT = 0;
|
|
7499
|
+
var DEFLATING = 1;
|
|
7500
|
+
var GET_BLOB_DATA = 2;
|
|
7501
|
+
|
|
7502
|
+
class Sender {
|
|
7503
|
+
constructor(socket, extensions, generateMask) {
|
|
7504
|
+
this._extensions = extensions || {};
|
|
7505
|
+
if (generateMask) {
|
|
7506
|
+
this._generateMask = generateMask;
|
|
7507
|
+
this._maskBuffer = Buffer.alloc(4);
|
|
7508
|
+
}
|
|
7509
|
+
this._socket = socket;
|
|
7510
|
+
this._firstFragment = true;
|
|
7511
|
+
this._compress = false;
|
|
7512
|
+
this._bufferedBytes = 0;
|
|
7513
|
+
this._queue = [];
|
|
7514
|
+
this._state = DEFAULT;
|
|
7515
|
+
this.onerror = NOOP;
|
|
7516
|
+
this[kWebSocket] = undefined;
|
|
7517
|
+
}
|
|
7518
|
+
static frame(data, options) {
|
|
7519
|
+
let mask;
|
|
7520
|
+
let merge2 = false;
|
|
7521
|
+
let offset = 2;
|
|
7522
|
+
let skipMasking = false;
|
|
7523
|
+
if (options.mask) {
|
|
7524
|
+
mask = options.maskBuffer || maskBuffer;
|
|
7525
|
+
if (options.generateMask) {
|
|
7526
|
+
options.generateMask(mask);
|
|
7527
|
+
} else {
|
|
7528
|
+
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
7529
|
+
if (randomPool === undefined) {
|
|
7530
|
+
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
7531
|
+
}
|
|
7532
|
+
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
7533
|
+
randomPoolPointer = 0;
|
|
7534
|
+
}
|
|
7535
|
+
mask[0] = randomPool[randomPoolPointer++];
|
|
7536
|
+
mask[1] = randomPool[randomPoolPointer++];
|
|
7537
|
+
mask[2] = randomPool[randomPoolPointer++];
|
|
7538
|
+
mask[3] = randomPool[randomPoolPointer++];
|
|
7539
|
+
}
|
|
7540
|
+
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
7541
|
+
offset = 6;
|
|
7542
|
+
}
|
|
7543
|
+
let dataLength;
|
|
7544
|
+
if (typeof data === "string") {
|
|
7545
|
+
if ((!options.mask || skipMasking) && options[kByteLength] !== undefined) {
|
|
7546
|
+
dataLength = options[kByteLength];
|
|
7547
|
+
} else {
|
|
7548
|
+
data = Buffer.from(data);
|
|
7549
|
+
dataLength = data.length;
|
|
7550
|
+
}
|
|
7551
|
+
} else {
|
|
7552
|
+
dataLength = data.length;
|
|
7553
|
+
merge2 = options.mask && options.readOnly && !skipMasking;
|
|
7554
|
+
}
|
|
7555
|
+
let payloadLength = dataLength;
|
|
7556
|
+
if (dataLength >= 65536) {
|
|
7557
|
+
offset += 8;
|
|
7558
|
+
payloadLength = 127;
|
|
7559
|
+
} else if (dataLength > 125) {
|
|
7560
|
+
offset += 2;
|
|
7561
|
+
payloadLength = 126;
|
|
7562
|
+
}
|
|
7563
|
+
const target = Buffer.allocUnsafe(merge2 ? dataLength + offset : offset);
|
|
7564
|
+
target[0] = options.fin ? options.opcode | 128 : options.opcode;
|
|
7565
|
+
if (options.rsv1)
|
|
7566
|
+
target[0] |= 64;
|
|
7567
|
+
target[1] = payloadLength;
|
|
7568
|
+
if (payloadLength === 126) {
|
|
7569
|
+
target.writeUInt16BE(dataLength, 2);
|
|
7570
|
+
} else if (payloadLength === 127) {
|
|
7571
|
+
target[2] = target[3] = 0;
|
|
7572
|
+
target.writeUIntBE(dataLength, 4, 6);
|
|
7573
|
+
}
|
|
7574
|
+
if (!options.mask)
|
|
7575
|
+
return [target, data];
|
|
7576
|
+
target[1] |= 128;
|
|
7577
|
+
target[offset - 4] = mask[0];
|
|
7578
|
+
target[offset - 3] = mask[1];
|
|
7579
|
+
target[offset - 2] = mask[2];
|
|
7580
|
+
target[offset - 1] = mask[3];
|
|
7581
|
+
if (skipMasking)
|
|
7582
|
+
return [target, data];
|
|
7583
|
+
if (merge2) {
|
|
7584
|
+
applyMask(data, mask, target, offset, dataLength);
|
|
7585
|
+
return [target];
|
|
7586
|
+
}
|
|
7587
|
+
applyMask(data, mask, data, 0, dataLength);
|
|
7588
|
+
return [target, data];
|
|
7589
|
+
}
|
|
7590
|
+
close(code, data, mask, cb) {
|
|
7591
|
+
let buf;
|
|
7592
|
+
if (code === undefined) {
|
|
7593
|
+
buf = EMPTY_BUFFER;
|
|
7594
|
+
} else if (typeof code !== "number" || !isValidStatusCode(code)) {
|
|
7595
|
+
throw new TypeError("First argument must be a valid error code number");
|
|
7596
|
+
} else if (data === undefined || !data.length) {
|
|
7597
|
+
buf = Buffer.allocUnsafe(2);
|
|
7598
|
+
buf.writeUInt16BE(code, 0);
|
|
7599
|
+
} else {
|
|
7600
|
+
const length = Buffer.byteLength(data);
|
|
7601
|
+
if (length > 123) {
|
|
7602
|
+
throw new RangeError("The message must not be greater than 123 bytes");
|
|
7603
|
+
}
|
|
7604
|
+
buf = Buffer.allocUnsafe(2 + length);
|
|
7605
|
+
buf.writeUInt16BE(code, 0);
|
|
7606
|
+
if (typeof data === "string") {
|
|
7607
|
+
buf.write(data, 2);
|
|
7608
|
+
} else {
|
|
7609
|
+
buf.set(data, 2);
|
|
7610
|
+
}
|
|
7611
|
+
}
|
|
7612
|
+
const options = {
|
|
7613
|
+
[kByteLength]: buf.length,
|
|
7614
|
+
fin: true,
|
|
7615
|
+
generateMask: this._generateMask,
|
|
7616
|
+
mask,
|
|
7617
|
+
maskBuffer: this._maskBuffer,
|
|
7618
|
+
opcode: 8,
|
|
7619
|
+
readOnly: false,
|
|
7620
|
+
rsv1: false
|
|
7621
|
+
};
|
|
7622
|
+
if (this._state !== DEFAULT) {
|
|
7623
|
+
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
7624
|
+
} else {
|
|
7625
|
+
this.sendFrame(Sender.frame(buf, options), cb);
|
|
7626
|
+
}
|
|
7627
|
+
}
|
|
7628
|
+
ping(data, mask, cb) {
|
|
7629
|
+
let byteLength;
|
|
7630
|
+
let readOnly;
|
|
7631
|
+
if (typeof data === "string") {
|
|
7632
|
+
byteLength = Buffer.byteLength(data);
|
|
7633
|
+
readOnly = false;
|
|
7634
|
+
} else if (isBlob(data)) {
|
|
7635
|
+
byteLength = data.size;
|
|
7636
|
+
readOnly = false;
|
|
7637
|
+
} else {
|
|
7638
|
+
data = toBuffer(data);
|
|
7639
|
+
byteLength = data.length;
|
|
7640
|
+
readOnly = toBuffer.readOnly;
|
|
7641
|
+
}
|
|
7642
|
+
if (byteLength > 125) {
|
|
7643
|
+
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
7644
|
+
}
|
|
7645
|
+
const options = {
|
|
7646
|
+
[kByteLength]: byteLength,
|
|
7647
|
+
fin: true,
|
|
7648
|
+
generateMask: this._generateMask,
|
|
7649
|
+
mask,
|
|
7650
|
+
maskBuffer: this._maskBuffer,
|
|
7651
|
+
opcode: 9,
|
|
7652
|
+
readOnly,
|
|
7653
|
+
rsv1: false
|
|
7654
|
+
};
|
|
7655
|
+
if (isBlob(data)) {
|
|
7656
|
+
if (this._state !== DEFAULT) {
|
|
7657
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
7658
|
+
} else {
|
|
7659
|
+
this.getBlobData(data, false, options, cb);
|
|
7660
|
+
}
|
|
7661
|
+
} else if (this._state !== DEFAULT) {
|
|
7662
|
+
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
7663
|
+
} else {
|
|
7664
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
7665
|
+
}
|
|
7666
|
+
}
|
|
7667
|
+
pong(data, mask, cb) {
|
|
7668
|
+
let byteLength;
|
|
7669
|
+
let readOnly;
|
|
7670
|
+
if (typeof data === "string") {
|
|
7671
|
+
byteLength = Buffer.byteLength(data);
|
|
7672
|
+
readOnly = false;
|
|
7673
|
+
} else if (isBlob(data)) {
|
|
7674
|
+
byteLength = data.size;
|
|
7675
|
+
readOnly = false;
|
|
7676
|
+
} else {
|
|
7677
|
+
data = toBuffer(data);
|
|
7678
|
+
byteLength = data.length;
|
|
7679
|
+
readOnly = toBuffer.readOnly;
|
|
7680
|
+
}
|
|
7681
|
+
if (byteLength > 125) {
|
|
7682
|
+
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
7683
|
+
}
|
|
7684
|
+
const options = {
|
|
7685
|
+
[kByteLength]: byteLength,
|
|
7686
|
+
fin: true,
|
|
7687
|
+
generateMask: this._generateMask,
|
|
7688
|
+
mask,
|
|
7689
|
+
maskBuffer: this._maskBuffer,
|
|
7690
|
+
opcode: 10,
|
|
7691
|
+
readOnly,
|
|
7692
|
+
rsv1: false
|
|
7693
|
+
};
|
|
7694
|
+
if (isBlob(data)) {
|
|
7695
|
+
if (this._state !== DEFAULT) {
|
|
7696
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
7697
|
+
} else {
|
|
7698
|
+
this.getBlobData(data, false, options, cb);
|
|
7699
|
+
}
|
|
7700
|
+
} else if (this._state !== DEFAULT) {
|
|
7701
|
+
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
7702
|
+
} else {
|
|
7703
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
7704
|
+
}
|
|
7705
|
+
}
|
|
7706
|
+
send(data, options, cb) {
|
|
7707
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
7708
|
+
let opcode = options.binary ? 2 : 1;
|
|
7709
|
+
let rsv1 = options.compress;
|
|
7710
|
+
let byteLength;
|
|
7711
|
+
let readOnly;
|
|
7712
|
+
if (typeof data === "string") {
|
|
7713
|
+
byteLength = Buffer.byteLength(data);
|
|
7714
|
+
readOnly = false;
|
|
7715
|
+
} else if (isBlob(data)) {
|
|
7716
|
+
byteLength = data.size;
|
|
7717
|
+
readOnly = false;
|
|
7718
|
+
} else {
|
|
7719
|
+
data = toBuffer(data);
|
|
7720
|
+
byteLength = data.length;
|
|
7721
|
+
readOnly = toBuffer.readOnly;
|
|
7722
|
+
}
|
|
7723
|
+
if (this._firstFragment) {
|
|
7724
|
+
this._firstFragment = false;
|
|
7725
|
+
if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) {
|
|
7726
|
+
rsv1 = byteLength >= perMessageDeflate._threshold;
|
|
7727
|
+
}
|
|
7728
|
+
this._compress = rsv1;
|
|
7729
|
+
} else {
|
|
7730
|
+
rsv1 = false;
|
|
7731
|
+
opcode = 0;
|
|
7732
|
+
}
|
|
7733
|
+
if (options.fin)
|
|
7734
|
+
this._firstFragment = true;
|
|
7735
|
+
const opts = {
|
|
7736
|
+
[kByteLength]: byteLength,
|
|
7737
|
+
fin: options.fin,
|
|
7738
|
+
generateMask: this._generateMask,
|
|
7739
|
+
mask: options.mask,
|
|
7740
|
+
maskBuffer: this._maskBuffer,
|
|
7741
|
+
opcode,
|
|
7742
|
+
readOnly,
|
|
7743
|
+
rsv1
|
|
7744
|
+
};
|
|
7745
|
+
if (isBlob(data)) {
|
|
7746
|
+
if (this._state !== DEFAULT) {
|
|
7747
|
+
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
7748
|
+
} else {
|
|
7749
|
+
this.getBlobData(data, this._compress, opts, cb);
|
|
7750
|
+
}
|
|
7751
|
+
} else if (this._state !== DEFAULT) {
|
|
7752
|
+
this.enqueue([this.dispatch, data, this._compress, opts, cb]);
|
|
7753
|
+
} else {
|
|
7754
|
+
this.dispatch(data, this._compress, opts, cb);
|
|
7755
|
+
}
|
|
7756
|
+
}
|
|
7757
|
+
getBlobData(blob, compress, options, cb) {
|
|
7758
|
+
this._bufferedBytes += options[kByteLength];
|
|
7759
|
+
this._state = GET_BLOB_DATA;
|
|
7760
|
+
blob.arrayBuffer().then((arrayBuffer) => {
|
|
7761
|
+
if (this._socket.destroyed) {
|
|
7762
|
+
const err = new Error("The socket was closed while the blob was being read");
|
|
7763
|
+
process.nextTick(callCallbacks, this, err, cb);
|
|
7764
|
+
return;
|
|
7765
|
+
}
|
|
7766
|
+
this._bufferedBytes -= options[kByteLength];
|
|
7767
|
+
const data = toBuffer(arrayBuffer);
|
|
7768
|
+
if (!compress) {
|
|
7769
|
+
this._state = DEFAULT;
|
|
7770
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
7771
|
+
this.dequeue();
|
|
7772
|
+
} else {
|
|
7773
|
+
this.dispatch(data, compress, options, cb);
|
|
7774
|
+
}
|
|
7775
|
+
}).catch((err) => {
|
|
7776
|
+
process.nextTick(onError, this, err, cb);
|
|
7777
|
+
});
|
|
7778
|
+
}
|
|
7779
|
+
dispatch(data, compress, options, cb) {
|
|
7780
|
+
if (!compress) {
|
|
7781
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
7782
|
+
return;
|
|
7783
|
+
}
|
|
7784
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
7785
|
+
this._bufferedBytes += options[kByteLength];
|
|
7786
|
+
this._state = DEFLATING;
|
|
7787
|
+
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
7788
|
+
if (this._socket.destroyed) {
|
|
7789
|
+
const err = new Error("The socket was closed while data was being compressed");
|
|
7790
|
+
callCallbacks(this, err, cb);
|
|
7791
|
+
return;
|
|
7792
|
+
}
|
|
7793
|
+
this._bufferedBytes -= options[kByteLength];
|
|
7794
|
+
this._state = DEFAULT;
|
|
7795
|
+
options.readOnly = false;
|
|
7796
|
+
this.sendFrame(Sender.frame(buf, options), cb);
|
|
7797
|
+
this.dequeue();
|
|
7798
|
+
});
|
|
7799
|
+
}
|
|
7800
|
+
dequeue() {
|
|
7801
|
+
while (this._state === DEFAULT && this._queue.length) {
|
|
7802
|
+
const params = this._queue.shift();
|
|
7803
|
+
this._bufferedBytes -= params[3][kByteLength];
|
|
7804
|
+
Reflect.apply(params[0], this, params.slice(1));
|
|
7805
|
+
}
|
|
7806
|
+
}
|
|
7807
|
+
enqueue(params) {
|
|
7808
|
+
this._bufferedBytes += params[3][kByteLength];
|
|
7809
|
+
this._queue.push(params);
|
|
7810
|
+
}
|
|
7811
|
+
sendFrame(list, cb) {
|
|
7812
|
+
if (list.length === 2) {
|
|
7813
|
+
this._socket.cork();
|
|
7814
|
+
this._socket.write(list[0]);
|
|
7815
|
+
this._socket.write(list[1], cb);
|
|
7816
|
+
this._socket.uncork();
|
|
7817
|
+
} else {
|
|
7818
|
+
this._socket.write(list[0], cb);
|
|
7819
|
+
}
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
module.exports = Sender;
|
|
7823
|
+
function callCallbacks(sender, err, cb) {
|
|
7824
|
+
if (typeof cb === "function")
|
|
7825
|
+
cb(err);
|
|
7826
|
+
for (let i = 0;i < sender._queue.length; i++) {
|
|
7827
|
+
const params = sender._queue[i];
|
|
7828
|
+
const callback = params[params.length - 1];
|
|
7829
|
+
if (typeof callback === "function")
|
|
7830
|
+
callback(err);
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
function onError(sender, err, cb) {
|
|
7834
|
+
callCallbacks(sender, err, cb);
|
|
7835
|
+
sender.onerror(err);
|
|
7836
|
+
}
|
|
7837
|
+
});
|
|
7838
|
+
|
|
7839
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js
|
|
7840
|
+
var require_event_target = __commonJS((exports, module) => {
|
|
7841
|
+
var { kForOnEventAttribute, kListener } = require_constants();
|
|
7842
|
+
var kCode = Symbol("kCode");
|
|
7843
|
+
var kData = Symbol("kData");
|
|
7844
|
+
var kError = Symbol("kError");
|
|
7845
|
+
var kMessage = Symbol("kMessage");
|
|
7846
|
+
var kReason = Symbol("kReason");
|
|
7847
|
+
var kTarget = Symbol("kTarget");
|
|
7848
|
+
var kType = Symbol("kType");
|
|
7849
|
+
var kWasClean = Symbol("kWasClean");
|
|
7850
|
+
|
|
7851
|
+
class Event {
|
|
7852
|
+
constructor(type) {
|
|
7853
|
+
this[kTarget] = null;
|
|
7854
|
+
this[kType] = type;
|
|
7855
|
+
}
|
|
7856
|
+
get target() {
|
|
7857
|
+
return this[kTarget];
|
|
7858
|
+
}
|
|
7859
|
+
get type() {
|
|
7860
|
+
return this[kType];
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
Object.defineProperty(Event.prototype, "target", { enumerable: true });
|
|
7864
|
+
Object.defineProperty(Event.prototype, "type", { enumerable: true });
|
|
7865
|
+
|
|
7866
|
+
class CloseEvent extends Event {
|
|
7867
|
+
constructor(type, options = {}) {
|
|
7868
|
+
super(type);
|
|
7869
|
+
this[kCode] = options.code === undefined ? 0 : options.code;
|
|
7870
|
+
this[kReason] = options.reason === undefined ? "" : options.reason;
|
|
7871
|
+
this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;
|
|
7872
|
+
}
|
|
7873
|
+
get code() {
|
|
7874
|
+
return this[kCode];
|
|
7875
|
+
}
|
|
7876
|
+
get reason() {
|
|
7877
|
+
return this[kReason];
|
|
7878
|
+
}
|
|
7879
|
+
get wasClean() {
|
|
7880
|
+
return this[kWasClean];
|
|
7881
|
+
}
|
|
7882
|
+
}
|
|
7883
|
+
Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
|
|
7884
|
+
Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
|
|
7885
|
+
Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
|
|
7886
|
+
|
|
7887
|
+
class ErrorEvent extends Event {
|
|
7888
|
+
constructor(type, options = {}) {
|
|
7889
|
+
super(type);
|
|
7890
|
+
this[kError] = options.error === undefined ? null : options.error;
|
|
7891
|
+
this[kMessage] = options.message === undefined ? "" : options.message;
|
|
7892
|
+
}
|
|
7893
|
+
get error() {
|
|
7894
|
+
return this[kError];
|
|
7895
|
+
}
|
|
7896
|
+
get message() {
|
|
7897
|
+
return this[kMessage];
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7900
|
+
Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
|
|
7901
|
+
Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
|
|
7902
|
+
|
|
7903
|
+
class MessageEvent extends Event {
|
|
7904
|
+
constructor(type, options = {}) {
|
|
7905
|
+
super(type);
|
|
7906
|
+
this[kData] = options.data === undefined ? null : options.data;
|
|
7907
|
+
}
|
|
7908
|
+
get data() {
|
|
7909
|
+
return this[kData];
|
|
7910
|
+
}
|
|
7911
|
+
}
|
|
7912
|
+
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
7913
|
+
var EventTarget = {
|
|
7914
|
+
addEventListener(type, handler, options = {}) {
|
|
7915
|
+
for (const listener of this.listeners(type)) {
|
|
7916
|
+
if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
7917
|
+
return;
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
let wrapper;
|
|
7921
|
+
if (type === "message") {
|
|
7922
|
+
wrapper = function onMessage(data, isBinary) {
|
|
7923
|
+
const event = new MessageEvent("message", {
|
|
7924
|
+
data: isBinary ? data : data.toString()
|
|
7925
|
+
});
|
|
7926
|
+
event[kTarget] = this;
|
|
7927
|
+
callListener(handler, this, event);
|
|
7928
|
+
};
|
|
7929
|
+
} else if (type === "close") {
|
|
7930
|
+
wrapper = function onClose(code, message) {
|
|
7931
|
+
const event = new CloseEvent("close", {
|
|
7932
|
+
code,
|
|
7933
|
+
reason: message.toString(),
|
|
7934
|
+
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
7935
|
+
});
|
|
7936
|
+
event[kTarget] = this;
|
|
7937
|
+
callListener(handler, this, event);
|
|
7938
|
+
};
|
|
7939
|
+
} else if (type === "error") {
|
|
7940
|
+
wrapper = function onError(error48) {
|
|
7941
|
+
const event = new ErrorEvent("error", {
|
|
7942
|
+
error: error48,
|
|
7943
|
+
message: error48.message
|
|
7944
|
+
});
|
|
7945
|
+
event[kTarget] = this;
|
|
7946
|
+
callListener(handler, this, event);
|
|
7947
|
+
};
|
|
7948
|
+
} else if (type === "open") {
|
|
7949
|
+
wrapper = function onOpen() {
|
|
7950
|
+
const event = new Event("open");
|
|
7951
|
+
event[kTarget] = this;
|
|
7952
|
+
callListener(handler, this, event);
|
|
7953
|
+
};
|
|
7954
|
+
} else {
|
|
7955
|
+
return;
|
|
7956
|
+
}
|
|
7957
|
+
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
7958
|
+
wrapper[kListener] = handler;
|
|
7959
|
+
if (options.once) {
|
|
7960
|
+
this.once(type, wrapper);
|
|
7961
|
+
} else {
|
|
7962
|
+
this.on(type, wrapper);
|
|
7963
|
+
}
|
|
7964
|
+
},
|
|
7965
|
+
removeEventListener(type, handler) {
|
|
7966
|
+
for (const listener of this.listeners(type)) {
|
|
7967
|
+
if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
7968
|
+
this.removeListener(type, listener);
|
|
7969
|
+
break;
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
};
|
|
7974
|
+
module.exports = {
|
|
7975
|
+
CloseEvent,
|
|
7976
|
+
ErrorEvent,
|
|
7977
|
+
Event,
|
|
7978
|
+
EventTarget,
|
|
7979
|
+
MessageEvent
|
|
7980
|
+
};
|
|
7981
|
+
function callListener(listener, thisArg, event) {
|
|
7982
|
+
if (typeof listener === "object" && listener.handleEvent) {
|
|
7983
|
+
listener.handleEvent.call(listener, event);
|
|
7984
|
+
} else {
|
|
7985
|
+
listener.call(thisArg, event);
|
|
7986
|
+
}
|
|
7987
|
+
}
|
|
7988
|
+
});
|
|
7989
|
+
|
|
7990
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js
|
|
7991
|
+
var require_extension = __commonJS((exports, module) => {
|
|
7992
|
+
var { tokenChars } = require_validation2();
|
|
7993
|
+
function push(dest, name, elem) {
|
|
7994
|
+
if (dest[name] === undefined)
|
|
7995
|
+
dest[name] = [elem];
|
|
7996
|
+
else
|
|
7997
|
+
dest[name].push(elem);
|
|
7998
|
+
}
|
|
7999
|
+
function parse6(header) {
|
|
8000
|
+
const offers = Object.create(null);
|
|
8001
|
+
let params = Object.create(null);
|
|
8002
|
+
let mustUnescape = false;
|
|
8003
|
+
let isEscaping = false;
|
|
8004
|
+
let inQuotes = false;
|
|
8005
|
+
let extensionName;
|
|
8006
|
+
let paramName;
|
|
8007
|
+
let start = -1;
|
|
8008
|
+
let code = -1;
|
|
8009
|
+
let end = -1;
|
|
8010
|
+
let i = 0;
|
|
8011
|
+
for (;i < header.length; i++) {
|
|
8012
|
+
code = header.charCodeAt(i);
|
|
8013
|
+
if (extensionName === undefined) {
|
|
8014
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
8015
|
+
if (start === -1)
|
|
8016
|
+
start = i;
|
|
8017
|
+
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
8018
|
+
if (end === -1 && start !== -1)
|
|
8019
|
+
end = i;
|
|
8020
|
+
} else if (code === 59 || code === 44) {
|
|
8021
|
+
if (start === -1) {
|
|
8022
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8023
|
+
}
|
|
8024
|
+
if (end === -1)
|
|
8025
|
+
end = i;
|
|
8026
|
+
const name = header.slice(start, end);
|
|
8027
|
+
if (code === 44) {
|
|
8028
|
+
push(offers, name, params);
|
|
8029
|
+
params = Object.create(null);
|
|
8030
|
+
} else {
|
|
8031
|
+
extensionName = name;
|
|
8032
|
+
}
|
|
8033
|
+
start = end = -1;
|
|
8034
|
+
} else {
|
|
8035
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8036
|
+
}
|
|
8037
|
+
} else if (paramName === undefined) {
|
|
8038
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
8039
|
+
if (start === -1)
|
|
8040
|
+
start = i;
|
|
8041
|
+
} else if (code === 32 || code === 9) {
|
|
8042
|
+
if (end === -1 && start !== -1)
|
|
8043
|
+
end = i;
|
|
8044
|
+
} else if (code === 59 || code === 44) {
|
|
8045
|
+
if (start === -1) {
|
|
8046
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8047
|
+
}
|
|
8048
|
+
if (end === -1)
|
|
8049
|
+
end = i;
|
|
8050
|
+
push(params, header.slice(start, end), true);
|
|
8051
|
+
if (code === 44) {
|
|
8052
|
+
push(offers, extensionName, params);
|
|
8053
|
+
params = Object.create(null);
|
|
8054
|
+
extensionName = undefined;
|
|
8055
|
+
}
|
|
8056
|
+
start = end = -1;
|
|
8057
|
+
} else if (code === 61 && start !== -1 && end === -1) {
|
|
8058
|
+
paramName = header.slice(start, i);
|
|
8059
|
+
start = end = -1;
|
|
8060
|
+
} else {
|
|
8061
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8062
|
+
}
|
|
8063
|
+
} else {
|
|
8064
|
+
if (isEscaping) {
|
|
8065
|
+
if (tokenChars[code] !== 1) {
|
|
8066
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8067
|
+
}
|
|
8068
|
+
if (start === -1)
|
|
8069
|
+
start = i;
|
|
8070
|
+
else if (!mustUnescape)
|
|
8071
|
+
mustUnescape = true;
|
|
8072
|
+
isEscaping = false;
|
|
8073
|
+
} else if (inQuotes) {
|
|
8074
|
+
if (tokenChars[code] === 1) {
|
|
8075
|
+
if (start === -1)
|
|
8076
|
+
start = i;
|
|
8077
|
+
} else if (code === 34 && start !== -1) {
|
|
8078
|
+
inQuotes = false;
|
|
8079
|
+
end = i;
|
|
8080
|
+
} else if (code === 92) {
|
|
8081
|
+
isEscaping = true;
|
|
8082
|
+
} else {
|
|
8083
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8084
|
+
}
|
|
8085
|
+
} else if (code === 34 && header.charCodeAt(i - 1) === 61) {
|
|
8086
|
+
inQuotes = true;
|
|
8087
|
+
} else if (end === -1 && tokenChars[code] === 1) {
|
|
8088
|
+
if (start === -1)
|
|
8089
|
+
start = i;
|
|
8090
|
+
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
8091
|
+
if (end === -1)
|
|
8092
|
+
end = i;
|
|
8093
|
+
} else if (code === 59 || code === 44) {
|
|
8094
|
+
if (start === -1) {
|
|
8095
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8096
|
+
}
|
|
8097
|
+
if (end === -1)
|
|
8098
|
+
end = i;
|
|
8099
|
+
let value = header.slice(start, end);
|
|
8100
|
+
if (mustUnescape) {
|
|
8101
|
+
value = value.replace(/\\/g, "");
|
|
8102
|
+
mustUnescape = false;
|
|
8103
|
+
}
|
|
8104
|
+
push(params, paramName, value);
|
|
8105
|
+
if (code === 44) {
|
|
8106
|
+
push(offers, extensionName, params);
|
|
8107
|
+
params = Object.create(null);
|
|
8108
|
+
extensionName = undefined;
|
|
8109
|
+
}
|
|
8110
|
+
paramName = undefined;
|
|
8111
|
+
start = end = -1;
|
|
8112
|
+
} else {
|
|
8113
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
}
|
|
8117
|
+
if (start === -1 || inQuotes || code === 32 || code === 9) {
|
|
8118
|
+
throw new SyntaxError("Unexpected end of input");
|
|
8119
|
+
}
|
|
8120
|
+
if (end === -1)
|
|
8121
|
+
end = i;
|
|
8122
|
+
const token = header.slice(start, end);
|
|
8123
|
+
if (extensionName === undefined) {
|
|
8124
|
+
push(offers, token, params);
|
|
8125
|
+
} else {
|
|
8126
|
+
if (paramName === undefined) {
|
|
8127
|
+
push(params, token, true);
|
|
8128
|
+
} else if (mustUnescape) {
|
|
8129
|
+
push(params, paramName, token.replace(/\\/g, ""));
|
|
8130
|
+
} else {
|
|
8131
|
+
push(params, paramName, token);
|
|
8132
|
+
}
|
|
8133
|
+
push(offers, extensionName, params);
|
|
8134
|
+
}
|
|
8135
|
+
return offers;
|
|
8136
|
+
}
|
|
8137
|
+
function format(extensions) {
|
|
8138
|
+
return Object.keys(extensions).map((extension) => {
|
|
8139
|
+
let configurations = extensions[extension];
|
|
8140
|
+
if (!Array.isArray(configurations))
|
|
8141
|
+
configurations = [configurations];
|
|
8142
|
+
return configurations.map((params) => {
|
|
8143
|
+
return [extension].concat(Object.keys(params).map((k) => {
|
|
8144
|
+
let values = params[k];
|
|
8145
|
+
if (!Array.isArray(values))
|
|
8146
|
+
values = [values];
|
|
8147
|
+
return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
|
|
8148
|
+
})).join("; ");
|
|
8149
|
+
}).join(", ");
|
|
8150
|
+
}).join(", ");
|
|
8151
|
+
}
|
|
8152
|
+
module.exports = { format, parse: parse6 };
|
|
8153
|
+
});
|
|
8154
|
+
|
|
8155
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js
|
|
8156
|
+
var require_websocket = __commonJS((exports, module) => {
|
|
8157
|
+
var EventEmitter = __require("events");
|
|
8158
|
+
var https = __require("https");
|
|
8159
|
+
var http = __require("http");
|
|
8160
|
+
var net = __require("net");
|
|
8161
|
+
var tls = __require("tls");
|
|
8162
|
+
var { randomBytes, createHash } = __require("crypto");
|
|
8163
|
+
var { Duplex, Readable } = __require("stream");
|
|
8164
|
+
var { URL: URL2 } = __require("url");
|
|
8165
|
+
var PerMessageDeflate = require_permessage_deflate();
|
|
8166
|
+
var Receiver = require_receiver();
|
|
8167
|
+
var Sender = require_sender();
|
|
8168
|
+
var { isBlob } = require_validation2();
|
|
8169
|
+
var {
|
|
8170
|
+
BINARY_TYPES,
|
|
8171
|
+
CLOSE_TIMEOUT,
|
|
8172
|
+
EMPTY_BUFFER,
|
|
8173
|
+
GUID,
|
|
8174
|
+
kForOnEventAttribute,
|
|
8175
|
+
kListener,
|
|
8176
|
+
kStatusCode,
|
|
8177
|
+
kWebSocket,
|
|
8178
|
+
NOOP
|
|
8179
|
+
} = require_constants();
|
|
8180
|
+
var {
|
|
8181
|
+
EventTarget: { addEventListener, removeEventListener }
|
|
8182
|
+
} = require_event_target();
|
|
8183
|
+
var { format, parse: parse6 } = require_extension();
|
|
8184
|
+
var { toBuffer } = require_buffer_util();
|
|
8185
|
+
var kAborted = Symbol("kAborted");
|
|
8186
|
+
var protocolVersions = [8, 13];
|
|
8187
|
+
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
8188
|
+
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
8189
|
+
|
|
8190
|
+
class WebSocket extends EventEmitter {
|
|
8191
|
+
constructor(address, protocols, options) {
|
|
8192
|
+
super();
|
|
8193
|
+
this._binaryType = BINARY_TYPES[0];
|
|
8194
|
+
this._closeCode = 1006;
|
|
8195
|
+
this._closeFrameReceived = false;
|
|
8196
|
+
this._closeFrameSent = false;
|
|
8197
|
+
this._closeMessage = EMPTY_BUFFER;
|
|
8198
|
+
this._closeTimer = null;
|
|
8199
|
+
this._errorEmitted = false;
|
|
8200
|
+
this._extensions = {};
|
|
8201
|
+
this._paused = false;
|
|
8202
|
+
this._protocol = "";
|
|
8203
|
+
this._readyState = WebSocket.CONNECTING;
|
|
8204
|
+
this._receiver = null;
|
|
8205
|
+
this._sender = null;
|
|
8206
|
+
this._socket = null;
|
|
8207
|
+
if (address !== null) {
|
|
8208
|
+
this._bufferedAmount = 0;
|
|
8209
|
+
this._isServer = false;
|
|
8210
|
+
this._redirects = 0;
|
|
8211
|
+
if (protocols === undefined) {
|
|
8212
|
+
protocols = [];
|
|
8213
|
+
} else if (!Array.isArray(protocols)) {
|
|
8214
|
+
if (typeof protocols === "object" && protocols !== null) {
|
|
8215
|
+
options = protocols;
|
|
8216
|
+
protocols = [];
|
|
8217
|
+
} else {
|
|
8218
|
+
protocols = [protocols];
|
|
8219
|
+
}
|
|
8220
|
+
}
|
|
8221
|
+
initAsClient(this, address, protocols, options);
|
|
8222
|
+
} else {
|
|
8223
|
+
this._autoPong = options.autoPong;
|
|
8224
|
+
this._closeTimeout = options.closeTimeout;
|
|
8225
|
+
this._isServer = true;
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
get binaryType() {
|
|
8229
|
+
return this._binaryType;
|
|
8230
|
+
}
|
|
8231
|
+
set binaryType(type) {
|
|
8232
|
+
if (!BINARY_TYPES.includes(type))
|
|
8233
|
+
return;
|
|
8234
|
+
this._binaryType = type;
|
|
8235
|
+
if (this._receiver)
|
|
8236
|
+
this._receiver._binaryType = type;
|
|
8237
|
+
}
|
|
8238
|
+
get bufferedAmount() {
|
|
8239
|
+
if (!this._socket)
|
|
8240
|
+
return this._bufferedAmount;
|
|
8241
|
+
return this._socket._writableState.length + this._sender._bufferedBytes;
|
|
8242
|
+
}
|
|
8243
|
+
get extensions() {
|
|
8244
|
+
return Object.keys(this._extensions).join();
|
|
8245
|
+
}
|
|
8246
|
+
get isPaused() {
|
|
8247
|
+
return this._paused;
|
|
8248
|
+
}
|
|
8249
|
+
get onclose() {
|
|
8250
|
+
return null;
|
|
8251
|
+
}
|
|
8252
|
+
get onerror() {
|
|
8253
|
+
return null;
|
|
8254
|
+
}
|
|
8255
|
+
get onopen() {
|
|
8256
|
+
return null;
|
|
8257
|
+
}
|
|
8258
|
+
get onmessage() {
|
|
8259
|
+
return null;
|
|
8260
|
+
}
|
|
8261
|
+
get protocol() {
|
|
8262
|
+
return this._protocol;
|
|
8263
|
+
}
|
|
8264
|
+
get readyState() {
|
|
8265
|
+
return this._readyState;
|
|
8266
|
+
}
|
|
8267
|
+
get url() {
|
|
8268
|
+
return this._url;
|
|
8269
|
+
}
|
|
8270
|
+
setSocket(socket, head, options) {
|
|
8271
|
+
const receiver = new Receiver({
|
|
8272
|
+
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
8273
|
+
binaryType: this.binaryType,
|
|
8274
|
+
extensions: this._extensions,
|
|
8275
|
+
isServer: this._isServer,
|
|
8276
|
+
maxPayload: options.maxPayload,
|
|
8277
|
+
skipUTF8Validation: options.skipUTF8Validation
|
|
8278
|
+
});
|
|
8279
|
+
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
8280
|
+
this._receiver = receiver;
|
|
8281
|
+
this._sender = sender;
|
|
8282
|
+
this._socket = socket;
|
|
8283
|
+
receiver[kWebSocket] = this;
|
|
8284
|
+
sender[kWebSocket] = this;
|
|
8285
|
+
socket[kWebSocket] = this;
|
|
8286
|
+
receiver.on("conclude", receiverOnConclude);
|
|
8287
|
+
receiver.on("drain", receiverOnDrain);
|
|
8288
|
+
receiver.on("error", receiverOnError);
|
|
8289
|
+
receiver.on("message", receiverOnMessage);
|
|
8290
|
+
receiver.on("ping", receiverOnPing);
|
|
8291
|
+
receiver.on("pong", receiverOnPong);
|
|
8292
|
+
sender.onerror = senderOnError;
|
|
8293
|
+
if (socket.setTimeout)
|
|
8294
|
+
socket.setTimeout(0);
|
|
8295
|
+
if (socket.setNoDelay)
|
|
8296
|
+
socket.setNoDelay();
|
|
8297
|
+
if (head.length > 0)
|
|
8298
|
+
socket.unshift(head);
|
|
8299
|
+
socket.on("close", socketOnClose);
|
|
8300
|
+
socket.on("data", socketOnData);
|
|
8301
|
+
socket.on("end", socketOnEnd);
|
|
8302
|
+
socket.on("error", socketOnError);
|
|
8303
|
+
this._readyState = WebSocket.OPEN;
|
|
8304
|
+
this.emit("open");
|
|
8305
|
+
}
|
|
8306
|
+
emitClose() {
|
|
8307
|
+
if (!this._socket) {
|
|
8308
|
+
this._readyState = WebSocket.CLOSED;
|
|
8309
|
+
this.emit("close", this._closeCode, this._closeMessage);
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
if (this._extensions[PerMessageDeflate.extensionName]) {
|
|
8313
|
+
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
8314
|
+
}
|
|
8315
|
+
this._receiver.removeAllListeners();
|
|
8316
|
+
this._readyState = WebSocket.CLOSED;
|
|
8317
|
+
this.emit("close", this._closeCode, this._closeMessage);
|
|
8318
|
+
}
|
|
8319
|
+
close(code, data) {
|
|
8320
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
8321
|
+
return;
|
|
8322
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
8323
|
+
const msg = "WebSocket was closed before the connection was established";
|
|
8324
|
+
abortHandshake(this, this._req, msg);
|
|
8325
|
+
return;
|
|
8326
|
+
}
|
|
8327
|
+
if (this.readyState === WebSocket.CLOSING) {
|
|
8328
|
+
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
|
|
8329
|
+
this._socket.end();
|
|
8330
|
+
}
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
this._readyState = WebSocket.CLOSING;
|
|
8334
|
+
this._sender.close(code, data, !this._isServer, (err) => {
|
|
8335
|
+
if (err)
|
|
8336
|
+
return;
|
|
8337
|
+
this._closeFrameSent = true;
|
|
8338
|
+
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) {
|
|
8339
|
+
this._socket.end();
|
|
8340
|
+
}
|
|
8341
|
+
});
|
|
8342
|
+
setCloseTimer(this);
|
|
8343
|
+
}
|
|
8344
|
+
pause() {
|
|
8345
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
8346
|
+
return;
|
|
8347
|
+
}
|
|
8348
|
+
this._paused = true;
|
|
8349
|
+
this._socket.pause();
|
|
8350
|
+
}
|
|
8351
|
+
ping(data, mask, cb) {
|
|
8352
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
8353
|
+
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
8354
|
+
}
|
|
8355
|
+
if (typeof data === "function") {
|
|
8356
|
+
cb = data;
|
|
8357
|
+
data = mask = undefined;
|
|
8358
|
+
} else if (typeof mask === "function") {
|
|
8359
|
+
cb = mask;
|
|
8360
|
+
mask = undefined;
|
|
8361
|
+
}
|
|
8362
|
+
if (typeof data === "number")
|
|
8363
|
+
data = data.toString();
|
|
8364
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
8365
|
+
sendAfterClose(this, data, cb);
|
|
8366
|
+
return;
|
|
8367
|
+
}
|
|
8368
|
+
if (mask === undefined)
|
|
8369
|
+
mask = !this._isServer;
|
|
8370
|
+
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
8371
|
+
}
|
|
8372
|
+
pong(data, mask, cb) {
|
|
8373
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
8374
|
+
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
8375
|
+
}
|
|
8376
|
+
if (typeof data === "function") {
|
|
8377
|
+
cb = data;
|
|
8378
|
+
data = mask = undefined;
|
|
8379
|
+
} else if (typeof mask === "function") {
|
|
8380
|
+
cb = mask;
|
|
8381
|
+
mask = undefined;
|
|
8382
|
+
}
|
|
8383
|
+
if (typeof data === "number")
|
|
8384
|
+
data = data.toString();
|
|
8385
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
8386
|
+
sendAfterClose(this, data, cb);
|
|
8387
|
+
return;
|
|
8388
|
+
}
|
|
8389
|
+
if (mask === undefined)
|
|
8390
|
+
mask = !this._isServer;
|
|
8391
|
+
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
8392
|
+
}
|
|
8393
|
+
resume() {
|
|
8394
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
8395
|
+
return;
|
|
8396
|
+
}
|
|
8397
|
+
this._paused = false;
|
|
8398
|
+
if (!this._receiver._writableState.needDrain)
|
|
8399
|
+
this._socket.resume();
|
|
8400
|
+
}
|
|
8401
|
+
send(data, options, cb) {
|
|
8402
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
8403
|
+
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
8404
|
+
}
|
|
8405
|
+
if (typeof options === "function") {
|
|
8406
|
+
cb = options;
|
|
8407
|
+
options = {};
|
|
8408
|
+
}
|
|
8409
|
+
if (typeof data === "number")
|
|
8410
|
+
data = data.toString();
|
|
8411
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
8412
|
+
sendAfterClose(this, data, cb);
|
|
8413
|
+
return;
|
|
8414
|
+
}
|
|
8415
|
+
const opts = {
|
|
8416
|
+
binary: typeof data !== "string",
|
|
8417
|
+
mask: !this._isServer,
|
|
8418
|
+
compress: true,
|
|
8419
|
+
fin: true,
|
|
8420
|
+
...options
|
|
8421
|
+
};
|
|
8422
|
+
if (!this._extensions[PerMessageDeflate.extensionName]) {
|
|
8423
|
+
opts.compress = false;
|
|
8424
|
+
}
|
|
8425
|
+
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
8426
|
+
}
|
|
8427
|
+
terminate() {
|
|
8428
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
8429
|
+
return;
|
|
8430
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
8431
|
+
const msg = "WebSocket was closed before the connection was established";
|
|
8432
|
+
abortHandshake(this, this._req, msg);
|
|
8433
|
+
return;
|
|
8434
|
+
}
|
|
8435
|
+
if (this._socket) {
|
|
8436
|
+
this._readyState = WebSocket.CLOSING;
|
|
8437
|
+
this._socket.destroy();
|
|
8438
|
+
}
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
8442
|
+
enumerable: true,
|
|
8443
|
+
value: readyStates.indexOf("CONNECTING")
|
|
8444
|
+
});
|
|
8445
|
+
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
8446
|
+
enumerable: true,
|
|
8447
|
+
value: readyStates.indexOf("CONNECTING")
|
|
8448
|
+
});
|
|
8449
|
+
Object.defineProperty(WebSocket, "OPEN", {
|
|
8450
|
+
enumerable: true,
|
|
8451
|
+
value: readyStates.indexOf("OPEN")
|
|
8452
|
+
});
|
|
8453
|
+
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
8454
|
+
enumerable: true,
|
|
8455
|
+
value: readyStates.indexOf("OPEN")
|
|
8456
|
+
});
|
|
8457
|
+
Object.defineProperty(WebSocket, "CLOSING", {
|
|
8458
|
+
enumerable: true,
|
|
8459
|
+
value: readyStates.indexOf("CLOSING")
|
|
8460
|
+
});
|
|
8461
|
+
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
8462
|
+
enumerable: true,
|
|
8463
|
+
value: readyStates.indexOf("CLOSING")
|
|
8464
|
+
});
|
|
8465
|
+
Object.defineProperty(WebSocket, "CLOSED", {
|
|
8466
|
+
enumerable: true,
|
|
8467
|
+
value: readyStates.indexOf("CLOSED")
|
|
8468
|
+
});
|
|
8469
|
+
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
8470
|
+
enumerable: true,
|
|
8471
|
+
value: readyStates.indexOf("CLOSED")
|
|
8472
|
+
});
|
|
8473
|
+
[
|
|
8474
|
+
"binaryType",
|
|
8475
|
+
"bufferedAmount",
|
|
8476
|
+
"extensions",
|
|
8477
|
+
"isPaused",
|
|
8478
|
+
"protocol",
|
|
8479
|
+
"readyState",
|
|
8480
|
+
"url"
|
|
8481
|
+
].forEach((property) => {
|
|
8482
|
+
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
8483
|
+
});
|
|
8484
|
+
["open", "error", "close", "message"].forEach((method) => {
|
|
8485
|
+
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
8486
|
+
enumerable: true,
|
|
8487
|
+
get() {
|
|
8488
|
+
for (const listener of this.listeners(method)) {
|
|
8489
|
+
if (listener[kForOnEventAttribute])
|
|
8490
|
+
return listener[kListener];
|
|
8491
|
+
}
|
|
8492
|
+
return null;
|
|
8493
|
+
},
|
|
8494
|
+
set(handler) {
|
|
8495
|
+
for (const listener of this.listeners(method)) {
|
|
8496
|
+
if (listener[kForOnEventAttribute]) {
|
|
8497
|
+
this.removeListener(method, listener);
|
|
8498
|
+
break;
|
|
8499
|
+
}
|
|
8500
|
+
}
|
|
8501
|
+
if (typeof handler !== "function")
|
|
8502
|
+
return;
|
|
8503
|
+
this.addEventListener(method, handler, {
|
|
8504
|
+
[kForOnEventAttribute]: true
|
|
8505
|
+
});
|
|
8506
|
+
}
|
|
8507
|
+
});
|
|
8508
|
+
});
|
|
8509
|
+
WebSocket.prototype.addEventListener = addEventListener;
|
|
8510
|
+
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
8511
|
+
module.exports = WebSocket;
|
|
8512
|
+
function initAsClient(websocket, address, protocols, options) {
|
|
8513
|
+
const opts = {
|
|
8514
|
+
allowSynchronousEvents: true,
|
|
8515
|
+
autoPong: true,
|
|
8516
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
8517
|
+
protocolVersion: protocolVersions[1],
|
|
8518
|
+
maxPayload: 100 * 1024 * 1024,
|
|
8519
|
+
skipUTF8Validation: false,
|
|
8520
|
+
perMessageDeflate: true,
|
|
8521
|
+
followRedirects: false,
|
|
8522
|
+
maxRedirects: 10,
|
|
8523
|
+
...options,
|
|
8524
|
+
socketPath: undefined,
|
|
8525
|
+
hostname: undefined,
|
|
8526
|
+
protocol: undefined,
|
|
8527
|
+
timeout: undefined,
|
|
8528
|
+
method: "GET",
|
|
8529
|
+
host: undefined,
|
|
8530
|
+
path: undefined,
|
|
8531
|
+
port: undefined
|
|
8532
|
+
};
|
|
8533
|
+
websocket._autoPong = opts.autoPong;
|
|
8534
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
8535
|
+
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
8536
|
+
throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} ` + `(supported versions: ${protocolVersions.join(", ")})`);
|
|
8537
|
+
}
|
|
8538
|
+
let parsedUrl;
|
|
8539
|
+
if (address instanceof URL2) {
|
|
8540
|
+
parsedUrl = address;
|
|
8541
|
+
} else {
|
|
8542
|
+
try {
|
|
8543
|
+
parsedUrl = new URL2(address);
|
|
8544
|
+
} catch {
|
|
8545
|
+
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
8546
|
+
}
|
|
8547
|
+
}
|
|
8548
|
+
if (parsedUrl.protocol === "http:") {
|
|
8549
|
+
parsedUrl.protocol = "ws:";
|
|
8550
|
+
} else if (parsedUrl.protocol === "https:") {
|
|
8551
|
+
parsedUrl.protocol = "wss:";
|
|
8552
|
+
}
|
|
8553
|
+
websocket._url = parsedUrl.href;
|
|
8554
|
+
const isSecure = parsedUrl.protocol === "wss:";
|
|
8555
|
+
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
8556
|
+
let invalidUrlMessage;
|
|
8557
|
+
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
8558
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", ` + '"http:", "https:", or "ws+unix:"';
|
|
8559
|
+
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
8560
|
+
invalidUrlMessage = "The URL's pathname is empty";
|
|
8561
|
+
} else if (parsedUrl.hash) {
|
|
8562
|
+
invalidUrlMessage = "The URL contains a fragment identifier";
|
|
8563
|
+
}
|
|
8564
|
+
if (invalidUrlMessage) {
|
|
8565
|
+
const err = new SyntaxError(invalidUrlMessage);
|
|
8566
|
+
if (websocket._redirects === 0) {
|
|
8567
|
+
throw err;
|
|
8568
|
+
} else {
|
|
8569
|
+
emitErrorAndClose(websocket, err);
|
|
8570
|
+
return;
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8573
|
+
const defaultPort = isSecure ? 443 : 80;
|
|
8574
|
+
const key = randomBytes(16).toString("base64");
|
|
8575
|
+
const request = isSecure ? https.request : http.request;
|
|
8576
|
+
const protocolSet = new Set;
|
|
8577
|
+
let perMessageDeflate;
|
|
8578
|
+
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
8579
|
+
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
8580
|
+
opts.port = parsedUrl.port || defaultPort;
|
|
8581
|
+
opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
|
|
8582
|
+
opts.headers = {
|
|
8583
|
+
...opts.headers,
|
|
8584
|
+
"Sec-WebSocket-Version": opts.protocolVersion,
|
|
8585
|
+
"Sec-WebSocket-Key": key,
|
|
8586
|
+
Connection: "Upgrade",
|
|
8587
|
+
Upgrade: "websocket"
|
|
8588
|
+
};
|
|
8589
|
+
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
8590
|
+
opts.timeout = opts.handshakeTimeout;
|
|
8591
|
+
if (opts.perMessageDeflate) {
|
|
8592
|
+
perMessageDeflate = new PerMessageDeflate({
|
|
8593
|
+
...opts.perMessageDeflate,
|
|
8594
|
+
isServer: false,
|
|
8595
|
+
maxPayload: opts.maxPayload
|
|
8596
|
+
});
|
|
8597
|
+
opts.headers["Sec-WebSocket-Extensions"] = format({
|
|
8598
|
+
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
8599
|
+
});
|
|
8600
|
+
}
|
|
8601
|
+
if (protocols.length) {
|
|
8602
|
+
for (const protocol of protocols) {
|
|
8603
|
+
if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) {
|
|
8604
|
+
throw new SyntaxError("An invalid or duplicated subprotocol was specified");
|
|
8605
|
+
}
|
|
8606
|
+
protocolSet.add(protocol);
|
|
8607
|
+
}
|
|
8608
|
+
opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
|
|
8609
|
+
}
|
|
8610
|
+
if (opts.origin) {
|
|
8611
|
+
if (opts.protocolVersion < 13) {
|
|
8612
|
+
opts.headers["Sec-WebSocket-Origin"] = opts.origin;
|
|
8613
|
+
} else {
|
|
8614
|
+
opts.headers.Origin = opts.origin;
|
|
8615
|
+
}
|
|
8616
|
+
}
|
|
8617
|
+
if (parsedUrl.username || parsedUrl.password) {
|
|
8618
|
+
opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
8619
|
+
}
|
|
8620
|
+
if (isIpcUrl) {
|
|
8621
|
+
const parts = opts.path.split(":");
|
|
8622
|
+
opts.socketPath = parts[0];
|
|
8623
|
+
opts.path = parts[1];
|
|
8624
|
+
}
|
|
8625
|
+
let req;
|
|
8626
|
+
if (opts.followRedirects) {
|
|
8627
|
+
if (websocket._redirects === 0) {
|
|
8628
|
+
websocket._originalIpc = isIpcUrl;
|
|
8629
|
+
websocket._originalSecure = isSecure;
|
|
8630
|
+
websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
|
|
8631
|
+
const headers = options && options.headers;
|
|
8632
|
+
options = { ...options, headers: {} };
|
|
8633
|
+
if (headers) {
|
|
8634
|
+
for (const [key2, value] of Object.entries(headers)) {
|
|
8635
|
+
options.headers[key2.toLowerCase()] = value;
|
|
8636
|
+
}
|
|
8637
|
+
}
|
|
8638
|
+
} else if (websocket.listenerCount("redirect") === 0) {
|
|
8639
|
+
const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
8640
|
+
if (!isSameHost || websocket._originalSecure && !isSecure) {
|
|
8641
|
+
delete opts.headers.authorization;
|
|
8642
|
+
delete opts.headers.cookie;
|
|
8643
|
+
if (!isSameHost)
|
|
8644
|
+
delete opts.headers.host;
|
|
8645
|
+
opts.auth = undefined;
|
|
8646
|
+
}
|
|
8647
|
+
}
|
|
8648
|
+
if (opts.auth && !options.headers.authorization) {
|
|
8649
|
+
options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
8650
|
+
}
|
|
8651
|
+
req = websocket._req = request(opts);
|
|
8652
|
+
if (websocket._redirects) {
|
|
8653
|
+
websocket.emit("redirect", websocket.url, req);
|
|
8654
|
+
}
|
|
8655
|
+
} else {
|
|
8656
|
+
req = websocket._req = request(opts);
|
|
8657
|
+
}
|
|
8658
|
+
if (opts.timeout) {
|
|
8659
|
+
req.on("timeout", () => {
|
|
8660
|
+
abortHandshake(websocket, req, "Opening handshake has timed out");
|
|
8661
|
+
});
|
|
8662
|
+
}
|
|
8663
|
+
req.on("error", (err) => {
|
|
8664
|
+
if (req === null || req[kAborted])
|
|
8665
|
+
return;
|
|
8666
|
+
req = websocket._req = null;
|
|
8667
|
+
emitErrorAndClose(websocket, err);
|
|
8668
|
+
});
|
|
8669
|
+
req.on("response", (res) => {
|
|
8670
|
+
const location = res.headers.location;
|
|
8671
|
+
const statusCode = res.statusCode;
|
|
8672
|
+
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
8673
|
+
if (++websocket._redirects > opts.maxRedirects) {
|
|
8674
|
+
abortHandshake(websocket, req, "Maximum redirects exceeded");
|
|
8675
|
+
return;
|
|
8676
|
+
}
|
|
8677
|
+
req.abort();
|
|
8678
|
+
let addr;
|
|
8679
|
+
try {
|
|
8680
|
+
addr = new URL2(location, address);
|
|
8681
|
+
} catch (e) {
|
|
8682
|
+
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
8683
|
+
emitErrorAndClose(websocket, err);
|
|
8684
|
+
return;
|
|
8685
|
+
}
|
|
8686
|
+
initAsClient(websocket, addr, protocols, options);
|
|
8687
|
+
} else if (!websocket.emit("unexpected-response", req, res)) {
|
|
8688
|
+
abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
8689
|
+
}
|
|
8690
|
+
});
|
|
8691
|
+
req.on("upgrade", (res, socket, head) => {
|
|
8692
|
+
websocket.emit("upgrade", res);
|
|
8693
|
+
if (websocket.readyState !== WebSocket.CONNECTING)
|
|
8694
|
+
return;
|
|
8695
|
+
req = websocket._req = null;
|
|
8696
|
+
const upgrade = res.headers.upgrade;
|
|
8697
|
+
if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
|
|
8698
|
+
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
8699
|
+
return;
|
|
8700
|
+
}
|
|
8701
|
+
const digest = createHash("sha1").update(key + GUID).digest("base64");
|
|
8702
|
+
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
8703
|
+
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
8704
|
+
return;
|
|
8705
|
+
}
|
|
8706
|
+
const serverProt = res.headers["sec-websocket-protocol"];
|
|
8707
|
+
let protError;
|
|
8708
|
+
if (serverProt !== undefined) {
|
|
8709
|
+
if (!protocolSet.size) {
|
|
8710
|
+
protError = "Server sent a subprotocol but none was requested";
|
|
8711
|
+
} else if (!protocolSet.has(serverProt)) {
|
|
8712
|
+
protError = "Server sent an invalid subprotocol";
|
|
8713
|
+
}
|
|
8714
|
+
} else if (protocolSet.size) {
|
|
8715
|
+
protError = "Server sent no subprotocol";
|
|
8716
|
+
}
|
|
8717
|
+
if (protError) {
|
|
8718
|
+
abortHandshake(websocket, socket, protError);
|
|
8719
|
+
return;
|
|
8720
|
+
}
|
|
8721
|
+
if (serverProt)
|
|
8722
|
+
websocket._protocol = serverProt;
|
|
8723
|
+
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
8724
|
+
if (secWebSocketExtensions !== undefined) {
|
|
8725
|
+
if (!perMessageDeflate) {
|
|
8726
|
+
const message = "Server sent a Sec-WebSocket-Extensions header but no extension " + "was requested";
|
|
8727
|
+
abortHandshake(websocket, socket, message);
|
|
8728
|
+
return;
|
|
8729
|
+
}
|
|
8730
|
+
let extensions;
|
|
8731
|
+
try {
|
|
8732
|
+
extensions = parse6(secWebSocketExtensions);
|
|
8733
|
+
} catch (err) {
|
|
8734
|
+
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
8735
|
+
abortHandshake(websocket, socket, message);
|
|
8736
|
+
return;
|
|
8737
|
+
}
|
|
8738
|
+
const extensionNames = Object.keys(extensions);
|
|
8739
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
|
|
8740
|
+
const message = "Server indicated an extension that was not requested";
|
|
8741
|
+
abortHandshake(websocket, socket, message);
|
|
8742
|
+
return;
|
|
8743
|
+
}
|
|
8744
|
+
try {
|
|
8745
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
|
|
8746
|
+
} catch (err) {
|
|
8747
|
+
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
8748
|
+
abortHandshake(websocket, socket, message);
|
|
8749
|
+
return;
|
|
8750
|
+
}
|
|
8751
|
+
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
8752
|
+
}
|
|
8753
|
+
websocket.setSocket(socket, head, {
|
|
8754
|
+
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
8755
|
+
generateMask: opts.generateMask,
|
|
8756
|
+
maxPayload: opts.maxPayload,
|
|
8757
|
+
skipUTF8Validation: opts.skipUTF8Validation
|
|
8758
|
+
});
|
|
8759
|
+
});
|
|
8760
|
+
if (opts.finishRequest) {
|
|
8761
|
+
opts.finishRequest(req, websocket);
|
|
8762
|
+
} else {
|
|
8763
|
+
req.end();
|
|
8764
|
+
}
|
|
8765
|
+
}
|
|
8766
|
+
function emitErrorAndClose(websocket, err) {
|
|
8767
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8768
|
+
websocket._errorEmitted = true;
|
|
8769
|
+
websocket.emit("error", err);
|
|
8770
|
+
websocket.emitClose();
|
|
8771
|
+
}
|
|
8772
|
+
function netConnect(options) {
|
|
8773
|
+
options.path = options.socketPath;
|
|
8774
|
+
return net.connect(options);
|
|
8775
|
+
}
|
|
8776
|
+
function tlsConnect(options) {
|
|
8777
|
+
options.path = undefined;
|
|
8778
|
+
if (!options.servername && options.servername !== "") {
|
|
8779
|
+
options.servername = net.isIP(options.host) ? "" : options.host;
|
|
8780
|
+
}
|
|
8781
|
+
return tls.connect(options);
|
|
8782
|
+
}
|
|
8783
|
+
function abortHandshake(websocket, stream, message) {
|
|
8784
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8785
|
+
const err = new Error(message);
|
|
8786
|
+
Error.captureStackTrace(err, abortHandshake);
|
|
8787
|
+
if (stream.setHeader) {
|
|
8788
|
+
stream[kAborted] = true;
|
|
8789
|
+
stream.abort();
|
|
8790
|
+
if (stream.socket && !stream.socket.destroyed) {
|
|
8791
|
+
stream.socket.destroy();
|
|
8792
|
+
}
|
|
8793
|
+
process.nextTick(emitErrorAndClose, websocket, err);
|
|
8794
|
+
} else {
|
|
8795
|
+
stream.destroy(err);
|
|
8796
|
+
stream.once("error", websocket.emit.bind(websocket, "error"));
|
|
8797
|
+
stream.once("close", websocket.emitClose.bind(websocket));
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
function sendAfterClose(websocket, data, cb) {
|
|
8801
|
+
if (data) {
|
|
8802
|
+
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
8803
|
+
if (websocket._socket)
|
|
8804
|
+
websocket._sender._bufferedBytes += length;
|
|
8805
|
+
else
|
|
8806
|
+
websocket._bufferedAmount += length;
|
|
8807
|
+
}
|
|
8808
|
+
if (cb) {
|
|
8809
|
+
const err = new Error(`WebSocket is not open: readyState ${websocket.readyState} ` + `(${readyStates[websocket.readyState]})`);
|
|
8810
|
+
process.nextTick(cb, err);
|
|
8811
|
+
}
|
|
8812
|
+
}
|
|
8813
|
+
function receiverOnConclude(code, reason) {
|
|
8814
|
+
const websocket = this[kWebSocket];
|
|
8815
|
+
websocket._closeFrameReceived = true;
|
|
8816
|
+
websocket._closeMessage = reason;
|
|
8817
|
+
websocket._closeCode = code;
|
|
8818
|
+
if (websocket._socket[kWebSocket] === undefined)
|
|
8819
|
+
return;
|
|
8820
|
+
websocket._socket.removeListener("data", socketOnData);
|
|
8821
|
+
process.nextTick(resume, websocket._socket);
|
|
8822
|
+
if (code === 1005)
|
|
8823
|
+
websocket.close();
|
|
8824
|
+
else
|
|
8825
|
+
websocket.close(code, reason);
|
|
8826
|
+
}
|
|
8827
|
+
function receiverOnDrain() {
|
|
8828
|
+
const websocket = this[kWebSocket];
|
|
8829
|
+
if (!websocket.isPaused)
|
|
8830
|
+
websocket._socket.resume();
|
|
8831
|
+
}
|
|
8832
|
+
function receiverOnError(err) {
|
|
8833
|
+
const websocket = this[kWebSocket];
|
|
8834
|
+
if (websocket._socket[kWebSocket] !== undefined) {
|
|
8835
|
+
websocket._socket.removeListener("data", socketOnData);
|
|
8836
|
+
process.nextTick(resume, websocket._socket);
|
|
8837
|
+
websocket.close(err[kStatusCode]);
|
|
8838
|
+
}
|
|
8839
|
+
if (!websocket._errorEmitted) {
|
|
8840
|
+
websocket._errorEmitted = true;
|
|
8841
|
+
websocket.emit("error", err);
|
|
8842
|
+
}
|
|
8843
|
+
}
|
|
8844
|
+
function receiverOnFinish() {
|
|
8845
|
+
this[kWebSocket].emitClose();
|
|
8846
|
+
}
|
|
8847
|
+
function receiverOnMessage(data, isBinary) {
|
|
8848
|
+
this[kWebSocket].emit("message", data, isBinary);
|
|
8849
|
+
}
|
|
8850
|
+
function receiverOnPing(data) {
|
|
8851
|
+
const websocket = this[kWebSocket];
|
|
8852
|
+
if (websocket._autoPong)
|
|
8853
|
+
websocket.pong(data, !this._isServer, NOOP);
|
|
8854
|
+
websocket.emit("ping", data);
|
|
8855
|
+
}
|
|
8856
|
+
function receiverOnPong(data) {
|
|
8857
|
+
this[kWebSocket].emit("pong", data);
|
|
8858
|
+
}
|
|
8859
|
+
function resume(stream) {
|
|
8860
|
+
stream.resume();
|
|
8861
|
+
}
|
|
8862
|
+
function senderOnError(err) {
|
|
8863
|
+
const websocket = this[kWebSocket];
|
|
8864
|
+
if (websocket.readyState === WebSocket.CLOSED)
|
|
8865
|
+
return;
|
|
8866
|
+
if (websocket.readyState === WebSocket.OPEN) {
|
|
8867
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8868
|
+
setCloseTimer(websocket);
|
|
8869
|
+
}
|
|
8870
|
+
this._socket.end();
|
|
8871
|
+
if (!websocket._errorEmitted) {
|
|
8872
|
+
websocket._errorEmitted = true;
|
|
8873
|
+
websocket.emit("error", err);
|
|
8874
|
+
}
|
|
8875
|
+
}
|
|
8876
|
+
function setCloseTimer(websocket) {
|
|
8877
|
+
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
8878
|
+
}
|
|
8879
|
+
function socketOnClose() {
|
|
8880
|
+
const websocket = this[kWebSocket];
|
|
8881
|
+
this.removeListener("close", socketOnClose);
|
|
8882
|
+
this.removeListener("data", socketOnData);
|
|
8883
|
+
this.removeListener("end", socketOnEnd);
|
|
8884
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8885
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
8886
|
+
const chunk = this.read(this._readableState.length);
|
|
8887
|
+
websocket._receiver.write(chunk);
|
|
8888
|
+
}
|
|
8889
|
+
websocket._receiver.end();
|
|
8890
|
+
this[kWebSocket] = undefined;
|
|
8891
|
+
clearTimeout(websocket._closeTimer);
|
|
8892
|
+
if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) {
|
|
8893
|
+
websocket.emitClose();
|
|
8894
|
+
} else {
|
|
8895
|
+
websocket._receiver.on("error", receiverOnFinish);
|
|
8896
|
+
websocket._receiver.on("finish", receiverOnFinish);
|
|
8897
|
+
}
|
|
8898
|
+
}
|
|
8899
|
+
function socketOnData(chunk) {
|
|
8900
|
+
if (!this[kWebSocket]._receiver.write(chunk)) {
|
|
8901
|
+
this.pause();
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
function socketOnEnd() {
|
|
8905
|
+
const websocket = this[kWebSocket];
|
|
8906
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8907
|
+
websocket._receiver.end();
|
|
8908
|
+
this.end();
|
|
8909
|
+
}
|
|
8910
|
+
function socketOnError() {
|
|
8911
|
+
const websocket = this[kWebSocket];
|
|
8912
|
+
this.removeListener("error", socketOnError);
|
|
8913
|
+
this.on("error", NOOP);
|
|
8914
|
+
if (websocket) {
|
|
8915
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
8916
|
+
this.destroy();
|
|
8917
|
+
}
|
|
8918
|
+
}
|
|
8919
|
+
});
|
|
8920
|
+
|
|
8921
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js
|
|
8922
|
+
var require_stream = __commonJS((exports, module) => {
|
|
8923
|
+
var WebSocket = require_websocket();
|
|
8924
|
+
var { Duplex } = __require("stream");
|
|
8925
|
+
function emitClose(stream) {
|
|
8926
|
+
stream.emit("close");
|
|
8927
|
+
}
|
|
8928
|
+
function duplexOnEnd() {
|
|
8929
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
8930
|
+
this.destroy();
|
|
8931
|
+
}
|
|
8932
|
+
}
|
|
8933
|
+
function duplexOnError(err) {
|
|
8934
|
+
this.removeListener("error", duplexOnError);
|
|
8935
|
+
this.destroy();
|
|
8936
|
+
if (this.listenerCount("error") === 0) {
|
|
8937
|
+
this.emit("error", err);
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8940
|
+
function createWebSocketStream(ws, options) {
|
|
8941
|
+
let terminateOnDestroy = true;
|
|
8942
|
+
const duplex = new Duplex({
|
|
8943
|
+
...options,
|
|
8944
|
+
autoDestroy: false,
|
|
8945
|
+
emitClose: false,
|
|
8946
|
+
objectMode: false,
|
|
8947
|
+
writableObjectMode: false
|
|
8948
|
+
});
|
|
8949
|
+
ws.on("message", function message(msg, isBinary) {
|
|
8950
|
+
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
8951
|
+
if (!duplex.push(data))
|
|
8952
|
+
ws.pause();
|
|
8953
|
+
});
|
|
8954
|
+
ws.once("error", function error48(err) {
|
|
8955
|
+
if (duplex.destroyed)
|
|
8956
|
+
return;
|
|
8957
|
+
terminateOnDestroy = false;
|
|
8958
|
+
duplex.destroy(err);
|
|
8959
|
+
});
|
|
8960
|
+
ws.once("close", function close() {
|
|
8961
|
+
if (duplex.destroyed)
|
|
8962
|
+
return;
|
|
8963
|
+
duplex.push(null);
|
|
8964
|
+
});
|
|
8965
|
+
duplex._destroy = function(err, callback) {
|
|
8966
|
+
if (ws.readyState === ws.CLOSED) {
|
|
8967
|
+
callback(err);
|
|
8968
|
+
process.nextTick(emitClose, duplex);
|
|
8969
|
+
return;
|
|
8970
|
+
}
|
|
8971
|
+
let called = false;
|
|
8972
|
+
ws.once("error", function error48(err2) {
|
|
8973
|
+
called = true;
|
|
8974
|
+
callback(err2);
|
|
8975
|
+
});
|
|
8976
|
+
ws.once("close", function close() {
|
|
8977
|
+
if (!called)
|
|
8978
|
+
callback(err);
|
|
8979
|
+
process.nextTick(emitClose, duplex);
|
|
8980
|
+
});
|
|
8981
|
+
if (terminateOnDestroy)
|
|
8982
|
+
ws.terminate();
|
|
8983
|
+
};
|
|
8984
|
+
duplex._final = function(callback) {
|
|
8985
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
8986
|
+
ws.once("open", function open() {
|
|
8987
|
+
duplex._final(callback);
|
|
8988
|
+
});
|
|
8989
|
+
return;
|
|
8990
|
+
}
|
|
8991
|
+
if (ws._socket === null)
|
|
8992
|
+
return;
|
|
8993
|
+
if (ws._socket._writableState.finished) {
|
|
8994
|
+
callback();
|
|
8995
|
+
if (duplex._readableState.endEmitted)
|
|
8996
|
+
duplex.destroy();
|
|
8997
|
+
} else {
|
|
8998
|
+
ws._socket.once("finish", function finish() {
|
|
8999
|
+
callback();
|
|
9000
|
+
});
|
|
9001
|
+
ws.close();
|
|
9002
|
+
}
|
|
9003
|
+
};
|
|
9004
|
+
duplex._read = function() {
|
|
9005
|
+
if (ws.isPaused)
|
|
9006
|
+
ws.resume();
|
|
9007
|
+
};
|
|
9008
|
+
duplex._write = function(chunk, encoding, callback) {
|
|
9009
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
9010
|
+
ws.once("open", function open() {
|
|
9011
|
+
duplex._write(chunk, encoding, callback);
|
|
9012
|
+
});
|
|
9013
|
+
return;
|
|
9014
|
+
}
|
|
9015
|
+
ws.send(chunk, callback);
|
|
9016
|
+
};
|
|
9017
|
+
duplex.on("end", duplexOnEnd);
|
|
9018
|
+
duplex.on("error", duplexOnError);
|
|
9019
|
+
return duplex;
|
|
9020
|
+
}
|
|
9021
|
+
module.exports = createWebSocketStream;
|
|
9022
|
+
});
|
|
9023
|
+
|
|
9024
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js
|
|
9025
|
+
var require_subprotocol = __commonJS((exports, module) => {
|
|
9026
|
+
var { tokenChars } = require_validation2();
|
|
9027
|
+
function parse6(header) {
|
|
9028
|
+
const protocols = new Set;
|
|
9029
|
+
let start = -1;
|
|
9030
|
+
let end = -1;
|
|
9031
|
+
let i = 0;
|
|
9032
|
+
for (i;i < header.length; i++) {
|
|
9033
|
+
const code = header.charCodeAt(i);
|
|
9034
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
9035
|
+
if (start === -1)
|
|
9036
|
+
start = i;
|
|
9037
|
+
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
9038
|
+
if (end === -1 && start !== -1)
|
|
9039
|
+
end = i;
|
|
9040
|
+
} else if (code === 44) {
|
|
9041
|
+
if (start === -1) {
|
|
9042
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
9043
|
+
}
|
|
9044
|
+
if (end === -1)
|
|
9045
|
+
end = i;
|
|
9046
|
+
const protocol2 = header.slice(start, end);
|
|
9047
|
+
if (protocols.has(protocol2)) {
|
|
9048
|
+
throw new SyntaxError(`The "${protocol2}" subprotocol is duplicated`);
|
|
9049
|
+
}
|
|
9050
|
+
protocols.add(protocol2);
|
|
9051
|
+
start = end = -1;
|
|
9052
|
+
} else {
|
|
9053
|
+
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
9054
|
+
}
|
|
9055
|
+
}
|
|
9056
|
+
if (start === -1 || end !== -1) {
|
|
9057
|
+
throw new SyntaxError("Unexpected end of input");
|
|
9058
|
+
}
|
|
9059
|
+
const protocol = header.slice(start, i);
|
|
9060
|
+
if (protocols.has(protocol)) {
|
|
9061
|
+
throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
|
9062
|
+
}
|
|
9063
|
+
protocols.add(protocol);
|
|
9064
|
+
return protocols;
|
|
9065
|
+
}
|
|
9066
|
+
module.exports = { parse: parse6 };
|
|
9067
|
+
});
|
|
9068
|
+
|
|
9069
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js
|
|
9070
|
+
var require_websocket_server = __commonJS((exports, module) => {
|
|
9071
|
+
var EventEmitter = __require("events");
|
|
9072
|
+
var http = __require("http");
|
|
9073
|
+
var { Duplex } = __require("stream");
|
|
9074
|
+
var { createHash } = __require("crypto");
|
|
9075
|
+
var extension = require_extension();
|
|
9076
|
+
var PerMessageDeflate = require_permessage_deflate();
|
|
9077
|
+
var subprotocol = require_subprotocol();
|
|
9078
|
+
var WebSocket = require_websocket();
|
|
9079
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
|
|
9080
|
+
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
9081
|
+
var RUNNING = 0;
|
|
9082
|
+
var CLOSING = 1;
|
|
9083
|
+
var CLOSED = 2;
|
|
9084
|
+
|
|
9085
|
+
class WebSocketServer extends EventEmitter {
|
|
9086
|
+
constructor(options, callback) {
|
|
9087
|
+
super();
|
|
9088
|
+
options = {
|
|
9089
|
+
allowSynchronousEvents: true,
|
|
9090
|
+
autoPong: true,
|
|
9091
|
+
maxPayload: 100 * 1024 * 1024,
|
|
9092
|
+
skipUTF8Validation: false,
|
|
9093
|
+
perMessageDeflate: false,
|
|
9094
|
+
handleProtocols: null,
|
|
9095
|
+
clientTracking: true,
|
|
9096
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
9097
|
+
verifyClient: null,
|
|
9098
|
+
noServer: false,
|
|
9099
|
+
backlog: null,
|
|
9100
|
+
server: null,
|
|
9101
|
+
host: null,
|
|
9102
|
+
path: null,
|
|
9103
|
+
port: null,
|
|
9104
|
+
WebSocket,
|
|
9105
|
+
...options
|
|
9106
|
+
};
|
|
9107
|
+
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
|
|
9108
|
+
throw new TypeError('One and only one of the "port", "server", or "noServer" options ' + "must be specified");
|
|
9109
|
+
}
|
|
9110
|
+
if (options.port != null) {
|
|
9111
|
+
this._server = http.createServer((req, res) => {
|
|
9112
|
+
const body = http.STATUS_CODES[426];
|
|
9113
|
+
res.writeHead(426, {
|
|
9114
|
+
"Content-Length": body.length,
|
|
9115
|
+
"Content-Type": "text/plain"
|
|
9116
|
+
});
|
|
9117
|
+
res.end(body);
|
|
9118
|
+
});
|
|
9119
|
+
this._server.listen(options.port, options.host, options.backlog, callback);
|
|
9120
|
+
} else if (options.server) {
|
|
9121
|
+
this._server = options.server;
|
|
9122
|
+
}
|
|
9123
|
+
if (this._server) {
|
|
9124
|
+
const emitConnection = this.emit.bind(this, "connection");
|
|
9125
|
+
this._removeListeners = addListeners(this._server, {
|
|
9126
|
+
listening: this.emit.bind(this, "listening"),
|
|
9127
|
+
error: this.emit.bind(this, "error"),
|
|
9128
|
+
upgrade: (req, socket, head) => {
|
|
9129
|
+
this.handleUpgrade(req, socket, head, emitConnection);
|
|
9130
|
+
}
|
|
9131
|
+
});
|
|
9132
|
+
}
|
|
9133
|
+
if (options.perMessageDeflate === true)
|
|
9134
|
+
options.perMessageDeflate = {};
|
|
9135
|
+
if (options.clientTracking) {
|
|
9136
|
+
this.clients = new Set;
|
|
9137
|
+
this._shouldEmitClose = false;
|
|
9138
|
+
}
|
|
9139
|
+
this.options = options;
|
|
9140
|
+
this._state = RUNNING;
|
|
9141
|
+
}
|
|
9142
|
+
address() {
|
|
9143
|
+
if (this.options.noServer) {
|
|
9144
|
+
throw new Error('The server is operating in "noServer" mode');
|
|
9145
|
+
}
|
|
9146
|
+
if (!this._server)
|
|
9147
|
+
return null;
|
|
9148
|
+
return this._server.address();
|
|
9149
|
+
}
|
|
9150
|
+
close(cb) {
|
|
9151
|
+
if (this._state === CLOSED) {
|
|
9152
|
+
if (cb) {
|
|
9153
|
+
this.once("close", () => {
|
|
9154
|
+
cb(new Error("The server is not running"));
|
|
9155
|
+
});
|
|
9156
|
+
}
|
|
9157
|
+
process.nextTick(emitClose, this);
|
|
9158
|
+
return;
|
|
9159
|
+
}
|
|
9160
|
+
if (cb)
|
|
9161
|
+
this.once("close", cb);
|
|
9162
|
+
if (this._state === CLOSING)
|
|
9163
|
+
return;
|
|
9164
|
+
this._state = CLOSING;
|
|
9165
|
+
if (this.options.noServer || this.options.server) {
|
|
9166
|
+
if (this._server) {
|
|
9167
|
+
this._removeListeners();
|
|
9168
|
+
this._removeListeners = this._server = null;
|
|
9169
|
+
}
|
|
9170
|
+
if (this.clients) {
|
|
9171
|
+
if (!this.clients.size) {
|
|
9172
|
+
process.nextTick(emitClose, this);
|
|
9173
|
+
} else {
|
|
9174
|
+
this._shouldEmitClose = true;
|
|
9175
|
+
}
|
|
9176
|
+
} else {
|
|
9177
|
+
process.nextTick(emitClose, this);
|
|
9178
|
+
}
|
|
9179
|
+
} else {
|
|
9180
|
+
const server = this._server;
|
|
9181
|
+
this._removeListeners();
|
|
9182
|
+
this._removeListeners = this._server = null;
|
|
9183
|
+
server.close(() => {
|
|
9184
|
+
emitClose(this);
|
|
9185
|
+
});
|
|
9186
|
+
}
|
|
9187
|
+
}
|
|
9188
|
+
shouldHandle(req) {
|
|
9189
|
+
if (this.options.path) {
|
|
9190
|
+
const index = req.url.indexOf("?");
|
|
9191
|
+
const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
|
|
9192
|
+
if (pathname !== this.options.path)
|
|
9193
|
+
return false;
|
|
9194
|
+
}
|
|
9195
|
+
return true;
|
|
9196
|
+
}
|
|
9197
|
+
handleUpgrade(req, socket, head, cb) {
|
|
9198
|
+
socket.on("error", socketOnError);
|
|
9199
|
+
const key = req.headers["sec-websocket-key"];
|
|
9200
|
+
const upgrade = req.headers.upgrade;
|
|
9201
|
+
const version2 = +req.headers["sec-websocket-version"];
|
|
9202
|
+
if (req.method !== "GET") {
|
|
9203
|
+
const message = "Invalid HTTP method";
|
|
9204
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
9205
|
+
return;
|
|
9206
|
+
}
|
|
9207
|
+
if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
|
|
9208
|
+
const message = "Invalid Upgrade header";
|
|
9209
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
9210
|
+
return;
|
|
9211
|
+
}
|
|
9212
|
+
if (key === undefined || !keyRegex.test(key)) {
|
|
9213
|
+
const message = "Missing or invalid Sec-WebSocket-Key header";
|
|
9214
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
9215
|
+
return;
|
|
9216
|
+
}
|
|
9217
|
+
if (version2 !== 13 && version2 !== 8) {
|
|
9218
|
+
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
9219
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
9220
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
9221
|
+
});
|
|
9222
|
+
return;
|
|
9223
|
+
}
|
|
9224
|
+
if (!this.shouldHandle(req)) {
|
|
9225
|
+
abortHandshake(socket, 400);
|
|
9226
|
+
return;
|
|
9227
|
+
}
|
|
9228
|
+
const secWebSocketProtocol = req.headers["sec-websocket-protocol"];
|
|
9229
|
+
let protocols = new Set;
|
|
9230
|
+
if (secWebSocketProtocol !== undefined) {
|
|
9231
|
+
try {
|
|
9232
|
+
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
9233
|
+
} catch (err) {
|
|
9234
|
+
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
9235
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
9236
|
+
return;
|
|
9237
|
+
}
|
|
9238
|
+
}
|
|
9239
|
+
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
9240
|
+
const extensions = {};
|
|
9241
|
+
if (this.options.perMessageDeflate && secWebSocketExtensions !== undefined) {
|
|
9242
|
+
const perMessageDeflate = new PerMessageDeflate({
|
|
9243
|
+
...this.options.perMessageDeflate,
|
|
9244
|
+
isServer: true,
|
|
9245
|
+
maxPayload: this.options.maxPayload
|
|
9246
|
+
});
|
|
9247
|
+
try {
|
|
9248
|
+
const offers = extension.parse(secWebSocketExtensions);
|
|
9249
|
+
if (offers[PerMessageDeflate.extensionName]) {
|
|
9250
|
+
perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
|
|
9251
|
+
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
9252
|
+
}
|
|
9253
|
+
} catch (err) {
|
|
9254
|
+
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
9255
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
9256
|
+
return;
|
|
9257
|
+
}
|
|
9258
|
+
}
|
|
9259
|
+
if (this.options.verifyClient) {
|
|
9260
|
+
const info = {
|
|
9261
|
+
origin: req.headers[`${version2 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
9262
|
+
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
9263
|
+
req
|
|
9264
|
+
};
|
|
9265
|
+
if (this.options.verifyClient.length === 2) {
|
|
9266
|
+
this.options.verifyClient(info, (verified, code, message, headers) => {
|
|
9267
|
+
if (!verified) {
|
|
9268
|
+
return abortHandshake(socket, code || 401, message, headers);
|
|
9269
|
+
}
|
|
9270
|
+
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
9271
|
+
});
|
|
9272
|
+
return;
|
|
9273
|
+
}
|
|
9274
|
+
if (!this.options.verifyClient(info))
|
|
9275
|
+
return abortHandshake(socket, 401);
|
|
9276
|
+
}
|
|
9277
|
+
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
9278
|
+
}
|
|
9279
|
+
completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
|
|
9280
|
+
if (!socket.readable || !socket.writable)
|
|
9281
|
+
return socket.destroy();
|
|
9282
|
+
if (socket[kWebSocket]) {
|
|
9283
|
+
throw new Error("server.handleUpgrade() was called more than once with the same " + "socket, possibly due to a misconfiguration");
|
|
9284
|
+
}
|
|
9285
|
+
if (this._state > RUNNING)
|
|
9286
|
+
return abortHandshake(socket, 503);
|
|
9287
|
+
const digest = createHash("sha1").update(key + GUID).digest("base64");
|
|
9288
|
+
const headers = [
|
|
9289
|
+
"HTTP/1.1 101 Switching Protocols",
|
|
9290
|
+
"Upgrade: websocket",
|
|
9291
|
+
"Connection: Upgrade",
|
|
9292
|
+
`Sec-WebSocket-Accept: ${digest}`
|
|
9293
|
+
];
|
|
9294
|
+
const ws = new this.options.WebSocket(null, undefined, this.options);
|
|
9295
|
+
if (protocols.size) {
|
|
9296
|
+
const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
9297
|
+
if (protocol) {
|
|
9298
|
+
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
9299
|
+
ws._protocol = protocol;
|
|
9300
|
+
}
|
|
9301
|
+
}
|
|
9302
|
+
if (extensions[PerMessageDeflate.extensionName]) {
|
|
9303
|
+
const params = extensions[PerMessageDeflate.extensionName].params;
|
|
9304
|
+
const value = extension.format({
|
|
9305
|
+
[PerMessageDeflate.extensionName]: [params]
|
|
9306
|
+
});
|
|
9307
|
+
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
9308
|
+
ws._extensions = extensions;
|
|
9309
|
+
}
|
|
9310
|
+
this.emit("headers", headers, req);
|
|
9311
|
+
socket.write(headers.concat(`\r
|
|
9312
|
+
`).join(`\r
|
|
9313
|
+
`));
|
|
9314
|
+
socket.removeListener("error", socketOnError);
|
|
9315
|
+
ws.setSocket(socket, head, {
|
|
9316
|
+
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
9317
|
+
maxPayload: this.options.maxPayload,
|
|
9318
|
+
skipUTF8Validation: this.options.skipUTF8Validation
|
|
9319
|
+
});
|
|
9320
|
+
if (this.clients) {
|
|
9321
|
+
this.clients.add(ws);
|
|
9322
|
+
ws.on("close", () => {
|
|
9323
|
+
this.clients.delete(ws);
|
|
9324
|
+
if (this._shouldEmitClose && !this.clients.size) {
|
|
9325
|
+
process.nextTick(emitClose, this);
|
|
9326
|
+
}
|
|
9327
|
+
});
|
|
9328
|
+
}
|
|
9329
|
+
cb(ws, req);
|
|
9330
|
+
}
|
|
9331
|
+
}
|
|
9332
|
+
module.exports = WebSocketServer;
|
|
9333
|
+
function addListeners(server, map3) {
|
|
9334
|
+
for (const event of Object.keys(map3))
|
|
9335
|
+
server.on(event, map3[event]);
|
|
9336
|
+
return function removeListeners() {
|
|
9337
|
+
for (const event of Object.keys(map3)) {
|
|
9338
|
+
server.removeListener(event, map3[event]);
|
|
9339
|
+
}
|
|
9340
|
+
};
|
|
9341
|
+
}
|
|
9342
|
+
function emitClose(server) {
|
|
9343
|
+
server._state = CLOSED;
|
|
9344
|
+
server.emit("close");
|
|
9345
|
+
}
|
|
9346
|
+
function socketOnError() {
|
|
9347
|
+
this.destroy();
|
|
9348
|
+
}
|
|
9349
|
+
function abortHandshake(socket, code, message, headers) {
|
|
9350
|
+
message = message || http.STATUS_CODES[code];
|
|
9351
|
+
headers = {
|
|
9352
|
+
Connection: "close",
|
|
9353
|
+
"Content-Type": "text/html",
|
|
9354
|
+
"Content-Length": Buffer.byteLength(message),
|
|
9355
|
+
...headers
|
|
9356
|
+
};
|
|
9357
|
+
socket.once("finish", socket.destroy);
|
|
9358
|
+
socket.end(`HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
|
|
9359
|
+
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join(`\r
|
|
9360
|
+
`) + `\r
|
|
9361
|
+
\r
|
|
9362
|
+
` + message);
|
|
9363
|
+
}
|
|
9364
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
9365
|
+
if (server.listenerCount("wsClientError")) {
|
|
9366
|
+
const err = new Error(message);
|
|
9367
|
+
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
9368
|
+
server.emit("wsClientError", err, socket, req);
|
|
9369
|
+
} else {
|
|
9370
|
+
abortHandshake(socket, code, message, headers);
|
|
9371
|
+
}
|
|
9372
|
+
}
|
|
9373
|
+
});
|
|
9374
|
+
|
|
9375
|
+
// ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/index.js
|
|
9376
|
+
var require_ws = __commonJS((exports, module) => {
|
|
9377
|
+
var createWebSocketStream = require_stream();
|
|
9378
|
+
var extension = require_extension();
|
|
9379
|
+
var PerMessageDeflate = require_permessage_deflate();
|
|
9380
|
+
var Receiver = require_receiver();
|
|
9381
|
+
var Sender = require_sender();
|
|
9382
|
+
var subprotocol = require_subprotocol();
|
|
9383
|
+
var WebSocket = require_websocket();
|
|
9384
|
+
var WebSocketServer = require_websocket_server();
|
|
9385
|
+
WebSocket.createWebSocketStream = createWebSocketStream;
|
|
9386
|
+
WebSocket.extension = extension;
|
|
9387
|
+
WebSocket.PerMessageDeflate = PerMessageDeflate;
|
|
9388
|
+
WebSocket.Receiver = Receiver;
|
|
9389
|
+
WebSocket.Sender = Sender;
|
|
9390
|
+
WebSocket.Server = WebSocketServer;
|
|
9391
|
+
WebSocket.subprotocol = subprotocol;
|
|
9392
|
+
WebSocket.WebSocket = WebSocket;
|
|
9393
|
+
WebSocket.WebSocketServer = WebSocketServer;
|
|
9394
|
+
module.exports = WebSocket;
|
|
9395
|
+
});
|
|
9396
|
+
|
|
6412
9397
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.js
|
|
6413
9398
|
var util;
|
|
6414
9399
|
(function(util2) {
|
|
@@ -6539,6 +9524,7 @@ var getParsedType = (data) => {
|
|
|
6539
9524
|
return ZodParsedType.unknown;
|
|
6540
9525
|
}
|
|
6541
9526
|
};
|
|
9527
|
+
|
|
6542
9528
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/ZodError.js
|
|
6543
9529
|
var ZodIssueCode = util.arrayToEnum([
|
|
6544
9530
|
"invalid_type",
|
|
@@ -6652,6 +9638,7 @@ ZodError.create = (issues) => {
|
|
|
6652
9638
|
const error = new ZodError(issues);
|
|
6653
9639
|
return error;
|
|
6654
9640
|
};
|
|
9641
|
+
|
|
6655
9642
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/locales/en.js
|
|
6656
9643
|
var errorMap = (issue, _ctx) => {
|
|
6657
9644
|
let message;
|
|
@@ -6754,11 +9741,13 @@ var errorMap = (issue, _ctx) => {
|
|
|
6754
9741
|
return { message };
|
|
6755
9742
|
};
|
|
6756
9743
|
var en_default = errorMap;
|
|
9744
|
+
|
|
6757
9745
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/errors.js
|
|
6758
9746
|
var overrideErrorMap = en_default;
|
|
6759
9747
|
function getErrorMap() {
|
|
6760
9748
|
return overrideErrorMap;
|
|
6761
9749
|
}
|
|
9750
|
+
|
|
6762
9751
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
|
|
6763
9752
|
var makeIssue = (params) => {
|
|
6764
9753
|
const { data, path, errorMaps, issueData } = params;
|
|
@@ -6800,6 +9789,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
6800
9789
|
});
|
|
6801
9790
|
ctx.common.issues.push(issue);
|
|
6802
9791
|
}
|
|
9792
|
+
|
|
6803
9793
|
class ParseStatus {
|
|
6804
9794
|
constructor() {
|
|
6805
9795
|
this.value = "valid";
|
|
@@ -6863,12 +9853,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
6863
9853
|
var isDirty = (x) => x.status === "dirty";
|
|
6864
9854
|
var isValid = (x) => x.status === "valid";
|
|
6865
9855
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
9856
|
+
|
|
6866
9857
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/errorUtil.js
|
|
6867
9858
|
var errorUtil;
|
|
6868
9859
|
(function(errorUtil2) {
|
|
6869
9860
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
6870
9861
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
6871
9862
|
})(errorUtil || (errorUtil = {}));
|
|
9863
|
+
|
|
6872
9864
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.js
|
|
6873
9865
|
class ParseInputLazyPath {
|
|
6874
9866
|
constructor(parent, value, path, key) {
|
|
@@ -6931,6 +9923,7 @@ function processCreateParams(params) {
|
|
|
6931
9923
|
};
|
|
6932
9924
|
return { errorMap: customMap, description };
|
|
6933
9925
|
}
|
|
9926
|
+
|
|
6934
9927
|
class ZodType {
|
|
6935
9928
|
get description() {
|
|
6936
9929
|
return this._def.description;
|
|
@@ -7294,6 +10287,7 @@ function isValidCidr(ip, version) {
|
|
|
7294
10287
|
}
|
|
7295
10288
|
return false;
|
|
7296
10289
|
}
|
|
10290
|
+
|
|
7297
10291
|
class ZodString extends ZodType {
|
|
7298
10292
|
_parse(input) {
|
|
7299
10293
|
if (this._def.coerce) {
|
|
@@ -7845,6 +10839,7 @@ function floatSafeRemainder(val, step) {
|
|
|
7845
10839
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
7846
10840
|
return valInt % stepInt / 10 ** decCount;
|
|
7847
10841
|
}
|
|
10842
|
+
|
|
7848
10843
|
class ZodNumber extends ZodType {
|
|
7849
10844
|
constructor() {
|
|
7850
10845
|
super(...arguments);
|
|
@@ -8077,6 +11072,7 @@ ZodNumber.create = (params) => {
|
|
|
8077
11072
|
...processCreateParams(params)
|
|
8078
11073
|
});
|
|
8079
11074
|
};
|
|
11075
|
+
|
|
8080
11076
|
class ZodBigInt extends ZodType {
|
|
8081
11077
|
constructor() {
|
|
8082
11078
|
super(...arguments);
|
|
@@ -8249,6 +11245,7 @@ ZodBigInt.create = (params) => {
|
|
|
8249
11245
|
...processCreateParams(params)
|
|
8250
11246
|
});
|
|
8251
11247
|
};
|
|
11248
|
+
|
|
8252
11249
|
class ZodBoolean extends ZodType {
|
|
8253
11250
|
_parse(input) {
|
|
8254
11251
|
if (this._def.coerce) {
|
|
@@ -8274,6 +11271,7 @@ ZodBoolean.create = (params) => {
|
|
|
8274
11271
|
...processCreateParams(params)
|
|
8275
11272
|
});
|
|
8276
11273
|
};
|
|
11274
|
+
|
|
8277
11275
|
class ZodDate extends ZodType {
|
|
8278
11276
|
_parse(input) {
|
|
8279
11277
|
if (this._def.coerce) {
|
|
@@ -8383,6 +11381,7 @@ ZodDate.create = (params) => {
|
|
|
8383
11381
|
...processCreateParams(params)
|
|
8384
11382
|
});
|
|
8385
11383
|
};
|
|
11384
|
+
|
|
8386
11385
|
class ZodSymbol extends ZodType {
|
|
8387
11386
|
_parse(input) {
|
|
8388
11387
|
const parsedType = this._getType(input);
|
|
@@ -8404,6 +11403,7 @@ ZodSymbol.create = (params) => {
|
|
|
8404
11403
|
...processCreateParams(params)
|
|
8405
11404
|
});
|
|
8406
11405
|
};
|
|
11406
|
+
|
|
8407
11407
|
class ZodUndefined extends ZodType {
|
|
8408
11408
|
_parse(input) {
|
|
8409
11409
|
const parsedType = this._getType(input);
|
|
@@ -8425,6 +11425,7 @@ ZodUndefined.create = (params) => {
|
|
|
8425
11425
|
...processCreateParams(params)
|
|
8426
11426
|
});
|
|
8427
11427
|
};
|
|
11428
|
+
|
|
8428
11429
|
class ZodNull extends ZodType {
|
|
8429
11430
|
_parse(input) {
|
|
8430
11431
|
const parsedType = this._getType(input);
|
|
@@ -8446,6 +11447,7 @@ ZodNull.create = (params) => {
|
|
|
8446
11447
|
...processCreateParams(params)
|
|
8447
11448
|
});
|
|
8448
11449
|
};
|
|
11450
|
+
|
|
8449
11451
|
class ZodAny extends ZodType {
|
|
8450
11452
|
constructor() {
|
|
8451
11453
|
super(...arguments);
|
|
@@ -8461,6 +11463,7 @@ ZodAny.create = (params) => {
|
|
|
8461
11463
|
...processCreateParams(params)
|
|
8462
11464
|
});
|
|
8463
11465
|
};
|
|
11466
|
+
|
|
8464
11467
|
class ZodUnknown extends ZodType {
|
|
8465
11468
|
constructor() {
|
|
8466
11469
|
super(...arguments);
|
|
@@ -8476,6 +11479,7 @@ ZodUnknown.create = (params) => {
|
|
|
8476
11479
|
...processCreateParams(params)
|
|
8477
11480
|
});
|
|
8478
11481
|
};
|
|
11482
|
+
|
|
8479
11483
|
class ZodNever extends ZodType {
|
|
8480
11484
|
_parse(input) {
|
|
8481
11485
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -8493,6 +11497,7 @@ ZodNever.create = (params) => {
|
|
|
8493
11497
|
...processCreateParams(params)
|
|
8494
11498
|
});
|
|
8495
11499
|
};
|
|
11500
|
+
|
|
8496
11501
|
class ZodVoid extends ZodType {
|
|
8497
11502
|
_parse(input) {
|
|
8498
11503
|
const parsedType = this._getType(input);
|
|
@@ -8514,6 +11519,7 @@ ZodVoid.create = (params) => {
|
|
|
8514
11519
|
...processCreateParams(params)
|
|
8515
11520
|
});
|
|
8516
11521
|
};
|
|
11522
|
+
|
|
8517
11523
|
class ZodArray extends ZodType {
|
|
8518
11524
|
_parse(input) {
|
|
8519
11525
|
const { ctx, status } = this._processInputParams(input);
|
|
@@ -8641,6 +11647,7 @@ function deepPartialify(schema) {
|
|
|
8641
11647
|
return schema;
|
|
8642
11648
|
}
|
|
8643
11649
|
}
|
|
11650
|
+
|
|
8644
11651
|
class ZodObject extends ZodType {
|
|
8645
11652
|
constructor() {
|
|
8646
11653
|
super(...arguments);
|
|
@@ -8894,6 +11901,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
8894
11901
|
...processCreateParams(params)
|
|
8895
11902
|
});
|
|
8896
11903
|
};
|
|
11904
|
+
|
|
8897
11905
|
class ZodUnion extends ZodType {
|
|
8898
11906
|
_parse(input) {
|
|
8899
11907
|
const { ctx } = this._processInputParams(input);
|
|
@@ -9016,6 +12024,7 @@ var getDiscriminator = (type) => {
|
|
|
9016
12024
|
return [];
|
|
9017
12025
|
}
|
|
9018
12026
|
};
|
|
12027
|
+
|
|
9019
12028
|
class ZodDiscriminatedUnion extends ZodType {
|
|
9020
12029
|
_parse(input) {
|
|
9021
12030
|
const { ctx } = this._processInputParams(input);
|
|
@@ -9122,6 +12131,7 @@ function mergeValues(a, b) {
|
|
|
9122
12131
|
return { valid: false };
|
|
9123
12132
|
}
|
|
9124
12133
|
}
|
|
12134
|
+
|
|
9125
12135
|
class ZodIntersection extends ZodType {
|
|
9126
12136
|
_parse(input) {
|
|
9127
12137
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -9175,6 +12185,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
9175
12185
|
...processCreateParams(params)
|
|
9176
12186
|
});
|
|
9177
12187
|
};
|
|
12188
|
+
|
|
9178
12189
|
class ZodTuple extends ZodType {
|
|
9179
12190
|
_parse(input) {
|
|
9180
12191
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -9242,6 +12253,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
9242
12253
|
...processCreateParams(params)
|
|
9243
12254
|
});
|
|
9244
12255
|
};
|
|
12256
|
+
|
|
9245
12257
|
class ZodRecord extends ZodType {
|
|
9246
12258
|
get keySchema() {
|
|
9247
12259
|
return this._def.keyType;
|
|
@@ -9295,6 +12307,7 @@ class ZodRecord extends ZodType {
|
|
|
9295
12307
|
});
|
|
9296
12308
|
}
|
|
9297
12309
|
}
|
|
12310
|
+
|
|
9298
12311
|
class ZodMap extends ZodType {
|
|
9299
12312
|
get keySchema() {
|
|
9300
12313
|
return this._def.keyType;
|
|
@@ -9361,6 +12374,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
9361
12374
|
...processCreateParams(params)
|
|
9362
12375
|
});
|
|
9363
12376
|
};
|
|
12377
|
+
|
|
9364
12378
|
class ZodSet extends ZodType {
|
|
9365
12379
|
_parse(input) {
|
|
9366
12380
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -9446,6 +12460,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
9446
12460
|
...processCreateParams(params)
|
|
9447
12461
|
});
|
|
9448
12462
|
};
|
|
12463
|
+
|
|
9449
12464
|
class ZodFunction extends ZodType {
|
|
9450
12465
|
constructor() {
|
|
9451
12466
|
super(...arguments);
|
|
@@ -9551,6 +12566,7 @@ class ZodFunction extends ZodType {
|
|
|
9551
12566
|
});
|
|
9552
12567
|
}
|
|
9553
12568
|
}
|
|
12569
|
+
|
|
9554
12570
|
class ZodLazy extends ZodType {
|
|
9555
12571
|
get schema() {
|
|
9556
12572
|
return this._def.getter();
|
|
@@ -9568,6 +12584,7 @@ ZodLazy.create = (getter, params) => {
|
|
|
9568
12584
|
...processCreateParams(params)
|
|
9569
12585
|
});
|
|
9570
12586
|
};
|
|
12587
|
+
|
|
9571
12588
|
class ZodLiteral extends ZodType {
|
|
9572
12589
|
_parse(input) {
|
|
9573
12590
|
if (input.data !== this._def.value) {
|
|
@@ -9599,6 +12616,7 @@ function createZodEnum(values, params) {
|
|
|
9599
12616
|
...processCreateParams(params)
|
|
9600
12617
|
});
|
|
9601
12618
|
}
|
|
12619
|
+
|
|
9602
12620
|
class ZodEnum extends ZodType {
|
|
9603
12621
|
_parse(input) {
|
|
9604
12622
|
if (typeof input.data !== "string") {
|
|
@@ -9664,6 +12682,7 @@ class ZodEnum extends ZodType {
|
|
|
9664
12682
|
}
|
|
9665
12683
|
}
|
|
9666
12684
|
ZodEnum.create = createZodEnum;
|
|
12685
|
+
|
|
9667
12686
|
class ZodNativeEnum extends ZodType {
|
|
9668
12687
|
_parse(input) {
|
|
9669
12688
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
@@ -9702,6 +12721,7 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
9702
12721
|
...processCreateParams(params)
|
|
9703
12722
|
});
|
|
9704
12723
|
};
|
|
12724
|
+
|
|
9705
12725
|
class ZodPromise extends ZodType {
|
|
9706
12726
|
unwrap() {
|
|
9707
12727
|
return this._def.type;
|
|
@@ -9732,6 +12752,7 @@ ZodPromise.create = (schema, params) => {
|
|
|
9732
12752
|
...processCreateParams(params)
|
|
9733
12753
|
});
|
|
9734
12754
|
};
|
|
12755
|
+
|
|
9735
12756
|
class ZodEffects extends ZodType {
|
|
9736
12757
|
innerType() {
|
|
9737
12758
|
return this._def.schema;
|
|
@@ -9890,6 +12911,7 @@ ZodOptional.create = (type, params) => {
|
|
|
9890
12911
|
...processCreateParams(params)
|
|
9891
12912
|
});
|
|
9892
12913
|
};
|
|
12914
|
+
|
|
9893
12915
|
class ZodNullable extends ZodType {
|
|
9894
12916
|
_parse(input) {
|
|
9895
12917
|
const parsedType = this._getType(input);
|
|
@@ -9909,6 +12931,7 @@ ZodNullable.create = (type, params) => {
|
|
|
9909
12931
|
...processCreateParams(params)
|
|
9910
12932
|
});
|
|
9911
12933
|
};
|
|
12934
|
+
|
|
9912
12935
|
class ZodDefault extends ZodType {
|
|
9913
12936
|
_parse(input) {
|
|
9914
12937
|
const { ctx } = this._processInputParams(input);
|
|
@@ -9934,6 +12957,7 @@ ZodDefault.create = (type, params) => {
|
|
|
9934
12957
|
...processCreateParams(params)
|
|
9935
12958
|
});
|
|
9936
12959
|
};
|
|
12960
|
+
|
|
9937
12961
|
class ZodCatch extends ZodType {
|
|
9938
12962
|
_parse(input) {
|
|
9939
12963
|
const { ctx } = this._processInputParams(input);
|
|
@@ -9987,6 +13011,7 @@ ZodCatch.create = (type, params) => {
|
|
|
9987
13011
|
...processCreateParams(params)
|
|
9988
13012
|
});
|
|
9989
13013
|
};
|
|
13014
|
+
|
|
9990
13015
|
class ZodNaN extends ZodType {
|
|
9991
13016
|
_parse(input) {
|
|
9992
13017
|
const parsedType = this._getType(input);
|
|
@@ -10009,6 +13034,7 @@ ZodNaN.create = (params) => {
|
|
|
10009
13034
|
});
|
|
10010
13035
|
};
|
|
10011
13036
|
var BRAND = Symbol("zod_brand");
|
|
13037
|
+
|
|
10012
13038
|
class ZodBranded extends ZodType {
|
|
10013
13039
|
_parse(input) {
|
|
10014
13040
|
const { ctx } = this._processInputParams(input);
|
|
@@ -10023,6 +13049,7 @@ class ZodBranded extends ZodType {
|
|
|
10023
13049
|
return this._def.type;
|
|
10024
13050
|
}
|
|
10025
13051
|
}
|
|
13052
|
+
|
|
10026
13053
|
class ZodPipeline extends ZodType {
|
|
10027
13054
|
_parse(input) {
|
|
10028
13055
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -10078,6 +13105,7 @@ class ZodPipeline extends ZodType {
|
|
|
10078
13105
|
});
|
|
10079
13106
|
}
|
|
10080
13107
|
}
|
|
13108
|
+
|
|
10081
13109
|
class ZodReadonly extends ZodType {
|
|
10082
13110
|
_parse(input) {
|
|
10083
13111
|
const result = this._def.innerType._parse(input);
|
|
@@ -10176,6 +13204,7 @@ var optionalType = ZodOptional.create;
|
|
|
10176
13204
|
var nullableType = ZodNullable.create;
|
|
10177
13205
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
10178
13206
|
var pipelineType = ZodPipeline.create;
|
|
13207
|
+
|
|
10179
13208
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/index.js
|
|
10180
13209
|
var exports_core2 = {};
|
|
10181
13210
|
__export(exports_core2, {
|
|
@@ -10453,6 +13482,7 @@ __export(exports_core2, {
|
|
|
10453
13482
|
$ZodArray: () => $ZodArray,
|
|
10454
13483
|
$ZodAny: () => $ZodAny
|
|
10455
13484
|
});
|
|
13485
|
+
|
|
10456
13486
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
10457
13487
|
var NEVER = Object.freeze({
|
|
10458
13488
|
status: "aborted"
|
|
@@ -10484,6 +13514,7 @@ function $constructor(name, initializer, params) {
|
|
|
10484
13514
|
}
|
|
10485
13515
|
}
|
|
10486
13516
|
const Parent = params?.Parent ?? Object;
|
|
13517
|
+
|
|
10487
13518
|
class Definition extends Parent {
|
|
10488
13519
|
}
|
|
10489
13520
|
Object.defineProperty(Definition, "name", { value: name });
|
|
@@ -10509,11 +13540,13 @@ function $constructor(name, initializer, params) {
|
|
|
10509
13540
|
return _;
|
|
10510
13541
|
}
|
|
10511
13542
|
var $brand = Symbol("zod_brand");
|
|
13543
|
+
|
|
10512
13544
|
class $ZodAsyncError extends Error {
|
|
10513
13545
|
constructor() {
|
|
10514
13546
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
10515
13547
|
}
|
|
10516
13548
|
}
|
|
13549
|
+
|
|
10517
13550
|
class $ZodEncodeError extends Error {
|
|
10518
13551
|
constructor(name) {
|
|
10519
13552
|
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
@@ -11195,9 +14228,11 @@ function hexToUint8Array(hex) {
|
|
|
11195
14228
|
function uint8ArrayToHex(bytes) {
|
|
11196
14229
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
11197
14230
|
}
|
|
14231
|
+
|
|
11198
14232
|
class Class {
|
|
11199
14233
|
constructor(..._args) {}
|
|
11200
14234
|
}
|
|
14235
|
+
|
|
11201
14236
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
11202
14237
|
var initializer = (inst, def) => {
|
|
11203
14238
|
inst.name = "$ZodError";
|
|
@@ -11334,6 +14369,7 @@ function prettifyError(error) {
|
|
|
11334
14369
|
return lines.join(`
|
|
11335
14370
|
`);
|
|
11336
14371
|
}
|
|
14372
|
+
|
|
11337
14373
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
11338
14374
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
11339
14375
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
@@ -11577,6 +14613,7 @@ var sha384_base64url = /* @__PURE__ */ fixedBase64url(64);
|
|
|
11577
14613
|
var sha512_hex = /^[0-9a-fA-F]{128}$/;
|
|
11578
14614
|
var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
|
|
11579
14615
|
var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
14616
|
+
|
|
11580
14617
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
11581
14618
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
11582
14619
|
var _a;
|
|
@@ -12123,6 +15160,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
12123
15160
|
payload.value = def.tx(payload.value);
|
|
12124
15161
|
};
|
|
12125
15162
|
});
|
|
15163
|
+
|
|
12126
15164
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
12127
15165
|
class Doc {
|
|
12128
15166
|
constructor(args = []) {
|
|
@@ -12160,12 +15198,14 @@ class Doc {
|
|
|
12160
15198
|
`));
|
|
12161
15199
|
}
|
|
12162
15200
|
}
|
|
15201
|
+
|
|
12163
15202
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
12164
15203
|
var version = {
|
|
12165
15204
|
major: 4,
|
|
12166
15205
|
minor: 3,
|
|
12167
15206
|
patch: 6
|
|
12168
15207
|
};
|
|
15208
|
+
|
|
12169
15209
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
12170
15210
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
12171
15211
|
var _a;
|
|
@@ -14181,6 +17221,7 @@ __export(exports_locales, {
|
|
|
14181
17221
|
az: () => az_default,
|
|
14182
17222
|
ar: () => ar_default
|
|
14183
17223
|
});
|
|
17224
|
+
|
|
14184
17225
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ar.js
|
|
14185
17226
|
var error = () => {
|
|
14186
17227
|
const Sizable = {
|
|
@@ -16997,6 +20038,7 @@ function km_default() {
|
|
|
16997
20038
|
localeError: error24()
|
|
16998
20039
|
};
|
|
16999
20040
|
}
|
|
20041
|
+
|
|
17000
20042
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/kh.js
|
|
17001
20043
|
function kh_default() {
|
|
17002
20044
|
return km_default();
|
|
@@ -18997,6 +22039,7 @@ function uk_default() {
|
|
|
18997
22039
|
localeError: error41()
|
|
18998
22040
|
};
|
|
18999
22041
|
}
|
|
22042
|
+
|
|
19000
22043
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ua.js
|
|
19001
22044
|
function ua_default() {
|
|
19002
22045
|
return uk_default();
|
|
@@ -19655,6 +22698,7 @@ function yo_default() {
|
|
|
19655
22698
|
var _a;
|
|
19656
22699
|
var $output = Symbol("ZodOutput");
|
|
19657
22700
|
var $input = Symbol("ZodInput");
|
|
22701
|
+
|
|
19658
22702
|
class $ZodRegistry {
|
|
19659
22703
|
constructor() {
|
|
19660
22704
|
this._map = new WeakMap;
|
|
@@ -21756,6 +24800,7 @@ function getLiteralValue(schema) {
|
|
|
21756
24800
|
return directValue;
|
|
21757
24801
|
return;
|
|
21758
24802
|
}
|
|
24803
|
+
|
|
21759
24804
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
21760
24805
|
var exports_external = {};
|
|
21761
24806
|
__export(exports_external, {
|
|
@@ -21996,6 +25041,7 @@ __export(exports_external, {
|
|
|
21996
25041
|
$input: () => $input,
|
|
21997
25042
|
$brand: () => $brand
|
|
21998
25043
|
});
|
|
25044
|
+
|
|
21999
25045
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
22000
25046
|
var exports_schemas2 = {};
|
|
22001
25047
|
__export(exports_schemas2, {
|
|
@@ -22164,6 +25210,7 @@ __export(exports_schemas2, {
|
|
|
22164
25210
|
ZodArray: () => ZodArray2,
|
|
22165
25211
|
ZodAny: () => ZodAny2
|
|
22166
25212
|
});
|
|
25213
|
+
|
|
22167
25214
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/checks.js
|
|
22168
25215
|
var exports_checks2 = {};
|
|
22169
25216
|
__export(exports_checks2, {
|
|
@@ -22197,6 +25244,7 @@ __export(exports_checks2, {
|
|
|
22197
25244
|
gt: () => _gt,
|
|
22198
25245
|
endsWith: () => _endsWith
|
|
22199
25246
|
});
|
|
25247
|
+
|
|
22200
25248
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
22201
25249
|
var exports_iso2 = {};
|
|
22202
25250
|
__export(exports_iso2, {
|
|
@@ -22237,6 +25285,7 @@ var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def)
|
|
|
22237
25285
|
function duration2(params) {
|
|
22238
25286
|
return _isoDuration(ZodISODuration, params);
|
|
22239
25287
|
}
|
|
25288
|
+
|
|
22240
25289
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
22241
25290
|
var initializer2 = (inst, issues) => {
|
|
22242
25291
|
$ZodError.init(inst, issues);
|
|
@@ -22271,6 +25320,7 @@ var ZodError2 = $constructor("ZodError", initializer2);
|
|
|
22271
25320
|
var ZodRealError = $constructor("ZodError", initializer2, {
|
|
22272
25321
|
Parent: Error
|
|
22273
25322
|
});
|
|
25323
|
+
|
|
22274
25324
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
22275
25325
|
var parse4 = /* @__PURE__ */ _parse(ZodRealError);
|
|
22276
25326
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
@@ -22284,6 +25334,7 @@ var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
|
22284
25334
|
var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
22285
25335
|
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
22286
25336
|
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
25337
|
+
|
|
22287
25338
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
22288
25339
|
var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
22289
25340
|
$ZodType.init(inst, def);
|
|
@@ -23869,8 +26920,10 @@ function bigint3(params) {
|
|
|
23869
26920
|
function date4(params) {
|
|
23870
26921
|
return _coercedDate(ZodDate2, params);
|
|
23871
26922
|
}
|
|
26923
|
+
|
|
23872
26924
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
23873
26925
|
config(en_default2());
|
|
26926
|
+
|
|
23874
26927
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
23875
26928
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
23876
26929
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
@@ -24686,6 +27739,7 @@ var ServerResultSchema = union([
|
|
|
24686
27739
|
ListTasksResultSchema,
|
|
24687
27740
|
CreateTaskResultSchema
|
|
24688
27741
|
]);
|
|
27742
|
+
|
|
24689
27743
|
class McpError extends Error {
|
|
24690
27744
|
constructor(code, message, data) {
|
|
24691
27745
|
super(`MCP error ${code}: ${message}`);
|
|
@@ -24703,6 +27757,7 @@ class McpError extends Error {
|
|
|
24703
27757
|
return new McpError(code, message, data);
|
|
24704
27758
|
}
|
|
24705
27759
|
}
|
|
27760
|
+
|
|
24706
27761
|
class UrlElicitationRequiredError extends McpError {
|
|
24707
27762
|
constructor(elicitations, message = `URL elicitation${elicitations.length > 1 ? "s" : ""} required`) {
|
|
24708
27763
|
super(ErrorCode.UrlElicitationRequired, message, {
|
|
@@ -24713,10 +27768,12 @@ class UrlElicitationRequiredError extends McpError {
|
|
|
24713
27768
|
return this.data?.elicitations ?? [];
|
|
24714
27769
|
}
|
|
24715
27770
|
}
|
|
27771
|
+
|
|
24716
27772
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
24717
27773
|
function isTerminal(status) {
|
|
24718
27774
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
24719
27775
|
}
|
|
27776
|
+
|
|
24720
27777
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
24721
27778
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
24722
27779
|
var defaultOptions = {
|
|
@@ -24808,6 +27865,7 @@ function parseAnyDef(refs) {
|
|
|
24808
27865
|
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
24809
27866
|
};
|
|
24810
27867
|
}
|
|
27868
|
+
|
|
24811
27869
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
24812
27870
|
function parseArrayDef(def, refs) {
|
|
24813
27871
|
const res = {
|
|
@@ -24831,6 +27889,7 @@ function parseArrayDef(def, refs) {
|
|
|
24831
27889
|
}
|
|
24832
27890
|
return res;
|
|
24833
27891
|
}
|
|
27892
|
+
|
|
24834
27893
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
24835
27894
|
function parseBigintDef(def, refs) {
|
|
24836
27895
|
const res = {
|
|
@@ -24876,20 +27935,24 @@ function parseBigintDef(def, refs) {
|
|
|
24876
27935
|
}
|
|
24877
27936
|
return res;
|
|
24878
27937
|
}
|
|
27938
|
+
|
|
24879
27939
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
24880
27940
|
function parseBooleanDef() {
|
|
24881
27941
|
return {
|
|
24882
27942
|
type: "boolean"
|
|
24883
27943
|
};
|
|
24884
27944
|
}
|
|
27945
|
+
|
|
24885
27946
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
24886
27947
|
function parseBrandedDef(_def, refs) {
|
|
24887
27948
|
return parseDef(_def.type._def, refs);
|
|
24888
27949
|
}
|
|
27950
|
+
|
|
24889
27951
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
24890
27952
|
var parseCatchDef = (def, refs) => {
|
|
24891
27953
|
return parseDef(def.innerType._def, refs);
|
|
24892
27954
|
};
|
|
27955
|
+
|
|
24893
27956
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
24894
27957
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
24895
27958
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
@@ -24934,6 +27997,7 @@ var integerDateParser = (def, refs) => {
|
|
|
24934
27997
|
}
|
|
24935
27998
|
return res;
|
|
24936
27999
|
};
|
|
28000
|
+
|
|
24937
28001
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
24938
28002
|
function parseDefaultDef(_def, refs) {
|
|
24939
28003
|
return {
|
|
@@ -24941,10 +28005,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
24941
28005
|
default: _def.defaultValue()
|
|
24942
28006
|
};
|
|
24943
28007
|
}
|
|
28008
|
+
|
|
24944
28009
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
24945
28010
|
function parseEffectsDef(_def, refs) {
|
|
24946
28011
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
24947
28012
|
}
|
|
28013
|
+
|
|
24948
28014
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
24949
28015
|
function parseEnumDef(def) {
|
|
24950
28016
|
return {
|
|
@@ -24952,6 +28018,7 @@ function parseEnumDef(def) {
|
|
|
24952
28018
|
enum: Array.from(def.values)
|
|
24953
28019
|
};
|
|
24954
28020
|
}
|
|
28021
|
+
|
|
24955
28022
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
24956
28023
|
var isJsonSchema7AllOfType = (type) => {
|
|
24957
28024
|
if ("type" in type && type.type === "string")
|
|
@@ -24993,6 +28060,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
24993
28060
|
...unevaluatedProperties
|
|
24994
28061
|
} : undefined;
|
|
24995
28062
|
}
|
|
28063
|
+
|
|
24996
28064
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
24997
28065
|
function parseLiteralDef(def, refs) {
|
|
24998
28066
|
const parsedType2 = typeof def.value;
|
|
@@ -25012,6 +28080,7 @@ function parseLiteralDef(def, refs) {
|
|
|
25012
28080
|
const: def.value
|
|
25013
28081
|
};
|
|
25014
28082
|
}
|
|
28083
|
+
|
|
25015
28084
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
25016
28085
|
var emojiRegex2 = undefined;
|
|
25017
28086
|
var zodPatterns = {
|
|
@@ -25308,6 +28377,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
25308
28377
|
}
|
|
25309
28378
|
return pattern;
|
|
25310
28379
|
}
|
|
28380
|
+
|
|
25311
28381
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
25312
28382
|
function parseRecordDef(def, refs) {
|
|
25313
28383
|
if (refs.target === "openAi") {
|
|
@@ -25359,6 +28429,7 @@ function parseRecordDef(def, refs) {
|
|
|
25359
28429
|
}
|
|
25360
28430
|
return schema;
|
|
25361
28431
|
}
|
|
28432
|
+
|
|
25362
28433
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
25363
28434
|
function parseMapDef(def, refs) {
|
|
25364
28435
|
if (refs.mapStrategy === "record") {
|
|
@@ -25383,6 +28454,7 @@ function parseMapDef(def, refs) {
|
|
|
25383
28454
|
}
|
|
25384
28455
|
};
|
|
25385
28456
|
}
|
|
28457
|
+
|
|
25386
28458
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
25387
28459
|
function parseNativeEnumDef(def) {
|
|
25388
28460
|
const object3 = def.values;
|
|
@@ -25396,6 +28468,7 @@ function parseNativeEnumDef(def) {
|
|
|
25396
28468
|
enum: actualValues
|
|
25397
28469
|
};
|
|
25398
28470
|
}
|
|
28471
|
+
|
|
25399
28472
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
25400
28473
|
function parseNeverDef(refs) {
|
|
25401
28474
|
return refs.target === "openAi" ? undefined : {
|
|
@@ -25405,6 +28478,7 @@ function parseNeverDef(refs) {
|
|
|
25405
28478
|
})
|
|
25406
28479
|
};
|
|
25407
28480
|
}
|
|
28481
|
+
|
|
25408
28482
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
25409
28483
|
function parseNullDef(refs) {
|
|
25410
28484
|
return refs.target === "openApi3" ? {
|
|
@@ -25414,6 +28488,7 @@ function parseNullDef(refs) {
|
|
|
25414
28488
|
type: "null"
|
|
25415
28489
|
};
|
|
25416
28490
|
}
|
|
28491
|
+
|
|
25417
28492
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
25418
28493
|
var primitiveMappings = {
|
|
25419
28494
|
ZodString: "string",
|
|
@@ -25481,6 +28556,7 @@ var asAnyOf = (def, refs) => {
|
|
|
25481
28556
|
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
25482
28557
|
return anyOf.length ? { anyOf } : undefined;
|
|
25483
28558
|
};
|
|
28559
|
+
|
|
25484
28560
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
25485
28561
|
function parseNullableDef(def, refs) {
|
|
25486
28562
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
@@ -25512,6 +28588,7 @@ function parseNullableDef(def, refs) {
|
|
|
25512
28588
|
});
|
|
25513
28589
|
return base && { anyOf: [base, { type: "null" }] };
|
|
25514
28590
|
}
|
|
28591
|
+
|
|
25515
28592
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
25516
28593
|
function parseNumberDef(def, refs) {
|
|
25517
28594
|
const res = {
|
|
@@ -25560,6 +28637,7 @@ function parseNumberDef(def, refs) {
|
|
|
25560
28637
|
}
|
|
25561
28638
|
return res;
|
|
25562
28639
|
}
|
|
28640
|
+
|
|
25563
28641
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
25564
28642
|
function parseObjectDef(def, refs) {
|
|
25565
28643
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
@@ -25629,6 +28707,7 @@ function safeIsOptional(schema) {
|
|
|
25629
28707
|
return true;
|
|
25630
28708
|
}
|
|
25631
28709
|
}
|
|
28710
|
+
|
|
25632
28711
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
25633
28712
|
var parseOptionalDef = (def, refs) => {
|
|
25634
28713
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
@@ -25647,6 +28726,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
25647
28726
|
]
|
|
25648
28727
|
} : parseAnyDef(refs);
|
|
25649
28728
|
};
|
|
28729
|
+
|
|
25650
28730
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
25651
28731
|
var parsePipelineDef = (def, refs) => {
|
|
25652
28732
|
if (refs.pipeStrategy === "input") {
|
|
@@ -25666,10 +28746,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
25666
28746
|
allOf: [a, b].filter((x) => x !== undefined)
|
|
25667
28747
|
};
|
|
25668
28748
|
};
|
|
28749
|
+
|
|
25669
28750
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
25670
28751
|
function parsePromiseDef(def, refs) {
|
|
25671
28752
|
return parseDef(def.type._def, refs);
|
|
25672
28753
|
}
|
|
28754
|
+
|
|
25673
28755
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
25674
28756
|
function parseSetDef(def, refs) {
|
|
25675
28757
|
const items = parseDef(def.valueType._def, {
|
|
@@ -25689,6 +28771,7 @@ function parseSetDef(def, refs) {
|
|
|
25689
28771
|
}
|
|
25690
28772
|
return schema;
|
|
25691
28773
|
}
|
|
28774
|
+
|
|
25692
28775
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
25693
28776
|
function parseTupleDef(def, refs) {
|
|
25694
28777
|
if (def.rest) {
|
|
@@ -25716,20 +28799,24 @@ function parseTupleDef(def, refs) {
|
|
|
25716
28799
|
};
|
|
25717
28800
|
}
|
|
25718
28801
|
}
|
|
28802
|
+
|
|
25719
28803
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
25720
28804
|
function parseUndefinedDef(refs) {
|
|
25721
28805
|
return {
|
|
25722
28806
|
not: parseAnyDef(refs)
|
|
25723
28807
|
};
|
|
25724
28808
|
}
|
|
28809
|
+
|
|
25725
28810
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
25726
28811
|
function parseUnknownDef(refs) {
|
|
25727
28812
|
return parseAnyDef(refs);
|
|
25728
28813
|
}
|
|
28814
|
+
|
|
25729
28815
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
25730
28816
|
var parseReadonlyDef = (def, refs) => {
|
|
25731
28817
|
return parseDef(def.innerType._def, refs);
|
|
25732
28818
|
};
|
|
28819
|
+
|
|
25733
28820
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
25734
28821
|
var selectParser = (def, typeName, refs) => {
|
|
25735
28822
|
switch (typeName) {
|
|
@@ -25807,6 +28894,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
25807
28894
|
})(typeName);
|
|
25808
28895
|
}
|
|
25809
28896
|
};
|
|
28897
|
+
|
|
25810
28898
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
25811
28899
|
function parseDef(def, refs, forceResolution = false) {
|
|
25812
28900
|
const seenItem = refs.seen.get(def);
|
|
@@ -25963,8 +29051,10 @@ function parseWithCompat(schema, data) {
|
|
|
25963
29051
|
}
|
|
25964
29052
|
return result.data;
|
|
25965
29053
|
}
|
|
29054
|
+
|
|
25966
29055
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
25967
29056
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
29057
|
+
|
|
25968
29058
|
class Protocol {
|
|
25969
29059
|
constructor(_options) {
|
|
25970
29060
|
this._options = _options;
|
|
@@ -26802,6 +29892,7 @@ function mergeCapabilities(base, additional) {
|
|
|
26802
29892
|
}
|
|
26803
29893
|
return result;
|
|
26804
29894
|
}
|
|
29895
|
+
|
|
26805
29896
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
26806
29897
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
26807
29898
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
@@ -26816,6 +29907,7 @@ function createDefaultAjvInstance() {
|
|
|
26816
29907
|
addFormats(ajv);
|
|
26817
29908
|
return ajv;
|
|
26818
29909
|
}
|
|
29910
|
+
|
|
26819
29911
|
class AjvJsonSchemaValidator {
|
|
26820
29912
|
constructor(ajv) {
|
|
26821
29913
|
this._ajv = ajv ?? createDefaultAjvInstance();
|
|
@@ -26840,6 +29932,7 @@ class AjvJsonSchemaValidator {
|
|
|
26840
29932
|
};
|
|
26841
29933
|
}
|
|
26842
29934
|
}
|
|
29935
|
+
|
|
26843
29936
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
26844
29937
|
class ExperimentalServerTasks {
|
|
26845
29938
|
constructor(_server) {
|
|
@@ -26917,6 +30010,7 @@ class ExperimentalServerTasks {
|
|
|
26917
30010
|
return this._server.cancelTask({ taskId }, options);
|
|
26918
30011
|
}
|
|
26919
30012
|
}
|
|
30013
|
+
|
|
26920
30014
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
26921
30015
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
26922
30016
|
if (!requests) {
|
|
@@ -26951,6 +30045,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
26951
30045
|
break;
|
|
26952
30046
|
}
|
|
26953
30047
|
}
|
|
30048
|
+
|
|
26954
30049
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
26955
30050
|
class Server extends Protocol {
|
|
26956
30051
|
constructor(_serverInfo, options) {
|
|
@@ -27283,6 +30378,7 @@ class Server extends Protocol {
|
|
|
27283
30378
|
return this.notification({ method: "notifications/prompts/list_changed" });
|
|
27284
30379
|
}
|
|
27285
30380
|
}
|
|
30381
|
+
|
|
27286
30382
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
27287
30383
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
27288
30384
|
function isCompletable(schema) {
|
|
@@ -27296,6 +30392,7 @@ var McpZodTypeKind;
|
|
|
27296
30392
|
(function(McpZodTypeKind2) {
|
|
27297
30393
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
27298
30394
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
30395
|
+
|
|
27299
30396
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
27300
30397
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
27301
30398
|
function validateToolName(name) {
|
|
@@ -27353,6 +30450,7 @@ function validateAndWarnToolName(name) {
|
|
|
27353
30450
|
issueToolNameWarning(name, result.warnings);
|
|
27354
30451
|
return result.isValid;
|
|
27355
30452
|
}
|
|
30453
|
+
|
|
27356
30454
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
27357
30455
|
class ExperimentalMcpServerTasks {
|
|
27358
30456
|
constructor(_mcpServer) {
|
|
@@ -27367,6 +30465,7 @@ class ExperimentalMcpServerTasks {
|
|
|
27367
30465
|
return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
|
|
27368
30466
|
}
|
|
27369
30467
|
}
|
|
30468
|
+
|
|
27370
30469
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
27371
30470
|
class McpServer {
|
|
27372
30471
|
constructor(serverInfo, options) {
|
|
@@ -28092,8 +31191,10 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
28092
31191
|
hasMore: false
|
|
28093
31192
|
}
|
|
28094
31193
|
};
|
|
31194
|
+
|
|
28095
31195
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
28096
31196
|
import process3 from "node:process";
|
|
31197
|
+
|
|
28097
31198
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
28098
31199
|
class ReadBuffer {
|
|
28099
31200
|
append(chunk) {
|
|
@@ -28123,6 +31224,7 @@ function serializeMessage(message) {
|
|
|
28123
31224
|
return JSON.stringify(message) + `
|
|
28124
31225
|
`;
|
|
28125
31226
|
}
|
|
31227
|
+
|
|
28126
31228
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
28127
31229
|
class StdioServerTransport {
|
|
28128
31230
|
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
@@ -28200,6 +31302,7 @@ function fromBase64(b64) {
|
|
|
28200
31302
|
}
|
|
28201
31303
|
return bytes;
|
|
28202
31304
|
}
|
|
31305
|
+
|
|
28203
31306
|
class KodamaCrypto {
|
|
28204
31307
|
static async generateKey() {
|
|
28205
31308
|
const key = await crypto.subtle.generateKey({ name: ALGO, length: KEY_LENGTH }, true, ["encrypt", "decrypt"]);
|
|
@@ -28228,6 +31331,7 @@ class KodamaCrypto {
|
|
|
28228
31331
|
return crypto.subtle.importKey("raw", raw, { name: ALGO, length: KEY_LENGTH }, false, ["encrypt", "decrypt"]);
|
|
28229
31332
|
}
|
|
28230
31333
|
}
|
|
31334
|
+
|
|
28231
31335
|
// src/permissions.ts
|
|
28232
31336
|
import { readFile } from "node:fs/promises";
|
|
28233
31337
|
// ../shared/src/constants.ts
|
|
@@ -28244,6 +31348,7 @@ var AUTO_DENY_PATTERNS = [
|
|
|
28244
31348
|
];
|
|
28245
31349
|
// ../shared/src/index.ts
|
|
28246
31350
|
var VALID_CODE_RE = new RegExp(`^${ROOM_CODE_PREFIX}-[${ROOM_CODE_CHARS}]{${ROOM_CODE_LENGTH}}$`);
|
|
31351
|
+
|
|
28247
31352
|
// src/permissions.ts
|
|
28248
31353
|
function globToRegex(pattern) {
|
|
28249
31354
|
let re = "";
|
|
@@ -28274,6 +31379,7 @@ function globToRegex(pattern) {
|
|
|
28274
31379
|
function matchesAny(filePath, patterns) {
|
|
28275
31380
|
return patterns.some((pattern) => globToRegex(pattern).test(filePath));
|
|
28276
31381
|
}
|
|
31382
|
+
|
|
28277
31383
|
class PermissionChecker {
|
|
28278
31384
|
allowPatterns;
|
|
28279
31385
|
denyPatterns;
|
|
@@ -28340,10 +31446,19 @@ class PermissionChecker {
|
|
|
28340
31446
|
}
|
|
28341
31447
|
}
|
|
28342
31448
|
}
|
|
31449
|
+
|
|
28343
31450
|
// src/room.ts
|
|
31451
|
+
var WS = typeof globalThis.WebSocket !== "undefined" ? globalThis.WebSocket : (() => {
|
|
31452
|
+
try {
|
|
31453
|
+
return require_ws();
|
|
31454
|
+
} catch {
|
|
31455
|
+
return null;
|
|
31456
|
+
}
|
|
31457
|
+
})();
|
|
28344
31458
|
var INITIAL_BACKOFF_MS = 1000;
|
|
28345
31459
|
var MAX_BACKOFF_MS = 30000;
|
|
28346
31460
|
var MAX_RECONNECT_ATTEMPTS = 10;
|
|
31461
|
+
|
|
28347
31462
|
class Kodama {
|
|
28348
31463
|
roomCode;
|
|
28349
31464
|
relayUrl;
|
|
@@ -28387,7 +31502,7 @@ class Kodama {
|
|
|
28387
31502
|
}
|
|
28388
31503
|
leave() {
|
|
28389
31504
|
this.closed = true;
|
|
28390
|
-
if (this.ws && this.ws.readyState ===
|
|
31505
|
+
if (this.ws && this.ws.readyState === WS.OPEN) {
|
|
28391
31506
|
this.ws.send(JSON.stringify({ action: "leave" }));
|
|
28392
31507
|
this.ws.close();
|
|
28393
31508
|
}
|
|
@@ -28403,7 +31518,7 @@ class Kodama {
|
|
|
28403
31518
|
return this.roomState;
|
|
28404
31519
|
}
|
|
28405
31520
|
connect() {
|
|
28406
|
-
const ws = new
|
|
31521
|
+
const ws = new WS(this.relayUrl);
|
|
28407
31522
|
this.ws = ws;
|
|
28408
31523
|
ws.addEventListener("open", () => {
|
|
28409
31524
|
this.reconnectAttempts = 0;
|
|
@@ -28531,7 +31646,7 @@ class Kodama {
|
|
|
28531
31646
|
const content = typeof response === "string" ? response : response.content;
|
|
28532
31647
|
const done = typeof response === "string" ? undefined : response.done;
|
|
28533
31648
|
const filtered = this.permissions.filterMessage(content);
|
|
28534
|
-
if (this.ws && this.ws.readyState ===
|
|
31649
|
+
if (this.ws && this.ws.readyState === WS.OPEN) {
|
|
28535
31650
|
this.ws.send(JSON.stringify({
|
|
28536
31651
|
action: "message",
|
|
28537
31652
|
content: filtered,
|
|
@@ -28566,6 +31681,7 @@ class Kodama {
|
|
|
28566
31681
|
}, delay);
|
|
28567
31682
|
}
|
|
28568
31683
|
}
|
|
31684
|
+
|
|
28569
31685
|
// src/adapters/mcp.ts
|
|
28570
31686
|
var kodama = null;
|
|
28571
31687
|
var savedRoomCode = null;
|
|
@@ -28579,8 +31695,8 @@ var turnQueue = [];
|
|
|
28579
31695
|
var listenResolve = null;
|
|
28580
31696
|
var sayResolve = null;
|
|
28581
31697
|
var whispers = [];
|
|
28582
|
-
var DEFAULT_RELAY = process.env.KODAMA_RELAY ?? "
|
|
28583
|
-
var WEB_URL = process.env.KODAMA_WEB ?? "
|
|
31698
|
+
var DEFAULT_RELAY = process.env.KODAMA_RELAY ?? "https://kodamarelay-production.up.railway.app";
|
|
31699
|
+
var WEB_URL = process.env.KODAMA_WEB ?? "https://kodama.run";
|
|
28584
31700
|
var LISTEN_TIMEOUT_MS = 5000;
|
|
28585
31701
|
function toWsUrl(httpUrl2) {
|
|
28586
31702
|
return httpUrl2.replace(/^http:\/\//, "ws://").replace(/^https:\/\//, "wss://").replace(/\/+$/, "") + "/ws";
|