@okostream/mcp 0.13.2 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +349 -231
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -2987,7 +2987,7 @@ var require_compile = __commonJS({
|
|
|
2987
2987
|
const schOrFunc = root.refs[ref2];
|
|
2988
2988
|
if (schOrFunc)
|
|
2989
2989
|
return schOrFunc;
|
|
2990
|
-
let _sch =
|
|
2990
|
+
let _sch = resolve4.call(this, root, ref2);
|
|
2991
2991
|
if (_sch === void 0) {
|
|
2992
2992
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref2];
|
|
2993
2993
|
const { schemaId } = this.opts;
|
|
@@ -3014,7 +3014,7 @@ var require_compile = __commonJS({
|
|
|
3014
3014
|
function sameSchemaEnv(s1, s2) {
|
|
3015
3015
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3016
3016
|
}
|
|
3017
|
-
function
|
|
3017
|
+
function resolve4(root, ref2) {
|
|
3018
3018
|
let sch;
|
|
3019
3019
|
while (typeof (sch = this.refs[ref2]) == "string")
|
|
3020
3020
|
ref2 = sch;
|
|
@@ -3645,7 +3645,7 @@ var require_fast_uri = __commonJS({
|
|
|
3645
3645
|
}
|
|
3646
3646
|
return uri;
|
|
3647
3647
|
}
|
|
3648
|
-
function
|
|
3648
|
+
function resolve4(baseURI, relativeURI, options2) {
|
|
3649
3649
|
const schemelessOptions = options2 ? Object.assign({ scheme: "null" }, options2) : { scheme: "null" };
|
|
3650
3650
|
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
3651
3651
|
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
@@ -3929,7 +3929,7 @@ var require_fast_uri = __commonJS({
|
|
|
3929
3929
|
var fastUri = {
|
|
3930
3930
|
SCHEMES,
|
|
3931
3931
|
normalize,
|
|
3932
|
-
resolve:
|
|
3932
|
+
resolve: resolve4,
|
|
3933
3933
|
resolveComponent,
|
|
3934
3934
|
equal,
|
|
3935
3935
|
serialize: serialize2,
|
|
@@ -7983,10 +7983,10 @@ var require_functor = __commonJS({
|
|
|
7983
7983
|
Functor.QUEUE_SIZE = 8;
|
|
7984
7984
|
Functor.prototype.call = function(error3, message, callback, context) {
|
|
7985
7985
|
if (this._stopped) return;
|
|
7986
|
-
var
|
|
7987
|
-
this._queue.push(
|
|
7988
|
-
if (
|
|
7989
|
-
|
|
7986
|
+
var record3 = { error: error3, message, callback, context, done: false }, called = false, self2 = this;
|
|
7987
|
+
this._queue.push(record3);
|
|
7988
|
+
if (record3.error) {
|
|
7989
|
+
record3.done = true;
|
|
7990
7990
|
this._stop();
|
|
7991
7991
|
return this._flushQueue();
|
|
7992
7992
|
}
|
|
@@ -7994,12 +7994,12 @@ var require_functor = __commonJS({
|
|
|
7994
7994
|
if (!(called ^ (called = true))) return;
|
|
7995
7995
|
if (err) {
|
|
7996
7996
|
self2._stop();
|
|
7997
|
-
|
|
7998
|
-
|
|
7997
|
+
record3.error = err;
|
|
7998
|
+
record3.message = null;
|
|
7999
7999
|
} else {
|
|
8000
|
-
|
|
8000
|
+
record3.message = msg;
|
|
8001
8001
|
}
|
|
8002
|
-
|
|
8002
|
+
record3.done = true;
|
|
8003
8003
|
self2._flushQueue();
|
|
8004
8004
|
};
|
|
8005
8005
|
try {
|
|
@@ -8013,16 +8013,16 @@ var require_functor = __commonJS({
|
|
|
8013
8013
|
this._stopped = true;
|
|
8014
8014
|
};
|
|
8015
8015
|
Functor.prototype._flushQueue = function() {
|
|
8016
|
-
var queue = this._queue,
|
|
8016
|
+
var queue = this._queue, record3;
|
|
8017
8017
|
while (queue.length > 0 && queue.peek().done) {
|
|
8018
|
-
|
|
8019
|
-
if (
|
|
8018
|
+
record3 = queue.shift();
|
|
8019
|
+
if (record3.error) {
|
|
8020
8020
|
this.pending = 0;
|
|
8021
8021
|
queue.clear();
|
|
8022
8022
|
} else {
|
|
8023
8023
|
this.pending -= 1;
|
|
8024
8024
|
}
|
|
8025
|
-
|
|
8025
|
+
record3.callback.call(record3.context, record3.error, record3.message);
|
|
8026
8026
|
}
|
|
8027
8027
|
};
|
|
8028
8028
|
module.exports = Functor;
|
|
@@ -8185,9 +8185,9 @@ var require_websocket_extensions = __commonJS({
|
|
|
8185
8185
|
this._inOrder.forEach(function(ext) {
|
|
8186
8186
|
var session = ext.createClientSession();
|
|
8187
8187
|
if (!session) return;
|
|
8188
|
-
var
|
|
8189
|
-
sessions.push(
|
|
8190
|
-
index[ext.name] =
|
|
8188
|
+
var record3 = [ext, session];
|
|
8189
|
+
sessions.push(record3);
|
|
8190
|
+
index[ext.name] = record3;
|
|
8191
8191
|
var offers = session.generateOffer();
|
|
8192
8192
|
offers = offers ? [].concat(offers) : [];
|
|
8193
8193
|
offers.forEach(function(off) {
|
|
@@ -8201,16 +8201,16 @@ var require_websocket_extensions = __commonJS({
|
|
|
8201
8201
|
activate: function(header) {
|
|
8202
8202
|
var responses = Parser2.parseHeader(header), sessions = [];
|
|
8203
8203
|
responses.eachOffer(function(name7, params) {
|
|
8204
|
-
var
|
|
8205
|
-
if (!
|
|
8204
|
+
var record3 = this._index[name7];
|
|
8205
|
+
if (!record3)
|
|
8206
8206
|
throw new Error('Server sent an extension response for unknown extension "' + name7 + '"');
|
|
8207
|
-
var ext =
|
|
8207
|
+
var ext = record3[0], session = record3[1], reserved = this._reserved(ext);
|
|
8208
8208
|
if (reserved)
|
|
8209
8209
|
throw new Error("Server sent two extension responses that use the RSV" + reserved[0] + ' bit: "' + reserved[1] + '" and "' + ext.name + '"');
|
|
8210
8210
|
if (session.activate(params) !== true)
|
|
8211
8211
|
throw new Error("Server sent unacceptable extension parameters: " + Parser2.serializeParams(name7, params));
|
|
8212
8212
|
this._reserve(ext);
|
|
8213
|
-
sessions.push(
|
|
8213
|
+
sessions.push(record3);
|
|
8214
8214
|
}, this);
|
|
8215
8215
|
this._sessions = sessions;
|
|
8216
8216
|
this._pipeline = new Pipeline(sessions);
|
|
@@ -10167,7 +10167,7 @@ var require_call_credentials = __commonJS({
|
|
|
10167
10167
|
if (isCurrentOauth2Client(googleCredentials)) {
|
|
10168
10168
|
getHeaders = googleCredentials.getRequestHeaders(options2.service_url);
|
|
10169
10169
|
} else {
|
|
10170
|
-
getHeaders = new Promise((
|
|
10170
|
+
getHeaders = new Promise((resolve4, reject) => {
|
|
10171
10171
|
googleCredentials.getRequestMetadata(options2.service_url, (err, headers) => {
|
|
10172
10172
|
if (err) {
|
|
10173
10173
|
reject(err);
|
|
@@ -10177,7 +10177,7 @@ var require_call_credentials = __commonJS({
|
|
|
10177
10177
|
reject(new Error("Headers not set by metadata plugin"));
|
|
10178
10178
|
return;
|
|
10179
10179
|
}
|
|
10180
|
-
|
|
10180
|
+
resolve4(headers);
|
|
10181
10181
|
});
|
|
10182
10182
|
});
|
|
10183
10183
|
}
|
|
@@ -10230,10 +10230,10 @@ var require_call_credentials = __commonJS({
|
|
|
10230
10230
|
this.metadataGenerator = metadataGenerator;
|
|
10231
10231
|
}
|
|
10232
10232
|
generateMetadata(options2) {
|
|
10233
|
-
return new Promise((
|
|
10233
|
+
return new Promise((resolve4, reject) => {
|
|
10234
10234
|
this.metadataGenerator(options2, (err, metadata) => {
|
|
10235
10235
|
if (metadata !== void 0) {
|
|
10236
|
-
|
|
10236
|
+
resolve4(metadata);
|
|
10237
10237
|
} else {
|
|
10238
10238
|
reject(err);
|
|
10239
10239
|
}
|
|
@@ -10838,9 +10838,9 @@ var require_service_config = __commonJS({
|
|
|
10838
10838
|
throw new Error("No matching service config found");
|
|
10839
10839
|
}
|
|
10840
10840
|
function extractAndSelectServiceConfig(txtRecord, percentage) {
|
|
10841
|
-
for (const
|
|
10842
|
-
if (
|
|
10843
|
-
const recordString =
|
|
10841
|
+
for (const record3 of txtRecord) {
|
|
10842
|
+
if (record3.length > 0 && record3[0].startsWith("grpc_config=")) {
|
|
10843
|
+
const recordString = record3.join("").substring("grpc_config=".length);
|
|
10844
10844
|
const recordJson = JSON.parse(recordString);
|
|
10845
10845
|
return validateAndSelectCanaryConfig(recordJson, percentage);
|
|
10846
10846
|
}
|
|
@@ -13066,7 +13066,7 @@ var require_aspromise = __commonJS({
|
|
|
13066
13066
|
var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true;
|
|
13067
13067
|
while (index < arguments.length)
|
|
13068
13068
|
params[offset++] = arguments[index++];
|
|
13069
|
-
return new Promise(function executor(
|
|
13069
|
+
return new Promise(function executor(resolve4, reject) {
|
|
13070
13070
|
params[offset] = function callback(err) {
|
|
13071
13071
|
if (pending) {
|
|
13072
13072
|
pending = false;
|
|
@@ -13076,7 +13076,7 @@ var require_aspromise = __commonJS({
|
|
|
13076
13076
|
var params2 = new Array(arguments.length - 1), offset2 = 0;
|
|
13077
13077
|
while (offset2 < params2.length)
|
|
13078
13078
|
params2[offset2++] = arguments[offset2];
|
|
13079
|
-
|
|
13079
|
+
resolve4.apply(null, params2);
|
|
13080
13080
|
}
|
|
13081
13081
|
}
|
|
13082
13082
|
};
|
|
@@ -15618,7 +15618,7 @@ var require_path = __commonJS({
|
|
|
15618
15618
|
return prefix + parts.join("/");
|
|
15619
15619
|
}
|
|
15620
15620
|
);
|
|
15621
|
-
path.resolve = function
|
|
15621
|
+
path.resolve = function resolve4(originPath, includePath, alreadyNormalized) {
|
|
15622
15622
|
if (!alreadyNormalized)
|
|
15623
15623
|
includePath = normalize(includePath);
|
|
15624
15624
|
if (isAbsolute3(includePath))
|
|
@@ -15975,7 +15975,7 @@ var require_mapfield = __commonJS({
|
|
|
15975
15975
|
keepComments ? this.comment : void 0
|
|
15976
15976
|
]);
|
|
15977
15977
|
};
|
|
15978
|
-
MapField.prototype.resolve = function
|
|
15978
|
+
MapField.prototype.resolve = function resolve4() {
|
|
15979
15979
|
if (this.resolved)
|
|
15980
15980
|
return this;
|
|
15981
15981
|
if (types.mapKey[this.keyType] === void 0)
|
|
@@ -16052,7 +16052,7 @@ var require_method = __commonJS({
|
|
|
16052
16052
|
this.parsedOptions
|
|
16053
16053
|
]);
|
|
16054
16054
|
};
|
|
16055
|
-
Method.prototype.resolve = function
|
|
16055
|
+
Method.prototype.resolve = function resolve4() {
|
|
16056
16056
|
if (this.resolved)
|
|
16057
16057
|
return this;
|
|
16058
16058
|
this.resolvedRequestType = this.parent.lookupType(this.requestType);
|
|
@@ -17665,7 +17665,7 @@ var require_field = __commonJS({
|
|
|
17665
17665
|
keepComments ? this.comment : void 0
|
|
17666
17666
|
]);
|
|
17667
17667
|
};
|
|
17668
|
-
Field2.prototype.resolve = function
|
|
17668
|
+
Field2.prototype.resolve = function resolve4() {
|
|
17669
17669
|
if (this.resolved)
|
|
17670
17670
|
return this;
|
|
17671
17671
|
if ((this.typeDefault = types.defaults[this.type]) === void 0) {
|
|
@@ -17938,7 +17938,7 @@ var require_object = __commonJS({
|
|
|
17938
17938
|
this.parent = null;
|
|
17939
17939
|
this.resolved = false;
|
|
17940
17940
|
};
|
|
17941
|
-
ReflectionObject.prototype.resolve = function
|
|
17941
|
+
ReflectionObject.prototype.resolve = function resolve4() {
|
|
17942
17942
|
if (this.resolved)
|
|
17943
17943
|
return this;
|
|
17944
17944
|
if (this.root instanceof Root)
|
|
@@ -23475,7 +23475,7 @@ var require_http_proxy = __commonJS({
|
|
|
23475
23475
|
options2.headers = headers;
|
|
23476
23476
|
const proxyAddressString = (0, subchannel_address_1.subchannelAddressToString)(address);
|
|
23477
23477
|
trace("Using proxy " + proxyAddressString + " to connect to " + options2.path);
|
|
23478
|
-
return new Promise((
|
|
23478
|
+
return new Promise((resolve4, reject) => {
|
|
23479
23479
|
const request = http.request(options2);
|
|
23480
23480
|
request.once("connect", (res, socket, head) => {
|
|
23481
23481
|
var _a2;
|
|
@@ -23489,7 +23489,7 @@ var require_http_proxy = __commonJS({
|
|
|
23489
23489
|
const remoteHost = (_a2 = hostPort2 === null || hostPort2 === void 0 ? void 0 : hostPort2.host) !== null && _a2 !== void 0 ? _a2 : targetPath;
|
|
23490
23490
|
const cts = tls.connect(Object.assign({ host: remoteHost, servername: remoteHost, socket }, connectionOptions), () => {
|
|
23491
23491
|
trace("Successfully established a TLS connection to " + options2.path + " through proxy " + proxyAddressString);
|
|
23492
|
-
|
|
23492
|
+
resolve4({ socket: cts, realTarget: parsedTarget });
|
|
23493
23493
|
});
|
|
23494
23494
|
cts.on("error", (error3) => {
|
|
23495
23495
|
trace("Failed to establish a TLS connection to " + options2.path + " through proxy " + proxyAddressString + " with error " + error3.message);
|
|
@@ -23497,7 +23497,7 @@ var require_http_proxy = __commonJS({
|
|
|
23497
23497
|
});
|
|
23498
23498
|
} else {
|
|
23499
23499
|
trace("Successfully established a plaintext connection to " + options2.path + " through proxy " + proxyAddressString);
|
|
23500
|
-
|
|
23500
|
+
resolve4({
|
|
23501
23501
|
socket,
|
|
23502
23502
|
realTarget: parsedTarget
|
|
23503
23503
|
});
|
|
@@ -24338,7 +24338,7 @@ var require_transport = __commonJS({
|
|
|
24338
24338
|
if (this.isShutdown) {
|
|
24339
24339
|
return Promise.reject();
|
|
24340
24340
|
}
|
|
24341
|
-
return new Promise((
|
|
24341
|
+
return new Promise((resolve4, reject) => {
|
|
24342
24342
|
var _a, _b, _c;
|
|
24343
24343
|
let remoteName;
|
|
24344
24344
|
if (proxyConnectionResult.realTarget) {
|
|
@@ -24390,7 +24390,7 @@ var require_transport = __commonJS({
|
|
|
24390
24390
|
session.unref();
|
|
24391
24391
|
session.once("connect", () => {
|
|
24392
24392
|
session.removeAllListeners();
|
|
24393
|
-
|
|
24393
|
+
resolve4(new Http2Transport(session, address, options2, remoteName));
|
|
24394
24394
|
this.session = null;
|
|
24395
24395
|
});
|
|
24396
24396
|
session.once("close", () => {
|
|
@@ -24721,18 +24721,18 @@ var require_compression_filter = __commonJS({
|
|
|
24721
24721
|
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
24722
24722
|
}
|
|
24723
24723
|
compressMessage(message) {
|
|
24724
|
-
return new Promise((
|
|
24724
|
+
return new Promise((resolve4, reject) => {
|
|
24725
24725
|
zlib.deflate(message, (err, output) => {
|
|
24726
24726
|
if (err) {
|
|
24727
24727
|
reject(err);
|
|
24728
24728
|
} else {
|
|
24729
|
-
|
|
24729
|
+
resolve4(output);
|
|
24730
24730
|
}
|
|
24731
24731
|
});
|
|
24732
24732
|
});
|
|
24733
24733
|
}
|
|
24734
24734
|
decompressMessage(message) {
|
|
24735
|
-
return new Promise((
|
|
24735
|
+
return new Promise((resolve4, reject) => {
|
|
24736
24736
|
let totalLength = 0;
|
|
24737
24737
|
const messageParts = [];
|
|
24738
24738
|
const decompresser = zlib.createInflate();
|
|
@@ -24754,7 +24754,7 @@ var require_compression_filter = __commonJS({
|
|
|
24754
24754
|
}
|
|
24755
24755
|
});
|
|
24756
24756
|
decompresser.on("end", () => {
|
|
24757
|
-
|
|
24757
|
+
resolve4(Buffer.concat(messageParts));
|
|
24758
24758
|
});
|
|
24759
24759
|
decompresser.write(message);
|
|
24760
24760
|
decompresser.end();
|
|
@@ -24767,18 +24767,18 @@ var require_compression_filter = __commonJS({
|
|
|
24767
24767
|
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
24768
24768
|
}
|
|
24769
24769
|
compressMessage(message) {
|
|
24770
|
-
return new Promise((
|
|
24770
|
+
return new Promise((resolve4, reject) => {
|
|
24771
24771
|
zlib.gzip(message, (err, output) => {
|
|
24772
24772
|
if (err) {
|
|
24773
24773
|
reject(err);
|
|
24774
24774
|
} else {
|
|
24775
|
-
|
|
24775
|
+
resolve4(output);
|
|
24776
24776
|
}
|
|
24777
24777
|
});
|
|
24778
24778
|
});
|
|
24779
24779
|
}
|
|
24780
24780
|
decompressMessage(message) {
|
|
24781
|
-
return new Promise((
|
|
24781
|
+
return new Promise((resolve4, reject) => {
|
|
24782
24782
|
let totalLength = 0;
|
|
24783
24783
|
const messageParts = [];
|
|
24784
24784
|
const decompresser = zlib.createGunzip();
|
|
@@ -24800,7 +24800,7 @@ var require_compression_filter = __commonJS({
|
|
|
24800
24800
|
}
|
|
24801
24801
|
});
|
|
24802
24802
|
decompresser.on("end", () => {
|
|
24803
|
-
|
|
24803
|
+
resolve4(Buffer.concat(messageParts));
|
|
24804
24804
|
});
|
|
24805
24805
|
decompresser.write(message);
|
|
24806
24806
|
decompresser.end();
|
|
@@ -26855,7 +26855,7 @@ var require_server_call = __commonJS({
|
|
|
26855
26855
|
} else {
|
|
26856
26856
|
decompresser = zlib.createGunzip();
|
|
26857
26857
|
}
|
|
26858
|
-
return new Promise((
|
|
26858
|
+
return new Promise((resolve4, reject) => {
|
|
26859
26859
|
let totalLength = 0;
|
|
26860
26860
|
const messageParts = [];
|
|
26861
26861
|
decompresser.on("error", (error3) => {
|
|
@@ -26876,7 +26876,7 @@ var require_server_call = __commonJS({
|
|
|
26876
26876
|
}
|
|
26877
26877
|
});
|
|
26878
26878
|
decompresser.on("end", () => {
|
|
26879
|
-
|
|
26879
|
+
resolve4(Buffer.concat(messageParts));
|
|
26880
26880
|
});
|
|
26881
26881
|
decompresser.write(messageContents);
|
|
26882
26882
|
decompresser.end();
|
|
@@ -26927,7 +26927,7 @@ var require_server_call = __commonJS({
|
|
|
26927
26927
|
return metadata;
|
|
26928
26928
|
}
|
|
26929
26929
|
receiveUnaryMessage(encoding) {
|
|
26930
|
-
return new Promise((
|
|
26930
|
+
return new Promise((resolve4, reject) => {
|
|
26931
26931
|
const { stream: stream2 } = this;
|
|
26932
26932
|
let receivedLength = 0;
|
|
26933
26933
|
const call2 = this;
|
|
@@ -26971,10 +26971,10 @@ var require_server_call = __commonJS({
|
|
|
26971
26971
|
const compressedMessageEncoding = compressed ? encoding : "identity";
|
|
26972
26972
|
const decompressedMessage = call2.getDecompressedMessage(requestBytes, compressedMessageEncoding);
|
|
26973
26973
|
if (Buffer.isBuffer(decompressedMessage)) {
|
|
26974
|
-
|
|
26974
|
+
resolve4(call2.deserializeMessageWithInternalError(decompressedMessage));
|
|
26975
26975
|
return;
|
|
26976
26976
|
}
|
|
26977
|
-
decompressedMessage.then((decompressed) =>
|
|
26977
|
+
decompressedMessage.then((decompressed) => resolve4(call2.deserializeMessageWithInternalError(decompressed)), (err2) => reject(err2.code ? err2 : {
|
|
26978
26978
|
code: constants_1.Status.INTERNAL,
|
|
26979
26979
|
details: `Received "grpc-encoding" header "${encoding}" but ${encoding} decompression failed`
|
|
26980
26980
|
}));
|
|
@@ -27563,16 +27563,16 @@ var require_server2 = __commonJS({
|
|
|
27563
27563
|
addr = address;
|
|
27564
27564
|
}
|
|
27565
27565
|
const http2Server = setupServer();
|
|
27566
|
-
return new Promise((
|
|
27566
|
+
return new Promise((resolve4, reject) => {
|
|
27567
27567
|
const onError = (err) => {
|
|
27568
27568
|
this.trace("Failed to bind " + (0, subchannel_address_1.subchannelAddressToString)(address) + " with error " + err.message);
|
|
27569
|
-
|
|
27569
|
+
resolve4(err);
|
|
27570
27570
|
};
|
|
27571
27571
|
http2Server.once("error", onError);
|
|
27572
27572
|
http2Server.listen(addr, () => {
|
|
27573
27573
|
if (this.shutdown) {
|
|
27574
27574
|
http2Server.close();
|
|
27575
|
-
|
|
27575
|
+
resolve4(new Error("bindAsync failed because server is shutdown"));
|
|
27576
27576
|
return;
|
|
27577
27577
|
}
|
|
27578
27578
|
const boundAddress = http2Server.address();
|
|
@@ -27615,7 +27615,7 @@ var require_server2 = __commonJS({
|
|
|
27615
27615
|
channelzRef
|
|
27616
27616
|
});
|
|
27617
27617
|
this.trace("Successfully bound " + (0, subchannel_address_1.subchannelAddressToString)(boundSubchannelAddress));
|
|
27618
|
-
|
|
27618
|
+
resolve4("port" in boundSubchannelAddress ? boundSubchannelAddress.port : portNum);
|
|
27619
27619
|
http2Server.removeListener("error", onError);
|
|
27620
27620
|
});
|
|
27621
27621
|
});
|
|
@@ -27641,16 +27641,16 @@ var require_server2 = __commonJS({
|
|
|
27641
27641
|
}
|
|
27642
27642
|
const address = addressList[0];
|
|
27643
27643
|
const http2Server = setupServer();
|
|
27644
|
-
return new Promise((
|
|
27644
|
+
return new Promise((resolve4, reject) => {
|
|
27645
27645
|
const onError = (err) => {
|
|
27646
27646
|
this.trace("Failed to bind " + (0, subchannel_address_1.subchannelAddressToString)(address) + " with error " + err.message);
|
|
27647
|
-
|
|
27647
|
+
resolve4(bindWildcardPort(addressList.slice(1)));
|
|
27648
27648
|
};
|
|
27649
27649
|
http2Server.once("error", onError);
|
|
27650
27650
|
http2Server.listen(address, () => {
|
|
27651
27651
|
if (this.shutdown) {
|
|
27652
27652
|
http2Server.close();
|
|
27653
|
-
|
|
27653
|
+
resolve4({ port: 0, count: 0 });
|
|
27654
27654
|
return;
|
|
27655
27655
|
}
|
|
27656
27656
|
const boundAddress = http2Server.address();
|
|
@@ -27686,7 +27686,7 @@ var require_server2 = __commonJS({
|
|
|
27686
27686
|
channelzRef
|
|
27687
27687
|
});
|
|
27688
27688
|
this.trace("Successfully bound " + (0, subchannel_address_1.subchannelAddressToString)(boundSubchannelAddress));
|
|
27689
|
-
|
|
27689
|
+
resolve4(bindSpecificPort(addressList.slice(1), boundAddress.port, 1));
|
|
27690
27690
|
http2Server.removeListener("error", onError);
|
|
27691
27691
|
});
|
|
27692
27692
|
});
|
|
@@ -28167,10 +28167,10 @@ var require_duration = __commonJS({
|
|
|
28167
28167
|
exports.msToDuration = msToDuration;
|
|
28168
28168
|
exports.durationToMs = durationToMs;
|
|
28169
28169
|
exports.isDuration = isDuration;
|
|
28170
|
-
function msToDuration(
|
|
28170
|
+
function msToDuration(millis2) {
|
|
28171
28171
|
return {
|
|
28172
|
-
seconds:
|
|
28173
|
-
nanos:
|
|
28172
|
+
seconds: millis2 / 1e3 | 0,
|
|
28173
|
+
nanos: millis2 % 1e3 * 1e6 | 0
|
|
28174
28174
|
};
|
|
28175
28175
|
}
|
|
28176
28176
|
function durationToMs(duration3) {
|
|
@@ -32575,9 +32575,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
32575
32575
|
}
|
|
32576
32576
|
close(callback) {
|
|
32577
32577
|
if (callback === void 0) {
|
|
32578
|
-
return new Promise((
|
|
32578
|
+
return new Promise((resolve4, reject) => {
|
|
32579
32579
|
this.close((err, data) => {
|
|
32580
|
-
return err ? reject(err) :
|
|
32580
|
+
return err ? reject(err) : resolve4(data);
|
|
32581
32581
|
});
|
|
32582
32582
|
});
|
|
32583
32583
|
}
|
|
@@ -32615,9 +32615,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
32615
32615
|
err = null;
|
|
32616
32616
|
}
|
|
32617
32617
|
if (callback === void 0) {
|
|
32618
|
-
return new Promise((
|
|
32618
|
+
return new Promise((resolve4, reject) => {
|
|
32619
32619
|
this.destroy(err, (err2, data) => {
|
|
32620
|
-
return err2 ? reject(err2) :
|
|
32620
|
+
return err2 ? reject(err2) : resolve4(data);
|
|
32621
32621
|
});
|
|
32622
32622
|
});
|
|
32623
32623
|
}
|
|
@@ -36114,8 +36114,8 @@ var require_promise = __commonJS({
|
|
|
36114
36114
|
function createDeferredPromise() {
|
|
36115
36115
|
let res;
|
|
36116
36116
|
let rej;
|
|
36117
|
-
const promise = new Promise((
|
|
36118
|
-
res =
|
|
36117
|
+
const promise = new Promise((resolve4, reject) => {
|
|
36118
|
+
res = resolve4;
|
|
36119
36119
|
rej = reject;
|
|
36120
36120
|
});
|
|
36121
36121
|
return { promise, resolve: res, reject: rej };
|
|
@@ -37519,12 +37519,12 @@ upgrade: ${upgrade}\r
|
|
|
37519
37519
|
cb();
|
|
37520
37520
|
}
|
|
37521
37521
|
}
|
|
37522
|
-
const waitForDrain = () => new Promise((
|
|
37522
|
+
const waitForDrain = () => new Promise((resolve4, reject) => {
|
|
37523
37523
|
assert3(callback === null);
|
|
37524
37524
|
if (socket[kError]) {
|
|
37525
37525
|
reject(socket[kError]);
|
|
37526
37526
|
} else {
|
|
37527
|
-
callback =
|
|
37527
|
+
callback = resolve4;
|
|
37528
37528
|
}
|
|
37529
37529
|
});
|
|
37530
37530
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -38369,12 +38369,12 @@ var require_client_h2 = __commonJS({
|
|
|
38369
38369
|
cb();
|
|
38370
38370
|
}
|
|
38371
38371
|
}
|
|
38372
|
-
const waitForDrain = () => new Promise((
|
|
38372
|
+
const waitForDrain = () => new Promise((resolve4, reject) => {
|
|
38373
38373
|
assert3(callback === null);
|
|
38374
38374
|
if (socket[kError]) {
|
|
38375
38375
|
reject(socket[kError]);
|
|
38376
38376
|
} else {
|
|
38377
|
-
callback =
|
|
38377
|
+
callback = resolve4;
|
|
38378
38378
|
}
|
|
38379
38379
|
});
|
|
38380
38380
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -38690,16 +38690,16 @@ var require_client4 = __commonJS({
|
|
|
38690
38690
|
return this[kNeedDrain] < 2;
|
|
38691
38691
|
}
|
|
38692
38692
|
[kClose]() {
|
|
38693
|
-
return new Promise((
|
|
38693
|
+
return new Promise((resolve4) => {
|
|
38694
38694
|
if (this[kSize]) {
|
|
38695
|
-
this[kClosedResolve] =
|
|
38695
|
+
this[kClosedResolve] = resolve4;
|
|
38696
38696
|
} else {
|
|
38697
|
-
|
|
38697
|
+
resolve4(null);
|
|
38698
38698
|
}
|
|
38699
38699
|
});
|
|
38700
38700
|
}
|
|
38701
38701
|
[kDestroy](err) {
|
|
38702
|
-
return new Promise((
|
|
38702
|
+
return new Promise((resolve4) => {
|
|
38703
38703
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
38704
38704
|
for (let i = 0; i < requests.length; i++) {
|
|
38705
38705
|
const request = requests[i];
|
|
@@ -38710,7 +38710,7 @@ var require_client4 = __commonJS({
|
|
|
38710
38710
|
this[kClosedResolve]();
|
|
38711
38711
|
this[kClosedResolve] = null;
|
|
38712
38712
|
}
|
|
38713
|
-
|
|
38713
|
+
resolve4(null);
|
|
38714
38714
|
};
|
|
38715
38715
|
if (this[kHTTPContext]) {
|
|
38716
38716
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -39115,8 +39115,8 @@ var require_pool_base = __commonJS({
|
|
|
39115
39115
|
}
|
|
39116
39116
|
return Promise.all(closeAll);
|
|
39117
39117
|
} else {
|
|
39118
|
-
return new Promise((
|
|
39119
|
-
this[kClosedResolve] =
|
|
39118
|
+
return new Promise((resolve4) => {
|
|
39119
|
+
this[kClosedResolve] = resolve4;
|
|
39120
39120
|
});
|
|
39121
39121
|
}
|
|
39122
39122
|
}
|
|
@@ -40233,7 +40233,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40233
40233
|
const proxyHost = this[kProxyUrl].hostname;
|
|
40234
40234
|
const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
|
|
40235
40235
|
debug("creating SOCKS5 connection to", proxyHost, proxyPort);
|
|
40236
|
-
const socket = await new Promise((
|
|
40236
|
+
const socket = await new Promise((resolve4, reject) => {
|
|
40237
40237
|
this[kConnector]({
|
|
40238
40238
|
hostname: proxyHost,
|
|
40239
40239
|
host: proxyHost,
|
|
@@ -40243,7 +40243,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40243
40243
|
if (err) {
|
|
40244
40244
|
reject(err);
|
|
40245
40245
|
} else {
|
|
40246
|
-
|
|
40246
|
+
resolve4(socket2);
|
|
40247
40247
|
}
|
|
40248
40248
|
});
|
|
40249
40249
|
});
|
|
@@ -40253,14 +40253,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40253
40253
|
socket.destroy();
|
|
40254
40254
|
});
|
|
40255
40255
|
await socks5Client.handshake();
|
|
40256
|
-
await new Promise((
|
|
40256
|
+
await new Promise((resolve4, reject) => {
|
|
40257
40257
|
const timeout = setTimeout(() => {
|
|
40258
40258
|
reject(new Error("SOCKS5 authentication timeout"));
|
|
40259
40259
|
}, 5e3);
|
|
40260
40260
|
const onAuthenticated = () => {
|
|
40261
40261
|
clearTimeout(timeout);
|
|
40262
40262
|
socks5Client.removeListener("error", onError);
|
|
40263
|
-
|
|
40263
|
+
resolve4();
|
|
40264
40264
|
};
|
|
40265
40265
|
const onError = (err) => {
|
|
40266
40266
|
clearTimeout(timeout);
|
|
@@ -40269,14 +40269,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40269
40269
|
};
|
|
40270
40270
|
if (socks5Client.state === STATES.AUTHENTICATED) {
|
|
40271
40271
|
clearTimeout(timeout);
|
|
40272
|
-
|
|
40272
|
+
resolve4();
|
|
40273
40273
|
} else {
|
|
40274
40274
|
socks5Client.once("authenticated", onAuthenticated);
|
|
40275
40275
|
socks5Client.once("error", onError);
|
|
40276
40276
|
}
|
|
40277
40277
|
});
|
|
40278
40278
|
await socks5Client.connect(targetHost, targetPort);
|
|
40279
|
-
await new Promise((
|
|
40279
|
+
await new Promise((resolve4, reject) => {
|
|
40280
40280
|
const timeout = setTimeout(() => {
|
|
40281
40281
|
reject(new Error("SOCKS5 connection timeout"));
|
|
40282
40282
|
}, 5e3);
|
|
@@ -40284,7 +40284,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40284
40284
|
debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
|
|
40285
40285
|
clearTimeout(timeout);
|
|
40286
40286
|
socks5Client.removeListener("error", onError);
|
|
40287
|
-
|
|
40287
|
+
resolve4();
|
|
40288
40288
|
};
|
|
40289
40289
|
const onError = (err) => {
|
|
40290
40290
|
clearTimeout(timeout);
|
|
@@ -40327,8 +40327,8 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
40327
40327
|
socket,
|
|
40328
40328
|
servername: this[kRequestTls]?.servername || targetHost
|
|
40329
40329
|
});
|
|
40330
|
-
await new Promise((
|
|
40331
|
-
finalSocket.once("secureConnect",
|
|
40330
|
+
await new Promise((resolve4, reject) => {
|
|
40331
|
+
finalSocket.once("secureConnect", resolve4);
|
|
40332
40332
|
finalSocket.once("error", reject);
|
|
40333
40333
|
});
|
|
40334
40334
|
}
|
|
@@ -41384,7 +41384,7 @@ var require_readable = __commonJS({
|
|
|
41384
41384
|
if (this._readableState.closeEmitted) {
|
|
41385
41385
|
return Promise.resolve(null);
|
|
41386
41386
|
}
|
|
41387
|
-
return new Promise((
|
|
41387
|
+
return new Promise((resolve4, reject) => {
|
|
41388
41388
|
if (this[kContentLength] && this[kContentLength] > limit2 || this[kBytesRead] > limit2) {
|
|
41389
41389
|
this.destroy(new AbortError());
|
|
41390
41390
|
}
|
|
@@ -41398,11 +41398,11 @@ var require_readable = __commonJS({
|
|
|
41398
41398
|
if (signal.aborted) {
|
|
41399
41399
|
reject(signal.reason ?? new AbortError());
|
|
41400
41400
|
} else {
|
|
41401
|
-
|
|
41401
|
+
resolve4(null);
|
|
41402
41402
|
}
|
|
41403
41403
|
});
|
|
41404
41404
|
} else {
|
|
41405
|
-
this.on("close",
|
|
41405
|
+
this.on("close", resolve4);
|
|
41406
41406
|
}
|
|
41407
41407
|
this.on("error", noop2).on("data", () => {
|
|
41408
41408
|
if (this[kBytesRead] > limit2) {
|
|
@@ -41430,7 +41430,7 @@ var require_readable = __commonJS({
|
|
|
41430
41430
|
}
|
|
41431
41431
|
function consume(stream2, type) {
|
|
41432
41432
|
assert3(!stream2[kConsume]);
|
|
41433
|
-
return new Promise((
|
|
41433
|
+
return new Promise((resolve4, reject) => {
|
|
41434
41434
|
if (isUnusable(stream2)) {
|
|
41435
41435
|
const rState = stream2._readableState;
|
|
41436
41436
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -41445,7 +41445,7 @@ var require_readable = __commonJS({
|
|
|
41445
41445
|
stream2[kConsume] = {
|
|
41446
41446
|
type,
|
|
41447
41447
|
stream: stream2,
|
|
41448
|
-
resolve:
|
|
41448
|
+
resolve: resolve4,
|
|
41449
41449
|
reject,
|
|
41450
41450
|
length: 0,
|
|
41451
41451
|
body: []
|
|
@@ -41519,18 +41519,18 @@ var require_readable = __commonJS({
|
|
|
41519
41519
|
return buffer;
|
|
41520
41520
|
}
|
|
41521
41521
|
function consumeEnd(consume2, encoding) {
|
|
41522
|
-
const { type, body, resolve:
|
|
41522
|
+
const { type, body, resolve: resolve4, stream: stream2, length } = consume2;
|
|
41523
41523
|
try {
|
|
41524
41524
|
if (type === "text") {
|
|
41525
|
-
|
|
41525
|
+
resolve4(chunksDecode(body, length, encoding));
|
|
41526
41526
|
} else if (type === "json") {
|
|
41527
|
-
|
|
41527
|
+
resolve4(JSON.parse(chunksDecode(body, length, encoding)));
|
|
41528
41528
|
} else if (type === "arrayBuffer") {
|
|
41529
|
-
|
|
41529
|
+
resolve4(chunksConcat(body, length).buffer);
|
|
41530
41530
|
} else if (type === "blob") {
|
|
41531
|
-
|
|
41531
|
+
resolve4(new Blob(body, { type: stream2[kContentType] }));
|
|
41532
41532
|
} else if (type === "bytes") {
|
|
41533
|
-
|
|
41533
|
+
resolve4(chunksConcat(body, length));
|
|
41534
41534
|
}
|
|
41535
41535
|
consumeFinish(consume2);
|
|
41536
41536
|
} catch (err) {
|
|
@@ -41720,9 +41720,9 @@ var require_api_request = __commonJS({
|
|
|
41720
41720
|
};
|
|
41721
41721
|
function request(opts, callback) {
|
|
41722
41722
|
if (callback === void 0) {
|
|
41723
|
-
return new Promise((
|
|
41723
|
+
return new Promise((resolve4, reject) => {
|
|
41724
41724
|
request.call(this, opts, (err, data) => {
|
|
41725
|
-
return err ? reject(err) :
|
|
41725
|
+
return err ? reject(err) : resolve4(data);
|
|
41726
41726
|
});
|
|
41727
41727
|
});
|
|
41728
41728
|
}
|
|
@@ -41934,9 +41934,9 @@ var require_api_stream = __commonJS({
|
|
|
41934
41934
|
};
|
|
41935
41935
|
function stream2(opts, factory, callback) {
|
|
41936
41936
|
if (callback === void 0) {
|
|
41937
|
-
return new Promise((
|
|
41937
|
+
return new Promise((resolve4, reject) => {
|
|
41938
41938
|
stream2.call(this, opts, factory, (err, data) => {
|
|
41939
|
-
return err ? reject(err) :
|
|
41939
|
+
return err ? reject(err) : resolve4(data);
|
|
41940
41940
|
});
|
|
41941
41941
|
});
|
|
41942
41942
|
}
|
|
@@ -42224,9 +42224,9 @@ var require_api_upgrade = __commonJS({
|
|
|
42224
42224
|
};
|
|
42225
42225
|
function upgrade(opts, callback) {
|
|
42226
42226
|
if (callback === void 0) {
|
|
42227
|
-
return new Promise((
|
|
42227
|
+
return new Promise((resolve4, reject) => {
|
|
42228
42228
|
upgrade.call(this, opts, (err, data) => {
|
|
42229
|
-
return err ? reject(err) :
|
|
42229
|
+
return err ? reject(err) : resolve4(data);
|
|
42230
42230
|
});
|
|
42231
42231
|
});
|
|
42232
42232
|
}
|
|
@@ -42319,9 +42319,9 @@ var require_api_connect = __commonJS({
|
|
|
42319
42319
|
};
|
|
42320
42320
|
function connect(opts, callback) {
|
|
42321
42321
|
if (callback === void 0) {
|
|
42322
|
-
return new Promise((
|
|
42322
|
+
return new Promise((resolve4, reject) => {
|
|
42323
42323
|
connect.call(this, opts, (err, data) => {
|
|
42324
|
-
return err ? reject(err) :
|
|
42324
|
+
return err ? reject(err) : resolve4(data);
|
|
42325
42325
|
});
|
|
42326
42326
|
});
|
|
42327
42327
|
}
|
|
@@ -43595,7 +43595,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
43595
43595
|
"node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
43596
43596
|
"use strict";
|
|
43597
43597
|
var { writeFile, readFile: readFile2, mkdir } = __require("node:fs/promises");
|
|
43598
|
-
var { dirname, resolve:
|
|
43598
|
+
var { dirname, resolve: resolve4 } = __require("node:path");
|
|
43599
43599
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
43600
43600
|
var { InvalidArgumentError, UndiciError } = require_errors2();
|
|
43601
43601
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -43796,7 +43796,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
43796
43796
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
43797
43797
|
}
|
|
43798
43798
|
try {
|
|
43799
|
-
const data = await readFile2(
|
|
43799
|
+
const data = await readFile2(resolve4(path), "utf8");
|
|
43800
43800
|
const parsed = JSON.parse(data);
|
|
43801
43801
|
if (Array.isArray(parsed)) {
|
|
43802
43802
|
this.#snapshots.clear();
|
|
@@ -43825,7 +43825,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
43825
43825
|
if (!path) {
|
|
43826
43826
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
43827
43827
|
}
|
|
43828
|
-
const resolvedPath =
|
|
43828
|
+
const resolvedPath = resolve4(path);
|
|
43829
43829
|
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
43830
43830
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
43831
43831
|
hash,
|
|
@@ -45020,17 +45020,17 @@ var require_dns = __commonJS({
|
|
|
45020
45020
|
const timestamp = Date.now();
|
|
45021
45021
|
const records = { records: { 4: null, 6: null } };
|
|
45022
45022
|
let minTTL = this.#maxTTL;
|
|
45023
|
-
for (const
|
|
45024
|
-
|
|
45025
|
-
if (typeof
|
|
45026
|
-
|
|
45027
|
-
minTTL = Math.min(minTTL,
|
|
45023
|
+
for (const record3 of addresses) {
|
|
45024
|
+
record3.timestamp = timestamp;
|
|
45025
|
+
if (typeof record3.ttl === "number") {
|
|
45026
|
+
record3.ttl = Math.min(record3.ttl, this.#maxTTL);
|
|
45027
|
+
minTTL = Math.min(minTTL, record3.ttl);
|
|
45028
45028
|
} else {
|
|
45029
|
-
|
|
45029
|
+
record3.ttl = this.#maxTTL;
|
|
45030
45030
|
}
|
|
45031
|
-
const familyRecords = records.records[
|
|
45032
|
-
familyRecords.ips.push(
|
|
45033
|
-
records.records[
|
|
45031
|
+
const familyRecords = records.records[record3.family] ?? { ips: [] };
|
|
45032
|
+
familyRecords.ips.push(record3);
|
|
45033
|
+
records.records[record3.family] = familyRecords;
|
|
45034
45034
|
}
|
|
45035
45035
|
this.storage.set(origin.hostname, records, { ttl: minTTL });
|
|
45036
45036
|
}
|
|
@@ -51138,7 +51138,7 @@ var require_fetch2 = __commonJS({
|
|
|
51138
51138
|
const agent = fetchParams.controller.dispatcher;
|
|
51139
51139
|
const path = url.pathname + url.search;
|
|
51140
51140
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
51141
|
-
return new Promise((
|
|
51141
|
+
return new Promise((resolve4, reject) => agent.dispatch(
|
|
51142
51142
|
{
|
|
51143
51143
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
51144
51144
|
origin: url.origin,
|
|
@@ -51226,7 +51226,7 @@ var require_fetch2 = __commonJS({
|
|
|
51226
51226
|
}
|
|
51227
51227
|
}
|
|
51228
51228
|
const onError = this.onError.bind(this);
|
|
51229
|
-
|
|
51229
|
+
resolve4({
|
|
51230
51230
|
status,
|
|
51231
51231
|
statusText,
|
|
51232
51232
|
headersList,
|
|
@@ -51279,7 +51279,7 @@ var require_fetch2 = __commonJS({
|
|
|
51279
51279
|
headersList.append(headerName, String(value), true);
|
|
51280
51280
|
}
|
|
51281
51281
|
}
|
|
51282
|
-
|
|
51282
|
+
resolve4({
|
|
51283
51283
|
status,
|
|
51284
51284
|
statusText: STATUS_CODES[status],
|
|
51285
51285
|
headersList,
|
|
@@ -51303,7 +51303,7 @@ var require_fetch2 = __commonJS({
|
|
|
51303
51303
|
headersList.append(nameStr, value.toString("latin1"), true);
|
|
51304
51304
|
}
|
|
51305
51305
|
}
|
|
51306
|
-
|
|
51306
|
+
resolve4({
|
|
51307
51307
|
status,
|
|
51308
51308
|
statusText: STATUS_CODES[status],
|
|
51309
51309
|
headersList,
|
|
@@ -68350,7 +68350,7 @@ var Protocol = class {
|
|
|
68350
68350
|
return;
|
|
68351
68351
|
}
|
|
68352
68352
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
68353
|
-
await new Promise((
|
|
68353
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
68354
68354
|
options2?.signal?.throwIfAborted();
|
|
68355
68355
|
}
|
|
68356
68356
|
} catch (error3) {
|
|
@@ -68367,7 +68367,7 @@ var Protocol = class {
|
|
|
68367
68367
|
*/
|
|
68368
68368
|
request(request, resultSchema, options2) {
|
|
68369
68369
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options2 ?? {};
|
|
68370
|
-
return new Promise((
|
|
68370
|
+
return new Promise((resolve4, reject) => {
|
|
68371
68371
|
const earlyReject = (error3) => {
|
|
68372
68372
|
reject(error3);
|
|
68373
68373
|
};
|
|
@@ -68445,7 +68445,7 @@ var Protocol = class {
|
|
|
68445
68445
|
if (!parseResult.success) {
|
|
68446
68446
|
reject(parseResult.error);
|
|
68447
68447
|
} else {
|
|
68448
|
-
|
|
68448
|
+
resolve4(parseResult.data);
|
|
68449
68449
|
}
|
|
68450
68450
|
} catch (error3) {
|
|
68451
68451
|
reject(error3);
|
|
@@ -68706,12 +68706,12 @@ var Protocol = class {
|
|
|
68706
68706
|
}
|
|
68707
68707
|
} catch {
|
|
68708
68708
|
}
|
|
68709
|
-
return new Promise((
|
|
68709
|
+
return new Promise((resolve4, reject) => {
|
|
68710
68710
|
if (signal.aborted) {
|
|
68711
68711
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
68712
68712
|
return;
|
|
68713
68713
|
}
|
|
68714
|
-
const timeoutId = setTimeout(
|
|
68714
|
+
const timeoutId = setTimeout(resolve4, interval);
|
|
68715
68715
|
signal.addEventListener("abort", () => {
|
|
68716
68716
|
clearTimeout(timeoutId);
|
|
68717
68717
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -69802,7 +69802,7 @@ var McpServer = class {
|
|
|
69802
69802
|
let task = createTaskResult.task;
|
|
69803
69803
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
69804
69804
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
69805
|
-
await new Promise((
|
|
69805
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
69806
69806
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
69807
69807
|
if (!updatedTask) {
|
|
69808
69808
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -70466,12 +70466,12 @@ var StdioServerTransport = class {
|
|
|
70466
70466
|
this.onclose?.();
|
|
70467
70467
|
}
|
|
70468
70468
|
send(message) {
|
|
70469
|
-
return new Promise((
|
|
70469
|
+
return new Promise((resolve4) => {
|
|
70470
70470
|
const json = serializeMessage(message);
|
|
70471
70471
|
if (this._stdout.write(json)) {
|
|
70472
|
-
|
|
70472
|
+
resolve4();
|
|
70473
70473
|
} else {
|
|
70474
|
-
this._stdout.once("drain",
|
|
70474
|
+
this._stdout.once("drain", resolve4);
|
|
70475
70475
|
}
|
|
70476
70476
|
});
|
|
70477
70477
|
}
|
|
@@ -71337,8 +71337,8 @@ var Deferred = class {
|
|
|
71337
71337
|
};
|
|
71338
71338
|
this.resolve = () => {
|
|
71339
71339
|
};
|
|
71340
|
-
this.promise = new Promise((
|
|
71341
|
-
this.resolve =
|
|
71340
|
+
this.promise = new Promise((resolve4, reject) => {
|
|
71341
|
+
this.resolve = resolve4;
|
|
71342
71342
|
this.reject = reject;
|
|
71343
71343
|
});
|
|
71344
71344
|
}
|
|
@@ -71452,7 +71452,7 @@ function isIndexedDBAvailable() {
|
|
|
71452
71452
|
}
|
|
71453
71453
|
}
|
|
71454
71454
|
function validateIndexedDBOpenable() {
|
|
71455
|
-
return new Promise((
|
|
71455
|
+
return new Promise((resolve4, reject) => {
|
|
71456
71456
|
try {
|
|
71457
71457
|
let preExist = true;
|
|
71458
71458
|
const DB_CHECK_NAME = "validate-browser-context-for-indexeddb-analytics-module";
|
|
@@ -71462,7 +71462,7 @@ function validateIndexedDBOpenable() {
|
|
|
71462
71462
|
if (!preExist) {
|
|
71463
71463
|
self.indexedDB.deleteDatabase(DB_CHECK_NAME);
|
|
71464
71464
|
}
|
|
71465
|
-
|
|
71465
|
+
resolve4(true);
|
|
71466
71466
|
};
|
|
71467
71467
|
request.onupgradeneeded = () => {
|
|
71468
71468
|
preExist = false;
|
|
@@ -72434,13 +72434,13 @@ var transactionStoreNamesMap = /* @__PURE__ */ new WeakMap();
|
|
|
72434
72434
|
var transformCache = /* @__PURE__ */ new WeakMap();
|
|
72435
72435
|
var reverseTransformCache = /* @__PURE__ */ new WeakMap();
|
|
72436
72436
|
function promisifyRequest(request) {
|
|
72437
|
-
const promise = new Promise((
|
|
72437
|
+
const promise = new Promise((resolve4, reject) => {
|
|
72438
72438
|
const unlisten = () => {
|
|
72439
72439
|
request.removeEventListener("success", success);
|
|
72440
72440
|
request.removeEventListener("error", error3);
|
|
72441
72441
|
};
|
|
72442
72442
|
const success = () => {
|
|
72443
|
-
|
|
72443
|
+
resolve4(wrap(request.result));
|
|
72444
72444
|
unlisten();
|
|
72445
72445
|
};
|
|
72446
72446
|
const error3 = () => {
|
|
@@ -72462,14 +72462,14 @@ function promisifyRequest(request) {
|
|
|
72462
72462
|
function cacheDonePromiseForTransaction(tx) {
|
|
72463
72463
|
if (transactionDoneMap.has(tx))
|
|
72464
72464
|
return;
|
|
72465
|
-
const done = new Promise((
|
|
72465
|
+
const done = new Promise((resolve4, reject) => {
|
|
72466
72466
|
const unlisten = () => {
|
|
72467
72467
|
tx.removeEventListener("complete", complete);
|
|
72468
72468
|
tx.removeEventListener("error", error3);
|
|
72469
72469
|
tx.removeEventListener("abort", error3);
|
|
72470
72470
|
};
|
|
72471
72471
|
const complete = () => {
|
|
72472
|
-
|
|
72472
|
+
resolve4();
|
|
72473
72473
|
unlisten();
|
|
72474
72474
|
};
|
|
72475
72475
|
const error3 = () => {
|
|
@@ -74693,10 +74693,10 @@ var AuthMiddlewareQueue = class {
|
|
|
74693
74693
|
this.queue = [];
|
|
74694
74694
|
}
|
|
74695
74695
|
pushCallback(callback, onAbort) {
|
|
74696
|
-
const wrappedCallback = (user) => new Promise((
|
|
74696
|
+
const wrappedCallback = (user) => new Promise((resolve4, reject) => {
|
|
74697
74697
|
try {
|
|
74698
74698
|
const result = callback(user);
|
|
74699
|
-
|
|
74699
|
+
resolve4(result);
|
|
74700
74700
|
} catch (e) {
|
|
74701
74701
|
reject(e);
|
|
74702
74702
|
}
|
|
@@ -74890,7 +74890,7 @@ var AuthImpl = class {
|
|
|
74890
74890
|
this.frameworks = [];
|
|
74891
74891
|
this.name = app.name;
|
|
74892
74892
|
this.clientVersion = config3.sdkClientVersion;
|
|
74893
|
-
this._persistenceManagerAvailable = new Promise((
|
|
74893
|
+
this._persistenceManagerAvailable = new Promise((resolve4) => this._resolvePersistenceManagerAvailable = resolve4);
|
|
74894
74894
|
}
|
|
74895
74895
|
_initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {
|
|
74896
74896
|
if (popupRedirectResolver) {
|
|
@@ -74956,8 +74956,8 @@ var AuthImpl = class {
|
|
|
74956
74956
|
if (_isFirebaseServerApp(this.app)) {
|
|
74957
74957
|
const idToken = this.app.settings.authIdToken;
|
|
74958
74958
|
if (idToken) {
|
|
74959
|
-
return new Promise((
|
|
74960
|
-
setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(
|
|
74959
|
+
return new Promise((resolve4) => {
|
|
74960
|
+
setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(resolve4, resolve4));
|
|
74961
74961
|
});
|
|
74962
74962
|
} else {
|
|
74963
74963
|
return this.directlySetCurrentUser(null);
|
|
@@ -75140,13 +75140,13 @@ var AuthImpl = class {
|
|
|
75140
75140
|
return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error3, completed);
|
|
75141
75141
|
}
|
|
75142
75142
|
authStateReady() {
|
|
75143
|
-
return new Promise((
|
|
75143
|
+
return new Promise((resolve4, reject) => {
|
|
75144
75144
|
if (this.currentUser) {
|
|
75145
|
-
|
|
75145
|
+
resolve4();
|
|
75146
75146
|
} else {
|
|
75147
75147
|
const unsubscribe = this.onAuthStateChanged(() => {
|
|
75148
75148
|
unsubscribe();
|
|
75149
|
-
|
|
75149
|
+
resolve4();
|
|
75150
75150
|
}, reject);
|
|
75151
75151
|
}
|
|
75152
75152
|
});
|
|
@@ -75459,7 +75459,7 @@ var RecaptchaEnterpriseVerifier = class _RecaptchaEnterpriseVerifier {
|
|
|
75459
75459
|
return auth2._tenantRecaptchaConfigs[auth2.tenantId].siteKey;
|
|
75460
75460
|
}
|
|
75461
75461
|
}
|
|
75462
|
-
return new Promise(async (
|
|
75462
|
+
return new Promise(async (resolve4, reject) => {
|
|
75463
75463
|
getRecaptchaConfig(auth2, {
|
|
75464
75464
|
clientType: "CLIENT_TYPE_WEB",
|
|
75465
75465
|
version: "RECAPTCHA_ENTERPRISE"
|
|
@@ -75474,21 +75474,21 @@ var RecaptchaEnterpriseVerifier = class _RecaptchaEnterpriseVerifier {
|
|
|
75474
75474
|
} else {
|
|
75475
75475
|
auth2._tenantRecaptchaConfigs[auth2.tenantId] = config3;
|
|
75476
75476
|
}
|
|
75477
|
-
return
|
|
75477
|
+
return resolve4(config3.siteKey);
|
|
75478
75478
|
}
|
|
75479
75479
|
}).catch((error3) => {
|
|
75480
75480
|
reject(error3);
|
|
75481
75481
|
});
|
|
75482
75482
|
});
|
|
75483
75483
|
}
|
|
75484
|
-
function retrieveRecaptchaToken(siteKey,
|
|
75484
|
+
function retrieveRecaptchaToken(siteKey, resolve4, reject) {
|
|
75485
75485
|
const grecaptcha = window.grecaptcha;
|
|
75486
75486
|
if (isEnterprise(grecaptcha)) {
|
|
75487
75487
|
grecaptcha.enterprise.ready(() => {
|
|
75488
75488
|
grecaptcha.enterprise.execute(siteKey, { action }).then((token) => {
|
|
75489
|
-
|
|
75489
|
+
resolve4(token);
|
|
75490
75490
|
}).catch(() => {
|
|
75491
|
-
|
|
75491
|
+
resolve4(FAKE_TOKEN);
|
|
75492
75492
|
});
|
|
75493
75493
|
});
|
|
75494
75494
|
} else {
|
|
@@ -75499,13 +75499,13 @@ var RecaptchaEnterpriseVerifier = class _RecaptchaEnterpriseVerifier {
|
|
|
75499
75499
|
const mockRecaptcha = new MockGreCAPTCHATopLevel();
|
|
75500
75500
|
return mockRecaptcha.execute("siteKey", { action: "verify" });
|
|
75501
75501
|
}
|
|
75502
|
-
return new Promise((
|
|
75502
|
+
return new Promise((resolve4, reject) => {
|
|
75503
75503
|
retrieveSiteKey(this.auth).then(async (siteKey) => {
|
|
75504
75504
|
if (!forceRefresh && isEnterprise(window.grecaptcha) && // If download has already been initiated, do not trigger another
|
|
75505
75505
|
// download, await the promise here.
|
|
75506
75506
|
_RecaptchaEnterpriseVerifier.scriptInjectionDeferred) {
|
|
75507
75507
|
await _RecaptchaEnterpriseVerifier.scriptInjectionDeferred.promise;
|
|
75508
|
-
retrieveRecaptchaToken(siteKey,
|
|
75508
|
+
retrieveRecaptchaToken(siteKey, resolve4, reject);
|
|
75509
75509
|
} else {
|
|
75510
75510
|
if (typeof window === "undefined") {
|
|
75511
75511
|
reject(new Error("RecaptchaVerifier is only supported in browser"));
|
|
@@ -75520,7 +75520,7 @@ var RecaptchaEnterpriseVerifier = class _RecaptchaEnterpriseVerifier {
|
|
|
75520
75520
|
_RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.resolve();
|
|
75521
75521
|
};
|
|
75522
75522
|
_loadJS(url).then(() => _RecaptchaEnterpriseVerifier.scriptInjectionDeferred?.promise).then(() => {
|
|
75523
|
-
retrieveRecaptchaToken(siteKey,
|
|
75523
|
+
retrieveRecaptchaToken(siteKey, resolve4, reject);
|
|
75524
75524
|
}).catch((error3) => {
|
|
75525
75525
|
reject(error3);
|
|
75526
75526
|
});
|
|
@@ -77687,12 +77687,12 @@ var AppCheckTokenProvider = class {
|
|
|
77687
77687
|
return Promise.resolve({ token: this.serverAppAppCheckToken });
|
|
77688
77688
|
}
|
|
77689
77689
|
if (!this.appCheck) {
|
|
77690
|
-
return new Promise((
|
|
77690
|
+
return new Promise((resolve4, reject) => {
|
|
77691
77691
|
setTimeout(() => {
|
|
77692
77692
|
if (this.appCheck) {
|
|
77693
|
-
this.getToken(forceRefresh).then(
|
|
77693
|
+
this.getToken(forceRefresh).then(resolve4, reject);
|
|
77694
77694
|
} else {
|
|
77695
|
-
|
|
77695
|
+
resolve4(null);
|
|
77696
77696
|
}
|
|
77697
77697
|
}, 0);
|
|
77698
77698
|
});
|
|
@@ -77719,12 +77719,12 @@ var FirebaseAuthTokenProvider = class {
|
|
|
77719
77719
|
}
|
|
77720
77720
|
getToken(forceRefresh) {
|
|
77721
77721
|
if (!this.auth_) {
|
|
77722
|
-
return new Promise((
|
|
77722
|
+
return new Promise((resolve4, reject) => {
|
|
77723
77723
|
setTimeout(() => {
|
|
77724
77724
|
if (this.auth_) {
|
|
77725
|
-
this.getToken(forceRefresh).then(
|
|
77725
|
+
this.getToken(forceRefresh).then(resolve4, reject);
|
|
77726
77726
|
} else {
|
|
77727
|
-
|
|
77727
|
+
resolve4(null);
|
|
77728
77728
|
}
|
|
77729
77729
|
}, 0);
|
|
77730
77730
|
});
|
|
@@ -82806,9 +82806,9 @@ function writeTreeAddMerge(writeTree, path, changedChildren, writeId) {
|
|
|
82806
82806
|
}
|
|
82807
82807
|
function writeTreeGetWrite(writeTree, writeId) {
|
|
82808
82808
|
for (let i = 0; i < writeTree.allWrites.length; i++) {
|
|
82809
|
-
const
|
|
82810
|
-
if (
|
|
82811
|
-
return
|
|
82809
|
+
const record3 = writeTree.allWrites[i];
|
|
82810
|
+
if (record3.writeId === writeId) {
|
|
82811
|
+
return record3;
|
|
82812
82812
|
}
|
|
82813
82813
|
}
|
|
82814
82814
|
return null;
|
|
@@ -91750,8 +91750,8 @@ var FirestoreError = class extends FirebaseError {
|
|
|
91750
91750
|
};
|
|
91751
91751
|
var Deferred2 = class {
|
|
91752
91752
|
constructor() {
|
|
91753
|
-
this.promise = new Promise((
|
|
91754
|
-
this.resolve =
|
|
91753
|
+
this.promise = new Promise((resolve4, reject) => {
|
|
91754
|
+
this.resolve = resolve4;
|
|
91755
91755
|
this.reject = reject;
|
|
91756
91756
|
});
|
|
91757
91757
|
}
|
|
@@ -92781,19 +92781,19 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92781
92781
|
return this.wrapFailure(catchFn, this.error);
|
|
92782
92782
|
}
|
|
92783
92783
|
} else {
|
|
92784
|
-
return new _PersistencePromise((
|
|
92784
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92785
92785
|
this.nextCallback = (value) => {
|
|
92786
|
-
this.wrapSuccess(nextFn, value).next(
|
|
92786
|
+
this.wrapSuccess(nextFn, value).next(resolve4, reject);
|
|
92787
92787
|
};
|
|
92788
92788
|
this.catchCallback = (error3) => {
|
|
92789
|
-
this.wrapFailure(catchFn, error3).next(
|
|
92789
|
+
this.wrapFailure(catchFn, error3).next(resolve4, reject);
|
|
92790
92790
|
};
|
|
92791
92791
|
});
|
|
92792
92792
|
}
|
|
92793
92793
|
}
|
|
92794
92794
|
toPromise() {
|
|
92795
|
-
return new Promise((
|
|
92796
|
-
this.next(
|
|
92795
|
+
return new Promise((resolve4, reject) => {
|
|
92796
|
+
this.next(resolve4, reject);
|
|
92797
92797
|
});
|
|
92798
92798
|
}
|
|
92799
92799
|
wrapUserFunction(fn) {
|
|
@@ -92823,17 +92823,17 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92823
92823
|
}
|
|
92824
92824
|
}
|
|
92825
92825
|
static resolve(result) {
|
|
92826
|
-
return new _PersistencePromise((
|
|
92827
|
-
|
|
92826
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92827
|
+
resolve4(result);
|
|
92828
92828
|
});
|
|
92829
92829
|
}
|
|
92830
92830
|
static reject(error3) {
|
|
92831
|
-
return new _PersistencePromise((
|
|
92831
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92832
92832
|
reject(error3);
|
|
92833
92833
|
});
|
|
92834
92834
|
}
|
|
92835
92835
|
static waitFor(all) {
|
|
92836
|
-
return new _PersistencePromise((
|
|
92836
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92837
92837
|
let expectedCount = 0;
|
|
92838
92838
|
let resolvedCount = 0;
|
|
92839
92839
|
let done = false;
|
|
@@ -92842,13 +92842,13 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92842
92842
|
element.next(() => {
|
|
92843
92843
|
++resolvedCount;
|
|
92844
92844
|
if (done && resolvedCount === expectedCount) {
|
|
92845
|
-
|
|
92845
|
+
resolve4();
|
|
92846
92846
|
}
|
|
92847
92847
|
}, (err) => reject(err));
|
|
92848
92848
|
});
|
|
92849
92849
|
done = true;
|
|
92850
92850
|
if (resolvedCount === expectedCount) {
|
|
92851
|
-
|
|
92851
|
+
resolve4();
|
|
92852
92852
|
}
|
|
92853
92853
|
});
|
|
92854
92854
|
}
|
|
@@ -92882,7 +92882,7 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92882
92882
|
* Concurrently map all array elements through asynchronous function.
|
|
92883
92883
|
*/
|
|
92884
92884
|
static mapArray(array3, f) {
|
|
92885
|
-
return new _PersistencePromise((
|
|
92885
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92886
92886
|
const expectedCount = array3.length;
|
|
92887
92887
|
const results = new Array(expectedCount);
|
|
92888
92888
|
let resolvedCount = 0;
|
|
@@ -92892,7 +92892,7 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92892
92892
|
results[current] = result;
|
|
92893
92893
|
++resolvedCount;
|
|
92894
92894
|
if (resolvedCount === expectedCount) {
|
|
92895
|
-
|
|
92895
|
+
resolve4(results);
|
|
92896
92896
|
}
|
|
92897
92897
|
}, (err) => reject(err));
|
|
92898
92898
|
}
|
|
@@ -92905,14 +92905,14 @@ var PersistencePromise = class _PersistencePromise {
|
|
|
92905
92905
|
* The `action` will be called repeatedly while `condition` is true.
|
|
92906
92906
|
*/
|
|
92907
92907
|
static doWhile(condition, action) {
|
|
92908
|
-
return new _PersistencePromise((
|
|
92908
|
+
return new _PersistencePromise((resolve4, reject) => {
|
|
92909
92909
|
const process3 = () => {
|
|
92910
92910
|
if (condition() === true) {
|
|
92911
92911
|
action().next(() => {
|
|
92912
92912
|
process3();
|
|
92913
92913
|
}, reject);
|
|
92914
92914
|
} else {
|
|
92915
|
-
|
|
92915
|
+
resolve4();
|
|
92916
92916
|
}
|
|
92917
92917
|
};
|
|
92918
92918
|
process3();
|
|
@@ -97680,12 +97680,12 @@ function generateUniqueDebugId() {
|
|
|
97680
97680
|
return "0x" + lastUniqueDebugId.toString(16);
|
|
97681
97681
|
}
|
|
97682
97682
|
function nodePromise(action) {
|
|
97683
|
-
return new Promise((
|
|
97683
|
+
return new Promise((resolve4, reject) => {
|
|
97684
97684
|
action((error3, value) => {
|
|
97685
97685
|
if (error3) {
|
|
97686
97686
|
reject(error3);
|
|
97687
97687
|
} else {
|
|
97688
|
-
|
|
97688
|
+
resolve4(value);
|
|
97689
97689
|
}
|
|
97690
97690
|
});
|
|
97691
97691
|
});
|
|
@@ -108350,8 +108350,8 @@ var TIMESTAMP_MAX_MICROSECONDS = TIMESTAMP_MAX_SECONDS * MICROSECONDS_PER_SECOND
|
|
|
108350
108350
|
function isMicrosInBounds(micros) {
|
|
108351
108351
|
return micros >= TIMESTAMP_MIN_MICROSECONDS && micros <= TIMESTAMP_MAX_MICROSECONDS;
|
|
108352
108352
|
}
|
|
108353
|
-
function isMillisInBounds(
|
|
108354
|
-
return
|
|
108353
|
+
function isMillisInBounds(millis2) {
|
|
108354
|
+
return millis2 >= TIMESTAMP_MIN_MILLISECONDS && millis2 <= TIMESTAMP_MAX_MILLISECONDS;
|
|
108355
108355
|
}
|
|
108356
108356
|
function isSecondsInBounds(seconds) {
|
|
108357
108357
|
return seconds >= TIMESTAMP_MIN_SECONDS && seconds <= TIMESTAMP_MAX_SECONDS;
|
|
@@ -108483,13 +108483,13 @@ var CoreTimestampToUnixMicros = class extends TimestampToUnix {
|
|
|
108483
108483
|
var CoreTimestampToUnixMillis = class extends TimestampToUnix {
|
|
108484
108484
|
toUnix(timestamp) {
|
|
108485
108485
|
const micros = timestampToMicros(timestamp);
|
|
108486
|
-
const
|
|
108486
|
+
const millis2 = micros / BigInt(1e3);
|
|
108487
108487
|
const submillis = micros % BigInt(1e3);
|
|
108488
|
-
if (
|
|
108489
|
-
return EvaluateResult.newValue({ integerValue:
|
|
108488
|
+
if (millis2 > BigInt(0) || submillis === BigInt(0)) {
|
|
108489
|
+
return EvaluateResult.newValue({ integerValue: millis2.toString() });
|
|
108490
108490
|
} else {
|
|
108491
108491
|
return EvaluateResult.newValue({
|
|
108492
|
-
integerValue: (
|
|
108492
|
+
integerValue: (millis2 - BigInt(1)).toString()
|
|
108493
108493
|
});
|
|
108494
108494
|
}
|
|
108495
108495
|
}
|
|
@@ -115737,13 +115737,13 @@ var ContextProvider = class {
|
|
|
115737
115737
|
};
|
|
115738
115738
|
var DEFAULT_REGION = "us-central1";
|
|
115739
115739
|
var responseLineRE = /^data: (.*?)(?:\n|$)/;
|
|
115740
|
-
function failAfter(
|
|
115740
|
+
function failAfter(millis2) {
|
|
115741
115741
|
let timer = null;
|
|
115742
115742
|
return {
|
|
115743
115743
|
promise: new Promise((_, reject) => {
|
|
115744
115744
|
timer = setTimeout(() => {
|
|
115745
115745
|
reject(new FunctionsError("deadline-exceeded", "deadline-exceeded"));
|
|
115746
|
-
},
|
|
115746
|
+
}, millis2);
|
|
115747
115747
|
}),
|
|
115748
115748
|
cancel: () => {
|
|
115749
115749
|
if (timer) {
|
|
@@ -115762,9 +115762,9 @@ var FunctionsService = class {
|
|
|
115762
115762
|
this.fetchImpl = fetchImpl;
|
|
115763
115763
|
this.emulatorOrigin = null;
|
|
115764
115764
|
this.contextProvider = new ContextProvider(app, authProvider, messagingProvider, appCheckProvider);
|
|
115765
|
-
this.cancelAllRequests = new Promise((
|
|
115765
|
+
this.cancelAllRequests = new Promise((resolve4) => {
|
|
115766
115766
|
this.deleteService = () => {
|
|
115767
|
-
return Promise.resolve(
|
|
115767
|
+
return Promise.resolve(resolve4());
|
|
115768
115768
|
};
|
|
115769
115769
|
});
|
|
115770
115770
|
try {
|
|
@@ -115943,8 +115943,8 @@ async function streamAtURL(functionsInstance, url, data, options2) {
|
|
|
115943
115943
|
}
|
|
115944
115944
|
let resultResolver;
|
|
115945
115945
|
let resultRejecter;
|
|
115946
|
-
const resultPromise = new Promise((
|
|
115947
|
-
resultResolver =
|
|
115946
|
+
const resultPromise = new Promise((resolve4, reject) => {
|
|
115947
|
+
resultResolver = resolve4;
|
|
115948
115948
|
resultRejecter = reject;
|
|
115949
115949
|
});
|
|
115950
115950
|
options2?.signal?.addEventListener("abort", () => {
|
|
@@ -116231,11 +116231,11 @@ if (!env.firebase.chatDatabaseURL) {
|
|
|
116231
116231
|
}
|
|
116232
116232
|
var chatRtdb = getDatabase(firebaseApp, env.firebase.chatDatabaseURL);
|
|
116233
116233
|
async function serverNowMs(db = chatRtdb) {
|
|
116234
|
-
const offset = await new Promise((
|
|
116234
|
+
const offset = await new Promise((resolve4) => {
|
|
116235
116235
|
onValue(ref(db, ".info/serverTimeOffset"), (snap) => {
|
|
116236
116236
|
const v = snap.val();
|
|
116237
|
-
|
|
116238
|
-
}, () =>
|
|
116237
|
+
resolve4(typeof v === "number" && Number.isFinite(v) ? v : 0);
|
|
116238
|
+
}, () => resolve4(0), { onlyOnce: true });
|
|
116239
116239
|
});
|
|
116240
116240
|
return Date.now() + offset;
|
|
116241
116241
|
}
|
|
@@ -116300,7 +116300,7 @@ function sanitizeScopes(scopes) {
|
|
|
116300
116300
|
}
|
|
116301
116301
|
|
|
116302
116302
|
// build/version.js
|
|
116303
|
-
var OKO_MCP_VERSION = "0.
|
|
116303
|
+
var OKO_MCP_VERSION = "0.14.1";
|
|
116304
116304
|
|
|
116305
116305
|
// build/auth.js
|
|
116306
116306
|
var state = null;
|
|
@@ -116944,11 +116944,11 @@ function serverFetchRefusal(error3) {
|
|
|
116944
116944
|
return null;
|
|
116945
116945
|
const details = error3.details;
|
|
116946
116946
|
if (details && typeof details === "object" && details.code === "REMOTE_FETCH_FAILED") {
|
|
116947
|
-
const
|
|
116947
|
+
const record3 = details;
|
|
116948
116948
|
const fallbackMessage = String(error3.message ?? "the server could not fetch the URL");
|
|
116949
116949
|
return {
|
|
116950
|
-
reason: typeof
|
|
116951
|
-
message: typeof
|
|
116950
|
+
reason: typeof record3.reason === "string" ? record3.reason : "unknown",
|
|
116951
|
+
message: typeof record3.message === "string" ? record3.message : fallbackMessage
|
|
116952
116952
|
};
|
|
116953
116953
|
}
|
|
116954
116954
|
const code = error3.code;
|
|
@@ -117327,7 +117327,7 @@ function imageVariantStatus(eventId, eventData, kind, cardId, elapsedMs) {
|
|
|
117327
117327
|
};
|
|
117328
117328
|
}
|
|
117329
117329
|
function sleep(ms) {
|
|
117330
|
-
return new Promise((
|
|
117330
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
117331
117331
|
}
|
|
117332
117332
|
async function waitForImageVariantTargets(uid, eventId, targets, timeoutSec) {
|
|
117333
117333
|
const startedAt = Date.now();
|
|
@@ -117610,13 +117610,24 @@ var notificationsMarkOutputSchema = external_exports.object({
|
|
|
117610
117610
|
markedRead: external_exports.number().int().nonnegative(),
|
|
117611
117611
|
notificationIds: external_exports.array(external_exports.string())
|
|
117612
117612
|
}).passthrough();
|
|
117613
|
+
var FORM_FIELD_TYPES = ["text", "tel", "email", "textarea", "select", "checkbox"];
|
|
117613
117614
|
var formFieldSchema = external_exports.object({
|
|
117614
117615
|
id: external_exports.string().min(1).optional(),
|
|
117615
117616
|
label: external_exports.string().max(120),
|
|
117616
|
-
type: external_exports.enum(
|
|
117617
|
+
type: external_exports.enum(FORM_FIELD_TYPES).default("text").describe("text | tel | email | textarea answer with free text; select (one answer) and checkbox (several) answer with one of `options`."),
|
|
117617
117618
|
required: external_exports.boolean().default(false),
|
|
117618
|
-
placeholder: external_exports.string().max(160).nullable().optional()
|
|
117619
|
-
|
|
117619
|
+
placeholder: external_exports.string().max(160).nullable().optional(),
|
|
117620
|
+
options: external_exports.array(external_exports.string().trim().min(1).max(80)).max(20).optional().describe("Choices of a select or checkbox field: 1\u201320 unique option texts. The lead stores the option text itself \u2014 a string for select, an array of strings for checkbox.")
|
|
117621
|
+
}).strict().superRefine((field2, ctx) => {
|
|
117622
|
+
const choice = field2.type === "select" || field2.type === "checkbox";
|
|
117623
|
+
const count = new Set(field2.options ?? []).size;
|
|
117624
|
+
if (choice && count === 0) {
|
|
117625
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["options"], message: `A ${field2.type} field needs at least one option.` });
|
|
117626
|
+
}
|
|
117627
|
+
if (!choice && field2.options !== void 0) {
|
|
117628
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["options"], message: `options belong to select or checkbox fields only; this field is ${field2.type}.` });
|
|
117629
|
+
}
|
|
117630
|
+
});
|
|
117620
117631
|
var formSchema = external_exports.object({
|
|
117621
117632
|
id: external_exports.string().min(1).optional(),
|
|
117622
117633
|
title: external_exports.string().max(160).nullable().optional(),
|
|
@@ -118008,8 +118019,8 @@ function parseTimestampCursor(cursor) {
|
|
|
118008
118019
|
const separator = cursor.indexOf("|");
|
|
118009
118020
|
const head = separator === -1 ? cursor : cursor.slice(0, separator);
|
|
118010
118021
|
const docId = separator === -1 ? "" : cursor.slice(separator + 1);
|
|
118011
|
-
const
|
|
118012
|
-
const at = Number.isFinite(
|
|
118022
|
+
const millis2 = Number(head);
|
|
118023
|
+
const at = Number.isFinite(millis2) && millis2 > 0 ? millis2 : Date.parse(head);
|
|
118013
118024
|
if (!Number.isFinite(at)) {
|
|
118014
118025
|
throw new Error("Invalid cursor. Use the nextCursor value returned by the previous page.");
|
|
118015
118026
|
}
|
|
@@ -118017,10 +118028,10 @@ function parseTimestampCursor(cursor) {
|
|
|
118017
118028
|
return docId ? [boundary, docId] : [boundary];
|
|
118018
118029
|
}
|
|
118019
118030
|
function timestampCursorFrom(value, docId) {
|
|
118020
|
-
const
|
|
118021
|
-
if (
|
|
118031
|
+
const millis2 = toMillis(value);
|
|
118032
|
+
if (millis2 == null)
|
|
118022
118033
|
return null;
|
|
118023
|
-
return docId ? `${
|
|
118034
|
+
return docId ? `${millis2}|${docId}` : String(millis2);
|
|
118024
118035
|
}
|
|
118025
118036
|
var ISO_WITH_OFFSET = /(?:Z|[+-]\d{2}:?\d{2})$/;
|
|
118026
118037
|
function parseIsoBound(value, label) {
|
|
@@ -118092,10 +118103,10 @@ function formatSeconds(value) {
|
|
|
118092
118103
|
return `${m}m ${String(s).padStart(2, "0")}s`;
|
|
118093
118104
|
}
|
|
118094
118105
|
function formatDateTime(value) {
|
|
118095
|
-
const
|
|
118096
|
-
if (
|
|
118106
|
+
const millis2 = toMillis(value);
|
|
118107
|
+
if (millis2 == null)
|
|
118097
118108
|
return "n/a";
|
|
118098
|
-
return new Date(
|
|
118109
|
+
return new Date(millis2).toISOString();
|
|
118099
118110
|
}
|
|
118100
118111
|
function markdownMetric(label, value, suffix = "") {
|
|
118101
118112
|
const metric = value === null || value === void 0 || value === "" ? "n/a" : String(value);
|
|
@@ -118552,8 +118563,67 @@ function eventRuntimeHint(runtime) {
|
|
|
118552
118563
|
];
|
|
118553
118564
|
}
|
|
118554
118565
|
|
|
118566
|
+
// build/tools/liveLayer.js
|
|
118567
|
+
var LIVE_FIELDS_HINT = "blocks.promoBanner.visibility, blocks.primaryCta.visibility, blocks.cards.visibility and blocks.video.placeholder.enabled are SETUP values. What viewers see right now is `live.<block>.visibleNow` \u2014 `decidedBy` says whether a live override (oko_set_block_visibility) or the setup default decided it. For the chat, `live.chat.accepting` is whether viewers can send a message right now; `blocks.chat.intake` is only the starting state. The live badge and the active analytics session are not resolved here: read oko_get_live_state (ctrl.liveBadge, ctrl.activeSessionId).";
|
|
118568
|
+
var LIVE_UNREADABLE_HINT = "blocks.*.visibility and .enabled above are SETUP values, not what viewers see now \u2014 and the live overrides could not be read with this key (they need analytics:read or live:control). Do not report a block as shown or hidden from these fields; read oko_get_live_state with a key that holds the scope.";
|
|
118569
|
+
function record2(value) {
|
|
118570
|
+
return value && typeof value === "object" ? value : {};
|
|
118571
|
+
}
|
|
118572
|
+
function millis(value) {
|
|
118573
|
+
if (typeof value === "number")
|
|
118574
|
+
return value;
|
|
118575
|
+
if (value && typeof value === "object" && typeof value.toMillis === "function") {
|
|
118576
|
+
return value.toMillis();
|
|
118577
|
+
}
|
|
118578
|
+
return null;
|
|
118579
|
+
}
|
|
118580
|
+
function resolve3(enabled, setupVisibility, override, scheduledForFuture = false) {
|
|
118581
|
+
if (!enabled)
|
|
118582
|
+
return { enabled: false, visibleNow: false, decidedBy: "setup: disabled" };
|
|
118583
|
+
if (typeof override === "boolean")
|
|
118584
|
+
return { enabled: true, visibleNow: override, decidedBy: "live override" };
|
|
118585
|
+
if (scheduledForFuture)
|
|
118586
|
+
return { enabled: true, visibleNow: false, decidedBy: "setup schedule" };
|
|
118587
|
+
return { enabled: true, visibleNow: setupVisibility !== "hidden", decidedBy: "setup default" };
|
|
118588
|
+
}
|
|
118589
|
+
async function readLiveLayer(eventId, data, nowMs) {
|
|
118590
|
+
const blocks = record2(data.blocks);
|
|
118591
|
+
let ctrl;
|
|
118592
|
+
try {
|
|
118593
|
+
ctrl = record2((await get(ref(rtdb, `events/${eventId}/ctrl`))).val());
|
|
118594
|
+
} catch {
|
|
118595
|
+
return { live: null, hints: [LIVE_UNREADABLE_HINT] };
|
|
118596
|
+
}
|
|
118597
|
+
const banner = record2(blocks.promoBanner);
|
|
118598
|
+
const cta = record2(blocks.primaryCta);
|
|
118599
|
+
const cards = record2(blocks.cards);
|
|
118600
|
+
const placeholder = record2(record2(blocks.video).placeholder);
|
|
118601
|
+
const chat = record2(blocks.chat);
|
|
118602
|
+
const showAt = millis(banner.showAt);
|
|
118603
|
+
let accepting = null;
|
|
118604
|
+
try {
|
|
118605
|
+
const mode = (await get(ref(chatRtdb, `settings/${eventId}/mode`))).val();
|
|
118606
|
+
accepting = mode !== "off";
|
|
118607
|
+
} catch {
|
|
118608
|
+
accepting = null;
|
|
118609
|
+
}
|
|
118610
|
+
const live = {
|
|
118611
|
+
readAt: new Date(nowMs).toISOString(),
|
|
118612
|
+
banner: resolve3(banner.enabled === true, banner.visibility, ctrl.bannerVisible, showAt !== null && showAt > nowMs),
|
|
118613
|
+
cta: resolve3(cta.enabled === true, cta.visibility, ctrl.ctaVisible),
|
|
118614
|
+
cards: resolve3(cards.enabled === true, cards.visibility, ctrl.cardsVisible),
|
|
118615
|
+
placeholder: resolve3(placeholder.enabled === true, "always", ctrl.placeholderVisible),
|
|
118616
|
+
chat: { panel: chat.enabled === true, accepting }
|
|
118617
|
+
};
|
|
118618
|
+
const hints = [LIVE_FIELDS_HINT];
|
|
118619
|
+
if (accepting === null) {
|
|
118620
|
+
hints.push("live.chat.accepting could not be read with this key; oko_get_live_state reports it when the key holds analytics:read.");
|
|
118621
|
+
}
|
|
118622
|
+
return { live, hints };
|
|
118623
|
+
}
|
|
118624
|
+
|
|
118555
118625
|
// build/tools/setupValidation.js
|
|
118556
|
-
function validateEventSetup(eventId, event) {
|
|
118626
|
+
function validateEventSetup(eventId, event, nowMs = Date.now()) {
|
|
118557
118627
|
const errors = [];
|
|
118558
118628
|
const warnings = [];
|
|
118559
118629
|
const suggestions = [];
|
|
@@ -118574,7 +118644,7 @@ function validateEventSetup(eventId, event) {
|
|
|
118574
118644
|
const eventDateMs = toMillis(meta2.eventDate);
|
|
118575
118645
|
if (eventDateMs == null) {
|
|
118576
118646
|
add(suggestions, "date_missing", "meta.eventDate", "Add the webinar date/time if it is known.");
|
|
118577
|
-
} else if (eventDateMs <
|
|
118647
|
+
} else if (eventDateMs < nowMs - 60 * 60 * 1e3) {
|
|
118578
118648
|
add(warnings, "date_in_past", "meta.eventDate", "Configured webinar date appears to be in the past.");
|
|
118579
118649
|
}
|
|
118580
118650
|
if (scheduleMissesDate(event.analyticsSessionMode, meta2.eventDate)) {
|
|
@@ -118593,6 +118663,16 @@ function validateEventSetup(eventId, event) {
|
|
|
118593
118663
|
const fields = Array.isArray(form.fields) ? form.fields : [];
|
|
118594
118664
|
if (fields.length === 0)
|
|
118595
118665
|
add(warnings, "form_fields_missing", `forms[${index}].fields`, "Lead form has no fields.");
|
|
118666
|
+
fields.forEach((rawField, fieldIndex) => {
|
|
118667
|
+
const field2 = asRecord(rawField);
|
|
118668
|
+
const type = safeString(field2.type);
|
|
118669
|
+
if (type !== "select" && type !== "checkbox")
|
|
118670
|
+
return;
|
|
118671
|
+
const options2 = Array.isArray(field2.options) ? field2.options : [];
|
|
118672
|
+
if (!options2.some((item) => typeof item === "string" && item.trim())) {
|
|
118673
|
+
add(errors, "form_field_options_missing", `forms[${index}].fields[${fieldIndex}].options`, `A ${type} field has no options, so the viewer sees an empty list. Add at least one option or change the field type.`);
|
|
118674
|
+
}
|
|
118675
|
+
});
|
|
118596
118676
|
});
|
|
118597
118677
|
for (const id of duplicateFormIds)
|
|
118598
118678
|
add(errors, "form_id_duplicate", "forms", `Duplicate form id: ${id}.`);
|
|
@@ -118756,7 +118836,7 @@ function registerEventTools(server2) {
|
|
|
118756
118836
|
"limit: maximum events to return, default 30, max 100.",
|
|
118757
118837
|
"cursor: pagination cursor returned as nextCursor by the previous page; reuse it with the same filters.",
|
|
118758
118838
|
"workspaceId: optional workspace filter.",
|
|
118759
|
-
'detail: "compact" (default) returns the light card projection; "full" returns event documents without the access composition,
|
|
118839
|
+
'detail: "compact" (default) returns the light card projection; "full" returns event documents without the access composition \u2014 the setup document of oko_get_event, but WITHOUT its `live` layer (what viewers see now).',
|
|
118760
118840
|
"from/to: optional ISO timestamps bounding meta.eventDate; sorting switches to eventDate descending and undated events are excluded."
|
|
118761
118841
|
],
|
|
118762
118842
|
returns: "events plus count, limit, hasMore/has_more, nextCursor/next_cursor.",
|
|
@@ -118817,7 +118897,7 @@ function registerEventTools(server2) {
|
|
|
118817
118897
|
return { id: item.id, ...data };
|
|
118818
118898
|
});
|
|
118819
118899
|
}
|
|
118820
|
-
const projectionHint = args.detail === "compact" ? { hints: ['Compact rows are a projection rebuilt after each change and can lag the event by seconds (title, date, permissions). For fields that must be current, call oko_get_event or use detail="full".'] } : {};
|
|
118900
|
+
const projectionHint = args.detail === "compact" ? { hints: ['Compact rows are a projection rebuilt after each change and can lag the event by seconds (title, date, permissions). For fields that must be current, call oko_get_event or use detail="full".'] } : { hints: ["Full documents carry SETUP values only: blocks.*.visibility / .enabled are defaults, not what viewers see now, and there is no `live` layer here. To report whether a block is shown right now, call oko_get_event for that event and read live.<block>.visibleNow."] };
|
|
118821
118901
|
return textResult({ events, ...cursorMeta(events.length, args.limit, hasMore, nextCursor), ...projectionHint }, { truncationHint: 'Use a smaller limit, cursor pagination, or detail="compact".' });
|
|
118822
118902
|
}
|
|
118823
118903
|
throw new Error("Event list not received: the eventAccess index returned an empty result.");
|
|
@@ -118827,9 +118907,10 @@ function registerEventTools(server2) {
|
|
|
118827
118907
|
description: toolDescription({
|
|
118828
118908
|
summary: "Read one OKO event visible to the organizer.",
|
|
118829
118909
|
args: ["eventId: OKO event document id."],
|
|
118830
|
-
returns: "event document fields plus id
|
|
118831
|
-
examples: ["Use after oko_create_webinar to verify setup and return the event URL to the user."],
|
|
118910
|
+
returns: "event document fields plus id, public event URL, and `live` \u2014 what viewers see RIGHT NOW per block (banner, cta, cards, placeholder: enabled, visibleNow, decidedBy; chat: panel, accepting), resolved from the live overrides on top of setup. The event's access composition (the historical uid arrays) is never returned; ask oko_list_workspace_access for who has access.",
|
|
118911
|
+
examples: ["Use after oko_create_webinar to verify setup and return the event URL to the user.", 'To answer "is the banner shown to viewers now?" read live.banner.visibleNow, never blocks.promoBanner.visibility.'],
|
|
118832
118912
|
notes: [
|
|
118913
|
+
"blocks.promoBanner.visibility, blocks.primaryCta.visibility, blocks.cards.visibility and blocks.video.placeholder.enabled are SETUP values \u2014 the default a block starts with. A live override (oko_set_block_visibility, or the organizer's switch in analytics) replaces it without touching setup, so these fields do not say what viewers see now: `live.<block>.visibleNow` does, with `decidedBy` naming the layer that decided. oko_get_live_state shows the raw overrides (ctrl.bannerVisible and so on).",
|
|
118833
118914
|
"blocks.chat: the panel exists exactly when blocks.chat.enabled is true (false HIDES the panel; messages are kept for 90 days and come back when it is enabled again). Message intake is ONE live state \u2014 oko_set_chat_mode reads and writes it; blocks.chat.intake is only the STARTING state an untouched event has (closed by default, or open), and blocks.chat.openOnSessionStart / closeOnSessionEnd are two triggers that flip that same state when an analytics session starts or ends. blocks.chat.mode and blocks.chat.visibility are legacy and read by nobody \u2014 ignore those two."
|
|
118834
118915
|
]
|
|
118835
118916
|
}),
|
|
@@ -118839,10 +118920,13 @@ function registerEventTools(server2) {
|
|
|
118839
118920
|
}, async ({ eventId }) => {
|
|
118840
118921
|
const { uid } = await authed(["events:read"]);
|
|
118841
118922
|
const data = await readEvent(eventId, uid, "read");
|
|
118923
|
+
const { live, hints } = await readLiveLayer(eventId, data, await serverNowMs());
|
|
118842
118924
|
return textResult({
|
|
118843
118925
|
id: eventId,
|
|
118844
118926
|
...serialize(eventDocumentForOutput(data)),
|
|
118845
|
-
...eventLinks(eventId)
|
|
118927
|
+
...eventLinks(eventId),
|
|
118928
|
+
live,
|
|
118929
|
+
hints
|
|
118846
118930
|
});
|
|
118847
118931
|
});
|
|
118848
118932
|
server2.registerTool("oko_validate_event_setup", {
|
|
@@ -118863,7 +118947,7 @@ function registerEventTools(server2) {
|
|
|
118863
118947
|
}, async ({ eventId }) => {
|
|
118864
118948
|
const { uid } = await authed(["events:read"]);
|
|
118865
118949
|
const data = await readEvent(eventId, uid, "read");
|
|
118866
|
-
return textResult(validateEventSetup(eventId, data));
|
|
118950
|
+
return textResult(validateEventSetup(eventId, data, await serverNowMs()));
|
|
118867
118951
|
});
|
|
118868
118952
|
server2.registerTool("oko_create_webinar", {
|
|
118869
118953
|
title: "Create webinar",
|
|
@@ -119093,7 +119177,11 @@ function registerEventTools(server2) {
|
|
|
119093
119177
|
label: field2.label.trim(),
|
|
119094
119178
|
type: field2.type,
|
|
119095
119179
|
required: field2.required === true,
|
|
119096
|
-
placeholder: field2.placeholder?.trim() || null
|
|
119180
|
+
placeholder: field2.placeholder?.trim() || null,
|
|
119181
|
+
// Options are written for choice types only (the schema refuses them
|
|
119182
|
+
// elsewhere); duplicates collapse, order is kept — the viewer sees the
|
|
119183
|
+
// list in this order and a checkbox answer is stored in it.
|
|
119184
|
+
...field2.type === "select" || field2.type === "checkbox" ? { options: [...new Set((field2.options ?? []).map((option) => option.trim()).filter(Boolean))] } : {}
|
|
119097
119185
|
}))
|
|
119098
119186
|
}));
|
|
119099
119187
|
Object.assign(patch, telegramPatch);
|
|
@@ -119531,6 +119619,26 @@ function scopeRejectionResult(toolName, scope) {
|
|
|
119531
119619
|
isError: true
|
|
119532
119620
|
};
|
|
119533
119621
|
}
|
|
119622
|
+
function isRtdbPermissionDenied(error3) {
|
|
119623
|
+
return Boolean(error3 && typeof error3 === "object" && error3.code === "PERMISSION_DENIED");
|
|
119624
|
+
}
|
|
119625
|
+
function livePermissionRejectionResult(toolName, args) {
|
|
119626
|
+
const ids = idsFromArgs(args);
|
|
119627
|
+
return {
|
|
119628
|
+
...textResult({
|
|
119629
|
+
errorCode: "LIVE_PERMISSION_REQUIRED",
|
|
119630
|
+
tool: toolName,
|
|
119631
|
+
...ids,
|
|
119632
|
+
message: "OKO refused this live action: the organizer behind this key is neither the owner of the event nor a member of its workspace with the permission this action needs (control live \u2014 for block switches, the live badge, viewer refresh and sessions; moderate chat \u2014 for chat moderation). Nothing was changed. Live actions follow the event's workspace rights; platform-owner rights do not apply through MCP, because a key always acts as an organizer.",
|
|
119633
|
+
whatToDo: [
|
|
119634
|
+
"Ask the event owner to add this organizer to the event's workspace with that permission (OKO cabinet \u2192 workspace \u2192 members), then repeat the call.",
|
|
119635
|
+
"Do not retry as is and do not change parameters: rules do not change between attempts.",
|
|
119636
|
+
"Anyone who already holds the permission on this event can do the same thing in the OKO cabinet right now (analytics screen or chat panel)."
|
|
119637
|
+
]
|
|
119638
|
+
}),
|
|
119639
|
+
isError: true
|
|
119640
|
+
};
|
|
119641
|
+
}
|
|
119534
119642
|
function platformRejectionResult(toolName, args, readOnly) {
|
|
119535
119643
|
const ids = idsFromArgs(args);
|
|
119536
119644
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -119631,6 +119739,8 @@ function installToolInstrumentation(server2) {
|
|
|
119631
119739
|
await recordToolAudit(name7, "error", handlerArgs[0], startedAt, error3);
|
|
119632
119740
|
if (error3 instanceof OkoScopeError)
|
|
119633
119741
|
return withUpdateNotice(scopeRejectionResult(name7, error3.scope));
|
|
119742
|
+
if (!readOnly && isRtdbPermissionDenied(error3))
|
|
119743
|
+
return withUpdateNotice(livePermissionRejectionResult(name7, handlerArgs[0]));
|
|
119634
119744
|
if (isFirestorePermissionDenied(error3))
|
|
119635
119745
|
return withUpdateNotice(platformRejectionResult(name7, handlerArgs[0], readOnly));
|
|
119636
119746
|
throw error3;
|
|
@@ -119664,7 +119774,7 @@ function registerLeadTools(server2) {
|
|
|
119664
119774
|
"limit: max rows, default 50, max 200.",
|
|
119665
119775
|
"cursor: lead document id returned as nextCursor by the previous page."
|
|
119666
119776
|
],
|
|
119667
|
-
returns: "leads or csv plus count, limit, hasMore/has_more, nextCursor/next_cursor. Without formId the rows are newest-first across pages; with formId they are newest-first WITHIN a page only, because paging there follows document ids \u2014 to rank one form's submissions by time, read every page and sort by submittedAt.",
|
|
119777
|
+
returns: "leads or csv plus count, limit, hasMore/has_more, nextCursor/next_cursor. A lead's values are keyed by field id: a checkbox field answers with an array of option texts, every other field with a string (in the CSV both sit inside valuesJson). Without formId the rows are newest-first across pages; with formId they are newest-first WITHIN a page only, because paging there follows document ids \u2014 to rank one form's submissions by time, read every page and sort by submittedAt.",
|
|
119668
119778
|
examples: ["Use formId to export one form; if Firestore requests an index, create it from the error link and rerun."]
|
|
119669
119779
|
}),
|
|
119670
119780
|
inputSchema: {
|
|
@@ -119927,7 +120037,7 @@ function registerLiveTools(server2) {
|
|
|
119927
120037
|
description: toolDescription({
|
|
119928
120038
|
summary: "Read main RTDB live controls, aggregate analytics, and chat settings for an event.",
|
|
119929
120039
|
args: ["eventId: event to inspect."],
|
|
119930
|
-
returns: "eventId, agg metrics, ctrl live overrides, and chat settings (mode, slowModeMs, automodEnabled, allowViewerLinks, plus accepting \u2014 whether message intake is open right now, as the server enforces it). ctrl.chatMode is the live control for message intake: public, off, or absent (then the event's starting state blocks.chat.intake applies and accepting shows the result).",
|
|
120040
|
+
returns: "eventId, agg metrics, ctrl live overrides, and chat settings (mode, slowModeMs, automodEnabled, allowViewerLinks, plus accepting \u2014 whether message intake is open right now, as the server enforces it). ctrl.chatMode is the live control for message intake: public, off, or absent (then the event's starting state blocks.chat.intake applies and accepting shows the result). ctrl.<block>Visible is an override; when it is absent the block follows its setup default \u2014 oko_get_event \u2192 live gives the resolved visibleNow per block.",
|
|
119931
120041
|
examples: ["Use during a webinar before changing live block visibility or starting/ending sessions."],
|
|
119932
120042
|
notes: [
|
|
119933
120043
|
"Live state does not carry the event team: to see who has access to an event and with which permissions, use oko_list_workspace_access on the event's workspace."
|
|
@@ -119951,7 +120061,15 @@ function registerLiveTools(server2) {
|
|
|
119951
120061
|
chat[field2] = value;
|
|
119952
120062
|
});
|
|
119953
120063
|
chat.accepting = chat.mode !== "off";
|
|
119954
|
-
return textResult({
|
|
120064
|
+
return textResult({
|
|
120065
|
+
eventId,
|
|
120066
|
+
agg: aggSnap.val() ?? {},
|
|
120067
|
+
ctrl: ctrlSnap.val() ?? {},
|
|
120068
|
+
chat,
|
|
120069
|
+
hints: [
|
|
120070
|
+
"ctrl holds live OVERRIDES only: a missing ctrl.bannerVisible / ctaVisible / cardsVisible / placeholderVisible means no override \u2014 the block follows its setup default, it is not hidden. For the resolved answer per block (visibleNow and which layer decided) read oko_get_event \u2192 live."
|
|
120071
|
+
]
|
|
120072
|
+
});
|
|
119955
120073
|
});
|
|
119956
120074
|
server2.registerTool("oko_set_block_visibility", {
|
|
119957
120075
|
title: "Set live block visibility",
|