@kevisual/cli 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant-opencode.js +1572 -271
- package/dist/assistant-server.js +1076 -254
- package/dist/assistant.js +616 -112
- package/dist/envision.js +2 -2
- package/package.json +1 -1
- package/readme.md +1 -0
package/dist/assistant-server.js
CHANGED
|
@@ -10540,7 +10540,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10540
10540
|
if (isObject2) {
|
|
10541
10541
|
if (ns.isStructSchema()) {
|
|
10542
10542
|
const record2 = value;
|
|
10543
|
-
const
|
|
10543
|
+
const union = ns.isUnionSchema();
|
|
10544
10544
|
const out = {};
|
|
10545
10545
|
let nameMap = undefined;
|
|
10546
10546
|
const { jsonName } = this.settings;
|
|
@@ -10548,7 +10548,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10548
10548
|
nameMap = {};
|
|
10549
10549
|
}
|
|
10550
10550
|
let unionSerde;
|
|
10551
|
-
if (
|
|
10551
|
+
if (union) {
|
|
10552
10552
|
unionSerde = new UnionSerde(record2, out);
|
|
10553
10553
|
}
|
|
10554
10554
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
@@ -10557,14 +10557,14 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10557
10557
|
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
10558
10558
|
nameMap[fromKey] = memberName;
|
|
10559
10559
|
}
|
|
10560
|
-
if (
|
|
10560
|
+
if (union) {
|
|
10561
10561
|
unionSerde.mark(fromKey);
|
|
10562
10562
|
}
|
|
10563
10563
|
if (record2[fromKey] != null) {
|
|
10564
10564
|
out[memberName] = this._read(memberSchema, record2[fromKey]);
|
|
10565
10565
|
}
|
|
10566
10566
|
}
|
|
10567
|
-
if (
|
|
10567
|
+
if (union) {
|
|
10568
10568
|
unionSerde.writeUnknown();
|
|
10569
10569
|
} else if (typeof record2.__type === "string") {
|
|
10570
10570
|
for (const [k, v] of Object.entries(record2)) {
|
|
@@ -11171,22 +11171,22 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
11171
11171
|
return buffer;
|
|
11172
11172
|
}
|
|
11173
11173
|
if (ns.isStructSchema()) {
|
|
11174
|
-
const
|
|
11174
|
+
const union = ns.isUnionSchema();
|
|
11175
11175
|
let unionSerde;
|
|
11176
|
-
if (
|
|
11176
|
+
if (union) {
|
|
11177
11177
|
unionSerde = new UnionSerde(value, buffer);
|
|
11178
11178
|
}
|
|
11179
11179
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
11180
11180
|
const memberTraits = memberSchema.getMergedTraits();
|
|
11181
11181
|
const xmlObjectKey = !memberTraits.httpPayload ? memberSchema.getMemberTraits().xmlName ?? memberName : memberTraits.xmlName ?? memberSchema.getName();
|
|
11182
|
-
if (
|
|
11182
|
+
if (union) {
|
|
11183
11183
|
unionSerde.mark(xmlObjectKey);
|
|
11184
11184
|
}
|
|
11185
11185
|
if (value[xmlObjectKey] != null) {
|
|
11186
11186
|
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
11187
11187
|
}
|
|
11188
11188
|
}
|
|
11189
|
-
if (
|
|
11189
|
+
if (union) {
|
|
11190
11190
|
unionSerde.writeUnknown();
|
|
11191
11191
|
}
|
|
11192
11192
|
return buffer;
|
|
@@ -13058,12 +13058,12 @@ var require_dist_cjs30 = __commonJS((exports) => {
|
|
|
13058
13058
|
SelectorType2["ENV"] = "env";
|
|
13059
13059
|
SelectorType2["CONFIG"] = "shared config entry";
|
|
13060
13060
|
})(SelectorType || (SelectorType = {}));
|
|
13061
|
-
var stringUnionSelector = (obj, key,
|
|
13061
|
+
var stringUnionSelector = (obj, key, union, type) => {
|
|
13062
13062
|
if (!(key in obj))
|
|
13063
13063
|
return;
|
|
13064
13064
|
const value = obj[key].toUpperCase();
|
|
13065
|
-
if (!Object.values(
|
|
13066
|
-
throw new TypeError(`Cannot load ${type} '${key}'. Expected one of ${Object.values(
|
|
13065
|
+
if (!Object.values(union).includes(value)) {
|
|
13066
|
+
throw new TypeError(`Cannot load ${type} '${key}'. Expected one of ${Object.values(union)}, got '${obj[key]}'.`);
|
|
13067
13067
|
}
|
|
13068
13068
|
return value;
|
|
13069
13069
|
};
|
|
@@ -24619,7 +24619,7 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
24619
24619
|
if (isObject2) {
|
|
24620
24620
|
if (ns.isStructSchema()) {
|
|
24621
24621
|
const record2 = value;
|
|
24622
|
-
const
|
|
24622
|
+
const union = ns.isUnionSchema();
|
|
24623
24623
|
const out = {};
|
|
24624
24624
|
let nameMap = undefined;
|
|
24625
24625
|
const { jsonName } = this.settings;
|
|
@@ -24627,7 +24627,7 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
24627
24627
|
nameMap = {};
|
|
24628
24628
|
}
|
|
24629
24629
|
let unionSerde;
|
|
24630
|
-
if (
|
|
24630
|
+
if (union) {
|
|
24631
24631
|
unionSerde = new UnionSerde(record2, out);
|
|
24632
24632
|
}
|
|
24633
24633
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
@@ -24636,14 +24636,14 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
24636
24636
|
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
24637
24637
|
nameMap[fromKey] = memberName;
|
|
24638
24638
|
}
|
|
24639
|
-
if (
|
|
24639
|
+
if (union) {
|
|
24640
24640
|
unionSerde.mark(fromKey);
|
|
24641
24641
|
}
|
|
24642
24642
|
if (record2[fromKey] != null) {
|
|
24643
24643
|
out[memberName] = this._read(memberSchema, record2[fromKey]);
|
|
24644
24644
|
}
|
|
24645
24645
|
}
|
|
24646
|
-
if (
|
|
24646
|
+
if (union) {
|
|
24647
24647
|
unionSerde.writeUnknown();
|
|
24648
24648
|
} else if (typeof record2.__type === "string") {
|
|
24649
24649
|
for (const [k, v] of Object.entries(record2)) {
|
|
@@ -25250,22 +25250,22 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
25250
25250
|
return buffer;
|
|
25251
25251
|
}
|
|
25252
25252
|
if (ns.isStructSchema()) {
|
|
25253
|
-
const
|
|
25253
|
+
const union = ns.isUnionSchema();
|
|
25254
25254
|
let unionSerde;
|
|
25255
|
-
if (
|
|
25255
|
+
if (union) {
|
|
25256
25256
|
unionSerde = new UnionSerde(value, buffer);
|
|
25257
25257
|
}
|
|
25258
25258
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
25259
25259
|
const memberTraits = memberSchema.getMergedTraits();
|
|
25260
25260
|
const xmlObjectKey = !memberTraits.httpPayload ? memberSchema.getMemberTraits().xmlName ?? memberName : memberTraits.xmlName ?? memberSchema.getName();
|
|
25261
|
-
if (
|
|
25261
|
+
if (union) {
|
|
25262
25262
|
unionSerde.mark(xmlObjectKey);
|
|
25263
25263
|
}
|
|
25264
25264
|
if (value[xmlObjectKey] != null) {
|
|
25265
25265
|
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
25266
25266
|
}
|
|
25267
25267
|
}
|
|
25268
|
-
if (
|
|
25268
|
+
if (union) {
|
|
25269
25269
|
unionSerde.writeUnknown();
|
|
25270
25270
|
}
|
|
25271
25271
|
return buffer;
|
|
@@ -35572,26 +35572,26 @@ var require_escape_html = __commonJS((exports, module) => {
|
|
|
35572
35572
|
if (!match) {
|
|
35573
35573
|
return str;
|
|
35574
35574
|
}
|
|
35575
|
-
var
|
|
35575
|
+
var escape3;
|
|
35576
35576
|
var html = "";
|
|
35577
35577
|
var index = 0;
|
|
35578
35578
|
var lastIndex = 0;
|
|
35579
35579
|
for (index = match.index;index < str.length; index++) {
|
|
35580
35580
|
switch (str.charCodeAt(index)) {
|
|
35581
35581
|
case 34:
|
|
35582
|
-
|
|
35582
|
+
escape3 = """;
|
|
35583
35583
|
break;
|
|
35584
35584
|
case 38:
|
|
35585
|
-
|
|
35585
|
+
escape3 = "&";
|
|
35586
35586
|
break;
|
|
35587
35587
|
case 39:
|
|
35588
|
-
|
|
35588
|
+
escape3 = "'";
|
|
35589
35589
|
break;
|
|
35590
35590
|
case 60:
|
|
35591
|
-
|
|
35591
|
+
escape3 = "<";
|
|
35592
35592
|
break;
|
|
35593
35593
|
case 62:
|
|
35594
|
-
|
|
35594
|
+
escape3 = ">";
|
|
35595
35595
|
break;
|
|
35596
35596
|
default:
|
|
35597
35597
|
continue;
|
|
@@ -35600,7 +35600,7 @@ var require_escape_html = __commonJS((exports, module) => {
|
|
|
35600
35600
|
html += str.substring(lastIndex, index);
|
|
35601
35601
|
}
|
|
35602
35602
|
lastIndex = index + 1;
|
|
35603
|
-
html +=
|
|
35603
|
+
html += escape3;
|
|
35604
35604
|
}
|
|
35605
35605
|
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
|
35606
35606
|
}
|
|
@@ -62827,7 +62827,7 @@ var useKey = (envKey, initKey = "context") => {
|
|
|
62827
62827
|
return null;
|
|
62828
62828
|
};
|
|
62829
62829
|
|
|
62830
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
62830
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.2/node_modules/@kevisual/router/dist/router.js
|
|
62831
62831
|
import { createRequire as createRequire2 } from "node:module";
|
|
62832
62832
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
62833
62833
|
import http from "node:http";
|
|
@@ -62839,25 +62839,43 @@ var __getProtoOf2 = Object.getPrototypeOf;
|
|
|
62839
62839
|
var __defProp2 = Object.defineProperty;
|
|
62840
62840
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
62841
62841
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
62842
|
+
function __accessProp2(key) {
|
|
62843
|
+
return this[key];
|
|
62844
|
+
}
|
|
62845
|
+
var __toESMCache_node2;
|
|
62846
|
+
var __toESMCache_esm2;
|
|
62842
62847
|
var __toESM2 = (mod, isNodeMode, target) => {
|
|
62848
|
+
var canCache = mod != null && typeof mod === "object";
|
|
62849
|
+
if (canCache) {
|
|
62850
|
+
var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
|
|
62851
|
+
var cached = cache.get(mod);
|
|
62852
|
+
if (cached)
|
|
62853
|
+
return cached;
|
|
62854
|
+
}
|
|
62843
62855
|
target = mod != null ? __create2(__getProtoOf2(mod)) : {};
|
|
62844
62856
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target;
|
|
62845
62857
|
for (let key of __getOwnPropNames2(mod))
|
|
62846
62858
|
if (!__hasOwnProp2.call(to, key))
|
|
62847
62859
|
__defProp2(to, key, {
|
|
62848
|
-
get: (
|
|
62860
|
+
get: __accessProp2.bind(mod, key),
|
|
62849
62861
|
enumerable: true
|
|
62850
62862
|
});
|
|
62863
|
+
if (canCache)
|
|
62864
|
+
cache.set(mod, to);
|
|
62851
62865
|
return to;
|
|
62852
62866
|
};
|
|
62853
62867
|
var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
62868
|
+
var __returnValue2 = (v) => v;
|
|
62869
|
+
function __exportSetter2(name, newValue) {
|
|
62870
|
+
this[name] = __returnValue2.bind(null, newValue);
|
|
62871
|
+
}
|
|
62854
62872
|
var __export2 = (target, all) => {
|
|
62855
62873
|
for (var name in all)
|
|
62856
62874
|
__defProp2(target, name, {
|
|
62857
62875
|
get: all[name],
|
|
62858
62876
|
enumerable: true,
|
|
62859
62877
|
configurable: true,
|
|
62860
|
-
set: (
|
|
62878
|
+
set: __exportSetter2.bind(all, name)
|
|
62861
62879
|
});
|
|
62862
62880
|
};
|
|
62863
62881
|
var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
@@ -63037,6 +63055,464 @@ var require_eventemitter3 = __commonJS2((exports, module) => {
|
|
|
63037
63055
|
module.exports = EventEmitter2;
|
|
63038
63056
|
}
|
|
63039
63057
|
});
|
|
63058
|
+
var require_core = __commonJS2((exports, module) => {
|
|
63059
|
+
(function(root, factory) {
|
|
63060
|
+
if (typeof exports === "object") {
|
|
63061
|
+
module.exports = exports = factory();
|
|
63062
|
+
} else if (typeof define === "function" && define.amd) {
|
|
63063
|
+
define([], factory);
|
|
63064
|
+
} else {
|
|
63065
|
+
root.CryptoJS = factory();
|
|
63066
|
+
}
|
|
63067
|
+
})(exports, function() {
|
|
63068
|
+
var CryptoJS = CryptoJS || function(Math2, undefined2) {
|
|
63069
|
+
var crypto22;
|
|
63070
|
+
if (typeof window !== "undefined" && window.crypto) {
|
|
63071
|
+
crypto22 = window.crypto;
|
|
63072
|
+
}
|
|
63073
|
+
if (typeof self !== "undefined" && self.crypto) {
|
|
63074
|
+
crypto22 = self.crypto;
|
|
63075
|
+
}
|
|
63076
|
+
if (typeof globalThis !== "undefined" && globalThis.crypto) {
|
|
63077
|
+
crypto22 = globalThis.crypto;
|
|
63078
|
+
}
|
|
63079
|
+
if (!crypto22 && typeof window !== "undefined" && window.msCrypto) {
|
|
63080
|
+
crypto22 = window.msCrypto;
|
|
63081
|
+
}
|
|
63082
|
+
if (!crypto22 && typeof global !== "undefined" && global.crypto) {
|
|
63083
|
+
crypto22 = global.crypto;
|
|
63084
|
+
}
|
|
63085
|
+
if (!crypto22 && true) {
|
|
63086
|
+
try {
|
|
63087
|
+
crypto22 = __require2("crypto");
|
|
63088
|
+
} catch (err) {}
|
|
63089
|
+
}
|
|
63090
|
+
var cryptoSecureRandomInt = function() {
|
|
63091
|
+
if (crypto22) {
|
|
63092
|
+
if (typeof crypto22.getRandomValues === "function") {
|
|
63093
|
+
try {
|
|
63094
|
+
return crypto22.getRandomValues(new Uint32Array(1))[0];
|
|
63095
|
+
} catch (err) {}
|
|
63096
|
+
}
|
|
63097
|
+
if (typeof crypto22.randomBytes === "function") {
|
|
63098
|
+
try {
|
|
63099
|
+
return crypto22.randomBytes(4).readInt32LE();
|
|
63100
|
+
} catch (err) {}
|
|
63101
|
+
}
|
|
63102
|
+
}
|
|
63103
|
+
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
63104
|
+
};
|
|
63105
|
+
var create = Object.create || function() {
|
|
63106
|
+
function F() {}
|
|
63107
|
+
return function(obj) {
|
|
63108
|
+
var subtype;
|
|
63109
|
+
F.prototype = obj;
|
|
63110
|
+
subtype = new F;
|
|
63111
|
+
F.prototype = null;
|
|
63112
|
+
return subtype;
|
|
63113
|
+
};
|
|
63114
|
+
}();
|
|
63115
|
+
var C = {};
|
|
63116
|
+
var C_lib = C.lib = {};
|
|
63117
|
+
var Base = C_lib.Base = function() {
|
|
63118
|
+
return {
|
|
63119
|
+
extend: function(overrides) {
|
|
63120
|
+
var subtype = create(this);
|
|
63121
|
+
if (overrides) {
|
|
63122
|
+
subtype.mixIn(overrides);
|
|
63123
|
+
}
|
|
63124
|
+
if (!subtype.hasOwnProperty("init") || this.init === subtype.init) {
|
|
63125
|
+
subtype.init = function() {
|
|
63126
|
+
subtype.$super.init.apply(this, arguments);
|
|
63127
|
+
};
|
|
63128
|
+
}
|
|
63129
|
+
subtype.init.prototype = subtype;
|
|
63130
|
+
subtype.$super = this;
|
|
63131
|
+
return subtype;
|
|
63132
|
+
},
|
|
63133
|
+
create: function() {
|
|
63134
|
+
var instance = this.extend();
|
|
63135
|
+
instance.init.apply(instance, arguments);
|
|
63136
|
+
return instance;
|
|
63137
|
+
},
|
|
63138
|
+
init: function() {},
|
|
63139
|
+
mixIn: function(properties) {
|
|
63140
|
+
for (var propertyName in properties) {
|
|
63141
|
+
if (properties.hasOwnProperty(propertyName)) {
|
|
63142
|
+
this[propertyName] = properties[propertyName];
|
|
63143
|
+
}
|
|
63144
|
+
}
|
|
63145
|
+
if (properties.hasOwnProperty("toString")) {
|
|
63146
|
+
this.toString = properties.toString;
|
|
63147
|
+
}
|
|
63148
|
+
},
|
|
63149
|
+
clone: function() {
|
|
63150
|
+
return this.init.prototype.extend(this);
|
|
63151
|
+
}
|
|
63152
|
+
};
|
|
63153
|
+
}();
|
|
63154
|
+
var WordArray = C_lib.WordArray = Base.extend({
|
|
63155
|
+
init: function(words2, sigBytes) {
|
|
63156
|
+
words2 = this.words = words2 || [];
|
|
63157
|
+
if (sigBytes != undefined2) {
|
|
63158
|
+
this.sigBytes = sigBytes;
|
|
63159
|
+
} else {
|
|
63160
|
+
this.sigBytes = words2.length * 4;
|
|
63161
|
+
}
|
|
63162
|
+
},
|
|
63163
|
+
toString: function(encoder) {
|
|
63164
|
+
return (encoder || Hex).stringify(this);
|
|
63165
|
+
},
|
|
63166
|
+
concat: function(wordArray) {
|
|
63167
|
+
var thisWords = this.words;
|
|
63168
|
+
var thatWords = wordArray.words;
|
|
63169
|
+
var thisSigBytes = this.sigBytes;
|
|
63170
|
+
var thatSigBytes = wordArray.sigBytes;
|
|
63171
|
+
this.clamp();
|
|
63172
|
+
if (thisSigBytes % 4) {
|
|
63173
|
+
for (var i = 0;i < thatSigBytes; i++) {
|
|
63174
|
+
var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
63175
|
+
thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
|
|
63176
|
+
}
|
|
63177
|
+
} else {
|
|
63178
|
+
for (var j = 0;j < thatSigBytes; j += 4) {
|
|
63179
|
+
thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2];
|
|
63180
|
+
}
|
|
63181
|
+
}
|
|
63182
|
+
this.sigBytes += thatSigBytes;
|
|
63183
|
+
return this;
|
|
63184
|
+
},
|
|
63185
|
+
clamp: function() {
|
|
63186
|
+
var words2 = this.words;
|
|
63187
|
+
var sigBytes = this.sigBytes;
|
|
63188
|
+
words2[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
|
|
63189
|
+
words2.length = Math2.ceil(sigBytes / 4);
|
|
63190
|
+
},
|
|
63191
|
+
clone: function() {
|
|
63192
|
+
var clone3 = Base.clone.call(this);
|
|
63193
|
+
clone3.words = this.words.slice(0);
|
|
63194
|
+
return clone3;
|
|
63195
|
+
},
|
|
63196
|
+
random: function(nBytes) {
|
|
63197
|
+
var words2 = [];
|
|
63198
|
+
for (var i = 0;i < nBytes; i += 4) {
|
|
63199
|
+
words2.push(cryptoSecureRandomInt());
|
|
63200
|
+
}
|
|
63201
|
+
return new WordArray.init(words2, nBytes);
|
|
63202
|
+
}
|
|
63203
|
+
});
|
|
63204
|
+
var C_enc = C.enc = {};
|
|
63205
|
+
var Hex = C_enc.Hex = {
|
|
63206
|
+
stringify: function(wordArray) {
|
|
63207
|
+
var words2 = wordArray.words;
|
|
63208
|
+
var sigBytes = wordArray.sigBytes;
|
|
63209
|
+
var hexChars = [];
|
|
63210
|
+
for (var i = 0;i < sigBytes; i++) {
|
|
63211
|
+
var bite = words2[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
63212
|
+
hexChars.push((bite >>> 4).toString(16));
|
|
63213
|
+
hexChars.push((bite & 15).toString(16));
|
|
63214
|
+
}
|
|
63215
|
+
return hexChars.join("");
|
|
63216
|
+
},
|
|
63217
|
+
parse: function(hexStr) {
|
|
63218
|
+
var hexStrLength = hexStr.length;
|
|
63219
|
+
var words2 = [];
|
|
63220
|
+
for (var i = 0;i < hexStrLength; i += 2) {
|
|
63221
|
+
words2[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
|
|
63222
|
+
}
|
|
63223
|
+
return new WordArray.init(words2, hexStrLength / 2);
|
|
63224
|
+
}
|
|
63225
|
+
};
|
|
63226
|
+
var Latin1 = C_enc.Latin1 = {
|
|
63227
|
+
stringify: function(wordArray) {
|
|
63228
|
+
var words2 = wordArray.words;
|
|
63229
|
+
var sigBytes = wordArray.sigBytes;
|
|
63230
|
+
var latin1Chars = [];
|
|
63231
|
+
for (var i = 0;i < sigBytes; i++) {
|
|
63232
|
+
var bite = words2[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
63233
|
+
latin1Chars.push(String.fromCharCode(bite));
|
|
63234
|
+
}
|
|
63235
|
+
return latin1Chars.join("");
|
|
63236
|
+
},
|
|
63237
|
+
parse: function(latin1Str) {
|
|
63238
|
+
var latin1StrLength = latin1Str.length;
|
|
63239
|
+
var words2 = [];
|
|
63240
|
+
for (var i = 0;i < latin1StrLength; i++) {
|
|
63241
|
+
words2[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
|
|
63242
|
+
}
|
|
63243
|
+
return new WordArray.init(words2, latin1StrLength);
|
|
63244
|
+
}
|
|
63245
|
+
};
|
|
63246
|
+
var Utf8 = C_enc.Utf8 = {
|
|
63247
|
+
stringify: function(wordArray) {
|
|
63248
|
+
try {
|
|
63249
|
+
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
|
63250
|
+
} catch (e) {
|
|
63251
|
+
throw new Error("Malformed UTF-8 data");
|
|
63252
|
+
}
|
|
63253
|
+
},
|
|
63254
|
+
parse: function(utf8Str) {
|
|
63255
|
+
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
|
63256
|
+
}
|
|
63257
|
+
};
|
|
63258
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
|
63259
|
+
reset: function() {
|
|
63260
|
+
this._data = new WordArray.init;
|
|
63261
|
+
this._nDataBytes = 0;
|
|
63262
|
+
},
|
|
63263
|
+
_append: function(data) {
|
|
63264
|
+
if (typeof data == "string") {
|
|
63265
|
+
data = Utf8.parse(data);
|
|
63266
|
+
}
|
|
63267
|
+
this._data.concat(data);
|
|
63268
|
+
this._nDataBytes += data.sigBytes;
|
|
63269
|
+
},
|
|
63270
|
+
_process: function(doFlush) {
|
|
63271
|
+
var processedWords;
|
|
63272
|
+
var data = this._data;
|
|
63273
|
+
var dataWords = data.words;
|
|
63274
|
+
var dataSigBytes = data.sigBytes;
|
|
63275
|
+
var blockSize = this.blockSize;
|
|
63276
|
+
var blockSizeBytes = blockSize * 4;
|
|
63277
|
+
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
|
63278
|
+
if (doFlush) {
|
|
63279
|
+
nBlocksReady = Math2.ceil(nBlocksReady);
|
|
63280
|
+
} else {
|
|
63281
|
+
nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
|
63282
|
+
}
|
|
63283
|
+
var nWordsReady = nBlocksReady * blockSize;
|
|
63284
|
+
var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes);
|
|
63285
|
+
if (nWordsReady) {
|
|
63286
|
+
for (var offset = 0;offset < nWordsReady; offset += blockSize) {
|
|
63287
|
+
this._doProcessBlock(dataWords, offset);
|
|
63288
|
+
}
|
|
63289
|
+
processedWords = dataWords.splice(0, nWordsReady);
|
|
63290
|
+
data.sigBytes -= nBytesReady;
|
|
63291
|
+
}
|
|
63292
|
+
return new WordArray.init(processedWords, nBytesReady);
|
|
63293
|
+
},
|
|
63294
|
+
clone: function() {
|
|
63295
|
+
var clone3 = Base.clone.call(this);
|
|
63296
|
+
clone3._data = this._data.clone();
|
|
63297
|
+
return clone3;
|
|
63298
|
+
},
|
|
63299
|
+
_minBufferSize: 0
|
|
63300
|
+
});
|
|
63301
|
+
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
|
63302
|
+
cfg: Base.extend(),
|
|
63303
|
+
init: function(cfg) {
|
|
63304
|
+
this.cfg = this.cfg.extend(cfg);
|
|
63305
|
+
this.reset();
|
|
63306
|
+
},
|
|
63307
|
+
reset: function() {
|
|
63308
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
63309
|
+
this._doReset();
|
|
63310
|
+
},
|
|
63311
|
+
update: function(messageUpdate) {
|
|
63312
|
+
this._append(messageUpdate);
|
|
63313
|
+
this._process();
|
|
63314
|
+
return this;
|
|
63315
|
+
},
|
|
63316
|
+
finalize: function(messageUpdate) {
|
|
63317
|
+
if (messageUpdate) {
|
|
63318
|
+
this._append(messageUpdate);
|
|
63319
|
+
}
|
|
63320
|
+
var hash2 = this._doFinalize();
|
|
63321
|
+
return hash2;
|
|
63322
|
+
},
|
|
63323
|
+
blockSize: 512 / 32,
|
|
63324
|
+
_createHelper: function(hasher) {
|
|
63325
|
+
return function(message, cfg) {
|
|
63326
|
+
return new hasher.init(cfg).finalize(message);
|
|
63327
|
+
};
|
|
63328
|
+
},
|
|
63329
|
+
_createHmacHelper: function(hasher) {
|
|
63330
|
+
return function(message, key) {
|
|
63331
|
+
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
|
63332
|
+
};
|
|
63333
|
+
}
|
|
63334
|
+
});
|
|
63335
|
+
var C_algo = C.algo = {};
|
|
63336
|
+
return C;
|
|
63337
|
+
}(Math);
|
|
63338
|
+
return CryptoJS;
|
|
63339
|
+
});
|
|
63340
|
+
});
|
|
63341
|
+
var require_md5 = __commonJS2((exports, module) => {
|
|
63342
|
+
(function(root, factory) {
|
|
63343
|
+
if (typeof exports === "object") {
|
|
63344
|
+
module.exports = exports = factory(require_core());
|
|
63345
|
+
} else if (typeof define === "function" && define.amd) {
|
|
63346
|
+
define(["./core"], factory);
|
|
63347
|
+
} else {
|
|
63348
|
+
factory(root.CryptoJS);
|
|
63349
|
+
}
|
|
63350
|
+
})(exports, function(CryptoJS) {
|
|
63351
|
+
(function(Math2) {
|
|
63352
|
+
var C = CryptoJS;
|
|
63353
|
+
var C_lib = C.lib;
|
|
63354
|
+
var WordArray = C_lib.WordArray;
|
|
63355
|
+
var Hasher = C_lib.Hasher;
|
|
63356
|
+
var C_algo = C.algo;
|
|
63357
|
+
var T = [];
|
|
63358
|
+
(function() {
|
|
63359
|
+
for (var i = 0;i < 64; i++) {
|
|
63360
|
+
T[i] = Math2.abs(Math2.sin(i + 1)) * 4294967296 | 0;
|
|
63361
|
+
}
|
|
63362
|
+
})();
|
|
63363
|
+
var MD5 = C_algo.MD5 = Hasher.extend({
|
|
63364
|
+
_doReset: function() {
|
|
63365
|
+
this._hash = new WordArray.init([
|
|
63366
|
+
1732584193,
|
|
63367
|
+
4023233417,
|
|
63368
|
+
2562383102,
|
|
63369
|
+
271733878
|
|
63370
|
+
]);
|
|
63371
|
+
},
|
|
63372
|
+
_doProcessBlock: function(M, offset) {
|
|
63373
|
+
for (var i = 0;i < 16; i++) {
|
|
63374
|
+
var offset_i = offset + i;
|
|
63375
|
+
var M_offset_i = M[offset_i];
|
|
63376
|
+
M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 16711935 | (M_offset_i << 24 | M_offset_i >>> 8) & 4278255360;
|
|
63377
|
+
}
|
|
63378
|
+
var H = this._hash.words;
|
|
63379
|
+
var M_offset_0 = M[offset + 0];
|
|
63380
|
+
var M_offset_1 = M[offset + 1];
|
|
63381
|
+
var M_offset_2 = M[offset + 2];
|
|
63382
|
+
var M_offset_3 = M[offset + 3];
|
|
63383
|
+
var M_offset_4 = M[offset + 4];
|
|
63384
|
+
var M_offset_5 = M[offset + 5];
|
|
63385
|
+
var M_offset_6 = M[offset + 6];
|
|
63386
|
+
var M_offset_7 = M[offset + 7];
|
|
63387
|
+
var M_offset_8 = M[offset + 8];
|
|
63388
|
+
var M_offset_9 = M[offset + 9];
|
|
63389
|
+
var M_offset_10 = M[offset + 10];
|
|
63390
|
+
var M_offset_11 = M[offset + 11];
|
|
63391
|
+
var M_offset_12 = M[offset + 12];
|
|
63392
|
+
var M_offset_13 = M[offset + 13];
|
|
63393
|
+
var M_offset_14 = M[offset + 14];
|
|
63394
|
+
var M_offset_15 = M[offset + 15];
|
|
63395
|
+
var a = H[0];
|
|
63396
|
+
var b = H[1];
|
|
63397
|
+
var c = H[2];
|
|
63398
|
+
var d = H[3];
|
|
63399
|
+
a = FF(a, b, c, d, M_offset_0, 7, T[0]);
|
|
63400
|
+
d = FF(d, a, b, c, M_offset_1, 12, T[1]);
|
|
63401
|
+
c = FF(c, d, a, b, M_offset_2, 17, T[2]);
|
|
63402
|
+
b = FF(b, c, d, a, M_offset_3, 22, T[3]);
|
|
63403
|
+
a = FF(a, b, c, d, M_offset_4, 7, T[4]);
|
|
63404
|
+
d = FF(d, a, b, c, M_offset_5, 12, T[5]);
|
|
63405
|
+
c = FF(c, d, a, b, M_offset_6, 17, T[6]);
|
|
63406
|
+
b = FF(b, c, d, a, M_offset_7, 22, T[7]);
|
|
63407
|
+
a = FF(a, b, c, d, M_offset_8, 7, T[8]);
|
|
63408
|
+
d = FF(d, a, b, c, M_offset_9, 12, T[9]);
|
|
63409
|
+
c = FF(c, d, a, b, M_offset_10, 17, T[10]);
|
|
63410
|
+
b = FF(b, c, d, a, M_offset_11, 22, T[11]);
|
|
63411
|
+
a = FF(a, b, c, d, M_offset_12, 7, T[12]);
|
|
63412
|
+
d = FF(d, a, b, c, M_offset_13, 12, T[13]);
|
|
63413
|
+
c = FF(c, d, a, b, M_offset_14, 17, T[14]);
|
|
63414
|
+
b = FF(b, c, d, a, M_offset_15, 22, T[15]);
|
|
63415
|
+
a = GG(a, b, c, d, M_offset_1, 5, T[16]);
|
|
63416
|
+
d = GG(d, a, b, c, M_offset_6, 9, T[17]);
|
|
63417
|
+
c = GG(c, d, a, b, M_offset_11, 14, T[18]);
|
|
63418
|
+
b = GG(b, c, d, a, M_offset_0, 20, T[19]);
|
|
63419
|
+
a = GG(a, b, c, d, M_offset_5, 5, T[20]);
|
|
63420
|
+
d = GG(d, a, b, c, M_offset_10, 9, T[21]);
|
|
63421
|
+
c = GG(c, d, a, b, M_offset_15, 14, T[22]);
|
|
63422
|
+
b = GG(b, c, d, a, M_offset_4, 20, T[23]);
|
|
63423
|
+
a = GG(a, b, c, d, M_offset_9, 5, T[24]);
|
|
63424
|
+
d = GG(d, a, b, c, M_offset_14, 9, T[25]);
|
|
63425
|
+
c = GG(c, d, a, b, M_offset_3, 14, T[26]);
|
|
63426
|
+
b = GG(b, c, d, a, M_offset_8, 20, T[27]);
|
|
63427
|
+
a = GG(a, b, c, d, M_offset_13, 5, T[28]);
|
|
63428
|
+
d = GG(d, a, b, c, M_offset_2, 9, T[29]);
|
|
63429
|
+
c = GG(c, d, a, b, M_offset_7, 14, T[30]);
|
|
63430
|
+
b = GG(b, c, d, a, M_offset_12, 20, T[31]);
|
|
63431
|
+
a = HH(a, b, c, d, M_offset_5, 4, T[32]);
|
|
63432
|
+
d = HH(d, a, b, c, M_offset_8, 11, T[33]);
|
|
63433
|
+
c = HH(c, d, a, b, M_offset_11, 16, T[34]);
|
|
63434
|
+
b = HH(b, c, d, a, M_offset_14, 23, T[35]);
|
|
63435
|
+
a = HH(a, b, c, d, M_offset_1, 4, T[36]);
|
|
63436
|
+
d = HH(d, a, b, c, M_offset_4, 11, T[37]);
|
|
63437
|
+
c = HH(c, d, a, b, M_offset_7, 16, T[38]);
|
|
63438
|
+
b = HH(b, c, d, a, M_offset_10, 23, T[39]);
|
|
63439
|
+
a = HH(a, b, c, d, M_offset_13, 4, T[40]);
|
|
63440
|
+
d = HH(d, a, b, c, M_offset_0, 11, T[41]);
|
|
63441
|
+
c = HH(c, d, a, b, M_offset_3, 16, T[42]);
|
|
63442
|
+
b = HH(b, c, d, a, M_offset_6, 23, T[43]);
|
|
63443
|
+
a = HH(a, b, c, d, M_offset_9, 4, T[44]);
|
|
63444
|
+
d = HH(d, a, b, c, M_offset_12, 11, T[45]);
|
|
63445
|
+
c = HH(c, d, a, b, M_offset_15, 16, T[46]);
|
|
63446
|
+
b = HH(b, c, d, a, M_offset_2, 23, T[47]);
|
|
63447
|
+
a = II(a, b, c, d, M_offset_0, 6, T[48]);
|
|
63448
|
+
d = II(d, a, b, c, M_offset_7, 10, T[49]);
|
|
63449
|
+
c = II(c, d, a, b, M_offset_14, 15, T[50]);
|
|
63450
|
+
b = II(b, c, d, a, M_offset_5, 21, T[51]);
|
|
63451
|
+
a = II(a, b, c, d, M_offset_12, 6, T[52]);
|
|
63452
|
+
d = II(d, a, b, c, M_offset_3, 10, T[53]);
|
|
63453
|
+
c = II(c, d, a, b, M_offset_10, 15, T[54]);
|
|
63454
|
+
b = II(b, c, d, a, M_offset_1, 21, T[55]);
|
|
63455
|
+
a = II(a, b, c, d, M_offset_8, 6, T[56]);
|
|
63456
|
+
d = II(d, a, b, c, M_offset_15, 10, T[57]);
|
|
63457
|
+
c = II(c, d, a, b, M_offset_6, 15, T[58]);
|
|
63458
|
+
b = II(b, c, d, a, M_offset_13, 21, T[59]);
|
|
63459
|
+
a = II(a, b, c, d, M_offset_4, 6, T[60]);
|
|
63460
|
+
d = II(d, a, b, c, M_offset_11, 10, T[61]);
|
|
63461
|
+
c = II(c, d, a, b, M_offset_2, 15, T[62]);
|
|
63462
|
+
b = II(b, c, d, a, M_offset_9, 21, T[63]);
|
|
63463
|
+
H[0] = H[0] + a | 0;
|
|
63464
|
+
H[1] = H[1] + b | 0;
|
|
63465
|
+
H[2] = H[2] + c | 0;
|
|
63466
|
+
H[3] = H[3] + d | 0;
|
|
63467
|
+
},
|
|
63468
|
+
_doFinalize: function() {
|
|
63469
|
+
var data = this._data;
|
|
63470
|
+
var dataWords = data.words;
|
|
63471
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
63472
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
63473
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
63474
|
+
var nBitsTotalH = Math2.floor(nBitsTotal / 4294967296);
|
|
63475
|
+
var nBitsTotalL = nBitsTotal;
|
|
63476
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 16711935 | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 4278255360;
|
|
63477
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 16711935 | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 4278255360;
|
|
63478
|
+
data.sigBytes = (dataWords.length + 1) * 4;
|
|
63479
|
+
this._process();
|
|
63480
|
+
var hash2 = this._hash;
|
|
63481
|
+
var H = hash2.words;
|
|
63482
|
+
for (var i = 0;i < 4; i++) {
|
|
63483
|
+
var H_i = H[i];
|
|
63484
|
+
H[i] = (H_i << 8 | H_i >>> 24) & 16711935 | (H_i << 24 | H_i >>> 8) & 4278255360;
|
|
63485
|
+
}
|
|
63486
|
+
return hash2;
|
|
63487
|
+
},
|
|
63488
|
+
clone: function() {
|
|
63489
|
+
var clone3 = Hasher.clone.call(this);
|
|
63490
|
+
clone3._hash = this._hash.clone();
|
|
63491
|
+
return clone3;
|
|
63492
|
+
}
|
|
63493
|
+
});
|
|
63494
|
+
function FF(a, b, c, d, x, s, t) {
|
|
63495
|
+
var n = a + (b & c | ~b & d) + x + t;
|
|
63496
|
+
return (n << s | n >>> 32 - s) + b;
|
|
63497
|
+
}
|
|
63498
|
+
function GG(a, b, c, d, x, s, t) {
|
|
63499
|
+
var n = a + (b & d | c & ~d) + x + t;
|
|
63500
|
+
return (n << s | n >>> 32 - s) + b;
|
|
63501
|
+
}
|
|
63502
|
+
function HH(a, b, c, d, x, s, t) {
|
|
63503
|
+
var n = a + (b ^ c ^ d) + x + t;
|
|
63504
|
+
return (n << s | n >>> 32 - s) + b;
|
|
63505
|
+
}
|
|
63506
|
+
function II(a, b, c, d, x, s, t) {
|
|
63507
|
+
var n = a + (c ^ (b | ~d)) + x + t;
|
|
63508
|
+
return (n << s | n >>> 32 - s) + b;
|
|
63509
|
+
}
|
|
63510
|
+
C.MD5 = Hasher._createHelper(MD5);
|
|
63511
|
+
C.HmacMD5 = Hasher._createHmacHelper(MD5);
|
|
63512
|
+
})(Math);
|
|
63513
|
+
return CryptoJS.MD5;
|
|
63514
|
+
});
|
|
63515
|
+
});
|
|
63040
63516
|
var require_constants = __commonJS2((exports, module) => {
|
|
63041
63517
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
63042
63518
|
var hasBlob = typeof Blob !== "undefined";
|
|
@@ -63044,6 +63520,7 @@ var require_constants = __commonJS2((exports, module) => {
|
|
|
63044
63520
|
BINARY_TYPES.push("blob");
|
|
63045
63521
|
module.exports = {
|
|
63046
63522
|
BINARY_TYPES,
|
|
63523
|
+
CLOSE_TIMEOUT: 30000,
|
|
63047
63524
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
63048
63525
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
63049
63526
|
hasBlob,
|
|
@@ -63379,14 +63856,14 @@ var require_permessage_deflate = __commonJS2((exports, module) => {
|
|
|
63379
63856
|
}
|
|
63380
63857
|
}
|
|
63381
63858
|
module.exports = PerMessageDeflate;
|
|
63382
|
-
function deflateOnData(
|
|
63383
|
-
this[kBuffers].push(
|
|
63384
|
-
this[kTotalLength] +=
|
|
63859
|
+
function deflateOnData(chunk2) {
|
|
63860
|
+
this[kBuffers].push(chunk2);
|
|
63861
|
+
this[kTotalLength] += chunk2.length;
|
|
63385
63862
|
}
|
|
63386
|
-
function inflateOnData(
|
|
63387
|
-
this[kTotalLength] +=
|
|
63863
|
+
function inflateOnData(chunk2) {
|
|
63864
|
+
this[kTotalLength] += chunk2.length;
|
|
63388
63865
|
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
63389
|
-
this[kBuffers].push(
|
|
63866
|
+
this[kBuffers].push(chunk2);
|
|
63390
63867
|
return;
|
|
63391
63868
|
}
|
|
63392
63869
|
this[kError] = new RangeError("Max payload size exceeded");
|
|
@@ -63397,6 +63874,10 @@ var require_permessage_deflate = __commonJS2((exports, module) => {
|
|
|
63397
63874
|
}
|
|
63398
63875
|
function inflateOnError(err) {
|
|
63399
63876
|
this[kPerMessageDeflate]._inflate = null;
|
|
63877
|
+
if (this[kError]) {
|
|
63878
|
+
this[kCallback](this[kError]);
|
|
63879
|
+
return;
|
|
63880
|
+
}
|
|
63400
63881
|
err[kStatusCode] = 1007;
|
|
63401
63882
|
this[kCallback](err);
|
|
63402
63883
|
}
|
|
@@ -63564,11 +64045,11 @@ var require_validation = __commonJS2((exports, module) => {
|
|
|
63564
64045
|
}
|
|
63565
64046
|
return true;
|
|
63566
64047
|
}
|
|
63567
|
-
function
|
|
64048
|
+
function isBlob2(value) {
|
|
63568
64049
|
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");
|
|
63569
64050
|
}
|
|
63570
64051
|
module.exports = {
|
|
63571
|
-
isBlob,
|
|
64052
|
+
isBlob: isBlob2,
|
|
63572
64053
|
isValidStatusCode,
|
|
63573
64054
|
isValidUTF8: _isValidUTF8,
|
|
63574
64055
|
tokenChars
|
|
@@ -63625,11 +64106,11 @@ var require_receiver = __commonJS2((exports, module) => {
|
|
|
63625
64106
|
this._loop = false;
|
|
63626
64107
|
this._state = GET_INFO;
|
|
63627
64108
|
}
|
|
63628
|
-
_write(
|
|
64109
|
+
_write(chunk2, encoding, cb) {
|
|
63629
64110
|
if (this._opcode === 8 && this._state == GET_INFO)
|
|
63630
64111
|
return cb();
|
|
63631
|
-
this._bufferedBytes +=
|
|
63632
|
-
this._buffers.push(
|
|
64112
|
+
this._bufferedBytes += chunk2.length;
|
|
64113
|
+
this._buffers.push(chunk2);
|
|
63633
64114
|
this.startLoop(cb);
|
|
63634
64115
|
}
|
|
63635
64116
|
consume(n) {
|
|
@@ -63963,7 +64444,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
63963
64444
|
var { randomFillSync } = __require2("crypto");
|
|
63964
64445
|
var PerMessageDeflate = require_permessage_deflate();
|
|
63965
64446
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
63966
|
-
var { isBlob, isValidStatusCode } = require_validation();
|
|
64447
|
+
var { isBlob: isBlob2, isValidStatusCode } = require_validation();
|
|
63967
64448
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
63968
64449
|
var kByteLength = Symbol("kByteLength");
|
|
63969
64450
|
var maskBuffer = Buffer.alloc(4);
|
|
@@ -64106,7 +64587,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64106
64587
|
if (typeof data === "string") {
|
|
64107
64588
|
byteLength = Buffer.byteLength(data);
|
|
64108
64589
|
readOnly = false;
|
|
64109
|
-
} else if (
|
|
64590
|
+
} else if (isBlob2(data)) {
|
|
64110
64591
|
byteLength = data.size;
|
|
64111
64592
|
readOnly = false;
|
|
64112
64593
|
} else {
|
|
@@ -64127,7 +64608,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64127
64608
|
readOnly,
|
|
64128
64609
|
rsv1: false
|
|
64129
64610
|
};
|
|
64130
|
-
if (
|
|
64611
|
+
if (isBlob2(data)) {
|
|
64131
64612
|
if (this._state !== DEFAULT) {
|
|
64132
64613
|
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
64133
64614
|
} else {
|
|
@@ -64145,7 +64626,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64145
64626
|
if (typeof data === "string") {
|
|
64146
64627
|
byteLength = Buffer.byteLength(data);
|
|
64147
64628
|
readOnly = false;
|
|
64148
|
-
} else if (
|
|
64629
|
+
} else if (isBlob2(data)) {
|
|
64149
64630
|
byteLength = data.size;
|
|
64150
64631
|
readOnly = false;
|
|
64151
64632
|
} else {
|
|
@@ -64166,7 +64647,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64166
64647
|
readOnly,
|
|
64167
64648
|
rsv1: false
|
|
64168
64649
|
};
|
|
64169
|
-
if (
|
|
64650
|
+
if (isBlob2(data)) {
|
|
64170
64651
|
if (this._state !== DEFAULT) {
|
|
64171
64652
|
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
64172
64653
|
} else {
|
|
@@ -64187,7 +64668,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64187
64668
|
if (typeof data === "string") {
|
|
64188
64669
|
byteLength = Buffer.byteLength(data);
|
|
64189
64670
|
readOnly = false;
|
|
64190
|
-
} else if (
|
|
64671
|
+
} else if (isBlob2(data)) {
|
|
64191
64672
|
byteLength = data.size;
|
|
64192
64673
|
readOnly = false;
|
|
64193
64674
|
} else {
|
|
@@ -64217,7 +64698,7 @@ var require_sender = __commonJS2((exports, module) => {
|
|
|
64217
64698
|
readOnly,
|
|
64218
64699
|
rsv1
|
|
64219
64700
|
};
|
|
64220
|
-
if (
|
|
64701
|
+
if (isBlob2(data)) {
|
|
64221
64702
|
if (this._state !== DEFAULT) {
|
|
64222
64703
|
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
64223
64704
|
} else {
|
|
@@ -64634,9 +65115,10 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64634
65115
|
var PerMessageDeflate = require_permessage_deflate();
|
|
64635
65116
|
var Receiver = require_receiver();
|
|
64636
65117
|
var Sender = require_sender();
|
|
64637
|
-
var { isBlob } = require_validation();
|
|
65118
|
+
var { isBlob: isBlob2 } = require_validation();
|
|
64638
65119
|
var {
|
|
64639
65120
|
BINARY_TYPES,
|
|
65121
|
+
CLOSE_TIMEOUT,
|
|
64640
65122
|
EMPTY_BUFFER,
|
|
64641
65123
|
GUID,
|
|
64642
65124
|
kForOnEventAttribute,
|
|
@@ -64650,7 +65132,6 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64650
65132
|
} = require_event_target();
|
|
64651
65133
|
var { format, parse: parse5 } = require_extension();
|
|
64652
65134
|
var { toBuffer } = require_buffer_util();
|
|
64653
|
-
var closeTimeout = 30 * 1000;
|
|
64654
65135
|
var kAborted = Symbol("kAborted");
|
|
64655
65136
|
var protocolVersions = [8, 13];
|
|
64656
65137
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
@@ -64690,6 +65171,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64690
65171
|
initAsClient(this, address, protocols, options);
|
|
64691
65172
|
} else {
|
|
64692
65173
|
this._autoPong = options.autoPong;
|
|
65174
|
+
this._closeTimeout = options.closeTimeout;
|
|
64693
65175
|
this._isServer = true;
|
|
64694
65176
|
}
|
|
64695
65177
|
}
|
|
@@ -64735,7 +65217,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64735
65217
|
get url() {
|
|
64736
65218
|
return this._url;
|
|
64737
65219
|
}
|
|
64738
|
-
setSocket(socket,
|
|
65220
|
+
setSocket(socket, head2, options) {
|
|
64739
65221
|
const receiver = new Receiver({
|
|
64740
65222
|
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
64741
65223
|
binaryType: this.binaryType,
|
|
@@ -64762,8 +65244,8 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64762
65244
|
socket.setTimeout(0);
|
|
64763
65245
|
if (socket.setNoDelay)
|
|
64764
65246
|
socket.setNoDelay();
|
|
64765
|
-
if (
|
|
64766
|
-
socket.unshift(
|
|
65247
|
+
if (head2.length > 0)
|
|
65248
|
+
socket.unshift(head2);
|
|
64767
65249
|
socket.on("close", socketOnClose);
|
|
64768
65250
|
socket.on("data", socketOnData);
|
|
64769
65251
|
socket.on("end", socketOnEnd);
|
|
@@ -64981,6 +65463,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64981
65463
|
const opts = {
|
|
64982
65464
|
allowSynchronousEvents: true,
|
|
64983
65465
|
autoPong: true,
|
|
65466
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
64984
65467
|
protocolVersion: protocolVersions[1],
|
|
64985
65468
|
maxPayload: 100 * 1024 * 1024,
|
|
64986
65469
|
skipUTF8Validation: false,
|
|
@@ -64998,6 +65481,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
64998
65481
|
port: undefined
|
|
64999
65482
|
};
|
|
65000
65483
|
websocket._autoPong = opts.autoPong;
|
|
65484
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
65001
65485
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
65002
65486
|
throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} ` + `(supported versions: ${protocolVersions.join(", ")})`);
|
|
65003
65487
|
}
|
|
@@ -65150,7 +65634,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65150
65634
|
abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
65151
65635
|
}
|
|
65152
65636
|
});
|
|
65153
|
-
req.on("upgrade", (res, socket,
|
|
65637
|
+
req.on("upgrade", (res, socket, head2) => {
|
|
65154
65638
|
websocket.emit("upgrade", res);
|
|
65155
65639
|
if (websocket.readyState !== WebSocket2.CONNECTING)
|
|
65156
65640
|
return;
|
|
@@ -65212,7 +65696,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65212
65696
|
}
|
|
65213
65697
|
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
65214
65698
|
}
|
|
65215
|
-
websocket.setSocket(socket,
|
|
65699
|
+
websocket.setSocket(socket, head2, {
|
|
65216
65700
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
65217
65701
|
generateMask: opts.generateMask,
|
|
65218
65702
|
maxPayload: opts.maxPayload,
|
|
@@ -65261,7 +65745,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65261
65745
|
}
|
|
65262
65746
|
function sendAfterClose(websocket, data, cb) {
|
|
65263
65747
|
if (data) {
|
|
65264
|
-
const length =
|
|
65748
|
+
const length = isBlob2(data) ? data.size : toBuffer(data).length;
|
|
65265
65749
|
if (websocket._socket)
|
|
65266
65750
|
websocket._sender._bufferedBytes += length;
|
|
65267
65751
|
else
|
|
@@ -65336,7 +65820,7 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65336
65820
|
}
|
|
65337
65821
|
}
|
|
65338
65822
|
function setCloseTimer(websocket) {
|
|
65339
|
-
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket),
|
|
65823
|
+
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
65340
65824
|
}
|
|
65341
65825
|
function socketOnClose() {
|
|
65342
65826
|
const websocket = this[kWebSocket];
|
|
@@ -65344,9 +65828,9 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65344
65828
|
this.removeListener("data", socketOnData);
|
|
65345
65829
|
this.removeListener("end", socketOnEnd);
|
|
65346
65830
|
websocket._readyState = WebSocket2.CLOSING;
|
|
65347
|
-
|
|
65348
|
-
|
|
65349
|
-
websocket._receiver.write(
|
|
65831
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
65832
|
+
const chunk2 = this.read(this._readableState.length);
|
|
65833
|
+
websocket._receiver.write(chunk2);
|
|
65350
65834
|
}
|
|
65351
65835
|
websocket._receiver.end();
|
|
65352
65836
|
this[kWebSocket] = undefined;
|
|
@@ -65358,8 +65842,8 @@ var require_websocket = __commonJS2((exports, module) => {
|
|
|
65358
65842
|
websocket._receiver.on("finish", receiverOnFinish);
|
|
65359
65843
|
}
|
|
65360
65844
|
}
|
|
65361
|
-
function socketOnData(
|
|
65362
|
-
if (!this[kWebSocket]._receiver.write(
|
|
65845
|
+
function socketOnData(chunk2) {
|
|
65846
|
+
if (!this[kWebSocket]._receiver.write(chunk2)) {
|
|
65363
65847
|
this.pause();
|
|
65364
65848
|
}
|
|
65365
65849
|
}
|
|
@@ -65465,14 +65949,14 @@ var require_stream = __commonJS2((exports, module) => {
|
|
|
65465
65949
|
if (ws.isPaused)
|
|
65466
65950
|
ws.resume();
|
|
65467
65951
|
};
|
|
65468
|
-
duplex._write = function(
|
|
65952
|
+
duplex._write = function(chunk2, encoding, callback) {
|
|
65469
65953
|
if (ws.readyState === ws.CONNECTING) {
|
|
65470
65954
|
ws.once("open", function open() {
|
|
65471
|
-
duplex._write(
|
|
65955
|
+
duplex._write(chunk2, encoding, callback);
|
|
65472
65956
|
});
|
|
65473
65957
|
return;
|
|
65474
65958
|
}
|
|
65475
|
-
ws.send(
|
|
65959
|
+
ws.send(chunk2, callback);
|
|
65476
65960
|
};
|
|
65477
65961
|
duplex.on("end", duplexOnEnd);
|
|
65478
65962
|
duplex.on("error", duplexOnError);
|
|
@@ -65532,7 +66016,7 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65532
66016
|
var PerMessageDeflate = require_permessage_deflate();
|
|
65533
66017
|
var subprotocol = require_subprotocol();
|
|
65534
66018
|
var WebSocket2 = require_websocket();
|
|
65535
|
-
var { GUID, kWebSocket } = require_constants();
|
|
66019
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
|
|
65536
66020
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
65537
66021
|
var RUNNING = 0;
|
|
65538
66022
|
var CLOSING = 1;
|
|
@@ -65549,6 +66033,7 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65549
66033
|
perMessageDeflate: false,
|
|
65550
66034
|
handleProtocols: null,
|
|
65551
66035
|
clientTracking: true,
|
|
66036
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
65552
66037
|
verifyClient: null,
|
|
65553
66038
|
noServer: false,
|
|
65554
66039
|
backlog: null,
|
|
@@ -65580,8 +66065,8 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65580
66065
|
this._removeListeners = addListeners(this._server, {
|
|
65581
66066
|
listening: this.emit.bind(this, "listening"),
|
|
65582
66067
|
error: this.emit.bind(this, "error"),
|
|
65583
|
-
upgrade: (req, socket,
|
|
65584
|
-
this.handleUpgrade(req, socket,
|
|
66068
|
+
upgrade: (req, socket, head2) => {
|
|
66069
|
+
this.handleUpgrade(req, socket, head2, emitConnection);
|
|
65585
66070
|
}
|
|
65586
66071
|
});
|
|
65587
66072
|
}
|
|
@@ -65649,7 +66134,7 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65649
66134
|
}
|
|
65650
66135
|
return true;
|
|
65651
66136
|
}
|
|
65652
|
-
handleUpgrade(req, socket,
|
|
66137
|
+
handleUpgrade(req, socket, head2, cb) {
|
|
65653
66138
|
socket.on("error", socketOnError);
|
|
65654
66139
|
const key = req.headers["sec-websocket-key"];
|
|
65655
66140
|
const upgrade = req.headers.upgrade;
|
|
@@ -65669,9 +66154,11 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65669
66154
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
65670
66155
|
return;
|
|
65671
66156
|
}
|
|
65672
|
-
if (version2 !==
|
|
66157
|
+
if (version2 !== 13 && version2 !== 8) {
|
|
65673
66158
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
65674
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
66159
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
66160
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
66161
|
+
});
|
|
65675
66162
|
return;
|
|
65676
66163
|
}
|
|
65677
66164
|
if (!this.shouldHandle(req)) {
|
|
@@ -65716,16 +66203,16 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65716
66203
|
if (!verified) {
|
|
65717
66204
|
return abortHandshake(socket, code || 401, message, headers);
|
|
65718
66205
|
}
|
|
65719
|
-
this.completeUpgrade(extensions, key, protocols, req, socket,
|
|
66206
|
+
this.completeUpgrade(extensions, key, protocols, req, socket, head2, cb);
|
|
65720
66207
|
});
|
|
65721
66208
|
return;
|
|
65722
66209
|
}
|
|
65723
66210
|
if (!this.options.verifyClient(info))
|
|
65724
66211
|
return abortHandshake(socket, 401);
|
|
65725
66212
|
}
|
|
65726
|
-
this.completeUpgrade(extensions, key, protocols, req, socket,
|
|
66213
|
+
this.completeUpgrade(extensions, key, protocols, req, socket, head2, cb);
|
|
65727
66214
|
}
|
|
65728
|
-
completeUpgrade(extensions, key, protocols, req, socket,
|
|
66215
|
+
completeUpgrade(extensions, key, protocols, req, socket, head2, cb) {
|
|
65729
66216
|
if (!socket.readable || !socket.writable)
|
|
65730
66217
|
return socket.destroy();
|
|
65731
66218
|
if (socket[kWebSocket]) {
|
|
@@ -65761,7 +66248,7 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65761
66248
|
`).join(`\r
|
|
65762
66249
|
`));
|
|
65763
66250
|
socket.removeListener("error", socketOnError);
|
|
65764
|
-
ws.setSocket(socket,
|
|
66251
|
+
ws.setSocket(socket, head2, {
|
|
65765
66252
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
65766
66253
|
maxPayload: this.options.maxPayload,
|
|
65767
66254
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
@@ -65810,13 +66297,13 @@ var require_websocket_server = __commonJS2((exports, module) => {
|
|
|
65810
66297
|
\r
|
|
65811
66298
|
` + message);
|
|
65812
66299
|
}
|
|
65813
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
66300
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
65814
66301
|
if (server.listenerCount("wsClientError")) {
|
|
65815
66302
|
const err = new Error(message);
|
|
65816
66303
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
65817
66304
|
server.emit("wsClientError", err, socket, req);
|
|
65818
66305
|
} else {
|
|
65819
|
-
abortHandshake(socket, code, message);
|
|
66306
|
+
abortHandshake(socket, code, message, headers);
|
|
65820
66307
|
}
|
|
65821
66308
|
}
|
|
65822
66309
|
});
|
|
@@ -65892,6 +66379,9 @@ function pick(obj, keys) {
|
|
|
65892
66379
|
return result;
|
|
65893
66380
|
}
|
|
65894
66381
|
var import__ = __toESM2(require_eventemitter3(), 1);
|
|
66382
|
+
function isUnsafeProperty(key) {
|
|
66383
|
+
return key === "__proto__";
|
|
66384
|
+
}
|
|
65895
66385
|
function isPlainObject(value) {
|
|
65896
66386
|
if (!value || typeof value !== "object") {
|
|
65897
66387
|
return false;
|
|
@@ -65903,9 +66393,6 @@ function isPlainObject(value) {
|
|
|
65903
66393
|
}
|
|
65904
66394
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
65905
66395
|
}
|
|
65906
|
-
function isUnsafeProperty(key) {
|
|
65907
|
-
return key === "__proto__";
|
|
65908
|
-
}
|
|
65909
66396
|
function merge(target, source) {
|
|
65910
66397
|
const sourceKeys = Object.keys(source);
|
|
65911
66398
|
for (let i = 0;i < sourceKeys.length; i++) {
|
|
@@ -65936,8 +66423,8 @@ class MockProcess {
|
|
|
65936
66423
|
process;
|
|
65937
66424
|
constructor(opts) {
|
|
65938
66425
|
this.emitter = opts?.emitter || new import__.default;
|
|
65939
|
-
const
|
|
65940
|
-
if (
|
|
66426
|
+
const isNode2 = opts?.isNode ?? true;
|
|
66427
|
+
if (isNode2) {
|
|
65941
66428
|
this.process = globalThis?.process;
|
|
65942
66429
|
}
|
|
65943
66430
|
}
|
|
@@ -65968,7 +66455,7 @@ class MockProcess {
|
|
|
65968
66455
|
this.process = undefined;
|
|
65969
66456
|
}
|
|
65970
66457
|
}
|
|
65971
|
-
var listenProcess = async ({ app, mockProcess, params = {}, timeout = 10 * 60 * 60 * 1000 }) => {
|
|
66458
|
+
var listenProcess = async ({ app, mockProcess, params = {}, timeout: timeout2 = 10 * 60 * 60 * 1000 }) => {
|
|
65972
66459
|
const process2 = mockProcess || new MockProcess;
|
|
65973
66460
|
let isEnd = false;
|
|
65974
66461
|
const timer = setTimeout(() => {
|
|
@@ -65978,7 +66465,7 @@ var listenProcess = async ({ app, mockProcess, params = {}, timeout = 10 * 60 *
|
|
|
65978
66465
|
process2.send?.({ success: false, error: "Timeout" }, () => {
|
|
65979
66466
|
process2.exit?.(1);
|
|
65980
66467
|
});
|
|
65981
|
-
},
|
|
66468
|
+
}, timeout2);
|
|
65982
66469
|
const getParams = async () => {
|
|
65983
66470
|
return new Promise((resolve) => {
|
|
65984
66471
|
process2.on((params2) => {
|
|
@@ -66020,7 +66507,7 @@ var listenProcess = async ({ app, mockProcess, params = {}, timeout = 10 * 60 *
|
|
|
66020
66507
|
};
|
|
66021
66508
|
var exports_external = {};
|
|
66022
66509
|
__export2(exports_external, {
|
|
66023
|
-
xor: () =>
|
|
66510
|
+
xor: () => xor2,
|
|
66024
66511
|
xid: () => xid2,
|
|
66025
66512
|
void: () => _void2,
|
|
66026
66513
|
uuidv7: () => uuidv7,
|
|
@@ -66031,7 +66518,7 @@ __export2(exports_external, {
|
|
|
66031
66518
|
url: () => url,
|
|
66032
66519
|
uppercase: () => _uppercase,
|
|
66033
66520
|
unknown: () => unknown,
|
|
66034
|
-
union: () =>
|
|
66521
|
+
union: () => union2,
|
|
66035
66522
|
undefined: () => _undefined3,
|
|
66036
66523
|
ulid: () => ulid2,
|
|
66037
66524
|
uint64: () => uint64,
|
|
@@ -66119,7 +66606,7 @@ __export2(exports_external, {
|
|
|
66119
66606
|
iso: () => exports_iso,
|
|
66120
66607
|
ipv6: () => ipv62,
|
|
66121
66608
|
ipv4: () => ipv42,
|
|
66122
|
-
intersection: () =>
|
|
66609
|
+
intersection: () => intersection2,
|
|
66123
66610
|
int64: () => int64,
|
|
66124
66611
|
int32: () => int32,
|
|
66125
66612
|
int: () => int,
|
|
@@ -66161,7 +66648,7 @@ __export2(exports_external, {
|
|
|
66161
66648
|
config: () => config,
|
|
66162
66649
|
coerce: () => exports_coerce,
|
|
66163
66650
|
codec: () => codec,
|
|
66164
|
-
clone: () =>
|
|
66651
|
+
clone: () => clone2,
|
|
66165
66652
|
cidrv6: () => cidrv62,
|
|
66166
66653
|
cidrv4: () => cidrv42,
|
|
66167
66654
|
check: () => check,
|
|
@@ -66296,7 +66783,7 @@ __export2(exports_core2, {
|
|
|
66296
66783
|
createToJSONSchemaMethod: () => createToJSONSchemaMethod,
|
|
66297
66784
|
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
|
|
66298
66785
|
config: () => config,
|
|
66299
|
-
clone: () =>
|
|
66786
|
+
clone: () => clone2,
|
|
66300
66787
|
_xor: () => _xor,
|
|
66301
66788
|
_xid: () => _xid,
|
|
66302
66789
|
_void: () => _void,
|
|
@@ -66624,11 +67111,11 @@ __export2(exports_util, {
|
|
|
66624
67111
|
promiseAllObject: () => promiseAllObject,
|
|
66625
67112
|
primitiveTypes: () => primitiveTypes,
|
|
66626
67113
|
prefixIssues: () => prefixIssues,
|
|
66627
|
-
pick: () =>
|
|
66628
|
-
partial: () =>
|
|
67114
|
+
pick: () => pick3,
|
|
67115
|
+
partial: () => partial2,
|
|
66629
67116
|
parsedType: () => parsedType,
|
|
66630
67117
|
optionalKeys: () => optionalKeys,
|
|
66631
|
-
omit: () =>
|
|
67118
|
+
omit: () => omit2,
|
|
66632
67119
|
objectClone: () => objectClone,
|
|
66633
67120
|
numKeys: () => numKeys,
|
|
66634
67121
|
nullish: () => nullish,
|
|
@@ -66638,7 +67125,7 @@ __export2(exports_util, {
|
|
|
66638
67125
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
66639
67126
|
joinValues: () => joinValues,
|
|
66640
67127
|
issue: () => issue,
|
|
66641
|
-
isPlainObject: () =>
|
|
67128
|
+
isPlainObject: () => isPlainObject3,
|
|
66642
67129
|
isObject: () => isObject,
|
|
66643
67130
|
hexToUint8Array: () => hexToUint8Array,
|
|
66644
67131
|
getSizableOrigin: () => getSizableOrigin,
|
|
@@ -66654,7 +67141,7 @@ __export2(exports_util, {
|
|
|
66654
67141
|
defineLazy: () => defineLazy,
|
|
66655
67142
|
createTransparentProxy: () => createTransparentProxy,
|
|
66656
67143
|
cloneDef: () => cloneDef,
|
|
66657
|
-
clone: () =>
|
|
67144
|
+
clone: () => clone2,
|
|
66658
67145
|
cleanRegex: () => cleanRegex,
|
|
66659
67146
|
cleanEnum: () => cleanEnum,
|
|
66660
67147
|
captureStackTrace: () => captureStackTrace,
|
|
@@ -66823,7 +67310,7 @@ var allowsEval = cached(() => {
|
|
|
66823
67310
|
return false;
|
|
66824
67311
|
}
|
|
66825
67312
|
});
|
|
66826
|
-
function
|
|
67313
|
+
function isPlainObject3(o) {
|
|
66827
67314
|
if (isObject(o) === false)
|
|
66828
67315
|
return false;
|
|
66829
67316
|
const ctor = o.constructor;
|
|
@@ -66840,7 +67327,7 @@ function isPlainObject2(o) {
|
|
|
66840
67327
|
return true;
|
|
66841
67328
|
}
|
|
66842
67329
|
function shallowClone(o) {
|
|
66843
|
-
if (
|
|
67330
|
+
if (isPlainObject3(o))
|
|
66844
67331
|
return { ...o };
|
|
66845
67332
|
if (Array.isArray(o))
|
|
66846
67333
|
return [...o];
|
|
@@ -66904,7 +67391,7 @@ var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol",
|
|
|
66904
67391
|
function escapeRegex(str) {
|
|
66905
67392
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
66906
67393
|
}
|
|
66907
|
-
function
|
|
67394
|
+
function clone2(inst, def, params) {
|
|
66908
67395
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
66909
67396
|
if (!def || params?.parent)
|
|
66910
67397
|
cl._zod.parent = inst;
|
|
@@ -66982,7 +67469,7 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
66982
67469
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
66983
67470
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
66984
67471
|
};
|
|
66985
|
-
function
|
|
67472
|
+
function pick3(schema, mask) {
|
|
66986
67473
|
const currDef = schema._zod.def;
|
|
66987
67474
|
const checks = currDef.checks;
|
|
66988
67475
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -67005,9 +67492,9 @@ function pick2(schema, mask) {
|
|
|
67005
67492
|
},
|
|
67006
67493
|
checks: []
|
|
67007
67494
|
});
|
|
67008
|
-
return
|
|
67495
|
+
return clone2(schema, def);
|
|
67009
67496
|
}
|
|
67010
|
-
function
|
|
67497
|
+
function omit2(schema, mask) {
|
|
67011
67498
|
const currDef = schema._zod.def;
|
|
67012
67499
|
const checks = currDef.checks;
|
|
67013
67500
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -67030,10 +67517,10 @@ function omit(schema, mask) {
|
|
|
67030
67517
|
},
|
|
67031
67518
|
checks: []
|
|
67032
67519
|
});
|
|
67033
|
-
return
|
|
67520
|
+
return clone2(schema, def);
|
|
67034
67521
|
}
|
|
67035
67522
|
function extend(schema, shape) {
|
|
67036
|
-
if (!
|
|
67523
|
+
if (!isPlainObject3(shape)) {
|
|
67037
67524
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
67038
67525
|
}
|
|
67039
67526
|
const checks = schema._zod.def.checks;
|
|
@@ -67053,10 +67540,10 @@ function extend(schema, shape) {
|
|
|
67053
67540
|
return _shape;
|
|
67054
67541
|
}
|
|
67055
67542
|
});
|
|
67056
|
-
return
|
|
67543
|
+
return clone2(schema, def);
|
|
67057
67544
|
}
|
|
67058
67545
|
function safeExtend(schema, shape) {
|
|
67059
|
-
if (!
|
|
67546
|
+
if (!isPlainObject3(shape)) {
|
|
67060
67547
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
67061
67548
|
}
|
|
67062
67549
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -67066,7 +67553,7 @@ function safeExtend(schema, shape) {
|
|
|
67066
67553
|
return _shape;
|
|
67067
67554
|
}
|
|
67068
67555
|
});
|
|
67069
|
-
return
|
|
67556
|
+
return clone2(schema, def);
|
|
67070
67557
|
}
|
|
67071
67558
|
function merge2(a, b) {
|
|
67072
67559
|
const def = mergeDefs(a._zod.def, {
|
|
@@ -67080,9 +67567,9 @@ function merge2(a, b) {
|
|
|
67080
67567
|
},
|
|
67081
67568
|
checks: []
|
|
67082
67569
|
});
|
|
67083
|
-
return
|
|
67570
|
+
return clone2(a, def);
|
|
67084
67571
|
}
|
|
67085
|
-
function
|
|
67572
|
+
function partial2(Class, schema, mask) {
|
|
67086
67573
|
const currDef = schema._zod.def;
|
|
67087
67574
|
const checks = currDef.checks;
|
|
67088
67575
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -67118,7 +67605,7 @@ function partial(Class, schema, mask) {
|
|
|
67118
67605
|
},
|
|
67119
67606
|
checks: []
|
|
67120
67607
|
});
|
|
67121
|
-
return
|
|
67608
|
+
return clone2(schema, def);
|
|
67122
67609
|
}
|
|
67123
67610
|
function required(Class, schema, mask) {
|
|
67124
67611
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -67149,7 +67636,7 @@ function required(Class, schema, mask) {
|
|
|
67149
67636
|
return shape;
|
|
67150
67637
|
}
|
|
67151
67638
|
});
|
|
67152
|
-
return
|
|
67639
|
+
return clone2(schema, def);
|
|
67153
67640
|
}
|
|
67154
67641
|
function aborted(x, startIndex = 0) {
|
|
67155
67642
|
if (x.aborted === true)
|
|
@@ -68826,15 +69313,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
68826
69313
|
} catch (_err) {}
|
|
68827
69314
|
}
|
|
68828
69315
|
const input = payload.value;
|
|
68829
|
-
const
|
|
68830
|
-
const isValidDate =
|
|
69316
|
+
const isDate2 = input instanceof Date;
|
|
69317
|
+
const isValidDate = isDate2 && !Number.isNaN(input.getTime());
|
|
68831
69318
|
if (isValidDate)
|
|
68832
69319
|
return payload;
|
|
68833
69320
|
payload.issues.push({
|
|
68834
69321
|
expected: "date",
|
|
68835
69322
|
code: "invalid_type",
|
|
68836
69323
|
input,
|
|
68837
|
-
...
|
|
69324
|
+
...isDate2 ? { received: "Invalid Date" } : {},
|
|
68838
69325
|
inst
|
|
68839
69326
|
});
|
|
68840
69327
|
return payload;
|
|
@@ -69314,7 +69801,7 @@ function mergeValues(a, b) {
|
|
|
69314
69801
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
69315
69802
|
return { valid: true, data: a };
|
|
69316
69803
|
}
|
|
69317
|
-
if (
|
|
69804
|
+
if (isPlainObject3(a) && isPlainObject3(b)) {
|
|
69318
69805
|
const bKeys = Object.keys(b);
|
|
69319
69806
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
69320
69807
|
const newObj = { ...a, ...b };
|
|
@@ -69439,8 +69926,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
69439
69926
|
}
|
|
69440
69927
|
}
|
|
69441
69928
|
if (def.rest) {
|
|
69442
|
-
const
|
|
69443
|
-
for (const el of
|
|
69929
|
+
const rest2 = input.slice(items.length);
|
|
69930
|
+
for (const el of rest2) {
|
|
69444
69931
|
i++;
|
|
69445
69932
|
const result = def.rest._zod.run({
|
|
69446
69933
|
value: el,
|
|
@@ -69468,7 +69955,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
69468
69955
|
$ZodType.init(inst, def);
|
|
69469
69956
|
inst._zod.parse = (payload, ctx) => {
|
|
69470
69957
|
const input = payload.value;
|
|
69471
|
-
if (!
|
|
69958
|
+
if (!isPlainObject3(input)) {
|
|
69472
69959
|
payload.issues.push({
|
|
69473
69960
|
expected: "record",
|
|
69474
69961
|
code: "invalid_type",
|
|
@@ -73166,11 +73653,11 @@ var capitalizeFirstCharacter = (text) => {
|
|
|
73166
73653
|
};
|
|
73167
73654
|
function getUnitTypeFromNumber(number2) {
|
|
73168
73655
|
const abs = Math.abs(number2);
|
|
73169
|
-
const
|
|
73170
|
-
const
|
|
73171
|
-
if (
|
|
73656
|
+
const last2 = abs % 10;
|
|
73657
|
+
const last22 = abs % 100;
|
|
73658
|
+
if (last22 >= 11 && last22 <= 19 || last2 === 0)
|
|
73172
73659
|
return "many";
|
|
73173
|
-
if (
|
|
73660
|
+
if (last2 === 1)
|
|
73174
73661
|
return "one";
|
|
73175
73662
|
return "few";
|
|
73176
73663
|
}
|
|
@@ -76371,11 +76858,11 @@ function _intersection(Class2, left, right) {
|
|
|
76371
76858
|
function _tuple(Class2, items, _paramsOrRest, _params) {
|
|
76372
76859
|
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
76373
76860
|
const params = hasRest ? _params : _paramsOrRest;
|
|
76374
|
-
const
|
|
76861
|
+
const rest2 = hasRest ? _paramsOrRest : null;
|
|
76375
76862
|
return new Class2({
|
|
76376
76863
|
type: "tuple",
|
|
76377
76864
|
items,
|
|
76378
|
-
rest,
|
|
76865
|
+
rest: rest2,
|
|
76379
76866
|
...normalizeParams(params)
|
|
76380
76867
|
});
|
|
76381
76868
|
}
|
|
@@ -77313,30 +77800,30 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
77313
77800
|
...params,
|
|
77314
77801
|
path: [...params.path, prefixPath, i]
|
|
77315
77802
|
}));
|
|
77316
|
-
const
|
|
77803
|
+
const rest2 = def.rest ? process2(def.rest, ctx, {
|
|
77317
77804
|
...params,
|
|
77318
77805
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
77319
77806
|
}) : null;
|
|
77320
77807
|
if (ctx.target === "draft-2020-12") {
|
|
77321
77808
|
json.prefixItems = prefixItems;
|
|
77322
|
-
if (
|
|
77323
|
-
json.items =
|
|
77809
|
+
if (rest2) {
|
|
77810
|
+
json.items = rest2;
|
|
77324
77811
|
}
|
|
77325
77812
|
} else if (ctx.target === "openapi-3.0") {
|
|
77326
77813
|
json.items = {
|
|
77327
77814
|
anyOf: prefixItems
|
|
77328
77815
|
};
|
|
77329
|
-
if (
|
|
77330
|
-
json.items.anyOf.push(
|
|
77816
|
+
if (rest2) {
|
|
77817
|
+
json.items.anyOf.push(rest2);
|
|
77331
77818
|
}
|
|
77332
77819
|
json.minItems = prefixItems.length;
|
|
77333
|
-
if (!
|
|
77820
|
+
if (!rest2) {
|
|
77334
77821
|
json.maxItems = prefixItems.length;
|
|
77335
77822
|
}
|
|
77336
77823
|
} else {
|
|
77337
77824
|
json.items = prefixItems;
|
|
77338
|
-
if (
|
|
77339
|
-
json.additionalItems =
|
|
77825
|
+
if (rest2) {
|
|
77826
|
+
json.additionalItems = rest2;
|
|
77340
77827
|
}
|
|
77341
77828
|
}
|
|
77342
77829
|
const { minimum, maximum } = schema._zod.bag;
|
|
@@ -77595,7 +78082,7 @@ class JSONSchemaGenerator {
|
|
|
77595
78082
|
var exports_json_schema = {};
|
|
77596
78083
|
var exports_schemas2 = {};
|
|
77597
78084
|
__export2(exports_schemas2, {
|
|
77598
|
-
xor: () =>
|
|
78085
|
+
xor: () => xor2,
|
|
77599
78086
|
xid: () => xid2,
|
|
77600
78087
|
void: () => _void2,
|
|
77601
78088
|
uuidv7: () => uuidv7,
|
|
@@ -77604,7 +78091,7 @@ __export2(exports_schemas2, {
|
|
|
77604
78091
|
uuid: () => uuid2,
|
|
77605
78092
|
url: () => url,
|
|
77606
78093
|
unknown: () => unknown,
|
|
77607
|
-
union: () =>
|
|
78094
|
+
union: () => union2,
|
|
77608
78095
|
undefined: () => _undefined3,
|
|
77609
78096
|
ulid: () => ulid2,
|
|
77610
78097
|
uint64: () => uint64,
|
|
@@ -77652,7 +78139,7 @@ __export2(exports_schemas2, {
|
|
|
77652
78139
|
json: () => json,
|
|
77653
78140
|
ipv6: () => ipv62,
|
|
77654
78141
|
ipv4: () => ipv42,
|
|
77655
|
-
intersection: () =>
|
|
78142
|
+
intersection: () => intersection2,
|
|
77656
78143
|
int64: () => int64,
|
|
77657
78144
|
int32: () => int32,
|
|
77658
78145
|
int: () => int,
|
|
@@ -77899,7 +78386,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
77899
78386
|
});
|
|
77900
78387
|
};
|
|
77901
78388
|
inst.with = inst.check;
|
|
77902
|
-
inst.clone = (def2, params) =>
|
|
78389
|
+
inst.clone = (def2, params) => clone2(inst, def2, params);
|
|
77903
78390
|
inst.brand = () => inst;
|
|
77904
78391
|
inst.register = (reg, meta2) => {
|
|
77905
78392
|
reg.add(inst, meta2);
|
|
@@ -77927,8 +78414,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
77927
78414
|
inst.nullish = () => optional(nullable(inst));
|
|
77928
78415
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
77929
78416
|
inst.array = () => array(inst);
|
|
77930
|
-
inst.or = (arg) =>
|
|
77931
|
-
inst.and = (arg) =>
|
|
78417
|
+
inst.or = (arg) => union2([inst, arg]);
|
|
78418
|
+
inst.and = (arg) => intersection2(inst, arg);
|
|
77932
78419
|
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
77933
78420
|
inst.default = (def2) => _default2(inst, def2);
|
|
77934
78421
|
inst.prefault = (def2) => prefault(inst, def2);
|
|
@@ -78431,7 +78918,7 @@ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
|
78431
78918
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
78432
78919
|
inst.options = def.options;
|
|
78433
78920
|
});
|
|
78434
|
-
function
|
|
78921
|
+
function union2(options, params) {
|
|
78435
78922
|
return new ZodUnion({
|
|
78436
78923
|
type: "union",
|
|
78437
78924
|
options,
|
|
@@ -78444,7 +78931,7 @@ var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
|
78444
78931
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
78445
78932
|
inst.options = def.options;
|
|
78446
78933
|
});
|
|
78447
|
-
function
|
|
78934
|
+
function xor2(options, params) {
|
|
78448
78935
|
return new ZodXor({
|
|
78449
78936
|
type: "union",
|
|
78450
78937
|
options,
|
|
@@ -78469,7 +78956,7 @@ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def
|
|
|
78469
78956
|
ZodType.init(inst, def);
|
|
78470
78957
|
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
78471
78958
|
});
|
|
78472
|
-
function
|
|
78959
|
+
function intersection2(left, right) {
|
|
78473
78960
|
return new ZodIntersection({
|
|
78474
78961
|
type: "intersection",
|
|
78475
78962
|
left,
|
|
@@ -78480,19 +78967,19 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
78480
78967
|
$ZodTuple.init(inst, def);
|
|
78481
78968
|
ZodType.init(inst, def);
|
|
78482
78969
|
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
78483
|
-
inst.rest = (
|
|
78970
|
+
inst.rest = (rest2) => inst.clone({
|
|
78484
78971
|
...inst._zod.def,
|
|
78485
|
-
rest
|
|
78972
|
+
rest: rest2
|
|
78486
78973
|
});
|
|
78487
78974
|
});
|
|
78488
78975
|
function tuple(items, _paramsOrRest, _params) {
|
|
78489
78976
|
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
78490
78977
|
const params = hasRest ? _params : _paramsOrRest;
|
|
78491
|
-
const
|
|
78978
|
+
const rest2 = hasRest ? _paramsOrRest : null;
|
|
78492
78979
|
return new ZodTuple({
|
|
78493
78980
|
type: "tuple",
|
|
78494
78981
|
items,
|
|
78495
|
-
rest,
|
|
78982
|
+
rest: rest2,
|
|
78496
78983
|
...exports_util.normalizeParams(params)
|
|
78497
78984
|
});
|
|
78498
78985
|
}
|
|
@@ -78512,7 +78999,7 @@ function record(keyType, valueType, params) {
|
|
|
78512
78999
|
});
|
|
78513
79000
|
}
|
|
78514
79001
|
function partialRecord(keyType, valueType, params) {
|
|
78515
|
-
const k =
|
|
79002
|
+
const k = clone2(keyType);
|
|
78516
79003
|
k._zod.values = undefined;
|
|
78517
79004
|
return new ZodRecord({
|
|
78518
79005
|
type: "record",
|
|
@@ -78944,7 +79431,7 @@ var stringbool = (...args) => _stringbool({
|
|
|
78944
79431
|
}, ...args);
|
|
78945
79432
|
function json(params) {
|
|
78946
79433
|
const jsonSchema = lazy(() => {
|
|
78947
|
-
return
|
|
79434
|
+
return union2([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
78948
79435
|
});
|
|
78949
79436
|
return jsonSchema;
|
|
78950
79437
|
}
|
|
@@ -79309,9 +79796,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
79309
79796
|
const items = schema.items;
|
|
79310
79797
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
79311
79798
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
79312
|
-
const
|
|
79313
|
-
if (
|
|
79314
|
-
zodSchema = z.tuple(tupleItems).rest(
|
|
79799
|
+
const rest2 = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : undefined;
|
|
79800
|
+
if (rest2) {
|
|
79801
|
+
zodSchema = z.tuple(tupleItems).rest(rest2);
|
|
79315
79802
|
} else {
|
|
79316
79803
|
zodSchema = z.tuple(tupleItems);
|
|
79317
79804
|
}
|
|
@@ -79323,9 +79810,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
79323
79810
|
}
|
|
79324
79811
|
} else if (Array.isArray(items)) {
|
|
79325
79812
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
79326
|
-
const
|
|
79327
|
-
if (
|
|
79328
|
-
zodSchema = z.tuple(tupleItems).rest(
|
|
79813
|
+
const rest2 = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : undefined;
|
|
79814
|
+
if (rest2) {
|
|
79815
|
+
zodSchema = z.tuple(tupleItems).rest(rest2);
|
|
79329
79816
|
} else {
|
|
79330
79817
|
zodSchema = z.tuple(tupleItems);
|
|
79331
79818
|
}
|
|
@@ -79472,7 +79959,7 @@ function fillPool(bytes) {
|
|
|
79472
79959
|
}
|
|
79473
79960
|
poolOffset += bytes;
|
|
79474
79961
|
}
|
|
79475
|
-
function
|
|
79962
|
+
function random2(bytes) {
|
|
79476
79963
|
fillPool(bytes |= 0);
|
|
79477
79964
|
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
79478
79965
|
}
|
|
@@ -79495,12 +79982,16 @@ function customRandom(alphabet, defaultSize, getRandom) {
|
|
|
79495
79982
|
};
|
|
79496
79983
|
}
|
|
79497
79984
|
function customAlphabet(alphabet, size = 21) {
|
|
79498
|
-
return customRandom(alphabet, size,
|
|
79985
|
+
return customRandom(alphabet, size, random2);
|
|
79499
79986
|
}
|
|
79987
|
+
var import_md5 = __toESM2(require_md5(), 1);
|
|
79500
79988
|
var nanoid3 = customAlphabet("abcdefghijklmnopqrstuvwxyz", 16);
|
|
79501
79989
|
var randomId = (length = 8, affix = "") => {
|
|
79502
79990
|
return affix + nanoid3(length);
|
|
79503
79991
|
};
|
|
79992
|
+
var hashIdMd5Sync = (pathKey) => {
|
|
79993
|
+
return import_md5.default(pathKey).toString().substring(0, 16);
|
|
79994
|
+
};
|
|
79504
79995
|
var extractArgs = (args) => {
|
|
79505
79996
|
if (args && typeof args === "object" && typeof args.shape === "object") {
|
|
79506
79997
|
return args.shape;
|
|
@@ -79520,7 +80011,7 @@ var toJSONSchema2 = (args, opts) => {
|
|
|
79520
80011
|
jsonSchema.optional = true;
|
|
79521
80012
|
}
|
|
79522
80013
|
};
|
|
79523
|
-
const
|
|
80014
|
+
const isError2 = (keys2) => {
|
|
79524
80015
|
const errorKeys = ["toJSONSchema", "def", "type", "parse"];
|
|
79525
80016
|
const hasErrorKeys = errorKeys.every((key) => keys2.includes(key));
|
|
79526
80017
|
return hasErrorKeys;
|
|
@@ -79530,7 +80021,7 @@ var toJSONSchema2 = (args, opts) => {
|
|
|
79530
80021
|
if (typeof args === "object" && typeof args.toJSONSchema === "function") {
|
|
79531
80022
|
return args.toJSONSchema();
|
|
79532
80023
|
}
|
|
79533
|
-
if (
|
|
80024
|
+
if (isError2(Object.keys(args))) {
|
|
79534
80025
|
return {};
|
|
79535
80026
|
}
|
|
79536
80027
|
const schema = exports_external.object(args);
|
|
@@ -79538,7 +80029,7 @@ var toJSONSchema2 = (args, opts) => {
|
|
|
79538
80029
|
}
|
|
79539
80030
|
args = extractArgs(args);
|
|
79540
80031
|
let keys = Object.keys(args);
|
|
79541
|
-
if (
|
|
80032
|
+
if (isError2(keys)) {
|
|
79542
80033
|
console.error(`[toJSONSchema error]: 解析到的 schema 可能不正确,包含了zod默认的value的schema. 请检查输入的 schema 是否正确。`);
|
|
79543
80034
|
args = {};
|
|
79544
80035
|
keys = [];
|
|
@@ -79621,12 +80112,9 @@ class Route {
|
|
|
79621
80112
|
key = key.trim();
|
|
79622
80113
|
this.path = path;
|
|
79623
80114
|
this.key = key;
|
|
80115
|
+
const pathKey = `${path}$$${key}`;
|
|
79624
80116
|
if (opts) {
|
|
79625
|
-
this.id = opts.id ||
|
|
79626
|
-
if (!opts.id && opts.idUsePath) {
|
|
79627
|
-
const delimiter = opts.delimiter ?? "$$";
|
|
79628
|
-
this.id = path + delimiter + key;
|
|
79629
|
-
}
|
|
80117
|
+
this.id = opts.id || hashIdMd5Sync(pathKey);
|
|
79630
80118
|
this.run = opts.run;
|
|
79631
80119
|
this.nextRoute = opts.nextRoute;
|
|
79632
80120
|
this.description = opts.description;
|
|
@@ -79637,7 +80125,9 @@ class Route {
|
|
|
79637
80125
|
this.path = opts.path || path;
|
|
79638
80126
|
} else {
|
|
79639
80127
|
this.middleware = [];
|
|
79640
|
-
|
|
80128
|
+
}
|
|
80129
|
+
if (!this.id) {
|
|
80130
|
+
this.id = hashIdMd5Sync(pathKey);
|
|
79641
80131
|
}
|
|
79642
80132
|
this.isDebug = opts?.isDebug ?? false;
|
|
79643
80133
|
}
|
|
@@ -79775,8 +80265,8 @@ class QueryRouter {
|
|
|
79775
80265
|
for (let i = 0;i < m.middleware.length; i++) {
|
|
79776
80266
|
const item = m.middleware[i];
|
|
79777
80267
|
let route2;
|
|
79778
|
-
const
|
|
79779
|
-
if (
|
|
80268
|
+
const isString2 = typeof item === "string";
|
|
80269
|
+
if (isString2) {
|
|
79780
80270
|
route2 = this.routes.find((r) => r.id === item);
|
|
79781
80271
|
} else {
|
|
79782
80272
|
route2 = this.routes.find((r) => {
|
|
@@ -79788,7 +80278,7 @@ class QueryRouter {
|
|
|
79788
80278
|
});
|
|
79789
80279
|
}
|
|
79790
80280
|
if (!route2) {
|
|
79791
|
-
if (
|
|
80281
|
+
if (isString2) {
|
|
79792
80282
|
errorMiddleware.push({
|
|
79793
80283
|
id: item
|
|
79794
80284
|
});
|
|
@@ -80119,8 +80609,8 @@ class QueryRouterServer extends QueryRouter {
|
|
|
80119
80609
|
return this.run({ path, key, id, payload }, ctx);
|
|
80120
80610
|
}
|
|
80121
80611
|
}
|
|
80122
|
-
var
|
|
80123
|
-
var
|
|
80612
|
+
var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
80613
|
+
var isBrowser22 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
80124
80614
|
var isDeno = typeof Deno !== "undefined" && typeof Deno.version === "object" && typeof Deno.version.deno === "string";
|
|
80125
80615
|
var isBun = typeof Bun !== "undefined" && typeof Bun.version === "string";
|
|
80126
80616
|
var parseBody = async (req) => {
|
|
@@ -80159,8 +80649,8 @@ var parseBody = async (req) => {
|
|
|
80159
80649
|
}
|
|
80160
80650
|
return new Promise((resolve, reject) => {
|
|
80161
80651
|
const arr = [];
|
|
80162
|
-
req.on("data", (
|
|
80163
|
-
arr.push(
|
|
80652
|
+
req.on("data", (chunk2) => {
|
|
80653
|
+
arr.push(chunk2);
|
|
80164
80654
|
});
|
|
80165
80655
|
req.on("end", () => {
|
|
80166
80656
|
try {
|
|
@@ -80277,7 +80767,7 @@ function stringifySetCookie(_name, _val, _opts) {
|
|
|
80277
80767
|
str += "; Path=" + cookie.path;
|
|
80278
80768
|
}
|
|
80279
80769
|
if (cookie.expires) {
|
|
80280
|
-
if (!
|
|
80770
|
+
if (!isDate2(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
|
|
80281
80771
|
throw new TypeError(`option expires is invalid: ${cookie.expires}`);
|
|
80282
80772
|
}
|
|
80283
80773
|
str += "; Expires=" + cookie.expires.toUTCString();
|
|
@@ -80359,7 +80849,7 @@ function decode3(str) {
|
|
|
80359
80849
|
return str;
|
|
80360
80850
|
}
|
|
80361
80851
|
}
|
|
80362
|
-
function
|
|
80852
|
+
function isDate2(val) {
|
|
80363
80853
|
return __toString.call(val) === "[object Date]";
|
|
80364
80854
|
}
|
|
80365
80855
|
var parseIfJson = (input) => {
|
|
@@ -80558,7 +81048,7 @@ class ServerBase {
|
|
|
80558
81048
|
return;
|
|
80559
81049
|
}
|
|
80560
81050
|
}
|
|
80561
|
-
const { type, data: typeData, ...
|
|
81051
|
+
const { type, data: typeData, ...rest2 } = data;
|
|
80562
81052
|
if (!type) {
|
|
80563
81053
|
ws.send(JSON.stringify({ code: 500, message: "type is required" }));
|
|
80564
81054
|
return;
|
|
@@ -80566,7 +81056,7 @@ class ServerBase {
|
|
|
80566
81056
|
const res = {
|
|
80567
81057
|
type,
|
|
80568
81058
|
data: {},
|
|
80569
|
-
...
|
|
81059
|
+
...rest2
|
|
80570
81060
|
};
|
|
80571
81061
|
const end = (data2, all) => {
|
|
80572
81062
|
const result = {
|
|
@@ -80680,11 +81170,11 @@ class WsServer extends WsServerBase {
|
|
|
80680
81170
|
super.listen();
|
|
80681
81171
|
const server = this.server;
|
|
80682
81172
|
const wss = this.wss;
|
|
80683
|
-
server.server.on("upgrade", (req, socket,
|
|
81173
|
+
server.server.on("upgrade", (req, socket, head2) => {
|
|
80684
81174
|
const url3 = new URL(req.url, "http://localhost");
|
|
80685
81175
|
const listenPath = this.server.listeners.map((item) => item.path).filter((item) => item);
|
|
80686
81176
|
if (listenPath.includes(url3.pathname) || url3.pathname === this.server.path) {
|
|
80687
|
-
wss.handleUpgrade(req, socket,
|
|
81177
|
+
wss.handleUpgrade(req, socket, head2, (ws) => {
|
|
80688
81178
|
wss.emit("connection", ws, req);
|
|
80689
81179
|
});
|
|
80690
81180
|
} else {
|
|
@@ -80878,7 +81368,7 @@ class BunServer extends ServerBase {
|
|
|
80878
81368
|
}
|
|
80879
81369
|
this.setHeader("Set-Cookie", cookieString);
|
|
80880
81370
|
},
|
|
80881
|
-
write(
|
|
81371
|
+
write(chunk2, encoding, callback2) {
|
|
80882
81372
|
if (typeof encoding === "function") {
|
|
80883
81373
|
callback2 = encoding;
|
|
80884
81374
|
encoding = "utf8";
|
|
@@ -80886,7 +81376,7 @@ class BunServer extends ServerBase {
|
|
|
80886
81376
|
if (!this._bodyChunks) {
|
|
80887
81377
|
this._bodyChunks = [];
|
|
80888
81378
|
}
|
|
80889
|
-
this._bodyChunks.push(
|
|
81379
|
+
this._bodyChunks.push(chunk2);
|
|
80890
81380
|
if (callback2)
|
|
80891
81381
|
callback2();
|
|
80892
81382
|
return true;
|
|
@@ -80902,8 +81392,8 @@ class BunServer extends ServerBase {
|
|
|
80902
81392
|
}
|
|
80903
81393
|
const readableStream = new ReadableStream({
|
|
80904
81394
|
start(controller) {
|
|
80905
|
-
stream.on("data", (
|
|
80906
|
-
controller.enqueue(
|
|
81395
|
+
stream.on("data", (chunk2) => {
|
|
81396
|
+
controller.enqueue(chunk2);
|
|
80907
81397
|
});
|
|
80908
81398
|
stream.on("end", () => {
|
|
80909
81399
|
onClose();
|
|
@@ -80928,18 +81418,18 @@ class BunServer extends ServerBase {
|
|
|
80928
81418
|
if (this._bodyChunks && this._bodyChunks.length > 0) {
|
|
80929
81419
|
if (data)
|
|
80930
81420
|
this._bodyChunks.push(data);
|
|
80931
|
-
const hasBuffer = this._bodyChunks.some((
|
|
81421
|
+
const hasBuffer = this._bodyChunks.some((chunk2) => chunk2 instanceof Buffer || chunk2 instanceof Uint8Array);
|
|
80932
81422
|
if (hasBuffer) {
|
|
80933
|
-
const buffers = this._bodyChunks.map((
|
|
80934
|
-
if (
|
|
80935
|
-
return
|
|
80936
|
-
if (
|
|
80937
|
-
return Buffer.from(
|
|
80938
|
-
return Buffer.from(String(
|
|
81423
|
+
const buffers = this._bodyChunks.map((chunk2) => {
|
|
81424
|
+
if (chunk2 instanceof Buffer)
|
|
81425
|
+
return chunk2;
|
|
81426
|
+
if (chunk2 instanceof Uint8Array)
|
|
81427
|
+
return Buffer.from(chunk2);
|
|
81428
|
+
return Buffer.from(String(chunk2));
|
|
80939
81429
|
});
|
|
80940
81430
|
responseData = Buffer.concat(buffers);
|
|
80941
81431
|
} else {
|
|
80942
|
-
responseData = this._bodyChunks.map((
|
|
81432
|
+
responseData = this._bodyChunks.map((chunk2) => String(chunk2)).join("");
|
|
80943
81433
|
}
|
|
80944
81434
|
}
|
|
80945
81435
|
resolve(new Response(responseData, {
|
|
@@ -81042,22 +81532,36 @@ class App extends QueryRouterServer {
|
|
|
81042
81532
|
}
|
|
81043
81533
|
}
|
|
81044
81534
|
|
|
81045
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
81535
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.2/node_modules/@kevisual/router/dist/router-simple.js
|
|
81046
81536
|
import url3 from "node:url";
|
|
81047
81537
|
var __create3 = Object.create;
|
|
81048
81538
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
81049
81539
|
var __defProp3 = Object.defineProperty;
|
|
81050
81540
|
var __getOwnPropNames3 = Object.getOwnPropertyNames;
|
|
81051
81541
|
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
81542
|
+
function __accessProp3(key) {
|
|
81543
|
+
return this[key];
|
|
81544
|
+
}
|
|
81545
|
+
var __toESMCache_node3;
|
|
81546
|
+
var __toESMCache_esm3;
|
|
81052
81547
|
var __toESM3 = (mod, isNodeMode, target) => {
|
|
81548
|
+
var canCache = mod != null && typeof mod === "object";
|
|
81549
|
+
if (canCache) {
|
|
81550
|
+
var cache = isNodeMode ? __toESMCache_node3 ??= new WeakMap : __toESMCache_esm3 ??= new WeakMap;
|
|
81551
|
+
var cached2 = cache.get(mod);
|
|
81552
|
+
if (cached2)
|
|
81553
|
+
return cached2;
|
|
81554
|
+
}
|
|
81053
81555
|
target = mod != null ? __create3(__getProtoOf3(mod)) : {};
|
|
81054
81556
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target;
|
|
81055
81557
|
for (let key of __getOwnPropNames3(mod))
|
|
81056
81558
|
if (!__hasOwnProp3.call(to, key))
|
|
81057
81559
|
__defProp3(to, key, {
|
|
81058
|
-
get: (
|
|
81560
|
+
get: __accessProp3.bind(mod, key),
|
|
81059
81561
|
enumerable: true
|
|
81060
81562
|
});
|
|
81563
|
+
if (canCache)
|
|
81564
|
+
cache.set(mod, to);
|
|
81061
81565
|
return to;
|
|
81062
81566
|
};
|
|
81063
81567
|
var __commonJS3 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
@@ -81087,7 +81591,7 @@ var require_dist = __commonJS3((exports) => {
|
|
|
81087
81591
|
function escapeText(str) {
|
|
81088
81592
|
return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
|
|
81089
81593
|
}
|
|
81090
|
-
function
|
|
81594
|
+
function escape2(str) {
|
|
81091
81595
|
return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
81092
81596
|
}
|
|
81093
81597
|
|
|
@@ -81302,8 +81806,8 @@ var require_dist = __commonJS3((exports) => {
|
|
|
81302
81806
|
}
|
|
81303
81807
|
let pattern = `^(?:${sources.join("|")})`;
|
|
81304
81808
|
if (trailing)
|
|
81305
|
-
pattern += `(?:${
|
|
81306
|
-
pattern += end ? "$" : `(?=${
|
|
81809
|
+
pattern += `(?:${escape2(delimiter)}$)?`;
|
|
81810
|
+
pattern += end ? "$" : `(?=${escape2(delimiter)}|$)`;
|
|
81307
81811
|
const regexp = new RegExp(pattern, flags);
|
|
81308
81812
|
return { regexp, keys };
|
|
81309
81813
|
}
|
|
@@ -81336,7 +81840,7 @@ var require_dist = __commonJS3((exports) => {
|
|
|
81336
81840
|
let isSafeSegmentParam = true;
|
|
81337
81841
|
for (const token of tokens) {
|
|
81338
81842
|
if (token.type === "text") {
|
|
81339
|
-
result +=
|
|
81843
|
+
result += escape2(token.value);
|
|
81340
81844
|
backtrack += token.value;
|
|
81341
81845
|
isSafeSegmentParam || (isSafeSegmentParam = token.value.includes(delimiter));
|
|
81342
81846
|
continue;
|
|
@@ -81361,13 +81865,13 @@ var require_dist = __commonJS3((exports) => {
|
|
|
81361
81865
|
function negate(delimiter, backtrack) {
|
|
81362
81866
|
if (backtrack.length < 2) {
|
|
81363
81867
|
if (delimiter.length < 2)
|
|
81364
|
-
return `[^${
|
|
81365
|
-
return `(?:(?!${
|
|
81868
|
+
return `[^${escape2(delimiter + backtrack)}]`;
|
|
81869
|
+
return `(?:(?!${escape2(delimiter)})[^${escape2(backtrack)}])`;
|
|
81366
81870
|
}
|
|
81367
81871
|
if (delimiter.length < 2) {
|
|
81368
|
-
return `(?:(?!${
|
|
81872
|
+
return `(?:(?!${escape2(backtrack)})[^${escape2(delimiter)}])`;
|
|
81369
81873
|
}
|
|
81370
|
-
return `(?:(?!${
|
|
81874
|
+
return `(?:(?!${escape2(backtrack)}|${escape2(delimiter)})[\\s\\S])`;
|
|
81371
81875
|
}
|
|
81372
81876
|
function stringifyTokens(tokens) {
|
|
81373
81877
|
let value = "";
|
|
@@ -81412,8 +81916,8 @@ var require_dist = __commonJS3((exports) => {
|
|
|
81412
81916
|
}
|
|
81413
81917
|
});
|
|
81414
81918
|
var import_path_to_regexp = __toESM3(require_dist(), 1);
|
|
81415
|
-
var
|
|
81416
|
-
var
|
|
81919
|
+
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
81920
|
+
var isBrowser3 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
81417
81921
|
var isDeno2 = typeof Deno !== "undefined" && typeof Deno.version === "object" && typeof Deno.version.deno === "string";
|
|
81418
81922
|
var isBun2 = typeof Bun !== "undefined" && typeof Bun.version === "string";
|
|
81419
81923
|
var parseBody2 = async (req) => {
|
|
@@ -82456,7 +82960,7 @@ var useFileStore = (str, opts) => {
|
|
|
82456
82960
|
}
|
|
82457
82961
|
return filePath;
|
|
82458
82962
|
};
|
|
82459
|
-
var
|
|
82963
|
+
var isBrowser5 = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
82460
82964
|
function getDefaultExportFromCjs2(x) {
|
|
82461
82965
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
82462
82966
|
}
|
|
@@ -83439,7 +83943,7 @@ function isUnsafeProperty2(key) {
|
|
|
83439
83943
|
}
|
|
83440
83944
|
|
|
83441
83945
|
// ../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
83442
|
-
function
|
|
83946
|
+
function isPlainObject2(value) {
|
|
83443
83947
|
if (!value || typeof value !== "object") {
|
|
83444
83948
|
return false;
|
|
83445
83949
|
}
|
|
@@ -83465,7 +83969,7 @@ function merge3(target, source) {
|
|
|
83465
83969
|
target[key] = merge3(targetValue, sourceValue);
|
|
83466
83970
|
} else if (Array.isArray(sourceValue)) {
|
|
83467
83971
|
target[key] = merge3([], sourceValue);
|
|
83468
|
-
} else if (
|
|
83972
|
+
} else if (isPlainObject2(sourceValue)) {
|
|
83469
83973
|
target[key] = merge3({}, sourceValue);
|
|
83470
83974
|
} else if (targetValue === undefined || sourceValue !== undefined) {
|
|
83471
83975
|
target[key] = sourceValue;
|
|
@@ -83474,10 +83978,10 @@ function merge3(target, source) {
|
|
|
83474
83978
|
return target;
|
|
83475
83979
|
}
|
|
83476
83980
|
function isMergeableValue2(value) {
|
|
83477
|
-
return
|
|
83981
|
+
return isPlainObject2(value) || Array.isArray(value);
|
|
83478
83982
|
}
|
|
83479
83983
|
// ../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/omit.mjs
|
|
83480
|
-
function
|
|
83984
|
+
function omit(obj, keys) {
|
|
83481
83985
|
const result = { ...obj };
|
|
83482
83986
|
for (let i = 0;i < keys.length; i++) {
|
|
83483
83987
|
const key = keys[i];
|
|
@@ -83486,7 +83990,7 @@ function omit2(obj, keys) {
|
|
|
83486
83990
|
return result;
|
|
83487
83991
|
}
|
|
83488
83992
|
// ../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isBrowser.mjs
|
|
83489
|
-
function
|
|
83993
|
+
function isBrowser6() {
|
|
83490
83994
|
return typeof window !== "undefined" && window?.document != null;
|
|
83491
83995
|
}
|
|
83492
83996
|
// ../node_modules/.pnpm/@kevisual+oss@0.0.20/node_modules/@kevisual/oss/src/util/hash.ts
|
|
@@ -83649,7 +84153,7 @@ class OssBase {
|
|
|
83649
84153
|
const obj = await this.statObject(objectName, true);
|
|
83650
84154
|
if (obj) {
|
|
83651
84155
|
const omitMeta = ["size", "content-type", "cache-control", "app-source"];
|
|
83652
|
-
const objMeta = JSON.parse(JSON.stringify(
|
|
84156
|
+
const objMeta = JSON.parse(JSON.stringify(omit(obj.metaData, omitMeta)));
|
|
83653
84157
|
metaData = {
|
|
83654
84158
|
...objMeta,
|
|
83655
84159
|
...metaData
|
|
@@ -83813,7 +84317,7 @@ class OssBase {
|
|
|
83813
84317
|
return { success: false, metaData: null, obj: null, equalMeta: false };
|
|
83814
84318
|
}
|
|
83815
84319
|
const omitMeta = ["Content-Type", "Cache-Control", "app-source"];
|
|
83816
|
-
const metaData =
|
|
84320
|
+
const metaData = omit(obj.metaData, omitMeta);
|
|
83817
84321
|
let equalMeta = false;
|
|
83818
84322
|
if (meta3) {
|
|
83819
84323
|
equalMeta = JSON.stringify(metaData) === JSON.stringify(meta3);
|
|
@@ -93135,7 +93639,7 @@ __export3(exports_util2, {
|
|
|
93135
93639
|
primitiveTypes: () => primitiveTypes2,
|
|
93136
93640
|
prefixIssues: () => prefixIssues2,
|
|
93137
93641
|
pick: () => pick22,
|
|
93138
|
-
partial: () =>
|
|
93642
|
+
partial: () => partial5,
|
|
93139
93643
|
parsedType: () => parsedType2,
|
|
93140
93644
|
optionalKeys: () => optionalKeys2,
|
|
93141
93645
|
omit: () => omit3,
|
|
@@ -93592,7 +94096,7 @@ function merge22(a, b) {
|
|
|
93592
94096
|
});
|
|
93593
94097
|
return clone3(a, def);
|
|
93594
94098
|
}
|
|
93595
|
-
function
|
|
94099
|
+
function partial5(Class2, schema, mask) {
|
|
93596
94100
|
const currDef = schema._zod.def;
|
|
93597
94101
|
const checks = currDef.checks;
|
|
93598
94102
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -106355,7 +106859,7 @@ var initApi = async (opts) => {
|
|
|
106355
106859
|
_list = _list.filter((i) => !excludeIds.includes(i.id));
|
|
106356
106860
|
}
|
|
106357
106861
|
}
|
|
106358
|
-
const _isBrowser =
|
|
106862
|
+
const _isBrowser = isBrowser6();
|
|
106359
106863
|
for (const r of _list) {
|
|
106360
106864
|
if (r.path || r.id) {
|
|
106361
106865
|
_isBrowser && console.debug(`注册路由: [${r.path}] ${r?.key}`, "API");
|
|
@@ -106744,7 +107248,7 @@ class ModuleResolver {
|
|
|
106744
107248
|
// ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
106745
107249
|
var exports_external3 = {};
|
|
106746
107250
|
__export(exports_external3, {
|
|
106747
|
-
xor: () =>
|
|
107251
|
+
xor: () => xor5,
|
|
106748
107252
|
xid: () => xid6,
|
|
106749
107253
|
void: () => _void6,
|
|
106750
107254
|
uuidv7: () => uuidv73,
|
|
@@ -106755,7 +107259,7 @@ __export(exports_external3, {
|
|
|
106755
107259
|
url: () => url6,
|
|
106756
107260
|
uppercase: () => _uppercase3,
|
|
106757
107261
|
unknown: () => unknown3,
|
|
106758
|
-
union: () =>
|
|
107262
|
+
union: () => union5,
|
|
106759
107263
|
undefined: () => _undefined8,
|
|
106760
107264
|
ulid: () => ulid6,
|
|
106761
107265
|
uint64: () => uint643,
|
|
@@ -106843,7 +107347,7 @@ __export(exports_external3, {
|
|
|
106843
107347
|
iso: () => exports_iso3,
|
|
106844
107348
|
ipv6: () => ipv66,
|
|
106845
107349
|
ipv4: () => ipv46,
|
|
106846
|
-
intersection: () =>
|
|
107350
|
+
intersection: () => intersection5,
|
|
106847
107351
|
int64: () => int643,
|
|
106848
107352
|
int32: () => int323,
|
|
106849
107353
|
int: () => int3,
|
|
@@ -106885,7 +107389,7 @@ __export(exports_external3, {
|
|
|
106885
107389
|
config: () => config3,
|
|
106886
107390
|
coerce: () => exports_coerce3,
|
|
106887
107391
|
codec: () => codec3,
|
|
106888
|
-
clone: () =>
|
|
107392
|
+
clone: () => clone5,
|
|
106889
107393
|
cidrv6: () => cidrv66,
|
|
106890
107394
|
cidrv4: () => cidrv46,
|
|
106891
107395
|
check: () => check3,
|
|
@@ -107022,7 +107526,7 @@ __export(exports_core3, {
|
|
|
107022
107526
|
createToJSONSchemaMethod: () => createToJSONSchemaMethod3,
|
|
107023
107527
|
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod3,
|
|
107024
107528
|
config: () => config3,
|
|
107025
|
-
clone: () =>
|
|
107529
|
+
clone: () => clone5,
|
|
107026
107530
|
_xor: () => _xor3,
|
|
107027
107531
|
_xid: () => _xid3,
|
|
107028
107532
|
_void: () => _void5,
|
|
@@ -107353,11 +107857,11 @@ __export(exports_util3, {
|
|
|
107353
107857
|
promiseAllObject: () => promiseAllObject3,
|
|
107354
107858
|
primitiveTypes: () => primitiveTypes3,
|
|
107355
107859
|
prefixIssues: () => prefixIssues3,
|
|
107356
|
-
pick: () =>
|
|
107357
|
-
partial: () =>
|
|
107860
|
+
pick: () => pick4,
|
|
107861
|
+
partial: () => partial6,
|
|
107358
107862
|
parsedType: () => parsedType3,
|
|
107359
107863
|
optionalKeys: () => optionalKeys3,
|
|
107360
|
-
omit: () =>
|
|
107864
|
+
omit: () => omit5,
|
|
107361
107865
|
objectClone: () => objectClone3,
|
|
107362
107866
|
numKeys: () => numKeys3,
|
|
107363
107867
|
nullish: () => nullish5,
|
|
@@ -107383,7 +107887,7 @@ __export(exports_util3, {
|
|
|
107383
107887
|
defineLazy: () => defineLazy3,
|
|
107384
107888
|
createTransparentProxy: () => createTransparentProxy3,
|
|
107385
107889
|
cloneDef: () => cloneDef3,
|
|
107386
|
-
clone: () =>
|
|
107890
|
+
clone: () => clone5,
|
|
107387
107891
|
cleanRegex: () => cleanRegex3,
|
|
107388
107892
|
cleanEnum: () => cleanEnum3,
|
|
107389
107893
|
captureStackTrace: () => captureStackTrace3,
|
|
@@ -107633,7 +108137,7 @@ var primitiveTypes3 = new Set(["string", "number", "bigint", "boolean", "symbol"
|
|
|
107633
108137
|
function escapeRegex3(str) {
|
|
107634
108138
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
107635
108139
|
}
|
|
107636
|
-
function
|
|
108140
|
+
function clone5(inst, def, params) {
|
|
107637
108141
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
107638
108142
|
if (!def || params?.parent)
|
|
107639
108143
|
cl._zod.parent = inst;
|
|
@@ -107711,7 +108215,7 @@ var BIGINT_FORMAT_RANGES3 = {
|
|
|
107711
108215
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
107712
108216
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
107713
108217
|
};
|
|
107714
|
-
function
|
|
108218
|
+
function pick4(schema, mask) {
|
|
107715
108219
|
const currDef = schema._zod.def;
|
|
107716
108220
|
const checks = currDef.checks;
|
|
107717
108221
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -107734,9 +108238,9 @@ function pick5(schema, mask) {
|
|
|
107734
108238
|
},
|
|
107735
108239
|
checks: []
|
|
107736
108240
|
});
|
|
107737
|
-
return
|
|
108241
|
+
return clone5(schema, def);
|
|
107738
108242
|
}
|
|
107739
|
-
function
|
|
108243
|
+
function omit5(schema, mask) {
|
|
107740
108244
|
const currDef = schema._zod.def;
|
|
107741
108245
|
const checks = currDef.checks;
|
|
107742
108246
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -107759,7 +108263,7 @@ function omit4(schema, mask) {
|
|
|
107759
108263
|
},
|
|
107760
108264
|
checks: []
|
|
107761
108265
|
});
|
|
107762
|
-
return
|
|
108266
|
+
return clone5(schema, def);
|
|
107763
108267
|
}
|
|
107764
108268
|
function extend3(schema, shape) {
|
|
107765
108269
|
if (!isPlainObject7(shape)) {
|
|
@@ -107782,7 +108286,7 @@ function extend3(schema, shape) {
|
|
|
107782
108286
|
return _shape;
|
|
107783
108287
|
}
|
|
107784
108288
|
});
|
|
107785
|
-
return
|
|
108289
|
+
return clone5(schema, def);
|
|
107786
108290
|
}
|
|
107787
108291
|
function safeExtend3(schema, shape) {
|
|
107788
108292
|
if (!isPlainObject7(shape)) {
|
|
@@ -107795,7 +108299,7 @@ function safeExtend3(schema, shape) {
|
|
|
107795
108299
|
return _shape;
|
|
107796
108300
|
}
|
|
107797
108301
|
});
|
|
107798
|
-
return
|
|
108302
|
+
return clone5(schema, def);
|
|
107799
108303
|
}
|
|
107800
108304
|
function merge6(a, b) {
|
|
107801
108305
|
const def = mergeDefs3(a._zod.def, {
|
|
@@ -107809,9 +108313,9 @@ function merge6(a, b) {
|
|
|
107809
108313
|
},
|
|
107810
108314
|
checks: []
|
|
107811
108315
|
});
|
|
107812
|
-
return
|
|
108316
|
+
return clone5(a, def);
|
|
107813
108317
|
}
|
|
107814
|
-
function
|
|
108318
|
+
function partial6(Class3, schema, mask) {
|
|
107815
108319
|
const currDef = schema._zod.def;
|
|
107816
108320
|
const checks = currDef.checks;
|
|
107817
108321
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -107847,7 +108351,7 @@ function partial5(Class3, schema, mask) {
|
|
|
107847
108351
|
},
|
|
107848
108352
|
checks: []
|
|
107849
108353
|
});
|
|
107850
|
-
return
|
|
108354
|
+
return clone5(schema, def);
|
|
107851
108355
|
}
|
|
107852
108356
|
function required3(Class3, schema, mask) {
|
|
107853
108357
|
const def = mergeDefs3(schema._zod.def, {
|
|
@@ -107878,7 +108382,7 @@ function required3(Class3, schema, mask) {
|
|
|
107878
108382
|
return shape;
|
|
107879
108383
|
}
|
|
107880
108384
|
});
|
|
107881
|
-
return
|
|
108385
|
+
return clone5(schema, def);
|
|
107882
108386
|
}
|
|
107883
108387
|
function aborted3(x, startIndex = 0) {
|
|
107884
108388
|
if (x.aborted === true)
|
|
@@ -118395,7 +118899,7 @@ var exports_json_schema3 = {};
|
|
|
118395
118899
|
// ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
118396
118900
|
var exports_schemas3 = {};
|
|
118397
118901
|
__export(exports_schemas3, {
|
|
118398
|
-
xor: () =>
|
|
118902
|
+
xor: () => xor5,
|
|
118399
118903
|
xid: () => xid6,
|
|
118400
118904
|
void: () => _void6,
|
|
118401
118905
|
uuidv7: () => uuidv73,
|
|
@@ -118404,7 +118908,7 @@ __export(exports_schemas3, {
|
|
|
118404
118908
|
uuid: () => uuid8,
|
|
118405
118909
|
url: () => url6,
|
|
118406
118910
|
unknown: () => unknown3,
|
|
118407
|
-
union: () =>
|
|
118911
|
+
union: () => union5,
|
|
118408
118912
|
undefined: () => _undefined8,
|
|
118409
118913
|
ulid: () => ulid6,
|
|
118410
118914
|
uint64: () => uint643,
|
|
@@ -118452,7 +118956,7 @@ __export(exports_schemas3, {
|
|
|
118452
118956
|
json: () => json3,
|
|
118453
118957
|
ipv6: () => ipv66,
|
|
118454
118958
|
ipv4: () => ipv46,
|
|
118455
|
-
intersection: () =>
|
|
118959
|
+
intersection: () => intersection5,
|
|
118456
118960
|
int64: () => int643,
|
|
118457
118961
|
int32: () => int323,
|
|
118458
118962
|
int: () => int3,
|
|
@@ -118709,7 +119213,7 @@ var ZodType3 = /* @__PURE__ */ $constructor3("ZodType", (inst, def) => {
|
|
|
118709
119213
|
});
|
|
118710
119214
|
};
|
|
118711
119215
|
inst.with = inst.check;
|
|
118712
|
-
inst.clone = (def2, params) =>
|
|
119216
|
+
inst.clone = (def2, params) => clone5(inst, def2, params);
|
|
118713
119217
|
inst.brand = () => inst;
|
|
118714
119218
|
inst.register = (reg, meta4) => {
|
|
118715
119219
|
reg.add(inst, meta4);
|
|
@@ -118737,8 +119241,8 @@ var ZodType3 = /* @__PURE__ */ $constructor3("ZodType", (inst, def) => {
|
|
|
118737
119241
|
inst.nullish = () => optional3(nullable3(inst));
|
|
118738
119242
|
inst.nonoptional = (params) => nonoptional3(inst, params);
|
|
118739
119243
|
inst.array = () => array4(inst);
|
|
118740
|
-
inst.or = (arg) =>
|
|
118741
|
-
inst.and = (arg) =>
|
|
119244
|
+
inst.or = (arg) => union5([inst, arg]);
|
|
119245
|
+
inst.and = (arg) => intersection5(inst, arg);
|
|
118742
119246
|
inst.transform = (tx) => pipe3(inst, transform3(tx));
|
|
118743
119247
|
inst.default = (def2) => _default6(inst, def2);
|
|
118744
119248
|
inst.prefault = (def2) => prefault3(inst, def2);
|
|
@@ -119241,7 +119745,7 @@ var ZodUnion3 = /* @__PURE__ */ $constructor3("ZodUnion", (inst, def) => {
|
|
|
119241
119745
|
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor3(inst, ctx, json3, params);
|
|
119242
119746
|
inst.options = def.options;
|
|
119243
119747
|
});
|
|
119244
|
-
function
|
|
119748
|
+
function union5(options, params) {
|
|
119245
119749
|
return new ZodUnion3({
|
|
119246
119750
|
type: "union",
|
|
119247
119751
|
options,
|
|
@@ -119254,7 +119758,7 @@ var ZodXor3 = /* @__PURE__ */ $constructor3("ZodXor", (inst, def) => {
|
|
|
119254
119758
|
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor3(inst, ctx, json3, params);
|
|
119255
119759
|
inst.options = def.options;
|
|
119256
119760
|
});
|
|
119257
|
-
function
|
|
119761
|
+
function xor5(options, params) {
|
|
119258
119762
|
return new ZodXor3({
|
|
119259
119763
|
type: "union",
|
|
119260
119764
|
options,
|
|
@@ -119279,7 +119783,7 @@ var ZodIntersection3 = /* @__PURE__ */ $constructor3("ZodIntersection", (inst, d
|
|
|
119279
119783
|
ZodType3.init(inst, def);
|
|
119280
119784
|
inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor3(inst, ctx, json3, params);
|
|
119281
119785
|
});
|
|
119282
|
-
function
|
|
119786
|
+
function intersection5(left, right) {
|
|
119283
119787
|
return new ZodIntersection3({
|
|
119284
119788
|
type: "intersection",
|
|
119285
119789
|
left,
|
|
@@ -119322,7 +119826,7 @@ function record3(keyType, valueType, params) {
|
|
|
119322
119826
|
});
|
|
119323
119827
|
}
|
|
119324
119828
|
function partialRecord3(keyType, valueType, params) {
|
|
119325
|
-
const k =
|
|
119829
|
+
const k = clone5(keyType);
|
|
119326
119830
|
k._zod.values = undefined;
|
|
119327
119831
|
return new ZodRecord3({
|
|
119328
119832
|
type: "record",
|
|
@@ -119754,7 +120258,7 @@ var stringbool3 = (...args2) => _stringbool3({
|
|
|
119754
120258
|
}, ...args2);
|
|
119755
120259
|
function json3(params) {
|
|
119756
120260
|
const jsonSchema = lazy3(() => {
|
|
119757
|
-
return
|
|
120261
|
+
return union5([string8(params), number7(), boolean7(), _null8(), array4(jsonSchema), record3(string8(), jsonSchema)]);
|
|
119758
120262
|
});
|
|
119759
120263
|
return jsonSchema;
|
|
119760
120264
|
}
|
|
@@ -127240,6 +127744,47 @@ var getClient = async (opts) => {
|
|
|
127240
127744
|
};
|
|
127241
127745
|
|
|
127242
127746
|
// src/routes/opencode/cnb.ts
|
|
127747
|
+
app.route({
|
|
127748
|
+
path: "opencode-cnb",
|
|
127749
|
+
key: "models",
|
|
127750
|
+
middleware: ["auth-admin"],
|
|
127751
|
+
description: "获取 OpenCode 可用模型列表,返回 providerID 和 modelID",
|
|
127752
|
+
metadata: {
|
|
127753
|
+
args: {
|
|
127754
|
+
baseUrl: exports_external3.string().optional().describe("OpenCode 服务地址,默认为 http://localhost:4096")
|
|
127755
|
+
}
|
|
127756
|
+
}
|
|
127757
|
+
}).define(async (ctx) => {
|
|
127758
|
+
const { baseUrl } = ctx.query;
|
|
127759
|
+
const client3 = await getClient({ baseUrl });
|
|
127760
|
+
if (!client3) {
|
|
127761
|
+
ctx.body = { content: "获取 OpenCode 客户端失败" };
|
|
127762
|
+
return;
|
|
127763
|
+
}
|
|
127764
|
+
const res = await client3.provider.list();
|
|
127765
|
+
const providerData = res?.data ?? res;
|
|
127766
|
+
const all = providerData?.all ?? [];
|
|
127767
|
+
const connected = providerData?.connected ?? [];
|
|
127768
|
+
const defaultModels = providerData?.default ?? {};
|
|
127769
|
+
const models = [];
|
|
127770
|
+
for (const provider2 of all) {
|
|
127771
|
+
const isConnected = connected.includes(provider2.id);
|
|
127772
|
+
for (const [modelKey, model] of Object.entries(provider2.models ?? {})) {
|
|
127773
|
+
models.push({
|
|
127774
|
+
providerID: provider2.id,
|
|
127775
|
+
providerName: provider2.name,
|
|
127776
|
+
modelID: modelKey,
|
|
127777
|
+
modelName: model.name ?? modelKey,
|
|
127778
|
+
isDefault: defaultModels[provider2.id] === modelKey,
|
|
127779
|
+
isConnected
|
|
127780
|
+
});
|
|
127781
|
+
}
|
|
127782
|
+
}
|
|
127783
|
+
ctx.body = {
|
|
127784
|
+
content: `共 ${models.length} 个模型,已连接提供商: ${connected.join(", ") || "无"}`,
|
|
127785
|
+
data: { models, connected, default: defaultModels }
|
|
127786
|
+
};
|
|
127787
|
+
}).addTo(app);
|
|
127243
127788
|
app.route({
|
|
127244
127789
|
path: "opencode-cnb",
|
|
127245
127790
|
key: "question",
|
|
@@ -127250,13 +127795,16 @@ app.route({
|
|
|
127250
127795
|
question: exports_external3.string().describe("问题"),
|
|
127251
127796
|
baseUrl: exports_external3.string().optional().describe("OpenCode 服务地址,默认为 http://localhost:4096"),
|
|
127252
127797
|
directory: exports_external3.string().optional().describe("运行目录,默认为根目录"),
|
|
127253
|
-
|
|
127798
|
+
messageId: exports_external3.string().optional().describe("消息 ID,选填"),
|
|
127254
127799
|
sessionId: exports_external3.string().optional().describe("会话 ID,选填"),
|
|
127255
|
-
|
|
127800
|
+
providerId: exports_external3.string().optional().describe("指定使用的提供商 ID,默认为空,表示使用默认提供商"),
|
|
127801
|
+
modelId: exports_external3.string().optional().describe("指定使用的模型 ID,默认为空,表示使用默认模型"),
|
|
127802
|
+
parts: exports_external3.array(exports_external3.any()).optional().describe("消息内容的分块,优先于 question 参数"),
|
|
127803
|
+
awaitAnswer: exports_external3.boolean().optional().describe("是否等待回答完成,默认为 false,开启后会在回答完成后返回完整回答内容")
|
|
127256
127804
|
}
|
|
127257
127805
|
}
|
|
127258
127806
|
}).define(async (ctx) => {
|
|
127259
|
-
const { question, baseUrl, directory = "/workspace",
|
|
127807
|
+
const { question, baseUrl, directory = "/workspace", messageId, sessionId, parts, awaitAnswer = false, providerId, modelId } = ctx.query;
|
|
127260
127808
|
const client3 = await getClient({ baseUrl });
|
|
127261
127809
|
if (!client3) {
|
|
127262
127810
|
ctx.body = { content: `OpenCode 客户端获取失败` };
|
|
@@ -127282,17 +127830,291 @@ app.route({
|
|
|
127282
127830
|
session = createSession.data;
|
|
127283
127831
|
}
|
|
127284
127832
|
let _parts = parts ?? [{ type: "text", text: question }];
|
|
127285
|
-
|
|
127833
|
+
let data = null;
|
|
127834
|
+
let model = null;
|
|
127835
|
+
if (providerId && modelId) {
|
|
127836
|
+
model = { providerID: providerId, modelID: modelId };
|
|
127837
|
+
}
|
|
127838
|
+
const promptPromise = client3.session.prompt({
|
|
127286
127839
|
body: {
|
|
127287
|
-
messageID,
|
|
127288
|
-
parts: _parts
|
|
127840
|
+
messageID: messageId,
|
|
127841
|
+
parts: _parts,
|
|
127842
|
+
...model ? { model } : {}
|
|
127289
127843
|
},
|
|
127290
127844
|
path: {
|
|
127291
127845
|
id: sessionId || session.id
|
|
127292
127846
|
}
|
|
127293
127847
|
});
|
|
127294
|
-
|
|
127295
|
-
|
|
127848
|
+
if (awaitAnswer) {
|
|
127849
|
+
const message = await promptPromise;
|
|
127850
|
+
data = message.data;
|
|
127851
|
+
} else {
|
|
127852
|
+
promptPromise.then((res) => {
|
|
127853
|
+
console.log(`Prompt completed with response:`, res.data.info.id);
|
|
127854
|
+
}).catch(() => {});
|
|
127855
|
+
}
|
|
127856
|
+
ctx.body = { content: awaitAnswer ? `已经完成` : `运行中`, data, sessionId: session.id };
|
|
127857
|
+
}).addTo(app);
|
|
127858
|
+
|
|
127859
|
+
// src/routes/opencode/session/index.ts
|
|
127860
|
+
app.route({
|
|
127861
|
+
path: "opencode-session",
|
|
127862
|
+
key: "list",
|
|
127863
|
+
middleware: ["auth-admin"],
|
|
127864
|
+
description: "列出所有 OpenCode Session",
|
|
127865
|
+
metadata: {
|
|
127866
|
+
tags: ["session"],
|
|
127867
|
+
...createSkill({
|
|
127868
|
+
skill: "list-opencode-sessions",
|
|
127869
|
+
title: "列出所有 Session",
|
|
127870
|
+
summary: "列出 OpenCode 中的所有会话,可按目录过滤",
|
|
127871
|
+
args: {
|
|
127872
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127873
|
+
}
|
|
127874
|
+
})
|
|
127875
|
+
}
|
|
127876
|
+
}).define(async (ctx) => {
|
|
127877
|
+
const { port } = ctx.query;
|
|
127878
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
127879
|
+
const result = await client3.session.list();
|
|
127880
|
+
ctx.body = { data: result.data, content: `共 ${result.data?.length ?? 0} 个 Session` };
|
|
127881
|
+
}).addTo(app);
|
|
127882
|
+
app.route({
|
|
127883
|
+
path: "opencode-session",
|
|
127884
|
+
key: "get",
|
|
127885
|
+
middleware: ["auth-admin"],
|
|
127886
|
+
description: "获取指定 OpenCode Session",
|
|
127887
|
+
metadata: {
|
|
127888
|
+
tags: ["session"],
|
|
127889
|
+
...createSkill({
|
|
127890
|
+
skill: "get-opencode-session",
|
|
127891
|
+
title: "获取 Session",
|
|
127892
|
+
summary: "根据 ID 获取指定的 OpenCode 会话信息",
|
|
127893
|
+
args: {
|
|
127894
|
+
id: tool.schema.string().describe("Session ID"),
|
|
127895
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127896
|
+
}
|
|
127897
|
+
})
|
|
127898
|
+
}
|
|
127899
|
+
}).define(async (ctx) => {
|
|
127900
|
+
const { id, port } = ctx.query;
|
|
127901
|
+
if (!id) {
|
|
127902
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
127903
|
+
return;
|
|
127904
|
+
}
|
|
127905
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
127906
|
+
const result = await client3.session.get({ path: { id } });
|
|
127907
|
+
ctx.body = { data: result.data, content: `已获取 Session: ${id}` };
|
|
127908
|
+
}).addTo(app);
|
|
127909
|
+
app.route({
|
|
127910
|
+
path: "opencode-session",
|
|
127911
|
+
key: "status",
|
|
127912
|
+
middleware: ["auth-admin"],
|
|
127913
|
+
description: "获取 OpenCode Session 状态",
|
|
127914
|
+
metadata: {
|
|
127915
|
+
tags: ["session"],
|
|
127916
|
+
...createSkill({
|
|
127917
|
+
skill: "get-opencode-session-status",
|
|
127918
|
+
title: "获取 Session 状态",
|
|
127919
|
+
summary: "获取当前 OpenCode 会话的运行状态,可按目录过滤",
|
|
127920
|
+
args: {
|
|
127921
|
+
directory: tool.schema.string().optional().describe("工作目录"),
|
|
127922
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127923
|
+
}
|
|
127924
|
+
})
|
|
127925
|
+
}
|
|
127926
|
+
}).define(async (ctx) => {
|
|
127927
|
+
const { directory, port } = ctx.query;
|
|
127928
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
127929
|
+
const result = await client3.session.status(directory ? { query: { directory } } : undefined);
|
|
127930
|
+
ctx.body = { data: result.data, content: `Session 状态已获取` };
|
|
127931
|
+
}).addTo(app);
|
|
127932
|
+
app.route({
|
|
127933
|
+
path: "opencode-session",
|
|
127934
|
+
key: "messages",
|
|
127935
|
+
middleware: ["auth-admin"],
|
|
127936
|
+
description: "列出 OpenCode Session 消息",
|
|
127937
|
+
metadata: {
|
|
127938
|
+
tags: ["session"],
|
|
127939
|
+
...createSkill({
|
|
127940
|
+
skill: "list-opencode-session-messages",
|
|
127941
|
+
title: "列出 Session 消息",
|
|
127942
|
+
summary: "列出指定 OpenCode 会话的所有消息记录",
|
|
127943
|
+
args: {
|
|
127944
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
127945
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127946
|
+
}
|
|
127947
|
+
})
|
|
127948
|
+
}
|
|
127949
|
+
}).define(async (ctx) => {
|
|
127950
|
+
const { sessionId, port } = ctx.query;
|
|
127951
|
+
if (!sessionId) {
|
|
127952
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
127953
|
+
return;
|
|
127954
|
+
}
|
|
127955
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
127956
|
+
const result = await client3.session.messages({ path: { id: sessionId } });
|
|
127957
|
+
ctx.body = { data: result.data, content: `Session ${sessionId} 共 ${result.data?.length ?? 0} 条消息` };
|
|
127958
|
+
}).addTo(app);
|
|
127959
|
+
app.route({
|
|
127960
|
+
path: "opencode-session",
|
|
127961
|
+
key: "create",
|
|
127962
|
+
middleware: ["auth-admin"],
|
|
127963
|
+
description: "创建 OpenCode Session",
|
|
127964
|
+
metadata: {
|
|
127965
|
+
tags: ["session"],
|
|
127966
|
+
...createSkill({
|
|
127967
|
+
skill: "create-opencode-session",
|
|
127968
|
+
title: "创建 Session",
|
|
127969
|
+
summary: "在指定目录创建一个新的 OpenCode 会话",
|
|
127970
|
+
args: {
|
|
127971
|
+
directory: tool.schema.string().optional().describe("工作目录,默认为 /workspace"),
|
|
127972
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127973
|
+
}
|
|
127974
|
+
})
|
|
127975
|
+
}
|
|
127976
|
+
}).define(async (ctx) => {
|
|
127977
|
+
const { directory = "/workspace", port } = ctx.query;
|
|
127978
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
127979
|
+
const result = await client3.session.create({ query: { directory } });
|
|
127980
|
+
ctx.body = { data: result.data, content: `Session 已创建,ID: ${result.data?.id}` };
|
|
127981
|
+
}).addTo(app);
|
|
127982
|
+
app.route({
|
|
127983
|
+
path: "opencode-session",
|
|
127984
|
+
key: "update",
|
|
127985
|
+
middleware: ["auth-admin"],
|
|
127986
|
+
description: "更新 OpenCode Session",
|
|
127987
|
+
metadata: {
|
|
127988
|
+
tags: ["session"],
|
|
127989
|
+
...createSkill({
|
|
127990
|
+
skill: "update-opencode-session",
|
|
127991
|
+
title: "更新 Session",
|
|
127992
|
+
summary: "更新指定 OpenCode 会话的属性,如标题",
|
|
127993
|
+
args: {
|
|
127994
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
127995
|
+
title: tool.schema.string().optional().describe("新的会话标题"),
|
|
127996
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
127997
|
+
}
|
|
127998
|
+
})
|
|
127999
|
+
}
|
|
128000
|
+
}).define(async (ctx) => {
|
|
128001
|
+
const { sessionId, title, port } = ctx.query;
|
|
128002
|
+
if (!sessionId) {
|
|
128003
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
128004
|
+
return;
|
|
128005
|
+
}
|
|
128006
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
128007
|
+
const result = await client3.session.update({ path: { id: sessionId }, body: { title } });
|
|
128008
|
+
ctx.body = { data: result.data, content: `Session ${sessionId} 已更新` };
|
|
128009
|
+
}).addTo(app);
|
|
128010
|
+
app.route({
|
|
128011
|
+
path: "opencode-session",
|
|
128012
|
+
key: "delete",
|
|
128013
|
+
middleware: ["auth-admin"],
|
|
128014
|
+
description: "删除 OpenCode Session",
|
|
128015
|
+
metadata: {
|
|
128016
|
+
tags: ["session"],
|
|
128017
|
+
...createSkill({
|
|
128018
|
+
skill: "delete-opencode-session",
|
|
128019
|
+
title: "删除 Session",
|
|
128020
|
+
summary: "根据 ID 删除指定的 OpenCode 会话及其所有数据",
|
|
128021
|
+
args: {
|
|
128022
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
128023
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
128024
|
+
}
|
|
128025
|
+
})
|
|
128026
|
+
}
|
|
128027
|
+
}).define(async (ctx) => {
|
|
128028
|
+
const { sessionId, port } = ctx.query;
|
|
128029
|
+
if (!sessionId) {
|
|
128030
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
128031
|
+
return;
|
|
128032
|
+
}
|
|
128033
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
128034
|
+
await client3.session.delete({ path: { id: sessionId } });
|
|
128035
|
+
ctx.body = { content: `Session ${sessionId} 已删除` };
|
|
128036
|
+
}).addTo(app);
|
|
128037
|
+
app.route({
|
|
128038
|
+
path: "opencode-session",
|
|
128039
|
+
key: "abort",
|
|
128040
|
+
middleware: ["auth-admin"],
|
|
128041
|
+
description: "中止 OpenCode Session",
|
|
128042
|
+
metadata: {
|
|
128043
|
+
tags: ["session"],
|
|
128044
|
+
...createSkill({
|
|
128045
|
+
skill: "abort-opencode-session",
|
|
128046
|
+
title: "中止 Session",
|
|
128047
|
+
summary: "中止正在运行的 OpenCode 会话",
|
|
128048
|
+
args: {
|
|
128049
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
128050
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
128051
|
+
}
|
|
128052
|
+
})
|
|
128053
|
+
}
|
|
128054
|
+
}).define(async (ctx) => {
|
|
128055
|
+
const { sessionId, port } = ctx.query;
|
|
128056
|
+
if (!sessionId) {
|
|
128057
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
128058
|
+
return;
|
|
128059
|
+
}
|
|
128060
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
128061
|
+
await client3.session.abort({ path: { id: sessionId } });
|
|
128062
|
+
ctx.body = { content: `Session ${sessionId} 已中止` };
|
|
128063
|
+
}).addTo(app);
|
|
128064
|
+
app.route({
|
|
128065
|
+
path: "opencode-session",
|
|
128066
|
+
key: "fork",
|
|
128067
|
+
middleware: ["auth-admin"],
|
|
128068
|
+
description: "Fork OpenCode Session",
|
|
128069
|
+
metadata: {
|
|
128070
|
+
tags: ["session"],
|
|
128071
|
+
...createSkill({
|
|
128072
|
+
skill: "fork-opencode-session",
|
|
128073
|
+
title: "Fork Session",
|
|
128074
|
+
summary: "从指定消息处 Fork 一个 OpenCode 会话",
|
|
128075
|
+
args: {
|
|
128076
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
128077
|
+
messageId: tool.schema.string().describe("从该消息处开始 Fork"),
|
|
128078
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
128079
|
+
}
|
|
128080
|
+
})
|
|
128081
|
+
}
|
|
128082
|
+
}).define(async (ctx) => {
|
|
128083
|
+
const { sessionId, messageId, port } = ctx.query;
|
|
128084
|
+
if (!sessionId || !messageId) {
|
|
128085
|
+
ctx.throw(400, "Session ID 和 messageId 不能为空");
|
|
128086
|
+
return;
|
|
128087
|
+
}
|
|
128088
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
128089
|
+
const result = await client3.session.fork({ path: { id: sessionId }, body: { messageID: messageId } });
|
|
128090
|
+
ctx.body = { data: result.data, content: `Session ${sessionId} 已从消息 ${messageId} Fork` };
|
|
128091
|
+
}).addTo(app);
|
|
128092
|
+
app.route({
|
|
128093
|
+
path: "opencode-session",
|
|
128094
|
+
key: "summarize",
|
|
128095
|
+
middleware: ["auth-admin"],
|
|
128096
|
+
description: "总结 OpenCode Session",
|
|
128097
|
+
metadata: {
|
|
128098
|
+
tags: ["session"],
|
|
128099
|
+
...createSkill({
|
|
128100
|
+
skill: "summarize-opencode-session",
|
|
128101
|
+
title: "总结 Session",
|
|
128102
|
+
summary: "对指定的 OpenCode 会话进行内容总结",
|
|
128103
|
+
args: {
|
|
128104
|
+
sessionId: tool.schema.string().describe("Session ID"),
|
|
128105
|
+
port: tool.schema.number().optional().describe("OpenCode 服务端口,默认为 4096")
|
|
128106
|
+
}
|
|
128107
|
+
})
|
|
128108
|
+
}
|
|
128109
|
+
}).define(async (ctx) => {
|
|
128110
|
+
const { sessionId, port } = ctx.query;
|
|
128111
|
+
if (!sessionId) {
|
|
128112
|
+
ctx.throw(400, "Session ID 不能为空");
|
|
128113
|
+
return;
|
|
128114
|
+
}
|
|
128115
|
+
const client3 = await opencodeManager.getClient({ port });
|
|
128116
|
+
const result = await client3.session.summarize({ path: { id: sessionId } });
|
|
128117
|
+
ctx.body = { data: result.data, content: `Session ${sessionId} 总结完成` };
|
|
127296
128118
|
}).addTo(app);
|
|
127297
128119
|
|
|
127298
128120
|
// src/routes/remote/index.ts
|
|
@@ -127356,7 +128178,7 @@ var getLiveMdContent = (opts) => {
|
|
|
127356
128178
|
const token = useKey("CNB_TOKEN") || "";
|
|
127357
128179
|
const openclawPort = useKey("OPENCLAW_PORT") || "80";
|
|
127358
128180
|
const openclawUrl = url4.replace("{{port}}", openclawPort);
|
|
127359
|
-
const openclawUrlSecret = openclawUrl + "/openclaw
|
|
128181
|
+
const openclawUrlSecret = openclawUrl + "/openclaw#token=" + token;
|
|
127360
128182
|
const opencodePort = useKey("OPENCODE_PORT") || "100";
|
|
127361
128183
|
const opencodeUrl = url4.replace("{{port}}", opencodePort);
|
|
127362
128184
|
const _opencodeURL = new URL(opencodeUrl);
|
|
@@ -128889,7 +129711,7 @@ function fillPool2(bytes) {
|
|
|
128889
129711
|
}
|
|
128890
129712
|
poolOffset2 += bytes;
|
|
128891
129713
|
}
|
|
128892
|
-
function
|
|
129714
|
+
function random5(bytes) {
|
|
128893
129715
|
fillPool2(bytes |= 0);
|
|
128894
129716
|
return pool2.subarray(poolOffset2 - bytes, poolOffset2);
|
|
128895
129717
|
}
|
|
@@ -128912,7 +129734,7 @@ function customRandom3(alphabet, defaultSize, getRandom) {
|
|
|
128912
129734
|
};
|
|
128913
129735
|
}
|
|
128914
129736
|
function customAlphabet3(alphabet, size = 21) {
|
|
128915
|
-
return customRandom3(alphabet, size,
|
|
129737
|
+
return customRandom3(alphabet, size, random5);
|
|
128916
129738
|
}
|
|
128917
129739
|
function nanoid8(size = 21) {
|
|
128918
129740
|
fillPool2(size |= 0);
|
|
@@ -129474,7 +130296,7 @@ var import_busboy = __toESM(require_lib2(), 1);
|
|
|
129474
130296
|
import path20 from "path";
|
|
129475
130297
|
import fs23 from "fs";
|
|
129476
130298
|
|
|
129477
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
130299
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.2/node_modules/@kevisual/router/src/server/cookie.ts
|
|
129478
130300
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
129479
130301
|
const C2 = function() {};
|
|
129480
130302
|
C2.prototype = Object.create(null);
|
|
@@ -129875,7 +130697,7 @@ var getBunPath = () => {
|
|
|
129875
130697
|
};
|
|
129876
130698
|
|
|
129877
130699
|
// ../node_modules/.pnpm/@kevisual+video-tools@0.0.13_dotenv@17.3.1_supports-color@10.2.2/node_modules/@kevisual/video-tools/src/ws/index.ts
|
|
129878
|
-
var
|
|
130700
|
+
var isBrowser7 = typeof process === "undefined" || typeof window !== "undefined" && typeof window.document !== "undefined" || typeof process !== "undefined" && process?.env?.BROWSER === "true";
|
|
129879
130701
|
var chantHttpToWs = (url4) => {
|
|
129880
130702
|
if (url4.startsWith("http://")) {
|
|
129881
130703
|
return url4.replace("http://", "ws://");
|
|
@@ -129888,7 +130710,7 @@ var chantHttpToWs = (url4) => {
|
|
|
129888
130710
|
var initWs = async (url4, options) => {
|
|
129889
130711
|
let ws;
|
|
129890
130712
|
url4 = chantHttpToWs(url4);
|
|
129891
|
-
if (
|
|
130713
|
+
if (isBrowser7) {
|
|
129892
130714
|
ws = new WebSocket(url4);
|
|
129893
130715
|
} else {
|
|
129894
130716
|
const wsPakcages = "ws";
|