kollab 0.1.22 → 0.1.23
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/index.js +217 -82
- package/dist/kollab-sidecar.cjs +532 -393
- package/package.json +1 -1
package/dist/kollab-sidecar.cjs
CHANGED
|
@@ -18332,7 +18332,7 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18332
18332
|
}
|
|
18333
18333
|
return "";
|
|
18334
18334
|
};
|
|
18335
|
-
this.send = function(
|
|
18335
|
+
this.send = function(data2) {
|
|
18336
18336
|
if (this.readyState != this.OPENED) {
|
|
18337
18337
|
throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");
|
|
18338
18338
|
}
|
|
@@ -18364,13 +18364,13 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18364
18364
|
throw new Error("XMLHttpRequest: Only GET method is supported");
|
|
18365
18365
|
}
|
|
18366
18366
|
if (settings.async) {
|
|
18367
|
-
fs12.readFile(unescape(url3.pathname), function(error62,
|
|
18367
|
+
fs12.readFile(unescape(url3.pathname), function(error62, data3) {
|
|
18368
18368
|
if (error62) {
|
|
18369
18369
|
self.handleError(error62, error62.errno || -1);
|
|
18370
18370
|
} else {
|
|
18371
18371
|
self.status = 200;
|
|
18372
|
-
self.responseText =
|
|
18373
|
-
self.response =
|
|
18372
|
+
self.responseText = data3.toString("utf8");
|
|
18373
|
+
self.response = data3;
|
|
18374
18374
|
setState(self.DONE);
|
|
18375
18375
|
}
|
|
18376
18376
|
});
|
|
@@ -18400,9 +18400,9 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18400
18400
|
headers["Authorization"] = "Basic " + authBuf.toString("base64");
|
|
18401
18401
|
}
|
|
18402
18402
|
if (settings.method === "GET" || settings.method === "HEAD") {
|
|
18403
|
-
|
|
18404
|
-
} else if (
|
|
18405
|
-
headers["Content-Length"] = Buffer.isBuffer(
|
|
18403
|
+
data2 = null;
|
|
18404
|
+
} else if (data2) {
|
|
18405
|
+
headers["Content-Length"] = Buffer.isBuffer(data2) ? data2.length : Buffer.byteLength(data2);
|
|
18406
18406
|
var headersKeys = Object.keys(headers);
|
|
18407
18407
|
if (!headersKeys.some(function(h) {
|
|
18408
18408
|
return h.toLowerCase() === "content-type";
|
|
@@ -18465,8 +18465,8 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18465
18465
|
self.status = response.statusCode;
|
|
18466
18466
|
response.on("data", function(chunk) {
|
|
18467
18467
|
if (chunk) {
|
|
18468
|
-
var
|
|
18469
|
-
self.response = Buffer.concat([self.response,
|
|
18468
|
+
var data3 = Buffer.from(chunk);
|
|
18469
|
+
self.response = Buffer.concat([self.response, data3]);
|
|
18470
18470
|
}
|
|
18471
18471
|
if (sendFlag) {
|
|
18472
18472
|
setState(self.LOADING);
|
|
@@ -18494,8 +18494,8 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18494
18494
|
socket.unref();
|
|
18495
18495
|
});
|
|
18496
18496
|
}
|
|
18497
|
-
if (
|
|
18498
|
-
request2.write(
|
|
18497
|
+
if (data2) {
|
|
18498
|
+
request2.write(data2);
|
|
18499
18499
|
}
|
|
18500
18500
|
request2.end();
|
|
18501
18501
|
self.dispatchEvent("loadstart");
|
|
@@ -18503,7 +18503,7 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
18503
18503
|
var contentFile = ".node-xmlhttprequest-content-" + process.pid;
|
|
18504
18504
|
var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
|
|
18505
18505
|
fs12.writeFileSync(syncFile, "", "utf8");
|
|
18506
|
-
var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (
|
|
18506
|
+
var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (data2 ? "req.write('" + JSON.stringify(data2).slice(1, -1).replace(/'/g, "\\'") + "');" : "") + "req.end();";
|
|
18507
18507
|
var syncProc = spawn3(process.argv[0], ["-e", execString]);
|
|
18508
18508
|
var statusText;
|
|
18509
18509
|
while (fs12.existsSync(syncFile)) {
|
|
@@ -19326,16 +19326,16 @@ var require_buffer_util = __commonJS({
|
|
|
19326
19326
|
}
|
|
19327
19327
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
19328
19328
|
}
|
|
19329
|
-
function toBuffer2(
|
|
19329
|
+
function toBuffer2(data2) {
|
|
19330
19330
|
toBuffer2.readOnly = true;
|
|
19331
|
-
if (Buffer.isBuffer(
|
|
19331
|
+
if (Buffer.isBuffer(data2)) return data2;
|
|
19332
19332
|
let buf;
|
|
19333
|
-
if (
|
|
19334
|
-
buf = new FastBuffer(
|
|
19335
|
-
} else if (ArrayBuffer.isView(
|
|
19336
|
-
buf = new FastBuffer(
|
|
19333
|
+
if (data2 instanceof ArrayBuffer) {
|
|
19334
|
+
buf = new FastBuffer(data2);
|
|
19335
|
+
} else if (ArrayBuffer.isView(data2)) {
|
|
19336
|
+
buf = new FastBuffer(data2.buffer, data2.byteOffset, data2.byteLength);
|
|
19337
19337
|
} else {
|
|
19338
|
-
buf = Buffer.from(
|
|
19338
|
+
buf = Buffer.from(data2);
|
|
19339
19339
|
toBuffer2.readOnly = false;
|
|
19340
19340
|
}
|
|
19341
19341
|
return buf;
|
|
@@ -19651,9 +19651,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
19651
19651
|
* @param {Function} callback Callback
|
|
19652
19652
|
* @public
|
|
19653
19653
|
*/
|
|
19654
|
-
decompress(
|
|
19654
|
+
decompress(data2, fin, callback) {
|
|
19655
19655
|
zlibLimiter.add((done) => {
|
|
19656
|
-
this._decompress(
|
|
19656
|
+
this._decompress(data2, fin, (err, result) => {
|
|
19657
19657
|
done();
|
|
19658
19658
|
callback(err, result);
|
|
19659
19659
|
});
|
|
@@ -19667,9 +19667,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
19667
19667
|
* @param {Function} callback Callback
|
|
19668
19668
|
* @public
|
|
19669
19669
|
*/
|
|
19670
|
-
compress(
|
|
19670
|
+
compress(data2, fin, callback) {
|
|
19671
19671
|
zlibLimiter.add((done) => {
|
|
19672
|
-
this._compress(
|
|
19672
|
+
this._compress(data2, fin, (err, result) => {
|
|
19673
19673
|
done();
|
|
19674
19674
|
callback(err, result);
|
|
19675
19675
|
});
|
|
@@ -19683,7 +19683,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19683
19683
|
* @param {Function} callback Callback
|
|
19684
19684
|
* @private
|
|
19685
19685
|
*/
|
|
19686
|
-
_decompress(
|
|
19686
|
+
_decompress(data2, fin, callback) {
|
|
19687
19687
|
const endpoint = this._isServer ? "client" : "server";
|
|
19688
19688
|
if (!this._inflate) {
|
|
19689
19689
|
const key = `${endpoint}_max_window_bits`;
|
|
@@ -19699,7 +19699,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19699
19699
|
this._inflate.on("data", inflateOnData);
|
|
19700
19700
|
}
|
|
19701
19701
|
this._inflate[kCallback] = callback;
|
|
19702
|
-
this._inflate.write(
|
|
19702
|
+
this._inflate.write(data2);
|
|
19703
19703
|
if (fin) this._inflate.write(TRAILER);
|
|
19704
19704
|
this._inflate.flush(() => {
|
|
19705
19705
|
const err = this._inflate[kError];
|
|
@@ -19709,7 +19709,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19709
19709
|
callback(err);
|
|
19710
19710
|
return;
|
|
19711
19711
|
}
|
|
19712
|
-
const
|
|
19712
|
+
const data3 = bufferUtil.concat(
|
|
19713
19713
|
this._inflate[kBuffers],
|
|
19714
19714
|
this._inflate[kTotalLength]
|
|
19715
19715
|
);
|
|
@@ -19723,7 +19723,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19723
19723
|
this._inflate.reset();
|
|
19724
19724
|
}
|
|
19725
19725
|
}
|
|
19726
|
-
callback(null,
|
|
19726
|
+
callback(null, data3);
|
|
19727
19727
|
});
|
|
19728
19728
|
}
|
|
19729
19729
|
/**
|
|
@@ -19734,7 +19734,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19734
19734
|
* @param {Function} callback Callback
|
|
19735
19735
|
* @private
|
|
19736
19736
|
*/
|
|
19737
|
-
_compress(
|
|
19737
|
+
_compress(data2, fin, callback) {
|
|
19738
19738
|
const endpoint = this._isServer ? "server" : "client";
|
|
19739
19739
|
if (!this._deflate) {
|
|
19740
19740
|
const key = `${endpoint}_max_window_bits`;
|
|
@@ -19748,17 +19748,17 @@ var require_permessage_deflate = __commonJS({
|
|
|
19748
19748
|
this._deflate.on("data", deflateOnData);
|
|
19749
19749
|
}
|
|
19750
19750
|
this._deflate[kCallback] = callback;
|
|
19751
|
-
this._deflate.write(
|
|
19751
|
+
this._deflate.write(data2);
|
|
19752
19752
|
this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
|
|
19753
19753
|
if (!this._deflate) {
|
|
19754
19754
|
return;
|
|
19755
19755
|
}
|
|
19756
|
-
let
|
|
19756
|
+
let data3 = bufferUtil.concat(
|
|
19757
19757
|
this._deflate[kBuffers],
|
|
19758
19758
|
this._deflate[kTotalLength]
|
|
19759
19759
|
);
|
|
19760
19760
|
if (fin) {
|
|
19761
|
-
|
|
19761
|
+
data3 = new FastBuffer(data3.buffer, data3.byteOffset, data3.length - 4);
|
|
19762
19762
|
}
|
|
19763
19763
|
this._deflate[kCallback] = null;
|
|
19764
19764
|
this._deflate[kTotalLength] = 0;
|
|
@@ -19766,7 +19766,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
19766
19766
|
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
19767
19767
|
this._deflate.reset();
|
|
19768
19768
|
}
|
|
19769
|
-
callback(null,
|
|
19769
|
+
callback(null, data3);
|
|
19770
19770
|
});
|
|
19771
19771
|
}
|
|
19772
19772
|
};
|
|
@@ -20403,19 +20403,19 @@ var require_receiver = __commonJS({
|
|
|
20403
20403
|
* @private
|
|
20404
20404
|
*/
|
|
20405
20405
|
getData(cb) {
|
|
20406
|
-
let
|
|
20406
|
+
let data2 = EMPTY_BUFFER;
|
|
20407
20407
|
if (this._payloadLength) {
|
|
20408
20408
|
if (this._bufferedBytes < this._payloadLength) {
|
|
20409
20409
|
this._loop = false;
|
|
20410
20410
|
return;
|
|
20411
20411
|
}
|
|
20412
|
-
|
|
20412
|
+
data2 = this.consume(this._payloadLength);
|
|
20413
20413
|
if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) {
|
|
20414
|
-
unmask(
|
|
20414
|
+
unmask(data2, this._mask);
|
|
20415
20415
|
}
|
|
20416
20416
|
}
|
|
20417
20417
|
if (this._opcode > 7) {
|
|
20418
|
-
this.controlMessage(
|
|
20418
|
+
this.controlMessage(data2, cb);
|
|
20419
20419
|
return;
|
|
20420
20420
|
}
|
|
20421
20421
|
if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
|
|
@@ -20431,12 +20431,12 @@ var require_receiver = __commonJS({
|
|
|
20431
20431
|
}
|
|
20432
20432
|
if (this._compressed) {
|
|
20433
20433
|
this._state = INFLATING;
|
|
20434
|
-
this.decompress(
|
|
20434
|
+
this.decompress(data2, cb);
|
|
20435
20435
|
return;
|
|
20436
20436
|
}
|
|
20437
|
-
if (
|
|
20437
|
+
if (data2.length) {
|
|
20438
20438
|
this._messageLength = this._totalPayloadLength;
|
|
20439
|
-
this._fragments.push(
|
|
20439
|
+
this._fragments.push(data2);
|
|
20440
20440
|
}
|
|
20441
20441
|
this.dataMessage(cb);
|
|
20442
20442
|
}
|
|
@@ -20447,9 +20447,9 @@ var require_receiver = __commonJS({
|
|
|
20447
20447
|
* @param {Function} cb Callback
|
|
20448
20448
|
* @private
|
|
20449
20449
|
*/
|
|
20450
|
-
decompress(
|
|
20450
|
+
decompress(data2, cb) {
|
|
20451
20451
|
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
20452
|
-
perMessageDeflate.decompress(
|
|
20452
|
+
perMessageDeflate.decompress(data2, this._fin, (err, buf) => {
|
|
20453
20453
|
if (err) return cb(err);
|
|
20454
20454
|
if (buf.length) {
|
|
20455
20455
|
this._messageLength += buf.length;
|
|
@@ -20489,23 +20489,23 @@ var require_receiver = __commonJS({
|
|
|
20489
20489
|
this._numFragments = 0;
|
|
20490
20490
|
this._fragments = [];
|
|
20491
20491
|
if (this._opcode === 2) {
|
|
20492
|
-
let
|
|
20492
|
+
let data2;
|
|
20493
20493
|
if (this._binaryType === "nodebuffer") {
|
|
20494
|
-
|
|
20494
|
+
data2 = concat(fragments, messageLength);
|
|
20495
20495
|
} else if (this._binaryType === "arraybuffer") {
|
|
20496
|
-
|
|
20496
|
+
data2 = toArrayBuffer(concat(fragments, messageLength));
|
|
20497
20497
|
} else if (this._binaryType === "blob") {
|
|
20498
|
-
|
|
20498
|
+
data2 = new Blob(fragments);
|
|
20499
20499
|
} else {
|
|
20500
|
-
|
|
20500
|
+
data2 = fragments;
|
|
20501
20501
|
}
|
|
20502
20502
|
if (this._allowSynchronousEvents) {
|
|
20503
|
-
this.emit("message",
|
|
20503
|
+
this.emit("message", data2, true);
|
|
20504
20504
|
this._state = GET_INFO;
|
|
20505
20505
|
} else {
|
|
20506
20506
|
this._state = DEFER_EVENT;
|
|
20507
20507
|
setImmediate(() => {
|
|
20508
|
-
this.emit("message",
|
|
20508
|
+
this.emit("message", data2, true);
|
|
20509
20509
|
this._state = GET_INFO;
|
|
20510
20510
|
this.startLoop(cb);
|
|
20511
20511
|
});
|
|
@@ -20543,14 +20543,14 @@ var require_receiver = __commonJS({
|
|
|
20543
20543
|
* @return {(Error|RangeError|undefined)} A possible error
|
|
20544
20544
|
* @private
|
|
20545
20545
|
*/
|
|
20546
|
-
controlMessage(
|
|
20546
|
+
controlMessage(data2, cb) {
|
|
20547
20547
|
if (this._opcode === 8) {
|
|
20548
|
-
if (
|
|
20548
|
+
if (data2.length === 0) {
|
|
20549
20549
|
this._loop = false;
|
|
20550
20550
|
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
20551
20551
|
this.end();
|
|
20552
20552
|
} else {
|
|
20553
|
-
const code =
|
|
20553
|
+
const code = data2.readUInt16BE(0);
|
|
20554
20554
|
if (!isValidStatusCode(code)) {
|
|
20555
20555
|
const error62 = this.createError(
|
|
20556
20556
|
RangeError,
|
|
@@ -20563,9 +20563,9 @@ var require_receiver = __commonJS({
|
|
|
20563
20563
|
return;
|
|
20564
20564
|
}
|
|
20565
20565
|
const buf = new FastBuffer(
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
20566
|
+
data2.buffer,
|
|
20567
|
+
data2.byteOffset + 2,
|
|
20568
|
+
data2.length - 2
|
|
20569
20569
|
);
|
|
20570
20570
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
20571
20571
|
const error62 = this.createError(
|
|
@@ -20586,12 +20586,12 @@ var require_receiver = __commonJS({
|
|
|
20586
20586
|
return;
|
|
20587
20587
|
}
|
|
20588
20588
|
if (this._allowSynchronousEvents) {
|
|
20589
|
-
this.emit(this._opcode === 9 ? "ping" : "pong",
|
|
20589
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data2);
|
|
20590
20590
|
this._state = GET_INFO;
|
|
20591
20591
|
} else {
|
|
20592
20592
|
this._state = DEFER_EVENT;
|
|
20593
20593
|
setImmediate(() => {
|
|
20594
|
-
this.emit(this._opcode === 9 ? "ping" : "pong",
|
|
20594
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data2);
|
|
20595
20595
|
this._state = GET_INFO;
|
|
20596
20596
|
this.startLoop(cb);
|
|
20597
20597
|
});
|
|
@@ -20692,7 +20692,7 @@ var require_sender = __commonJS({
|
|
|
20692
20692
|
* @return {(Buffer|String)[]} The framed data
|
|
20693
20693
|
* @public
|
|
20694
20694
|
*/
|
|
20695
|
-
static frame(
|
|
20695
|
+
static frame(data2, options) {
|
|
20696
20696
|
let mask;
|
|
20697
20697
|
let merge2 = false;
|
|
20698
20698
|
let offset = 2;
|
|
@@ -20718,15 +20718,15 @@ var require_sender = __commonJS({
|
|
|
20718
20718
|
offset = 6;
|
|
20719
20719
|
}
|
|
20720
20720
|
let dataLength;
|
|
20721
|
-
if (typeof
|
|
20721
|
+
if (typeof data2 === "string") {
|
|
20722
20722
|
if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) {
|
|
20723
20723
|
dataLength = options[kByteLength];
|
|
20724
20724
|
} else {
|
|
20725
|
-
|
|
20726
|
-
dataLength =
|
|
20725
|
+
data2 = Buffer.from(data2);
|
|
20726
|
+
dataLength = data2.length;
|
|
20727
20727
|
}
|
|
20728
20728
|
} else {
|
|
20729
|
-
dataLength =
|
|
20729
|
+
dataLength = data2.length;
|
|
20730
20730
|
merge2 = options.mask && options.readOnly && !skipMasking;
|
|
20731
20731
|
}
|
|
20732
20732
|
let payloadLength = dataLength;
|
|
@@ -20747,19 +20747,19 @@ var require_sender = __commonJS({
|
|
|
20747
20747
|
target[2] = target[3] = 0;
|
|
20748
20748
|
target.writeUIntBE(dataLength, 4, 6);
|
|
20749
20749
|
}
|
|
20750
|
-
if (!options.mask) return [target,
|
|
20750
|
+
if (!options.mask) return [target, data2];
|
|
20751
20751
|
target[1] |= 128;
|
|
20752
20752
|
target[offset - 4] = mask[0];
|
|
20753
20753
|
target[offset - 3] = mask[1];
|
|
20754
20754
|
target[offset - 2] = mask[2];
|
|
20755
20755
|
target[offset - 1] = mask[3];
|
|
20756
|
-
if (skipMasking) return [target,
|
|
20756
|
+
if (skipMasking) return [target, data2];
|
|
20757
20757
|
if (merge2) {
|
|
20758
|
-
applyMask(
|
|
20758
|
+
applyMask(data2, mask, target, offset, dataLength);
|
|
20759
20759
|
return [target];
|
|
20760
20760
|
}
|
|
20761
|
-
applyMask(
|
|
20762
|
-
return [target,
|
|
20761
|
+
applyMask(data2, mask, data2, 0, dataLength);
|
|
20762
|
+
return [target, data2];
|
|
20763
20763
|
}
|
|
20764
20764
|
/**
|
|
20765
20765
|
* Sends a close message to the other peer.
|
|
@@ -20770,26 +20770,26 @@ var require_sender = __commonJS({
|
|
|
20770
20770
|
* @param {Function} [cb] Callback
|
|
20771
20771
|
* @public
|
|
20772
20772
|
*/
|
|
20773
|
-
close(code,
|
|
20773
|
+
close(code, data2, mask, cb) {
|
|
20774
20774
|
let buf;
|
|
20775
20775
|
if (code === void 0) {
|
|
20776
20776
|
buf = EMPTY_BUFFER;
|
|
20777
20777
|
} else if (typeof code !== "number" || !isValidStatusCode(code)) {
|
|
20778
20778
|
throw new TypeError("First argument must be a valid error code number");
|
|
20779
|
-
} else if (
|
|
20779
|
+
} else if (data2 === void 0 || !data2.length) {
|
|
20780
20780
|
buf = Buffer.allocUnsafe(2);
|
|
20781
20781
|
buf.writeUInt16BE(code, 0);
|
|
20782
20782
|
} else {
|
|
20783
|
-
const length = Buffer.byteLength(
|
|
20783
|
+
const length = Buffer.byteLength(data2);
|
|
20784
20784
|
if (length > 123) {
|
|
20785
20785
|
throw new RangeError("The message must not be greater than 123 bytes");
|
|
20786
20786
|
}
|
|
20787
20787
|
buf = Buffer.allocUnsafe(2 + length);
|
|
20788
20788
|
buf.writeUInt16BE(code, 0);
|
|
20789
|
-
if (typeof
|
|
20790
|
-
buf.write(
|
|
20791
|
-
} else if (isUint8Array(
|
|
20792
|
-
buf.set(
|
|
20789
|
+
if (typeof data2 === "string") {
|
|
20790
|
+
buf.write(data2, 2);
|
|
20791
|
+
} else if (isUint8Array(data2)) {
|
|
20792
|
+
buf.set(data2, 2);
|
|
20793
20793
|
} else {
|
|
20794
20794
|
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
20795
20795
|
}
|
|
@@ -20818,18 +20818,18 @@ var require_sender = __commonJS({
|
|
|
20818
20818
|
* @param {Function} [cb] Callback
|
|
20819
20819
|
* @public
|
|
20820
20820
|
*/
|
|
20821
|
-
ping(
|
|
20821
|
+
ping(data2, mask, cb) {
|
|
20822
20822
|
let byteLength2;
|
|
20823
20823
|
let readOnly;
|
|
20824
|
-
if (typeof
|
|
20825
|
-
byteLength2 = Buffer.byteLength(
|
|
20824
|
+
if (typeof data2 === "string") {
|
|
20825
|
+
byteLength2 = Buffer.byteLength(data2);
|
|
20826
20826
|
readOnly = false;
|
|
20827
|
-
} else if (isBlob(
|
|
20828
|
-
byteLength2 =
|
|
20827
|
+
} else if (isBlob(data2)) {
|
|
20828
|
+
byteLength2 = data2.size;
|
|
20829
20829
|
readOnly = false;
|
|
20830
20830
|
} else {
|
|
20831
|
-
|
|
20832
|
-
byteLength2 =
|
|
20831
|
+
data2 = toBuffer2(data2);
|
|
20832
|
+
byteLength2 = data2.length;
|
|
20833
20833
|
readOnly = toBuffer2.readOnly;
|
|
20834
20834
|
}
|
|
20835
20835
|
if (byteLength2 > 125) {
|
|
@@ -20845,16 +20845,16 @@ var require_sender = __commonJS({
|
|
|
20845
20845
|
readOnly,
|
|
20846
20846
|
rsv1: false
|
|
20847
20847
|
};
|
|
20848
|
-
if (isBlob(
|
|
20848
|
+
if (isBlob(data2)) {
|
|
20849
20849
|
if (this._state !== DEFAULT) {
|
|
20850
|
-
this.enqueue([this.getBlobData,
|
|
20850
|
+
this.enqueue([this.getBlobData, data2, false, options, cb]);
|
|
20851
20851
|
} else {
|
|
20852
|
-
this.getBlobData(
|
|
20852
|
+
this.getBlobData(data2, false, options, cb);
|
|
20853
20853
|
}
|
|
20854
20854
|
} else if (this._state !== DEFAULT) {
|
|
20855
|
-
this.enqueue([this.dispatch,
|
|
20855
|
+
this.enqueue([this.dispatch, data2, false, options, cb]);
|
|
20856
20856
|
} else {
|
|
20857
|
-
this.sendFrame(_Sender.frame(
|
|
20857
|
+
this.sendFrame(_Sender.frame(data2, options), cb);
|
|
20858
20858
|
}
|
|
20859
20859
|
}
|
|
20860
20860
|
/**
|
|
@@ -20865,18 +20865,18 @@ var require_sender = __commonJS({
|
|
|
20865
20865
|
* @param {Function} [cb] Callback
|
|
20866
20866
|
* @public
|
|
20867
20867
|
*/
|
|
20868
|
-
pong(
|
|
20868
|
+
pong(data2, mask, cb) {
|
|
20869
20869
|
let byteLength2;
|
|
20870
20870
|
let readOnly;
|
|
20871
|
-
if (typeof
|
|
20872
|
-
byteLength2 = Buffer.byteLength(
|
|
20871
|
+
if (typeof data2 === "string") {
|
|
20872
|
+
byteLength2 = Buffer.byteLength(data2);
|
|
20873
20873
|
readOnly = false;
|
|
20874
|
-
} else if (isBlob(
|
|
20875
|
-
byteLength2 =
|
|
20874
|
+
} else if (isBlob(data2)) {
|
|
20875
|
+
byteLength2 = data2.size;
|
|
20876
20876
|
readOnly = false;
|
|
20877
20877
|
} else {
|
|
20878
|
-
|
|
20879
|
-
byteLength2 =
|
|
20878
|
+
data2 = toBuffer2(data2);
|
|
20879
|
+
byteLength2 = data2.length;
|
|
20880
20880
|
readOnly = toBuffer2.readOnly;
|
|
20881
20881
|
}
|
|
20882
20882
|
if (byteLength2 > 125) {
|
|
@@ -20892,16 +20892,16 @@ var require_sender = __commonJS({
|
|
|
20892
20892
|
readOnly,
|
|
20893
20893
|
rsv1: false
|
|
20894
20894
|
};
|
|
20895
|
-
if (isBlob(
|
|
20895
|
+
if (isBlob(data2)) {
|
|
20896
20896
|
if (this._state !== DEFAULT) {
|
|
20897
|
-
this.enqueue([this.getBlobData,
|
|
20897
|
+
this.enqueue([this.getBlobData, data2, false, options, cb]);
|
|
20898
20898
|
} else {
|
|
20899
|
-
this.getBlobData(
|
|
20899
|
+
this.getBlobData(data2, false, options, cb);
|
|
20900
20900
|
}
|
|
20901
20901
|
} else if (this._state !== DEFAULT) {
|
|
20902
|
-
this.enqueue([this.dispatch,
|
|
20902
|
+
this.enqueue([this.dispatch, data2, false, options, cb]);
|
|
20903
20903
|
} else {
|
|
20904
|
-
this.sendFrame(_Sender.frame(
|
|
20904
|
+
this.sendFrame(_Sender.frame(data2, options), cb);
|
|
20905
20905
|
}
|
|
20906
20906
|
}
|
|
20907
20907
|
/**
|
|
@@ -20920,21 +20920,21 @@ var require_sender = __commonJS({
|
|
|
20920
20920
|
* @param {Function} [cb] Callback
|
|
20921
20921
|
* @public
|
|
20922
20922
|
*/
|
|
20923
|
-
send(
|
|
20923
|
+
send(data2, options, cb) {
|
|
20924
20924
|
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
20925
20925
|
let opcode = options.binary ? 2 : 1;
|
|
20926
20926
|
let rsv1 = options.compress;
|
|
20927
20927
|
let byteLength2;
|
|
20928
20928
|
let readOnly;
|
|
20929
|
-
if (typeof
|
|
20930
|
-
byteLength2 = Buffer.byteLength(
|
|
20929
|
+
if (typeof data2 === "string") {
|
|
20930
|
+
byteLength2 = Buffer.byteLength(data2);
|
|
20931
20931
|
readOnly = false;
|
|
20932
|
-
} else if (isBlob(
|
|
20933
|
-
byteLength2 =
|
|
20932
|
+
} else if (isBlob(data2)) {
|
|
20933
|
+
byteLength2 = data2.size;
|
|
20934
20934
|
readOnly = false;
|
|
20935
20935
|
} else {
|
|
20936
|
-
|
|
20937
|
-
byteLength2 =
|
|
20936
|
+
data2 = toBuffer2(data2);
|
|
20937
|
+
byteLength2 = data2.length;
|
|
20938
20938
|
readOnly = toBuffer2.readOnly;
|
|
20939
20939
|
}
|
|
20940
20940
|
if (this._firstFragment) {
|
|
@@ -20958,16 +20958,16 @@ var require_sender = __commonJS({
|
|
|
20958
20958
|
readOnly,
|
|
20959
20959
|
rsv1
|
|
20960
20960
|
};
|
|
20961
|
-
if (isBlob(
|
|
20961
|
+
if (isBlob(data2)) {
|
|
20962
20962
|
if (this._state !== DEFAULT) {
|
|
20963
|
-
this.enqueue([this.getBlobData,
|
|
20963
|
+
this.enqueue([this.getBlobData, data2, this._compress, opts, cb]);
|
|
20964
20964
|
} else {
|
|
20965
|
-
this.getBlobData(
|
|
20965
|
+
this.getBlobData(data2, this._compress, opts, cb);
|
|
20966
20966
|
}
|
|
20967
20967
|
} else if (this._state !== DEFAULT) {
|
|
20968
|
-
this.enqueue([this.dispatch,
|
|
20968
|
+
this.enqueue([this.dispatch, data2, this._compress, opts, cb]);
|
|
20969
20969
|
} else {
|
|
20970
|
-
this.dispatch(
|
|
20970
|
+
this.dispatch(data2, this._compress, opts, cb);
|
|
20971
20971
|
}
|
|
20972
20972
|
}
|
|
20973
20973
|
/**
|
|
@@ -21005,13 +21005,13 @@ var require_sender = __commonJS({
|
|
|
21005
21005
|
return;
|
|
21006
21006
|
}
|
|
21007
21007
|
this._bufferedBytes -= options[kByteLength];
|
|
21008
|
-
const
|
|
21008
|
+
const data2 = toBuffer2(arrayBuffer);
|
|
21009
21009
|
if (!compress) {
|
|
21010
21010
|
this._state = DEFAULT;
|
|
21011
|
-
this.sendFrame(_Sender.frame(
|
|
21011
|
+
this.sendFrame(_Sender.frame(data2, options), cb);
|
|
21012
21012
|
this.dequeue();
|
|
21013
21013
|
} else {
|
|
21014
|
-
this.dispatch(
|
|
21014
|
+
this.dispatch(data2, compress, options, cb);
|
|
21015
21015
|
}
|
|
21016
21016
|
}).catch((err) => {
|
|
21017
21017
|
process.nextTick(onError, this, err, cb);
|
|
@@ -21040,15 +21040,15 @@ var require_sender = __commonJS({
|
|
|
21040
21040
|
* @param {Function} [cb] Callback
|
|
21041
21041
|
* @private
|
|
21042
21042
|
*/
|
|
21043
|
-
dispatch(
|
|
21043
|
+
dispatch(data2, compress, options, cb) {
|
|
21044
21044
|
if (!compress) {
|
|
21045
|
-
this.sendFrame(_Sender.frame(
|
|
21045
|
+
this.sendFrame(_Sender.frame(data2, options), cb);
|
|
21046
21046
|
return;
|
|
21047
21047
|
}
|
|
21048
21048
|
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
21049
21049
|
this._bufferedBytes += options[kByteLength];
|
|
21050
21050
|
this._state = DEFLATING;
|
|
21051
|
-
perMessageDeflate.compress(
|
|
21051
|
+
perMessageDeflate.compress(data2, options.fin, (_, buf) => {
|
|
21052
21052
|
if (this._socket.destroyed) {
|
|
21053
21053
|
const err = new Error(
|
|
21054
21054
|
"The socket was closed while data was being compressed"
|
|
@@ -21273,9 +21273,9 @@ var require_event_target = __commonJS({
|
|
|
21273
21273
|
}
|
|
21274
21274
|
let wrapper;
|
|
21275
21275
|
if (type === "message") {
|
|
21276
|
-
wrapper = function onMessage(
|
|
21276
|
+
wrapper = function onMessage(data2, isBinary2) {
|
|
21277
21277
|
const event = new MessageEvent("message", {
|
|
21278
|
-
data: isBinary2 ?
|
|
21278
|
+
data: isBinary2 ? data2 : data2.toString()
|
|
21279
21279
|
});
|
|
21280
21280
|
event[kTarget] = this;
|
|
21281
21281
|
callListener(handler, this, event);
|
|
@@ -21757,7 +21757,7 @@ var require_websocket = __commonJS({
|
|
|
21757
21757
|
* closing
|
|
21758
21758
|
* @public
|
|
21759
21759
|
*/
|
|
21760
|
-
close(code,
|
|
21760
|
+
close(code, data2) {
|
|
21761
21761
|
if (this.readyState === _WebSocket.CLOSED) return;
|
|
21762
21762
|
if (this.readyState === _WebSocket.CONNECTING) {
|
|
21763
21763
|
const msg = "WebSocket was closed before the connection was established";
|
|
@@ -21771,7 +21771,7 @@ var require_websocket = __commonJS({
|
|
|
21771
21771
|
return;
|
|
21772
21772
|
}
|
|
21773
21773
|
this._readyState = _WebSocket.CLOSING;
|
|
21774
|
-
this._sender.close(code,
|
|
21774
|
+
this._sender.close(code, data2, !this._isServer, (err) => {
|
|
21775
21775
|
if (err) return;
|
|
21776
21776
|
this._closeFrameSent = true;
|
|
21777
21777
|
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) {
|
|
@@ -21800,24 +21800,24 @@ var require_websocket = __commonJS({
|
|
|
21800
21800
|
* @param {Function} [cb] Callback which is executed when the ping is sent
|
|
21801
21801
|
* @public
|
|
21802
21802
|
*/
|
|
21803
|
-
ping(
|
|
21803
|
+
ping(data2, mask, cb) {
|
|
21804
21804
|
if (this.readyState === _WebSocket.CONNECTING) {
|
|
21805
21805
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
21806
21806
|
}
|
|
21807
|
-
if (typeof
|
|
21808
|
-
cb =
|
|
21809
|
-
|
|
21807
|
+
if (typeof data2 === "function") {
|
|
21808
|
+
cb = data2;
|
|
21809
|
+
data2 = mask = void 0;
|
|
21810
21810
|
} else if (typeof mask === "function") {
|
|
21811
21811
|
cb = mask;
|
|
21812
21812
|
mask = void 0;
|
|
21813
21813
|
}
|
|
21814
|
-
if (typeof
|
|
21814
|
+
if (typeof data2 === "number") data2 = data2.toString();
|
|
21815
21815
|
if (this.readyState !== _WebSocket.OPEN) {
|
|
21816
|
-
sendAfterClose(this,
|
|
21816
|
+
sendAfterClose(this, data2, cb);
|
|
21817
21817
|
return;
|
|
21818
21818
|
}
|
|
21819
21819
|
if (mask === void 0) mask = !this._isServer;
|
|
21820
|
-
this._sender.ping(
|
|
21820
|
+
this._sender.ping(data2 || EMPTY_BUFFER, mask, cb);
|
|
21821
21821
|
}
|
|
21822
21822
|
/**
|
|
21823
21823
|
* Send a pong.
|
|
@@ -21827,24 +21827,24 @@ var require_websocket = __commonJS({
|
|
|
21827
21827
|
* @param {Function} [cb] Callback which is executed when the pong is sent
|
|
21828
21828
|
* @public
|
|
21829
21829
|
*/
|
|
21830
|
-
pong(
|
|
21830
|
+
pong(data2, mask, cb) {
|
|
21831
21831
|
if (this.readyState === _WebSocket.CONNECTING) {
|
|
21832
21832
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
21833
21833
|
}
|
|
21834
|
-
if (typeof
|
|
21835
|
-
cb =
|
|
21836
|
-
|
|
21834
|
+
if (typeof data2 === "function") {
|
|
21835
|
+
cb = data2;
|
|
21836
|
+
data2 = mask = void 0;
|
|
21837
21837
|
} else if (typeof mask === "function") {
|
|
21838
21838
|
cb = mask;
|
|
21839
21839
|
mask = void 0;
|
|
21840
21840
|
}
|
|
21841
|
-
if (typeof
|
|
21841
|
+
if (typeof data2 === "number") data2 = data2.toString();
|
|
21842
21842
|
if (this.readyState !== _WebSocket.OPEN) {
|
|
21843
|
-
sendAfterClose(this,
|
|
21843
|
+
sendAfterClose(this, data2, cb);
|
|
21844
21844
|
return;
|
|
21845
21845
|
}
|
|
21846
21846
|
if (mask === void 0) mask = !this._isServer;
|
|
21847
|
-
this._sender.pong(
|
|
21847
|
+
this._sender.pong(data2 || EMPTY_BUFFER, mask, cb);
|
|
21848
21848
|
}
|
|
21849
21849
|
/**
|
|
21850
21850
|
* Resume the socket.
|
|
@@ -21873,7 +21873,7 @@ var require_websocket = __commonJS({
|
|
|
21873
21873
|
* @param {Function} [cb] Callback which is executed when data is written out
|
|
21874
21874
|
* @public
|
|
21875
21875
|
*/
|
|
21876
|
-
send(
|
|
21876
|
+
send(data2, options, cb) {
|
|
21877
21877
|
if (this.readyState === _WebSocket.CONNECTING) {
|
|
21878
21878
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
21879
21879
|
}
|
|
@@ -21881,13 +21881,13 @@ var require_websocket = __commonJS({
|
|
|
21881
21881
|
cb = options;
|
|
21882
21882
|
options = {};
|
|
21883
21883
|
}
|
|
21884
|
-
if (typeof
|
|
21884
|
+
if (typeof data2 === "number") data2 = data2.toString();
|
|
21885
21885
|
if (this.readyState !== _WebSocket.OPEN) {
|
|
21886
|
-
sendAfterClose(this,
|
|
21886
|
+
sendAfterClose(this, data2, cb);
|
|
21887
21887
|
return;
|
|
21888
21888
|
}
|
|
21889
21889
|
const opts = {
|
|
21890
|
-
binary: typeof
|
|
21890
|
+
binary: typeof data2 !== "string",
|
|
21891
21891
|
mask: !this._isServer,
|
|
21892
21892
|
compress: true,
|
|
21893
21893
|
fin: true,
|
|
@@ -21896,7 +21896,7 @@ var require_websocket = __commonJS({
|
|
|
21896
21896
|
if (!this._extensions[PerMessageDeflate2.extensionName]) {
|
|
21897
21897
|
opts.compress = false;
|
|
21898
21898
|
}
|
|
21899
|
-
this._sender.send(
|
|
21899
|
+
this._sender.send(data2 || EMPTY_BUFFER, opts, cb);
|
|
21900
21900
|
}
|
|
21901
21901
|
/**
|
|
21902
21902
|
* Forcibly close the connection.
|
|
@@ -22281,9 +22281,9 @@ var require_websocket = __commonJS({
|
|
|
22281
22281
|
stream.once("close", websocket.emitClose.bind(websocket));
|
|
22282
22282
|
}
|
|
22283
22283
|
}
|
|
22284
|
-
function sendAfterClose(websocket,
|
|
22285
|
-
if (
|
|
22286
|
-
const length = isBlob(
|
|
22284
|
+
function sendAfterClose(websocket, data2, cb) {
|
|
22285
|
+
if (data2) {
|
|
22286
|
+
const length = isBlob(data2) ? data2.size : toBuffer2(data2).length;
|
|
22287
22287
|
if (websocket._socket) websocket._sender._bufferedBytes += length;
|
|
22288
22288
|
else websocket._bufferedAmount += length;
|
|
22289
22289
|
}
|
|
@@ -22324,16 +22324,16 @@ var require_websocket = __commonJS({
|
|
|
22324
22324
|
function receiverOnFinish() {
|
|
22325
22325
|
this[kWebSocket].emitClose();
|
|
22326
22326
|
}
|
|
22327
|
-
function receiverOnMessage(
|
|
22328
|
-
this[kWebSocket].emit("message",
|
|
22327
|
+
function receiverOnMessage(data2, isBinary2) {
|
|
22328
|
+
this[kWebSocket].emit("message", data2, isBinary2);
|
|
22329
22329
|
}
|
|
22330
|
-
function receiverOnPing(
|
|
22330
|
+
function receiverOnPing(data2) {
|
|
22331
22331
|
const websocket = this[kWebSocket];
|
|
22332
|
-
if (websocket._autoPong) websocket.pong(
|
|
22333
|
-
websocket.emit("ping",
|
|
22332
|
+
if (websocket._autoPong) websocket.pong(data2, !this._isServer, NOOP);
|
|
22333
|
+
websocket.emit("ping", data2);
|
|
22334
22334
|
}
|
|
22335
|
-
function receiverOnPong(
|
|
22336
|
-
this[kWebSocket].emit("pong",
|
|
22335
|
+
function receiverOnPong(data2) {
|
|
22336
|
+
this[kWebSocket].emit("pong", data2);
|
|
22337
22337
|
}
|
|
22338
22338
|
function resume(stream) {
|
|
22339
22339
|
stream.resume();
|
|
@@ -22432,8 +22432,8 @@ var require_stream = __commonJS({
|
|
|
22432
22432
|
writableObjectMode: false
|
|
22433
22433
|
});
|
|
22434
22434
|
ws.on("message", function message(msg, isBinary2) {
|
|
22435
|
-
const
|
|
22436
|
-
if (!duplex.push(
|
|
22435
|
+
const data2 = !isBinary2 && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
22436
|
+
if (!duplex.push(data2)) ws.pause();
|
|
22437
22437
|
});
|
|
22438
22438
|
ws.once("error", function error62(err) {
|
|
22439
22439
|
if (duplex.destroyed) return;
|
|
@@ -25147,8 +25147,8 @@ function buildCreditReservedHint(input2) {
|
|
|
25147
25147
|
}
|
|
25148
25148
|
|
|
25149
25149
|
// src/lib/api-client.ts
|
|
25150
|
-
async function api(creds, method, path13, body) {
|
|
25151
|
-
return request(`${creds.api_url}/api${path13}`, method, body, creds.token);
|
|
25150
|
+
async function api(creds, method, path13, body, signal) {
|
|
25151
|
+
return request(`${creds.api_url}/api${path13}`, method, body, creds.token, signal);
|
|
25152
25152
|
}
|
|
25153
25153
|
async function apiSse(creds, path13, body, signal) {
|
|
25154
25154
|
return requestSse(`${creds.api_url}/api${path13}`, body, creds.token, signal);
|
|
@@ -25156,29 +25156,29 @@ async function apiSse(creds, path13, body, signal) {
|
|
|
25156
25156
|
async function publicApi(apiUrl, method, path13) {
|
|
25157
25157
|
return request(`${apiUrl}/api${path13}`, method);
|
|
25158
25158
|
}
|
|
25159
|
-
async function request(url3, method, body, token) {
|
|
25159
|
+
async function request(url3, method, body, token, signal) {
|
|
25160
25160
|
const headers = {
|
|
25161
25161
|
"Content-Type": "application/json"
|
|
25162
25162
|
};
|
|
25163
25163
|
if (token) {
|
|
25164
25164
|
headers.Authorization = `Bearer ${token}`;
|
|
25165
25165
|
}
|
|
25166
|
-
const init = { method, headers };
|
|
25166
|
+
const init = { method, headers, ...signal ? { signal } : {} };
|
|
25167
25167
|
if (body) {
|
|
25168
25168
|
init.body = JSON.stringify(body);
|
|
25169
25169
|
}
|
|
25170
25170
|
try {
|
|
25171
25171
|
const res = await fetch(url3, init);
|
|
25172
25172
|
const text2 = await res.text();
|
|
25173
|
-
let
|
|
25173
|
+
let data2;
|
|
25174
25174
|
try {
|
|
25175
|
-
|
|
25175
|
+
data2 = JSON.parse(text2);
|
|
25176
25176
|
} catch {
|
|
25177
25177
|
}
|
|
25178
25178
|
if (res.ok) {
|
|
25179
|
-
return { ok: true, data };
|
|
25179
|
+
return { ok: true, data: data2 };
|
|
25180
25180
|
}
|
|
25181
|
-
const errorMsg =
|
|
25181
|
+
const errorMsg = data2?.message ?? `HTTP ${res.status}`;
|
|
25182
25182
|
return { ok: false, error: String(errorMsg), status: res.status };
|
|
25183
25183
|
} catch (err) {
|
|
25184
25184
|
return {
|
|
@@ -25566,12 +25566,37 @@ function parseStringListOption(raw, label) {
|
|
|
25566
25566
|
|
|
25567
25567
|
// src/lib/output.ts
|
|
25568
25568
|
init_cjs_shims();
|
|
25569
|
+
|
|
25570
|
+
// src/lib/hosted-domain-error.ts
|
|
25571
|
+
init_cjs_shims();
|
|
25572
|
+
function domainErrorHint(code) {
|
|
25573
|
+
const hints = {
|
|
25574
|
+
HOSTED_APP_MAX_REQUIRED: "Your workspace plan does not include custom domains. Upgrade the workspace plan, then retry.",
|
|
25575
|
+
HOSTED_APP_DOMAIN_ALREADY_BOUND: "This domain is bound to another app. Ask its owner to remove that binding, or use another domain.",
|
|
25576
|
+
HOSTED_APP_DOMAIN_REMOVE_EXISTING_FIRST: "This app already has another domain. Run `kollab app domain remove --id <appId>` before changing domains.",
|
|
25577
|
+
HOSTED_APP_DOMAIN_RESERVED: "This domain belongs to the platform. Use a domain you own outside the platform domain.",
|
|
25578
|
+
HOSTED_APP_DOMAIN_INVALID: "Enter a hostname such as www.example.com, without https://, a port, or a path.",
|
|
25579
|
+
HOSTED_APP_DOMAIN_NOT_FOUND: "No domain is bound. Run `kollab app domain setup --id <appId> --domain <domain>` first.",
|
|
25580
|
+
HOSTED_APP_DOMAIN_CHANGED: "The binding changed or expired. Read domain status, then run setup again.",
|
|
25581
|
+
HOSTED_APP_CUSTOM_DOMAIN_DISABLED: "Custom domains are not enabled in this environment. Contact your workspace administrator.",
|
|
25582
|
+
HOSTED_APP_CUSTOM_DOMAIN_NOT_CONFIGURED: "The managed domain proxy is not configured. Contact your workspace administrator.",
|
|
25583
|
+
HOSTED_APP_DOMAIN_DNS_MISMATCH: "The routing record was not found or points elsewhere. Set the shown CNAME/A record, use DNS only (gray cloud), and remove conflicting AAAA records.",
|
|
25584
|
+
HOSTED_APP_DOMAIN_DNS_CHALLENGE_MISMATCH: "The ownership TXT is missing or does not match. Copy the current TXT name and value exactly, then wait for DNS propagation.",
|
|
25585
|
+
HOSTED_APP_DOMAIN_DNS_ROUTE_AND_CHALLENGE_MISMATCH: "Both routing and ownership TXT need attention. Copy both records exactly, use DNS only, and wait for propagation.",
|
|
25586
|
+
HOSTED_APP_DOMAIN_DNS_UNAVAILABLE: "DNS could not be checked yet. Wait a few seconds and run setup --wait again.",
|
|
25587
|
+
HOSTED_APP_DOMAIN_DNS_LOOP: "The routing CNAME chain loops or is too long. Point it directly at the shown proxy target."
|
|
25588
|
+
};
|
|
25589
|
+
return hints[code] ?? "Check domain status and retry. If the problem continues, contact your workspace administrator.";
|
|
25590
|
+
}
|
|
25591
|
+
|
|
25592
|
+
// src/lib/output.ts
|
|
25569
25593
|
function buildCliHint(result) {
|
|
25570
25594
|
const errorText = String(result.error ?? "").toLowerCase();
|
|
25571
25595
|
const creditReservedHint = buildCreditReservedHint(result);
|
|
25572
25596
|
if (creditReservedHint) {
|
|
25573
25597
|
return creditReservedHint;
|
|
25574
25598
|
}
|
|
25599
|
+
if (/hosted_app_(?:domain_|custom_domain_|max_required)/.test(errorText)) return domainErrorHint(String(result.error));
|
|
25575
25600
|
if (result.status === 401) {
|
|
25576
25601
|
return "Authentication failed. Run `kollab login`, or set `KOLLAB_TOKEN`/`KOLLAB_API_TOKEN` together with the correct `KOLLAB_API_URL`.";
|
|
25577
25602
|
}
|
|
@@ -27234,11 +27259,11 @@ async function fetchCanonicalArtifacts(creds, conversationId) {
|
|
|
27234
27259
|
);
|
|
27235
27260
|
return unwrapArtifactsPayload(artifactsResult.data);
|
|
27236
27261
|
}
|
|
27237
|
-
function unwrapMessagesPayload(
|
|
27238
|
-
if (Array.isArray(
|
|
27239
|
-
return
|
|
27262
|
+
function unwrapMessagesPayload(data2) {
|
|
27263
|
+
if (Array.isArray(data2)) {
|
|
27264
|
+
return data2.filter(asRecord);
|
|
27240
27265
|
}
|
|
27241
|
-
const record3 = asRecord(
|
|
27266
|
+
const record3 = asRecord(data2);
|
|
27242
27267
|
if (Array.isArray(record3?.messages)) {
|
|
27243
27268
|
return record3.messages.filter(asRecord);
|
|
27244
27269
|
}
|
|
@@ -27247,18 +27272,18 @@ function unwrapMessagesPayload(data) {
|
|
|
27247
27272
|
}
|
|
27248
27273
|
return [];
|
|
27249
27274
|
}
|
|
27250
|
-
function unwrapArtifactsPayload(
|
|
27251
|
-
if (Array.isArray(
|
|
27252
|
-
return
|
|
27275
|
+
function unwrapArtifactsPayload(data2) {
|
|
27276
|
+
if (Array.isArray(data2)) {
|
|
27277
|
+
return data2.filter(asRecord);
|
|
27253
27278
|
}
|
|
27254
|
-
const record3 = asRecord(
|
|
27279
|
+
const record3 = asRecord(data2);
|
|
27255
27280
|
if (Array.isArray(record3?.data)) {
|
|
27256
27281
|
return record3.data.filter(asRecord);
|
|
27257
27282
|
}
|
|
27258
27283
|
return [];
|
|
27259
27284
|
}
|
|
27260
|
-
function readGenerationStatus(
|
|
27261
|
-
const record3 = asRecord(
|
|
27285
|
+
function readGenerationStatus(data2) {
|
|
27286
|
+
const record3 = asRecord(data2);
|
|
27262
27287
|
const nested = asRecord(record3?.data);
|
|
27263
27288
|
const value2 = nested?.generationStatus ?? record3?.generationStatus;
|
|
27264
27289
|
return typeof value2 === "string" ? value2 : null;
|
|
@@ -28196,8 +28221,8 @@ function sleep4(ms) {
|
|
|
28196
28221
|
function asRecord3(value2) {
|
|
28197
28222
|
return value2 && typeof value2 === "object" ? value2 : null;
|
|
28198
28223
|
}
|
|
28199
|
-
function readGenerationStatus2(
|
|
28200
|
-
const record3 = asRecord3(
|
|
28224
|
+
function readGenerationStatus2(data2) {
|
|
28225
|
+
const record3 = asRecord3(data2);
|
|
28201
28226
|
const nested = asRecord3(record3?.data);
|
|
28202
28227
|
const value2 = nested?.generationStatus ?? record3?.generationStatus;
|
|
28203
28228
|
return typeof value2 === "string" ? value2 : null;
|
|
@@ -28921,15 +28946,15 @@ async function uploadSkillMultipart(apiUrl, token, filePath, name, spaceId) {
|
|
|
28921
28946
|
body: form
|
|
28922
28947
|
});
|
|
28923
28948
|
const text2 = await res.text();
|
|
28924
|
-
let
|
|
28949
|
+
let data2;
|
|
28925
28950
|
try {
|
|
28926
|
-
|
|
28951
|
+
data2 = JSON.parse(text2);
|
|
28927
28952
|
} catch {
|
|
28928
28953
|
}
|
|
28929
28954
|
if (res.ok) {
|
|
28930
|
-
return { ok: true, data };
|
|
28955
|
+
return { ok: true, data: data2 };
|
|
28931
28956
|
}
|
|
28932
|
-
const errorMsg =
|
|
28957
|
+
const errorMsg = data2?.message ?? `HTTP ${res.status}`;
|
|
28933
28958
|
return { ok: false, error: String(errorMsg), status: res.status };
|
|
28934
28959
|
} catch (err) {
|
|
28935
28960
|
return {
|
|
@@ -31703,13 +31728,13 @@ async function standaloneRequest(method, requestPath, body, options = {}) {
|
|
|
31703
31728
|
try {
|
|
31704
31729
|
const response = await fetch(`${apiUrl}/api${requestPath}${query}`, init);
|
|
31705
31730
|
const text2 = await response.text();
|
|
31706
|
-
let
|
|
31731
|
+
let data2;
|
|
31707
31732
|
try {
|
|
31708
|
-
|
|
31733
|
+
data2 = JSON.parse(text2);
|
|
31709
31734
|
} catch {
|
|
31710
31735
|
}
|
|
31711
|
-
if (response.ok) return { ok: true, status: response.status, data };
|
|
31712
|
-
const record3 =
|
|
31736
|
+
if (response.ok) return { ok: true, status: response.status, data: data2 };
|
|
31737
|
+
const record3 = data2 && typeof data2 === "object" ? data2 : void 0;
|
|
31713
31738
|
const retryHeader = response.headers.get("retry-after");
|
|
31714
31739
|
const retryAfter = retryHeader ? Number(retryHeader) : void 0;
|
|
31715
31740
|
const requestId = typeof record3?.request_id === "string" ? record3.request_id : void 0;
|
|
@@ -32015,12 +32040,12 @@ async function callStandaloneTool(tool, args, options = {}) {
|
|
|
32015
32040
|
requestId,
|
|
32016
32041
|
clientSource: options.clientSource ?? "mcp"
|
|
32017
32042
|
});
|
|
32018
|
-
let
|
|
32043
|
+
let data2 = result.ok ? result.data ?? {} : void 0;
|
|
32019
32044
|
let recoveredFromReceipt = false;
|
|
32020
32045
|
if (!result.ok) {
|
|
32021
32046
|
if (result.status === 503 && result.requestId) {
|
|
32022
32047
|
recoveredFromReceipt = true;
|
|
32023
|
-
|
|
32048
|
+
data2 = await pollStandaloneJob(tool, result.jobId, {
|
|
32024
32049
|
apiUrl,
|
|
32025
32050
|
apiKey: auth.apiKey,
|
|
32026
32051
|
jwtToken: auth.jwtToken,
|
|
@@ -32032,12 +32057,12 @@ async function callStandaloneTool(tool, args, options = {}) {
|
|
|
32032
32057
|
throw new Error(result.error ?? `Standalone tool failed: HTTP ${result.status}`);
|
|
32033
32058
|
}
|
|
32034
32059
|
}
|
|
32035
|
-
const candidate =
|
|
32060
|
+
const candidate = data2 && typeof data2 === "object" ? data2 : {};
|
|
32036
32061
|
const jobId = extractJobId(candidate);
|
|
32037
32062
|
if (jobId && LONG_TASK_TOOLS.has(tool) && !recoveredFromReceipt) {
|
|
32038
|
-
|
|
32063
|
+
data2 = await pollStandaloneJob(tool, jobId, { apiUrl, apiKey: auth.apiKey, jwtToken: auth.jwtToken, spaceId, requestId });
|
|
32039
32064
|
}
|
|
32040
|
-
const completed =
|
|
32065
|
+
const completed = data2 && typeof data2 === "object" ? data2 : {};
|
|
32041
32066
|
const artifacts = collectArtifacts(completed);
|
|
32042
32067
|
if (artifacts.length > 0) {
|
|
32043
32068
|
const downloaded = [];
|
|
@@ -32055,7 +32080,7 @@ async function callStandaloneTool(tool, args, options = {}) {
|
|
|
32055
32080
|
...downloadErrors.length > 0 ? { download_errors: downloadErrors } : {}
|
|
32056
32081
|
};
|
|
32057
32082
|
}
|
|
32058
|
-
return
|
|
32083
|
+
return data2;
|
|
32059
32084
|
}
|
|
32060
32085
|
function redactDownloadError(error62) {
|
|
32061
32086
|
const message = error62 instanceof Error ? error62.message : "Artifact download failed";
|
|
@@ -32456,14 +32481,14 @@ function registerMcpCommands(program3) {
|
|
|
32456
32481
|
});
|
|
32457
32482
|
const result = await api(creds, "GET", `/skills/mcp/catalog?${params.toString()}`);
|
|
32458
32483
|
printResult(
|
|
32459
|
-
mapApiData(result, (
|
|
32460
|
-
const entries = (Array.isArray(
|
|
32484
|
+
mapApiData(result, (data2) => {
|
|
32485
|
+
const entries = (Array.isArray(data2?.entries) ? data2.entries : []).map(sanitizeCatalogEntry).filter((entry) => entry !== null);
|
|
32461
32486
|
return {
|
|
32462
32487
|
query,
|
|
32463
|
-
total: typeof
|
|
32488
|
+
total: typeof data2?.total === "number" ? data2.total : void 0,
|
|
32464
32489
|
count: entries.length,
|
|
32465
|
-
hasMore: typeof
|
|
32466
|
-
nextCursor: readString(
|
|
32490
|
+
hasMore: typeof data2?.hasMore === "boolean" ? data2.hasMore : void 0,
|
|
32491
|
+
nextCursor: readString(data2?.nextCursor),
|
|
32467
32492
|
entries
|
|
32468
32493
|
};
|
|
32469
32494
|
})
|
|
@@ -33043,6 +33068,154 @@ async function requireHostedAppCredentials() {
|
|
|
33043
33068
|
};
|
|
33044
33069
|
}
|
|
33045
33070
|
|
|
33071
|
+
// src/commands/app-domain.ts
|
|
33072
|
+
init_cjs_shims();
|
|
33073
|
+
var import_node_url = require("url");
|
|
33074
|
+
function data(result) {
|
|
33075
|
+
if (!result.ok) throw new Error(result.error ?? "DOMAIN_REQUEST_FAILED");
|
|
33076
|
+
return result.data ?? null;
|
|
33077
|
+
}
|
|
33078
|
+
function domainRecords(view) {
|
|
33079
|
+
if (!view) return [];
|
|
33080
|
+
return [
|
|
33081
|
+
...view.dnsTarget ? [{ type: view.dnsRecordType, name: view.domain, value: view.dnsTarget, purpose: "routing" }] : [],
|
|
33082
|
+
...(view.validationRecords ?? []).map((record3) => ({ ...record3, purpose: "ownership" }))
|
|
33083
|
+
];
|
|
33084
|
+
}
|
|
33085
|
+
function domainOutput(view) {
|
|
33086
|
+
return {
|
|
33087
|
+
domain: view?.domain ?? null,
|
|
33088
|
+
status: view?.domainStatus ?? "none",
|
|
33089
|
+
records: domainRecords(view),
|
|
33090
|
+
nextAction: view?.nextAction ?? (view?.domainStatus === "active" ? view.certificateStatus === "ready" ? "done" : "wait_certificate" : view ? "add_records" : "none"),
|
|
33091
|
+
url: view ? `https://${view.domain}` : null,
|
|
33092
|
+
certificateStatus: view?.certificateStatus ?? "not_started",
|
|
33093
|
+
certificateCheckedAt: view?.certificateCheckedAt ?? null
|
|
33094
|
+
};
|
|
33095
|
+
}
|
|
33096
|
+
function domainInstructions(view, recordsOnly = false) {
|
|
33097
|
+
if (!view) return "No domain is bound. Run `kollab app domain setup --id <appId> --domain <domain>` first.";
|
|
33098
|
+
const lines = domainRecords(view).map((record3) => {
|
|
33099
|
+
const zone = view.dnsZone;
|
|
33100
|
+
const relative3 = zone && record3.name === zone ? "@" : zone && record3.name.endsWith(`.${zone}`) ? record3.name.slice(0, -zone.length - 1) : "(use the full name, or remove your DNS zone suffix)";
|
|
33101
|
+
return `${record3.type} | Full name: ${record3.name} | Host: ${relative3}${zone ? ` (zone: ${zone})` : ""} | Value: ${record3.value} | TTL: 300 seconds (or Auto)`;
|
|
33102
|
+
});
|
|
33103
|
+
if (recordsOnly) return [...lines, "Cloudflare or another proxy DNS provider: choose DNS only / gray cloud. TTL: 300 seconds or Auto."].join("\n");
|
|
33104
|
+
return [
|
|
33105
|
+
...lines,
|
|
33106
|
+
"Cloudflare or another proxy DNS provider: choose DNS only / gray cloud. Remove conflicting AAAA records.",
|
|
33107
|
+
`Status: ${view.domainStatus}; certificate: ${view.certificateStatus ?? "not_started"}; next: ${domainOutput(view).nextAction}`,
|
|
33108
|
+
...view.errorCode ? [domainErrorHint(view.errorCode)] : [],
|
|
33109
|
+
...view.dnsObserved ? [`Observed: ${view.dnsObserved}`] : []
|
|
33110
|
+
].join("\n");
|
|
33111
|
+
}
|
|
33112
|
+
async function setupDomain(request2, options, progress = () => void 0, clock = { now: () => Date.now(), sleep: (ms) => new Promise((resolve4) => setTimeout(resolve4, ms)) }) {
|
|
33113
|
+
const timeout = options.timeout ?? 600;
|
|
33114
|
+
if (!Number.isSafeInteger(timeout) || timeout <= 0 || timeout > 86400) throw new Error("INVALID_TIMEOUT");
|
|
33115
|
+
const domain2 = (0, import_node_url.domainToASCII)(options.domain.trim().replace(/\.+$/, "")).toLowerCase();
|
|
33116
|
+
if (!domain2 || /[/\\:@?#\s%]/.test(options.domain)) throw new Error("HOSTED_APP_DOMAIN_INVALID");
|
|
33117
|
+
let view = data(await request2("GET"));
|
|
33118
|
+
if (view && view.domain !== domain2) throw new Error("HOSTED_APP_DOMAIN_REMOVE_EXISTING_FIRST");
|
|
33119
|
+
if (!view) view = data(await request2("POST", "", { domain: domain2 }));
|
|
33120
|
+
if (!view) throw new Error("HOSTED_APP_DOMAIN_NOT_FOUND");
|
|
33121
|
+
let last = "";
|
|
33122
|
+
const report = () => {
|
|
33123
|
+
const fingerprint = JSON.stringify([view.domainStatus, view.certificateStatus, view.errorCode, view.dnsObserved, view.nextAction]);
|
|
33124
|
+
if (fingerprint !== last) {
|
|
33125
|
+
last = fingerprint;
|
|
33126
|
+
progress(view);
|
|
33127
|
+
}
|
|
33128
|
+
};
|
|
33129
|
+
report();
|
|
33130
|
+
if (!options.wait) return view;
|
|
33131
|
+
const dnsDeadline = clock.now() + timeout * 1e3;
|
|
33132
|
+
let certificateDeadline;
|
|
33133
|
+
let delay = 5e3;
|
|
33134
|
+
for (; ; ) {
|
|
33135
|
+
if (view.nextAction === "upgrade_required") throw new Error("HOSTED_APP_MAX_REQUIRED");
|
|
33136
|
+
if (view.domainStatus === "active" && !view.errorCode) {
|
|
33137
|
+
if (view.certificateStatus === "ready") return view;
|
|
33138
|
+
certificateDeadline ?? (certificateDeadline = clock.now() + 6e4);
|
|
33139
|
+
}
|
|
33140
|
+
const deadline = certificateDeadline ?? dnsDeadline;
|
|
33141
|
+
if (clock.now() >= deadline) {
|
|
33142
|
+
const error62 = new Error(certificateDeadline ? "CERTIFICATE_TIMEOUT" : "DNS_TIMEOUT");
|
|
33143
|
+
Object.assign(error62, { view });
|
|
33144
|
+
throw error62;
|
|
33145
|
+
}
|
|
33146
|
+
view = data(await request2("POST", "/verify"));
|
|
33147
|
+
if (!view || view.domain !== domain2) throw new Error("HOSTED_APP_DOMAIN_CHANGED");
|
|
33148
|
+
report();
|
|
33149
|
+
if (view.domainStatus === "active" && !view.errorCode && view.certificateStatus === "ready") return view;
|
|
33150
|
+
await clock.sleep(Math.min(delay, Math.max(0, deadline - clock.now())));
|
|
33151
|
+
delay = Math.min(1e4, delay + 1e3);
|
|
33152
|
+
}
|
|
33153
|
+
}
|
|
33154
|
+
function registerHostedAppDomainCommands(app) {
|
|
33155
|
+
const group = app.command("domain").description("Configure a custom domain and wait for trusted HTTPS");
|
|
33156
|
+
for (const name of ["list", "status", "add", "verify", "remove"]) {
|
|
33157
|
+
const command = group.command(name).description(`${name} the custom domain (status includes DNS and certificate readiness)`).requiredOption("--id <appId>", "Hosted App ID (UUID)");
|
|
33158
|
+
if (name === "add") command.requiredOption("--domain <domain>", "Customer-owned hostname or apex domain");
|
|
33159
|
+
command.action(async (options) => {
|
|
33160
|
+
try {
|
|
33161
|
+
const creds = await requireHostedAppCredentials();
|
|
33162
|
+
const method = name === "remove" ? "DELETE" : ["add", "verify"].includes(name) ? "POST" : "GET";
|
|
33163
|
+
printResult(await api(
|
|
33164
|
+
creds,
|
|
33165
|
+
method,
|
|
33166
|
+
`/hosted-apps/${encodeURIComponent(options.id)}/domains${name === "verify" ? "/verify" : ""}`,
|
|
33167
|
+
name === "add" ? { domain: options.domain } : void 0
|
|
33168
|
+
));
|
|
33169
|
+
} catch (error62) {
|
|
33170
|
+
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33171
|
+
}
|
|
33172
|
+
});
|
|
33173
|
+
}
|
|
33174
|
+
for (const name of ["setup", "records"]) {
|
|
33175
|
+
const command = group.command(name).description(name === "setup" ? "Bind a domain, print DNS records, and optionally wait for HTTPS" : "Print only the required DNS records").requiredOption("--id <appId>", "Hosted App ID (UUID)").option("--json", "Print a stable JSON object");
|
|
33176
|
+
if (name === "setup") command.requiredOption("--domain <domain>", "Customer-owned hostname or apex domain").option("--wait", "Wait for DNS and trusted HTTPS").option("--timeout <seconds>", "DNS wait timeout (1\u201386400 seconds)", "600");
|
|
33177
|
+
command.action(async (options) => {
|
|
33178
|
+
let latest = null;
|
|
33179
|
+
try {
|
|
33180
|
+
const creds = await requireHostedAppCredentials();
|
|
33181
|
+
const request2 = (method, suffix = "", body) => api(creds, method, `/hosted-apps/${encodeURIComponent(options.id)}/domains${suffix}`, body, AbortSignal.timeout(1e4));
|
|
33182
|
+
latest = name === "records" ? data(await request2("GET")) : await setupDomain(
|
|
33183
|
+
request2,
|
|
33184
|
+
{ ...options, timeout: Number(options.timeout) },
|
|
33185
|
+
(view) => {
|
|
33186
|
+
const initial = !latest;
|
|
33187
|
+
latest = view;
|
|
33188
|
+
if (!options.json) console.log(initial ? domainInstructions(view) : `Status: ${view.domainStatus}; certificate: ${view.certificateStatus ?? "not_started"}${view.errorCode ? `; ${domainErrorHint(view.errorCode)}` : ""}${view.dnsObserved ? `; Observed: ${view.dnsObserved}` : ""}`);
|
|
33189
|
+
}
|
|
33190
|
+
);
|
|
33191
|
+
if (options.json) console.log(JSON.stringify(domainOutput(latest), null, 2));
|
|
33192
|
+
else if (name === "records") console.log(domainInstructions(latest, true));
|
|
33193
|
+
else if (latest?.domainStatus === "active" && latest.certificateStatus === "ready" && !latest.errorCode)
|
|
33194
|
+
console.log(`HTTPS is ready: https://${latest.domain}`);
|
|
33195
|
+
else console.log("DNS or HTTPS is not ready yet. Add the records, then run setup with --wait.");
|
|
33196
|
+
if (!latest) process.exitCode = 1;
|
|
33197
|
+
} catch (error62) {
|
|
33198
|
+
const code = error62 instanceof Error ? error62.message : String(error62);
|
|
33199
|
+
const view = error62.view ?? latest;
|
|
33200
|
+
const hint = code === "INVALID_TIMEOUT" ? "--timeout must be an integer from 1 to 86400 seconds." : code === "CERTIFICATE_TIMEOUT" ? "DNS is verified, but trusted HTTPS is not ready. Retry setup --wait; check domain status for the certificate error." : code === "DNS_TIMEOUT" ? "DNS is not verified yet. Fix the missing or incorrect records shown in the observations, then retry setup --wait." : domainErrorHint(code);
|
|
33201
|
+
const output2 = {
|
|
33202
|
+
...domainOutput(view),
|
|
33203
|
+
...code === "HOSTED_APP_MAX_REQUIRED" ? { nextAction: "upgrade_required" } : {},
|
|
33204
|
+
error: code,
|
|
33205
|
+
message: hint,
|
|
33206
|
+
dnsObserved: view?.dnsObserved ?? null,
|
|
33207
|
+
dnsErrorCode: view?.errorCode ?? null,
|
|
33208
|
+
certificateErrorCode: view?.certificateErrorCode ?? null
|
|
33209
|
+
};
|
|
33210
|
+
if (options.json) console.log(JSON.stringify(output2, null, 2));
|
|
33211
|
+
console.error(options.json ? hint : `${code}: ${hint}
|
|
33212
|
+
${domainInstructions(view)}`);
|
|
33213
|
+
process.exitCode = 1;
|
|
33214
|
+
}
|
|
33215
|
+
});
|
|
33216
|
+
}
|
|
33217
|
+
}
|
|
33218
|
+
|
|
33046
33219
|
// src/commands/app.ts
|
|
33047
33220
|
var MAX_HOSTED_APP_FILE_BYTES = 20 * 1024 * 1024;
|
|
33048
33221
|
function validateHostedAppFile(filePath, fileSize) {
|
|
@@ -33221,41 +33394,7 @@ A .zip needs app.manifest.json, or a plain static site with index.html at its ro
|
|
|
33221
33394
|
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33222
33395
|
}
|
|
33223
33396
|
});
|
|
33224
|
-
|
|
33225
|
-
const listDomain = async (options) => {
|
|
33226
|
-
try {
|
|
33227
|
-
const creds = await requireHostedAppCredentials();
|
|
33228
|
-
printResult(await api(creds, "GET", `/hosted-apps/${encodeURIComponent(options.id)}/domains`));
|
|
33229
|
-
} catch (error62) {
|
|
33230
|
-
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33231
|
-
}
|
|
33232
|
-
};
|
|
33233
|
-
domain2.command("list").description("Show the Hosted App custom domain and DNS records").requiredOption("--id <appId>", "Hosted App ID (UUID)").action(listDomain);
|
|
33234
|
-
domain2.command("status").description("Show the Hosted App custom domain status").requiredOption("--id <appId>", "Hosted App ID (UUID)").action(listDomain);
|
|
33235
|
-
domain2.command("add").description("Request a certificate and bind a subdomain or apex domain").requiredOption("--id <appId>", "Hosted App ID (UUID)").requiredOption("--domain <domain>", "Customer-owned hostname or apex domain").action(async (options) => {
|
|
33236
|
-
try {
|
|
33237
|
-
const creds = await requireHostedAppCredentials();
|
|
33238
|
-
printResult(await api(creds, "POST", `/hosted-apps/${encodeURIComponent(options.id)}/domains`, { domain: options.domain }));
|
|
33239
|
-
} catch (error62) {
|
|
33240
|
-
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33241
|
-
}
|
|
33242
|
-
});
|
|
33243
|
-
domain2.command("verify").description("Refresh certificate and CloudFront deployment status").requiredOption("--id <appId>", "Hosted App ID (UUID)").action(async (options) => {
|
|
33244
|
-
try {
|
|
33245
|
-
const creds = await requireHostedAppCredentials();
|
|
33246
|
-
printResult(await api(creds, "POST", `/hosted-apps/${encodeURIComponent(options.id)}/domains/verify`));
|
|
33247
|
-
} catch (error62) {
|
|
33248
|
-
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33249
|
-
}
|
|
33250
|
-
});
|
|
33251
|
-
domain2.command("remove").description("Unbind and release the Hosted App custom domain").requiredOption("--id <appId>", "Hosted App ID (UUID)").action(async (options) => {
|
|
33252
|
-
try {
|
|
33253
|
-
const creds = await requireHostedAppCredentials();
|
|
33254
|
-
printResult(await api(creds, "DELETE", `/hosted-apps/${encodeURIComponent(options.id)}/domains`));
|
|
33255
|
-
} catch (error62) {
|
|
33256
|
-
emitError(error62 instanceof Error ? error62.message : String(error62));
|
|
33257
|
-
}
|
|
33258
|
-
});
|
|
33397
|
+
registerHostedAppDomainCommands(app);
|
|
33259
33398
|
app.command("ai").description("Pause, resume, or adjust a Hosted App AI budget").requiredOption("--id <appId>", "Hosted App ID (UUID)").option("--action <action>", "pause, resume, or budget").option("--daily-credit-limit <credits>", "Daily AI credit limit", (value2) => parseIntegerOption(value2, "--daily-credit-limit")).option("--monthly-credit-limit <credits>", "Monthly AI credit limit", (value2) => parseIntegerOption(value2, "--monthly-credit-limit")).action(async (options) => {
|
|
33260
33399
|
try {
|
|
33261
33400
|
if (!options.action && options.dailyCreditLimit === void 0 && options.monthlyCreditLimit === void 0) {
|
|
@@ -33403,19 +33542,19 @@ function registerModelCommands(program3) {
|
|
|
33403
33542
|
}
|
|
33404
33543
|
const envelope = result.data ?? {};
|
|
33405
33544
|
const payload = envelope.data && typeof envelope.data === "object" && !Array.isArray(envelope.data) ? envelope.data : {};
|
|
33406
|
-
const
|
|
33545
|
+
const data2 = {
|
|
33407
33546
|
...payload,
|
|
33408
33547
|
...typeof envelope.requestId === "string" ? { request_id: envelope.requestId } : {}
|
|
33409
33548
|
};
|
|
33410
|
-
const text2 = typeof
|
|
33411
|
-
const images = Array.isArray(
|
|
33549
|
+
const text2 = typeof data2.text === "string" ? data2.text : "";
|
|
33550
|
+
const images = Array.isArray(data2.images) ? data2.images : [];
|
|
33412
33551
|
if (!text2 && images.length === 0) emitError("\u6A21\u578B\u8FD4\u56DE\u4E86\u7A7A\u6587\u5B57");
|
|
33413
33552
|
const localPaths = await downloadModelImages(images, options.outputDir);
|
|
33414
33553
|
if (options.outputFile) {
|
|
33415
33554
|
await (0, import_promises3.writeFile)(options.outputFile, text2, { encoding: "utf8", mode: 384 });
|
|
33416
33555
|
}
|
|
33417
33556
|
if (options.json) {
|
|
33418
|
-
console.log(JSON.stringify({ ok: true, data: { ...
|
|
33557
|
+
console.log(JSON.stringify({ ok: true, data: { ...data2, ...options.outputFile ? { output_file: options.outputFile } : {}, ...localPaths.length ? { local_paths: localPaths } : {} } }, null, 2));
|
|
33419
33558
|
} else {
|
|
33420
33559
|
if (!options.outputFile) process.stdout.write(text2);
|
|
33421
33560
|
else console.error(`\u5DF2\u5199\u5165 ${options.outputFile}`);
|
|
@@ -33502,8 +33641,8 @@ var fs6 = __toESM(require("fs"));
|
|
|
33502
33641
|
var path6 = __toESM(require("path"));
|
|
33503
33642
|
var UNKNOWN_VERSION = "0.0.0";
|
|
33504
33643
|
function injectedVersion() {
|
|
33505
|
-
if ("0.1.
|
|
33506
|
-
return "0.1.
|
|
33644
|
+
if ("0.1.23".length > 0) {
|
|
33645
|
+
return "0.1.23";
|
|
33507
33646
|
}
|
|
33508
33647
|
return null;
|
|
33509
33648
|
}
|
|
@@ -33677,19 +33816,19 @@ Object.keys(PACKET_TYPES).forEach((key) => {
|
|
|
33677
33816
|
var ERROR_PACKET = { type: "error", data: "parser error" };
|
|
33678
33817
|
|
|
33679
33818
|
// node_modules/engine.io-parser/build/esm/encodePacket.js
|
|
33680
|
-
var encodePacket = ({ type, data }, supportsBinary, callback) => {
|
|
33681
|
-
if (
|
|
33682
|
-
return callback(supportsBinary ?
|
|
33819
|
+
var encodePacket = ({ type, data: data2 }, supportsBinary, callback) => {
|
|
33820
|
+
if (data2 instanceof ArrayBuffer || ArrayBuffer.isView(data2)) {
|
|
33821
|
+
return callback(supportsBinary ? data2 : "b" + toBuffer(data2, true).toString("base64"));
|
|
33683
33822
|
}
|
|
33684
|
-
return callback(PACKET_TYPES[type] + (
|
|
33823
|
+
return callback(PACKET_TYPES[type] + (data2 || ""));
|
|
33685
33824
|
};
|
|
33686
|
-
var toBuffer = (
|
|
33687
|
-
if (Buffer.isBuffer(
|
|
33688
|
-
return
|
|
33689
|
-
} else if (
|
|
33690
|
-
return Buffer.from(
|
|
33825
|
+
var toBuffer = (data2, forceBufferConversion) => {
|
|
33826
|
+
if (Buffer.isBuffer(data2) || data2 instanceof Uint8Array && !forceBufferConversion) {
|
|
33827
|
+
return data2;
|
|
33828
|
+
} else if (data2 instanceof ArrayBuffer) {
|
|
33829
|
+
return Buffer.from(data2);
|
|
33691
33830
|
} else {
|
|
33692
|
-
return Buffer.from(
|
|
33831
|
+
return Buffer.from(data2.buffer, data2.byteOffset, data2.byteLength);
|
|
33693
33832
|
}
|
|
33694
33833
|
};
|
|
33695
33834
|
var TEXT_ENCODER;
|
|
@@ -33732,22 +33871,22 @@ var decodePacket = (encodedPacket, binaryType) => {
|
|
|
33732
33871
|
type: PACKET_TYPES_REVERSE[type]
|
|
33733
33872
|
};
|
|
33734
33873
|
};
|
|
33735
|
-
var mapBinary = (
|
|
33874
|
+
var mapBinary = (data2, binaryType) => {
|
|
33736
33875
|
switch (binaryType) {
|
|
33737
33876
|
case "arraybuffer":
|
|
33738
|
-
if (
|
|
33739
|
-
return
|
|
33740
|
-
} else if (Buffer.isBuffer(
|
|
33741
|
-
return
|
|
33877
|
+
if (data2 instanceof ArrayBuffer) {
|
|
33878
|
+
return data2;
|
|
33879
|
+
} else if (Buffer.isBuffer(data2)) {
|
|
33880
|
+
return data2.buffer.slice(data2.byteOffset, data2.byteOffset + data2.byteLength);
|
|
33742
33881
|
} else {
|
|
33743
|
-
return
|
|
33882
|
+
return data2.buffer;
|
|
33744
33883
|
}
|
|
33745
33884
|
case "nodebuffer":
|
|
33746
33885
|
default:
|
|
33747
|
-
if (Buffer.isBuffer(
|
|
33748
|
-
return
|
|
33886
|
+
if (Buffer.isBuffer(data2)) {
|
|
33887
|
+
return data2;
|
|
33749
33888
|
} else {
|
|
33750
|
-
return Buffer.from(
|
|
33889
|
+
return Buffer.from(data2);
|
|
33751
33890
|
}
|
|
33752
33891
|
}
|
|
33753
33892
|
};
|
|
@@ -33880,8 +34019,8 @@ function createPacketDecoderStream(maxPayload, binaryType) {
|
|
|
33880
34019
|
if (totalLength(chunks) < expectedLength) {
|
|
33881
34020
|
break;
|
|
33882
34021
|
}
|
|
33883
|
-
const
|
|
33884
|
-
controller.enqueue(decodePacket(isBinary2 ?
|
|
34022
|
+
const data2 = concatChunks(chunks, expectedLength);
|
|
34023
|
+
controller.enqueue(decodePacket(isBinary2 ? data2 : TEXT_DECODER.decode(data2), binaryType));
|
|
33885
34024
|
state = 0;
|
|
33886
34025
|
}
|
|
33887
34026
|
if (expectedLength === 0 || expectedLength > maxPayload) {
|
|
@@ -34216,8 +34355,8 @@ var Transport = class extends Emitter {
|
|
|
34216
34355
|
* @param {String} data
|
|
34217
34356
|
* @protected
|
|
34218
34357
|
*/
|
|
34219
|
-
onData(
|
|
34220
|
-
const packet = decodePacket(
|
|
34358
|
+
onData(data2) {
|
|
34359
|
+
const packet = decodePacket(data2, this.socket.binaryType);
|
|
34221
34360
|
this.onPacket(packet);
|
|
34222
34361
|
}
|
|
34223
34362
|
/**
|
|
@@ -34335,8 +34474,8 @@ var Polling = class extends Transport {
|
|
|
34335
34474
|
*
|
|
34336
34475
|
* @protected
|
|
34337
34476
|
*/
|
|
34338
|
-
onData(
|
|
34339
|
-
debug2("polling got data %s",
|
|
34477
|
+
onData(data2) {
|
|
34478
|
+
debug2("polling got data %s", data2);
|
|
34340
34479
|
const callback = (packet) => {
|
|
34341
34480
|
if ("opening" === this.readyState && packet.type === "open") {
|
|
34342
34481
|
this.onOpen();
|
|
@@ -34347,7 +34486,7 @@ var Polling = class extends Transport {
|
|
|
34347
34486
|
}
|
|
34348
34487
|
this.onPacket(packet);
|
|
34349
34488
|
};
|
|
34350
|
-
decodePayload(
|
|
34489
|
+
decodePayload(data2, this.socket.binaryType).forEach(callback);
|
|
34351
34490
|
if ("closed" !== this.readyState) {
|
|
34352
34491
|
this._polling = false;
|
|
34353
34492
|
this.emitReserved("pollComplete");
|
|
@@ -34384,8 +34523,8 @@ var Polling = class extends Transport {
|
|
|
34384
34523
|
*/
|
|
34385
34524
|
write(packets) {
|
|
34386
34525
|
this.writable = false;
|
|
34387
|
-
encodePayload(packets, (
|
|
34388
|
-
this.doWrite(
|
|
34526
|
+
encodePayload(packets, (data2) => {
|
|
34527
|
+
this.doWrite(data2, () => {
|
|
34389
34528
|
this.writable = true;
|
|
34390
34529
|
this.emitReserved("drain");
|
|
34391
34530
|
});
|
|
@@ -34448,10 +34587,10 @@ var BaseXHR = class extends Polling {
|
|
|
34448
34587
|
* @param {Function} fn - called upon flush.
|
|
34449
34588
|
* @private
|
|
34450
34589
|
*/
|
|
34451
|
-
doWrite(
|
|
34590
|
+
doWrite(data2, fn) {
|
|
34452
34591
|
const req = this.request({
|
|
34453
34592
|
method: "POST",
|
|
34454
|
-
data
|
|
34593
|
+
data: data2
|
|
34455
34594
|
});
|
|
34456
34595
|
req.on("success", fn);
|
|
34457
34596
|
req.on("error", (xhrStatus, context) => {
|
|
@@ -34598,9 +34737,9 @@ var Request = class _Request extends Emitter {
|
|
|
34598
34737
|
* @private
|
|
34599
34738
|
*/
|
|
34600
34739
|
_onLoad() {
|
|
34601
|
-
const
|
|
34602
|
-
if (
|
|
34603
|
-
this.emitReserved("data",
|
|
34740
|
+
const data2 = this._xhr.responseText;
|
|
34741
|
+
if (data2 !== null) {
|
|
34742
|
+
this.emitReserved("data", data2);
|
|
34604
34743
|
this.emitReserved("success");
|
|
34605
34744
|
this._cleanup();
|
|
34606
34745
|
}
|
|
@@ -34725,9 +34864,9 @@ var BaseWS = class extends Transport {
|
|
|
34725
34864
|
for (let i = 0; i < packets.length; i++) {
|
|
34726
34865
|
const packet = packets[i];
|
|
34727
34866
|
const lastPacket = i === packets.length - 1;
|
|
34728
|
-
encodePacket(packet, this.supportsBinary, (
|
|
34867
|
+
encodePacket(packet, this.supportsBinary, (data2) => {
|
|
34729
34868
|
try {
|
|
34730
|
-
this.doWrite(packet,
|
|
34869
|
+
this.doWrite(packet, data2);
|
|
34731
34870
|
} catch (e) {
|
|
34732
34871
|
debug4("websocket closed before onclose event");
|
|
34733
34872
|
}
|
|
@@ -34780,7 +34919,7 @@ var WS = class extends BaseWS {
|
|
|
34780
34919
|
}
|
|
34781
34920
|
return new import_websocket.default(uri, protocols, opts);
|
|
34782
34921
|
}
|
|
34783
|
-
doWrite(packet,
|
|
34922
|
+
doWrite(packet, data2) {
|
|
34784
34923
|
const opts = {};
|
|
34785
34924
|
if (packet.options) {
|
|
34786
34925
|
opts.compress = packet.options.compress;
|
|
@@ -34788,13 +34927,13 @@ var WS = class extends BaseWS {
|
|
|
34788
34927
|
if (this.opts.perMessageDeflate) {
|
|
34789
34928
|
const len = (
|
|
34790
34929
|
// @ts-ignore
|
|
34791
|
-
"string" === typeof
|
|
34930
|
+
"string" === typeof data2 ? Buffer.byteLength(data2) : data2.length
|
|
34792
34931
|
);
|
|
34793
34932
|
if (len < this.opts.perMessageDeflate.threshold) {
|
|
34794
34933
|
opts.compress = false;
|
|
34795
34934
|
}
|
|
34796
34935
|
}
|
|
34797
|
-
this.ws.send(
|
|
34936
|
+
this.ws.send(data2, opts);
|
|
34798
34937
|
}
|
|
34799
34938
|
};
|
|
34800
34939
|
|
|
@@ -34928,13 +35067,13 @@ function pathNames(obj, path13) {
|
|
|
34928
35067
|
return names;
|
|
34929
35068
|
}
|
|
34930
35069
|
function queryKey(uri, query) {
|
|
34931
|
-
const
|
|
35070
|
+
const data2 = {};
|
|
34932
35071
|
query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function($0, $1, $2) {
|
|
34933
35072
|
if ($1) {
|
|
34934
|
-
|
|
35073
|
+
data2[$1] = $2;
|
|
34935
35074
|
}
|
|
34936
35075
|
});
|
|
34937
|
-
return
|
|
35076
|
+
return data2;
|
|
34938
35077
|
}
|
|
34939
35078
|
|
|
34940
35079
|
// node_modules/engine.io-client/build/esm-debug/socket.js
|
|
@@ -35252,14 +35391,14 @@ var Socket = class _Socket extends Emitter {
|
|
|
35252
35391
|
* @param {Object} data - handshake obj
|
|
35253
35392
|
* @private
|
|
35254
35393
|
*/
|
|
35255
|
-
onHandshake(
|
|
35256
|
-
this.emitReserved("handshake",
|
|
35257
|
-
this.id =
|
|
35258
|
-
this.transport.query.sid =
|
|
35259
|
-
this._upgrades = this._filterUpgrades(
|
|
35260
|
-
this._pingInterval =
|
|
35261
|
-
this._pingTimeout =
|
|
35262
|
-
this._maxPayload =
|
|
35394
|
+
onHandshake(data2) {
|
|
35395
|
+
this.emitReserved("handshake", data2);
|
|
35396
|
+
this.id = data2.sid;
|
|
35397
|
+
this.transport.query.sid = data2.sid;
|
|
35398
|
+
this._upgrades = this._filterUpgrades(data2.upgrades);
|
|
35399
|
+
this._pingInterval = data2.pingInterval;
|
|
35400
|
+
this._pingTimeout = data2.pingTimeout;
|
|
35401
|
+
this._maxPayload = data2.maxPayload;
|
|
35263
35402
|
this.onOpen();
|
|
35264
35403
|
if ("closed" === this.readyState)
|
|
35265
35404
|
return;
|
|
@@ -35322,9 +35461,9 @@ var Socket = class _Socket extends Emitter {
|
|
|
35322
35461
|
}
|
|
35323
35462
|
let payloadSize = 1;
|
|
35324
35463
|
for (let i = 0; i < this.writeBuffer.length; i++) {
|
|
35325
|
-
const
|
|
35326
|
-
if (
|
|
35327
|
-
payloadSize += byteLength(
|
|
35464
|
+
const data2 = this.writeBuffer[i].data;
|
|
35465
|
+
if (data2) {
|
|
35466
|
+
payloadSize += byteLength(data2);
|
|
35328
35467
|
}
|
|
35329
35468
|
if (i > 0 && payloadSize > this._maxPayload) {
|
|
35330
35469
|
debug6("only send %d out of %d packets", i, this.writeBuffer.length);
|
|
@@ -35391,10 +35530,10 @@ var Socket = class _Socket extends Emitter {
|
|
|
35391
35530
|
* @param {Function} fn - callback function.
|
|
35392
35531
|
* @private
|
|
35393
35532
|
*/
|
|
35394
|
-
_sendPacket(type,
|
|
35395
|
-
if ("function" === typeof
|
|
35396
|
-
fn =
|
|
35397
|
-
|
|
35533
|
+
_sendPacket(type, data2, options, fn) {
|
|
35534
|
+
if ("function" === typeof data2) {
|
|
35535
|
+
fn = data2;
|
|
35536
|
+
data2 = void 0;
|
|
35398
35537
|
}
|
|
35399
35538
|
if ("function" === typeof options) {
|
|
35400
35539
|
fn = options;
|
|
@@ -35407,7 +35546,7 @@ var Socket = class _Socket extends Emitter {
|
|
|
35407
35546
|
options.compress = false !== options.compress;
|
|
35408
35547
|
const packet = {
|
|
35409
35548
|
type,
|
|
35410
|
-
data,
|
|
35549
|
+
data: data2,
|
|
35411
35550
|
options
|
|
35412
35551
|
};
|
|
35413
35552
|
this.emitReserved("packetCreate", packet);
|
|
@@ -35631,60 +35770,60 @@ function deconstructPacket(packet) {
|
|
|
35631
35770
|
pack.attachments = buffers.length;
|
|
35632
35771
|
return { packet: pack, buffers };
|
|
35633
35772
|
}
|
|
35634
|
-
function _deconstructPacket(
|
|
35635
|
-
if (!
|
|
35636
|
-
return
|
|
35637
|
-
if (isBinary(
|
|
35773
|
+
function _deconstructPacket(data2, buffers, toJSON) {
|
|
35774
|
+
if (!data2)
|
|
35775
|
+
return data2;
|
|
35776
|
+
if (isBinary(data2)) {
|
|
35638
35777
|
const placeholder = { _placeholder: true, num: buffers.length };
|
|
35639
|
-
buffers.push(
|
|
35778
|
+
buffers.push(data2);
|
|
35640
35779
|
return placeholder;
|
|
35641
|
-
} else if (Array.isArray(
|
|
35642
|
-
const newData = new Array(
|
|
35643
|
-
for (let i = 0; i <
|
|
35644
|
-
newData[i] = _deconstructPacket(
|
|
35780
|
+
} else if (Array.isArray(data2)) {
|
|
35781
|
+
const newData = new Array(data2.length);
|
|
35782
|
+
for (let i = 0; i < data2.length; i++) {
|
|
35783
|
+
newData[i] = _deconstructPacket(data2[i], buffers);
|
|
35645
35784
|
}
|
|
35646
35785
|
return newData;
|
|
35647
|
-
} else if (typeof
|
|
35648
|
-
if (
|
|
35649
|
-
return _deconstructPacket(
|
|
35786
|
+
} else if (typeof data2 === "object" && !(data2 instanceof Date)) {
|
|
35787
|
+
if (data2.toJSON && typeof data2.toJSON === "function" && !toJSON) {
|
|
35788
|
+
return _deconstructPacket(data2.toJSON(), buffers, true);
|
|
35650
35789
|
}
|
|
35651
35790
|
const newData = {};
|
|
35652
|
-
for (const key in
|
|
35653
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
35654
|
-
newData[key] = _deconstructPacket(
|
|
35791
|
+
for (const key in data2) {
|
|
35792
|
+
if (Object.prototype.hasOwnProperty.call(data2, key)) {
|
|
35793
|
+
newData[key] = _deconstructPacket(data2[key], buffers);
|
|
35655
35794
|
}
|
|
35656
35795
|
}
|
|
35657
35796
|
return newData;
|
|
35658
35797
|
}
|
|
35659
|
-
return
|
|
35798
|
+
return data2;
|
|
35660
35799
|
}
|
|
35661
35800
|
function reconstructPacket(packet, buffers) {
|
|
35662
35801
|
packet.data = _reconstructPacket(packet.data, buffers);
|
|
35663
35802
|
delete packet.attachments;
|
|
35664
35803
|
return packet;
|
|
35665
35804
|
}
|
|
35666
|
-
function _reconstructPacket(
|
|
35667
|
-
if (!
|
|
35668
|
-
return
|
|
35669
|
-
if (
|
|
35670
|
-
const isIndexValid = typeof
|
|
35805
|
+
function _reconstructPacket(data2, buffers) {
|
|
35806
|
+
if (!data2)
|
|
35807
|
+
return data2;
|
|
35808
|
+
if (data2 && data2._placeholder === true) {
|
|
35809
|
+
const isIndexValid = typeof data2.num === "number" && data2.num >= 0 && data2.num < buffers.length;
|
|
35671
35810
|
if (isIndexValid) {
|
|
35672
|
-
return buffers[
|
|
35811
|
+
return buffers[data2.num];
|
|
35673
35812
|
} else {
|
|
35674
35813
|
throw new Error("illegal attachments");
|
|
35675
35814
|
}
|
|
35676
|
-
} else if (Array.isArray(
|
|
35677
|
-
for (let i = 0; i <
|
|
35678
|
-
|
|
35815
|
+
} else if (Array.isArray(data2)) {
|
|
35816
|
+
for (let i = 0; i < data2.length; i++) {
|
|
35817
|
+
data2[i] = _reconstructPacket(data2[i], buffers);
|
|
35679
35818
|
}
|
|
35680
|
-
} else if (typeof
|
|
35681
|
-
for (const key in
|
|
35682
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
35683
|
-
|
|
35819
|
+
} else if (typeof data2 === "object") {
|
|
35820
|
+
for (const key in data2) {
|
|
35821
|
+
if (Object.prototype.hasOwnProperty.call(data2, key)) {
|
|
35822
|
+
data2[key] = _reconstructPacket(data2[key], buffers);
|
|
35684
35823
|
}
|
|
35685
35824
|
}
|
|
35686
35825
|
}
|
|
35687
|
-
return
|
|
35826
|
+
return data2;
|
|
35688
35827
|
}
|
|
35689
35828
|
|
|
35690
35829
|
// node_modules/socket.io-parser/build/esm-debug/index.js
|
|
@@ -36320,8 +36459,8 @@ var Socket2 = class extends Emitter {
|
|
|
36320
36459
|
onopen() {
|
|
36321
36460
|
debug9("transport is open - connecting");
|
|
36322
36461
|
if (typeof this.auth == "function") {
|
|
36323
|
-
this.auth((
|
|
36324
|
-
this._sendConnectPacket(
|
|
36462
|
+
this.auth((data2) => {
|
|
36463
|
+
this._sendConnectPacket(data2);
|
|
36325
36464
|
});
|
|
36326
36465
|
} else {
|
|
36327
36466
|
this._sendConnectPacket(this.auth);
|
|
@@ -36333,10 +36472,10 @@ var Socket2 = class extends Emitter {
|
|
|
36333
36472
|
* @param data
|
|
36334
36473
|
* @private
|
|
36335
36474
|
*/
|
|
36336
|
-
_sendConnectPacket(
|
|
36475
|
+
_sendConnectPacket(data2) {
|
|
36337
36476
|
this.packet({
|
|
36338
36477
|
type: PacketType.CONNECT,
|
|
36339
|
-
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset },
|
|
36478
|
+
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, data2) : data2
|
|
36340
36479
|
});
|
|
36341
36480
|
}
|
|
36342
36481
|
/**
|
|
@@ -37009,9 +37148,9 @@ var Manager = class extends Emitter {
|
|
|
37009
37148
|
*
|
|
37010
37149
|
* @private
|
|
37011
37150
|
*/
|
|
37012
|
-
ondata(
|
|
37151
|
+
ondata(data2) {
|
|
37013
37152
|
try {
|
|
37014
|
-
this.decoder.add(
|
|
37153
|
+
this.decoder.add(data2);
|
|
37015
37154
|
} catch (e) {
|
|
37016
37155
|
this.onclose("parse error", e);
|
|
37017
37156
|
}
|
|
@@ -37777,8 +37916,8 @@ function runCommand(params) {
|
|
|
37777
37916
|
|
|
37778
37917
|
// src/local/executor.ts
|
|
37779
37918
|
var MUTATING_ACTIONS = /* @__PURE__ */ new Set(["write", "mkdir", "mv", "rm", "run", "fetch", "push"]);
|
|
37780
|
-
function ok(message,
|
|
37781
|
-
return { type: "local_result", commandId: message.commandId, deviceId: message.deviceId, status: "ok", data };
|
|
37919
|
+
function ok(message, data2) {
|
|
37920
|
+
return { type: "local_result", commandId: message.commandId, deviceId: message.deviceId, status: "ok", data: data2 };
|
|
37782
37921
|
}
|
|
37783
37922
|
function denied(message, code, text2) {
|
|
37784
37923
|
return {
|
|
@@ -38771,8 +38910,8 @@ function slugify(input2) {
|
|
|
38771
38910
|
}
|
|
38772
38911
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
38773
38912
|
};
|
|
38774
|
-
function isObject2(
|
|
38775
|
-
return typeof
|
|
38913
|
+
function isObject2(data2) {
|
|
38914
|
+
return typeof data2 === "object" && data2 !== null && !Array.isArray(data2);
|
|
38776
38915
|
}
|
|
38777
38916
|
var allowsEval = /* @__PURE__ */ cached(() => {
|
|
38778
38917
|
if (globalConfig.jitless) {
|
|
@@ -38816,24 +38955,24 @@ function shallowClone(o) {
|
|
|
38816
38955
|
return new Set(o);
|
|
38817
38956
|
return o;
|
|
38818
38957
|
}
|
|
38819
|
-
function numKeys(
|
|
38958
|
+
function numKeys(data2) {
|
|
38820
38959
|
let keyCount = 0;
|
|
38821
|
-
for (const key in
|
|
38822
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
38960
|
+
for (const key in data2) {
|
|
38961
|
+
if (Object.prototype.hasOwnProperty.call(data2, key)) {
|
|
38823
38962
|
keyCount++;
|
|
38824
38963
|
}
|
|
38825
38964
|
}
|
|
38826
38965
|
return keyCount;
|
|
38827
38966
|
}
|
|
38828
|
-
var getParsedType = (
|
|
38829
|
-
const t = typeof
|
|
38967
|
+
var getParsedType = (data2) => {
|
|
38968
|
+
const t = typeof data2;
|
|
38830
38969
|
switch (t) {
|
|
38831
38970
|
case "undefined":
|
|
38832
38971
|
return "undefined";
|
|
38833
38972
|
case "string":
|
|
38834
38973
|
return "string";
|
|
38835
38974
|
case "number":
|
|
38836
|
-
return Number.isNaN(
|
|
38975
|
+
return Number.isNaN(data2) ? "nan" : "number";
|
|
38837
38976
|
case "boolean":
|
|
38838
38977
|
return "boolean";
|
|
38839
38978
|
case "function":
|
|
@@ -38843,25 +38982,25 @@ var getParsedType = (data) => {
|
|
|
38843
38982
|
case "symbol":
|
|
38844
38983
|
return "symbol";
|
|
38845
38984
|
case "object":
|
|
38846
|
-
if (Array.isArray(
|
|
38985
|
+
if (Array.isArray(data2)) {
|
|
38847
38986
|
return "array";
|
|
38848
38987
|
}
|
|
38849
|
-
if (
|
|
38988
|
+
if (data2 === null) {
|
|
38850
38989
|
return "null";
|
|
38851
38990
|
}
|
|
38852
|
-
if (
|
|
38991
|
+
if (data2.then && typeof data2.then === "function" && data2.catch && typeof data2.catch === "function") {
|
|
38853
38992
|
return "promise";
|
|
38854
38993
|
}
|
|
38855
|
-
if (typeof Map !== "undefined" &&
|
|
38994
|
+
if (typeof Map !== "undefined" && data2 instanceof Map) {
|
|
38856
38995
|
return "map";
|
|
38857
38996
|
}
|
|
38858
|
-
if (typeof Set !== "undefined" &&
|
|
38997
|
+
if (typeof Set !== "undefined" && data2 instanceof Set) {
|
|
38859
38998
|
return "set";
|
|
38860
38999
|
}
|
|
38861
|
-
if (typeof Date !== "undefined" &&
|
|
39000
|
+
if (typeof Date !== "undefined" && data2 instanceof Date) {
|
|
38862
39001
|
return "date";
|
|
38863
39002
|
}
|
|
38864
|
-
if (typeof File !== "undefined" &&
|
|
39003
|
+
if (typeof File !== "undefined" && data2 instanceof File) {
|
|
38865
39004
|
return "file";
|
|
38866
39005
|
}
|
|
38867
39006
|
return "object";
|
|
@@ -39165,20 +39304,20 @@ function getLengthableOrigin(input2) {
|
|
|
39165
39304
|
return "string";
|
|
39166
39305
|
return "unknown";
|
|
39167
39306
|
}
|
|
39168
|
-
function parsedType(
|
|
39169
|
-
const t = typeof
|
|
39307
|
+
function parsedType(data2) {
|
|
39308
|
+
const t = typeof data2;
|
|
39170
39309
|
switch (t) {
|
|
39171
39310
|
case "number": {
|
|
39172
|
-
return Number.isNaN(
|
|
39311
|
+
return Number.isNaN(data2) ? "nan" : "number";
|
|
39173
39312
|
}
|
|
39174
39313
|
case "object": {
|
|
39175
|
-
if (
|
|
39314
|
+
if (data2 === null) {
|
|
39176
39315
|
return "null";
|
|
39177
39316
|
}
|
|
39178
|
-
if (Array.isArray(
|
|
39317
|
+
if (Array.isArray(data2)) {
|
|
39179
39318
|
return "array";
|
|
39180
39319
|
}
|
|
39181
|
-
const obj =
|
|
39320
|
+
const obj = data2;
|
|
39182
39321
|
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
39183
39322
|
return obj.constructor.name;
|
|
39184
39323
|
}
|
|
@@ -40943,15 +41082,15 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
40943
41082
|
}
|
|
40944
41083
|
};
|
|
40945
41084
|
});
|
|
40946
|
-
function isValidBase64(
|
|
40947
|
-
if (
|
|
41085
|
+
function isValidBase64(data2) {
|
|
41086
|
+
if (data2 === "")
|
|
40948
41087
|
return true;
|
|
40949
|
-
if (/\s/.test(
|
|
41088
|
+
if (/\s/.test(data2))
|
|
40950
41089
|
return false;
|
|
40951
|
-
if (
|
|
41090
|
+
if (data2.length % 4 !== 0)
|
|
40952
41091
|
return false;
|
|
40953
41092
|
try {
|
|
40954
|
-
atob(
|
|
41093
|
+
atob(data2);
|
|
40955
41094
|
return true;
|
|
40956
41095
|
} catch {
|
|
40957
41096
|
return false;
|
|
@@ -40974,10 +41113,10 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
40974
41113
|
};
|
|
40975
41114
|
});
|
|
40976
41115
|
var base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
40977
|
-
function isValidBase64URL(
|
|
40978
|
-
if (!base64urlCharset.test(
|
|
41116
|
+
function isValidBase64URL(data2) {
|
|
41117
|
+
if (!base64urlCharset.test(data2))
|
|
40979
41118
|
return false;
|
|
40980
|
-
const base643 =
|
|
41119
|
+
const base643 = data2.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
40981
41120
|
const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
|
|
40982
41121
|
return isValidBase64(padded);
|
|
40983
41122
|
}
|
|
@@ -51019,22 +51158,22 @@ function installCompiledUserMethods(target, source, parser) {
|
|
|
51019
51158
|
const sourceAny = source;
|
|
51020
51159
|
if (typeof sourceAny.safeParse === "function") {
|
|
51021
51160
|
const originalSafeParse = sourceAny.safeParse;
|
|
51022
|
-
targetAny.safeParse = (
|
|
51023
|
-
const out = parser(
|
|
51161
|
+
targetAny.safeParse = (data2, params) => {
|
|
51162
|
+
const out = parser(data2);
|
|
51024
51163
|
if (out !== INVALID) {
|
|
51025
51164
|
return { success: true, data: out };
|
|
51026
51165
|
}
|
|
51027
|
-
return originalSafeParse(
|
|
51166
|
+
return originalSafeParse(data2, params);
|
|
51028
51167
|
};
|
|
51029
51168
|
}
|
|
51030
51169
|
if (typeof sourceAny.parse === "function") {
|
|
51031
51170
|
const originalParse = sourceAny.parse;
|
|
51032
|
-
targetAny.parse = (
|
|
51033
|
-
const out = parser(
|
|
51171
|
+
targetAny.parse = (data2, params) => {
|
|
51172
|
+
const out = parser(data2);
|
|
51034
51173
|
if (out !== INVALID) {
|
|
51035
51174
|
return out;
|
|
51036
51175
|
}
|
|
51037
|
-
return originalParse(
|
|
51176
|
+
return originalParse(data2, params);
|
|
51038
51177
|
};
|
|
51039
51178
|
}
|
|
51040
51179
|
}
|
|
@@ -53568,12 +53707,12 @@ function _stringbool(Classes, _params) {
|
|
|
53568
53707
|
in: stringSchema,
|
|
53569
53708
|
out: booleanSchema,
|
|
53570
53709
|
transform: ((input2, payload) => {
|
|
53571
|
-
let
|
|
53710
|
+
let data2 = input2;
|
|
53572
53711
|
if (params.case !== "sensitive")
|
|
53573
|
-
|
|
53574
|
-
if (truthySet.has(
|
|
53712
|
+
data2 = data2.toLowerCase();
|
|
53713
|
+
if (truthySet.has(data2)) {
|
|
53575
53714
|
return true;
|
|
53576
|
-
} else if (falsySet.has(
|
|
53715
|
+
} else if (falsySet.has(data2)) {
|
|
53577
53716
|
return false;
|
|
53578
53717
|
} else {
|
|
53579
53718
|
payload.issues.push({
|
|
@@ -55386,17 +55525,17 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
55386
55525
|
set "~standard"(value2) {
|
|
55387
55526
|
util_exports.own(this, "~standard", value2);
|
|
55388
55527
|
},
|
|
55389
|
-
parse: function _parse2(
|
|
55390
|
-
return parse5(this,
|
|
55528
|
+
parse: function _parse2(data2, params) {
|
|
55529
|
+
return parse5(this, data2, params, { callee: _parse2 });
|
|
55391
55530
|
},
|
|
55392
|
-
parseAsync: async function _parseAsync2(
|
|
55393
|
-
return await parseAsync2(this,
|
|
55531
|
+
parseAsync: async function _parseAsync2(data2, params) {
|
|
55532
|
+
return await parseAsync2(this, data2, params, { callee: _parseAsync2 });
|
|
55394
55533
|
},
|
|
55395
|
-
safeParse(
|
|
55396
|
-
return safeParse2(this,
|
|
55534
|
+
safeParse(data2, params) {
|
|
55535
|
+
return safeParse2(this, data2, params);
|
|
55397
55536
|
},
|
|
55398
|
-
async safeParseAsync(
|
|
55399
|
-
return safeParseAsync2(this,
|
|
55537
|
+
async safeParseAsync(data2, params) {
|
|
55538
|
+
return safeParseAsync2(this, data2, params);
|
|
55400
55539
|
},
|
|
55401
55540
|
// `spa` is an alias: same function object as `safeParseAsync`, as before.
|
|
55402
55541
|
get spa() {
|
|
@@ -55405,35 +55544,35 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
55405
55544
|
set spa(value2) {
|
|
55406
55545
|
util_exports.own(this, "spa", value2);
|
|
55407
55546
|
},
|
|
55408
|
-
validate(
|
|
55409
|
-
return validate(this,
|
|
55547
|
+
validate(data2, params) {
|
|
55548
|
+
return validate(this, data2, params);
|
|
55410
55549
|
},
|
|
55411
|
-
validateAsync(
|
|
55412
|
-
return validateAsync(this,
|
|
55550
|
+
validateAsync(data2, params) {
|
|
55551
|
+
return validateAsync(this, data2, params);
|
|
55413
55552
|
},
|
|
55414
|
-
encode: function _encode2(
|
|
55415
|
-
return encode3(this,
|
|
55553
|
+
encode: function _encode2(data2, params) {
|
|
55554
|
+
return encode3(this, data2, params, { callee: _encode2 });
|
|
55416
55555
|
},
|
|
55417
|
-
decode: function _decode2(
|
|
55418
|
-
return decode3(this,
|
|
55556
|
+
decode: function _decode2(data2, params) {
|
|
55557
|
+
return decode3(this, data2, params, { callee: _decode2 });
|
|
55419
55558
|
},
|
|
55420
|
-
encodeAsync: async function _encodeAsync2(
|
|
55421
|
-
return await encodeAsync2(this,
|
|
55559
|
+
encodeAsync: async function _encodeAsync2(data2, params) {
|
|
55560
|
+
return await encodeAsync2(this, data2, params, { callee: _encodeAsync2 });
|
|
55422
55561
|
},
|
|
55423
|
-
decodeAsync: async function _decodeAsync2(
|
|
55424
|
-
return await decodeAsync2(this,
|
|
55562
|
+
decodeAsync: async function _decodeAsync2(data2, params) {
|
|
55563
|
+
return await decodeAsync2(this, data2, params, { callee: _decodeAsync2 });
|
|
55425
55564
|
},
|
|
55426
|
-
safeEncode(
|
|
55427
|
-
return safeEncode2(this,
|
|
55565
|
+
safeEncode(data2, params) {
|
|
55566
|
+
return safeEncode2(this, data2, params);
|
|
55428
55567
|
},
|
|
55429
|
-
safeDecode(
|
|
55430
|
-
return safeDecode2(this,
|
|
55568
|
+
safeDecode(data2, params) {
|
|
55569
|
+
return safeDecode2(this, data2, params);
|
|
55431
55570
|
},
|
|
55432
|
-
async safeEncodeAsync(
|
|
55433
|
-
return safeEncodeAsync2(this,
|
|
55571
|
+
async safeEncodeAsync(data2, params) {
|
|
55572
|
+
return safeEncodeAsync2(this, data2, params);
|
|
55434
55573
|
},
|
|
55435
|
-
async safeDecodeAsync(
|
|
55436
|
-
return safeDecodeAsync2(this,
|
|
55574
|
+
async safeDecodeAsync(data2, params) {
|
|
55575
|
+
return safeDecodeAsync2(this, data2, params);
|
|
55437
55576
|
},
|
|
55438
55577
|
toJSONSchema(params) {
|
|
55439
55578
|
return createToJSONSchemaMethod(this, {})(params);
|
|
@@ -56691,7 +56830,7 @@ function _instanceof(cls, params = {}) {
|
|
|
56691
56830
|
const inst = new ZodInstanceOf({
|
|
56692
56831
|
type: "custom",
|
|
56693
56832
|
check: "custom",
|
|
56694
|
-
fn: (
|
|
56833
|
+
fn: (data2) => data2 instanceof cls,
|
|
56695
56834
|
abort: true,
|
|
56696
56835
|
...util_exports.normalizeParams(params)
|
|
56697
56836
|
});
|