@inworld/cli 2.2.0 → 2.3.0
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/cli/inworld-mcp.js +738 -950
- package/dist/index.js +868 -1073
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -590,14 +590,14 @@ var require_help = __commonJS({
|
|
|
590
590
|
* @return {string}
|
|
591
591
|
*
|
|
592
592
|
*/
|
|
593
|
-
wrap(
|
|
593
|
+
wrap(str2, width, indent, minColumnWidth = 40) {
|
|
594
594
|
const indents = " \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF";
|
|
595
595
|
const manualIndent = new RegExp(`[\\n][${indents}]+`);
|
|
596
|
-
if (
|
|
596
|
+
if (str2.match(manualIndent)) return str2;
|
|
597
597
|
const columnWidth = width - indent;
|
|
598
|
-
if (columnWidth < minColumnWidth) return
|
|
599
|
-
const leadingStr =
|
|
600
|
-
const columnText =
|
|
598
|
+
if (columnWidth < minColumnWidth) return str2;
|
|
599
|
+
const leadingStr = str2.slice(0, indent);
|
|
600
|
+
const columnText = str2.slice(indent).replace("\r\n", "\n");
|
|
601
601
|
const indentString = " ".repeat(indent);
|
|
602
602
|
const zeroWidthSpace = "\u200B";
|
|
603
603
|
const breaks = `\\s${zeroWidthSpace}`;
|
|
@@ -866,9 +866,9 @@ var require_option = __commonJS({
|
|
|
866
866
|
return option.negate === (negativeValue === value);
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
|
-
function camelcase(
|
|
870
|
-
return
|
|
871
|
-
return
|
|
869
|
+
function camelcase(str2) {
|
|
870
|
+
return str2.split("-").reduce((str3, word) => {
|
|
871
|
+
return str3 + word[0].toUpperCase() + word.slice(1);
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
874
|
function splitOptionFlags(flags) {
|
|
@@ -1022,11 +1022,11 @@ var require_command = __commonJS({
|
|
|
1022
1022
|
this._showHelpAfterError = false;
|
|
1023
1023
|
this._showSuggestionAfterError = true;
|
|
1024
1024
|
this._outputConfiguration = {
|
|
1025
|
-
writeOut: (
|
|
1026
|
-
writeErr: (
|
|
1025
|
+
writeOut: (str2) => process18.stdout.write(str2),
|
|
1026
|
+
writeErr: (str2) => process18.stderr.write(str2),
|
|
1027
1027
|
getOutHelpWidth: () => process18.stdout.isTTY ? process18.stdout.columns : void 0,
|
|
1028
1028
|
getErrHelpWidth: () => process18.stderr.isTTY ? process18.stderr.columns : void 0,
|
|
1029
|
-
outputError: (
|
|
1029
|
+
outputError: (str2, write) => write(str2)
|
|
1030
1030
|
};
|
|
1031
1031
|
this._hidden = false;
|
|
1032
1032
|
this._helpOption = void 0;
|
|
@@ -2662,18 +2662,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2662
2662
|
* @param {string} [description]
|
|
2663
2663
|
* @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments
|
|
2664
2664
|
*/
|
|
2665
|
-
version(
|
|
2666
|
-
if (
|
|
2667
|
-
this._version =
|
|
2665
|
+
version(str2, flags, description) {
|
|
2666
|
+
if (str2 === void 0) return this._version;
|
|
2667
|
+
this._version = str2;
|
|
2668
2668
|
flags = flags || "-V, --version";
|
|
2669
2669
|
description = description || "output the version number";
|
|
2670
2670
|
const versionOption = this.createOption(flags, description);
|
|
2671
2671
|
this._versionOptionName = versionOption.attributeName();
|
|
2672
2672
|
this._registerOption(versionOption);
|
|
2673
2673
|
this.on("option:" + versionOption.name(), () => {
|
|
2674
|
-
this._outputConfiguration.writeOut(`${
|
|
2674
|
+
this._outputConfiguration.writeOut(`${str2}
|
|
2675
2675
|
`);
|
|
2676
|
-
this._exit(0, "commander.version",
|
|
2676
|
+
this._exit(0, "commander.version", str2);
|
|
2677
2677
|
});
|
|
2678
2678
|
return this;
|
|
2679
2679
|
}
|
|
@@ -2684,10 +2684,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2684
2684
|
* @param {object} [argsDescription]
|
|
2685
2685
|
* @return {(string|Command)}
|
|
2686
2686
|
*/
|
|
2687
|
-
description(
|
|
2688
|
-
if (
|
|
2687
|
+
description(str2, argsDescription) {
|
|
2688
|
+
if (str2 === void 0 && argsDescription === void 0)
|
|
2689
2689
|
return this._description;
|
|
2690
|
-
this._description =
|
|
2690
|
+
this._description = str2;
|
|
2691
2691
|
if (argsDescription) {
|
|
2692
2692
|
this._argsDescription = argsDescription;
|
|
2693
2693
|
}
|
|
@@ -2699,9 +2699,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2699
2699
|
* @param {string} [str]
|
|
2700
2700
|
* @return {(string|Command)}
|
|
2701
2701
|
*/
|
|
2702
|
-
summary(
|
|
2703
|
-
if (
|
|
2704
|
-
this._summary =
|
|
2702
|
+
summary(str2) {
|
|
2703
|
+
if (str2 === void 0) return this._summary;
|
|
2704
|
+
this._summary = str2;
|
|
2705
2705
|
return this;
|
|
2706
2706
|
}
|
|
2707
2707
|
/**
|
|
@@ -2749,8 +2749,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2749
2749
|
* @param {string} [str]
|
|
2750
2750
|
* @return {(string|Command)}
|
|
2751
2751
|
*/
|
|
2752
|
-
usage(
|
|
2753
|
-
if (
|
|
2752
|
+
usage(str2) {
|
|
2753
|
+
if (str2 === void 0) {
|
|
2754
2754
|
if (this._usage) return this._usage;
|
|
2755
2755
|
const args = this.registeredArguments.map((arg) => {
|
|
2756
2756
|
return humanReadableArgName(arg);
|
|
@@ -2761,7 +2761,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2761
2761
|
this.registeredArguments.length ? args : []
|
|
2762
2762
|
).join(" ");
|
|
2763
2763
|
}
|
|
2764
|
-
this._usage =
|
|
2764
|
+
this._usage = str2;
|
|
2765
2765
|
return this;
|
|
2766
2766
|
}
|
|
2767
2767
|
/**
|
|
@@ -2770,9 +2770,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2770
2770
|
* @param {string} [str]
|
|
2771
2771
|
* @return {(string|Command)}
|
|
2772
2772
|
*/
|
|
2773
|
-
name(
|
|
2774
|
-
if (
|
|
2775
|
-
this._name =
|
|
2773
|
+
name(str2) {
|
|
2774
|
+
if (str2 === void 0) return this._name;
|
|
2775
|
+
this._name = str2;
|
|
2776
2776
|
return this;
|
|
2777
2777
|
}
|
|
2778
2778
|
/**
|
|
@@ -3883,7 +3883,7 @@ var require_code = __commonJS({
|
|
|
3883
3883
|
}
|
|
3884
3884
|
exports._ = _;
|
|
3885
3885
|
var plus = new _Code("+");
|
|
3886
|
-
function
|
|
3886
|
+
function str2(strs, ...args) {
|
|
3887
3887
|
const expr = [safeStringify(strs[0])];
|
|
3888
3888
|
let i2 = 0;
|
|
3889
3889
|
while (i2 < args.length) {
|
|
@@ -3894,7 +3894,7 @@ var require_code = __commonJS({
|
|
|
3894
3894
|
optimize(expr);
|
|
3895
3895
|
return new _Code(expr);
|
|
3896
3896
|
}
|
|
3897
|
-
exports.str =
|
|
3897
|
+
exports.str = str2;
|
|
3898
3898
|
function addCodeArg(code, arg) {
|
|
3899
3899
|
if (arg instanceof _Code)
|
|
3900
3900
|
code.push(...arg._items);
|
|
@@ -3937,7 +3937,7 @@ var require_code = __commonJS({
|
|
|
3937
3937
|
return;
|
|
3938
3938
|
}
|
|
3939
3939
|
function strConcat(c1, c22) {
|
|
3940
|
-
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 :
|
|
3940
|
+
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 : str2`${c1}${c22}`;
|
|
3941
3941
|
}
|
|
3942
3942
|
exports.strConcat = strConcat;
|
|
3943
3943
|
function interpolate(x) {
|
|
@@ -4899,22 +4899,22 @@ var require_util = __commonJS({
|
|
|
4899
4899
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
4900
4900
|
}
|
|
4901
4901
|
exports.schemaRefOrVal = schemaRefOrVal;
|
|
4902
|
-
function unescapeFragment(
|
|
4903
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
4902
|
+
function unescapeFragment(str2) {
|
|
4903
|
+
return unescapeJsonPointer(decodeURIComponent(str2));
|
|
4904
4904
|
}
|
|
4905
4905
|
exports.unescapeFragment = unescapeFragment;
|
|
4906
|
-
function escapeFragment(
|
|
4907
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
4906
|
+
function escapeFragment(str2) {
|
|
4907
|
+
return encodeURIComponent(escapeJsonPointer(str2));
|
|
4908
4908
|
}
|
|
4909
4909
|
exports.escapeFragment = escapeFragment;
|
|
4910
|
-
function escapeJsonPointer(
|
|
4911
|
-
if (typeof
|
|
4912
|
-
return `${
|
|
4913
|
-
return
|
|
4910
|
+
function escapeJsonPointer(str2) {
|
|
4911
|
+
if (typeof str2 == "number")
|
|
4912
|
+
return `${str2}`;
|
|
4913
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4914
4914
|
}
|
|
4915
4915
|
exports.escapeJsonPointer = escapeJsonPointer;
|
|
4916
|
-
function unescapeJsonPointer(
|
|
4917
|
-
return
|
|
4916
|
+
function unescapeJsonPointer(str2) {
|
|
4917
|
+
return str2.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
4918
4918
|
}
|
|
4919
4919
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
4920
4920
|
function eachItem(xs, f) {
|
|
@@ -5939,8 +5939,8 @@ var require_json_schema_traverse = __commonJS({
|
|
|
5939
5939
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
5940
5940
|
}
|
|
5941
5941
|
}
|
|
5942
|
-
function escapeJsonPtr(
|
|
5943
|
-
return
|
|
5942
|
+
function escapeJsonPtr(str2) {
|
|
5943
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
5944
5944
|
}
|
|
5945
5945
|
}
|
|
5946
5946
|
});
|
|
@@ -7001,10 +7001,10 @@ var require_utils = __commonJS({
|
|
|
7001
7001
|
return { host, isIPV6: false };
|
|
7002
7002
|
}
|
|
7003
7003
|
}
|
|
7004
|
-
function findToken(
|
|
7004
|
+
function findToken(str2, token) {
|
|
7005
7005
|
let ind = 0;
|
|
7006
|
-
for (let i2 = 0; i2 <
|
|
7007
|
-
if (
|
|
7006
|
+
for (let i2 = 0; i2 < str2.length; i2++) {
|
|
7007
|
+
if (str2[i2] === token) ind++;
|
|
7008
7008
|
}
|
|
7009
7009
|
return ind;
|
|
7010
7010
|
}
|
|
@@ -7268,7 +7268,7 @@ var require_schemes = __commonJS({
|
|
|
7268
7268
|
urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
|
|
7269
7269
|
return urnComponent;
|
|
7270
7270
|
}
|
|
7271
|
-
var
|
|
7271
|
+
var http = (
|
|
7272
7272
|
/** @type {SchemeHandler} */
|
|
7273
7273
|
{
|
|
7274
7274
|
scheme: "http",
|
|
@@ -7281,7 +7281,7 @@ var require_schemes = __commonJS({
|
|
|
7281
7281
|
/** @type {SchemeHandler} */
|
|
7282
7282
|
{
|
|
7283
7283
|
scheme: "https",
|
|
7284
|
-
domainHost:
|
|
7284
|
+
domainHost: http.domainHost,
|
|
7285
7285
|
parse: httpParse,
|
|
7286
7286
|
serialize: httpSerialize
|
|
7287
7287
|
}
|
|
@@ -7325,7 +7325,7 @@ var require_schemes = __commonJS({
|
|
|
7325
7325
|
var SCHEMES = (
|
|
7326
7326
|
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
7327
7327
|
{
|
|
7328
|
-
http
|
|
7328
|
+
http,
|
|
7329
7329
|
https,
|
|
7330
7330
|
ws,
|
|
7331
7331
|
wss,
|
|
@@ -7657,7 +7657,7 @@ var require_core = __commonJS({
|
|
|
7657
7657
|
var util_1 = require_util();
|
|
7658
7658
|
var $dataRefSchema = require_data();
|
|
7659
7659
|
var uri_1 = require_uri();
|
|
7660
|
-
var defaultRegExp = (
|
|
7660
|
+
var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
|
|
7661
7661
|
defaultRegExp.code = "new RegExp";
|
|
7662
7662
|
var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
7663
7663
|
var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -8452,16 +8452,16 @@ var require_ucs2length = __commonJS({
|
|
|
8452
8452
|
"../../node_modules/conf/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
|
|
8453
8453
|
"use strict";
|
|
8454
8454
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8455
|
-
function ucs2length(
|
|
8456
|
-
const len =
|
|
8455
|
+
function ucs2length(str2) {
|
|
8456
|
+
const len = str2.length;
|
|
8457
8457
|
let length = 0;
|
|
8458
8458
|
let pos = 0;
|
|
8459
8459
|
let value;
|
|
8460
8460
|
while (pos < len) {
|
|
8461
8461
|
length++;
|
|
8462
|
-
value =
|
|
8462
|
+
value = str2.charCodeAt(pos++);
|
|
8463
8463
|
if (value >= 55296 && value <= 56319 && pos < len) {
|
|
8464
|
-
value =
|
|
8464
|
+
value = str2.charCodeAt(pos);
|
|
8465
8465
|
if ((value & 64512) === 56320)
|
|
8466
8466
|
pos++;
|
|
8467
8467
|
}
|
|
@@ -10919,8 +10919,8 @@ var require_formats = __commonJS({
|
|
|
10919
10919
|
}
|
|
10920
10920
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
10921
10921
|
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
10922
|
-
function date3(
|
|
10923
|
-
const matches = DATE.exec(
|
|
10922
|
+
function date3(str2) {
|
|
10923
|
+
const matches = DATE.exec(str2);
|
|
10924
10924
|
if (!matches)
|
|
10925
10925
|
return false;
|
|
10926
10926
|
const year = +matches[1];
|
|
@@ -10939,8 +10939,8 @@ var require_formats = __commonJS({
|
|
|
10939
10939
|
}
|
|
10940
10940
|
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
10941
10941
|
function getTime(strictTimeZone) {
|
|
10942
|
-
return function time3(
|
|
10943
|
-
const matches = TIME.exec(
|
|
10942
|
+
return function time3(str2) {
|
|
10943
|
+
const matches = TIME.exec(str2);
|
|
10944
10944
|
if (!matches)
|
|
10945
10945
|
return false;
|
|
10946
10946
|
const hr = +matches[1];
|
|
@@ -10986,8 +10986,8 @@ var require_formats = __commonJS({
|
|
|
10986
10986
|
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
10987
10987
|
function getDateTime(strictTimeZone) {
|
|
10988
10988
|
const time3 = getTime(strictTimeZone);
|
|
10989
|
-
return function date_time(
|
|
10990
|
-
const dateTime =
|
|
10989
|
+
return function date_time(str2) {
|
|
10990
|
+
const dateTime = str2.split(DATE_TIME_SEPARATOR);
|
|
10991
10991
|
return dateTime.length === 2 && date3(dateTime[0]) && time3(dateTime[1]);
|
|
10992
10992
|
};
|
|
10993
10993
|
}
|
|
@@ -11012,13 +11012,13 @@ var require_formats = __commonJS({
|
|
|
11012
11012
|
}
|
|
11013
11013
|
var NOT_URI_FRAGMENT = /\/|:/;
|
|
11014
11014
|
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
11015
|
-
function uri(
|
|
11016
|
-
return NOT_URI_FRAGMENT.test(
|
|
11015
|
+
function uri(str2) {
|
|
11016
|
+
return NOT_URI_FRAGMENT.test(str2) && URI.test(str2);
|
|
11017
11017
|
}
|
|
11018
11018
|
var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
11019
|
-
function byte(
|
|
11019
|
+
function byte(str2) {
|
|
11020
11020
|
BYTE.lastIndex = 0;
|
|
11021
|
-
return BYTE.test(
|
|
11021
|
+
return BYTE.test(str2);
|
|
11022
11022
|
}
|
|
11023
11023
|
var MIN_INT32 = -(2 ** 31);
|
|
11024
11024
|
var MAX_INT32 = 2 ** 31 - 1;
|
|
@@ -11032,11 +11032,11 @@ var require_formats = __commonJS({
|
|
|
11032
11032
|
return true;
|
|
11033
11033
|
}
|
|
11034
11034
|
var Z_ANCHOR = /[^\\]\\Z/;
|
|
11035
|
-
function regex(
|
|
11036
|
-
if (Z_ANCHOR.test(
|
|
11035
|
+
function regex(str2) {
|
|
11036
|
+
if (Z_ANCHOR.test(str2))
|
|
11037
11037
|
return false;
|
|
11038
11038
|
try {
|
|
11039
|
-
new RegExp(
|
|
11039
|
+
new RegExp(str2);
|
|
11040
11040
|
return true;
|
|
11041
11041
|
} catch (e) {
|
|
11042
11042
|
return false;
|
|
@@ -11113,7 +11113,7 @@ var require_code3 = __commonJS({
|
|
|
11113
11113
|
}
|
|
11114
11114
|
exports._ = _;
|
|
11115
11115
|
var plus = new _Code("+");
|
|
11116
|
-
function
|
|
11116
|
+
function str2(strs, ...args) {
|
|
11117
11117
|
const expr = [safeStringify(strs[0])];
|
|
11118
11118
|
let i2 = 0;
|
|
11119
11119
|
while (i2 < args.length) {
|
|
@@ -11124,7 +11124,7 @@ var require_code3 = __commonJS({
|
|
|
11124
11124
|
optimize(expr);
|
|
11125
11125
|
return new _Code(expr);
|
|
11126
11126
|
}
|
|
11127
|
-
exports.str =
|
|
11127
|
+
exports.str = str2;
|
|
11128
11128
|
function addCodeArg(code, arg) {
|
|
11129
11129
|
if (arg instanceof _Code)
|
|
11130
11130
|
code.push(...arg._items);
|
|
@@ -11167,7 +11167,7 @@ var require_code3 = __commonJS({
|
|
|
11167
11167
|
return;
|
|
11168
11168
|
}
|
|
11169
11169
|
function strConcat(c1, c22) {
|
|
11170
|
-
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 :
|
|
11170
|
+
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 : str2`${c1}${c22}`;
|
|
11171
11171
|
}
|
|
11172
11172
|
exports.strConcat = strConcat;
|
|
11173
11173
|
function interpolate(x) {
|
|
@@ -12129,22 +12129,22 @@ var require_util2 = __commonJS({
|
|
|
12129
12129
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
12130
12130
|
}
|
|
12131
12131
|
exports.schemaRefOrVal = schemaRefOrVal;
|
|
12132
|
-
function unescapeFragment(
|
|
12133
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
12132
|
+
function unescapeFragment(str2) {
|
|
12133
|
+
return unescapeJsonPointer(decodeURIComponent(str2));
|
|
12134
12134
|
}
|
|
12135
12135
|
exports.unescapeFragment = unescapeFragment;
|
|
12136
|
-
function escapeFragment(
|
|
12137
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
12136
|
+
function escapeFragment(str2) {
|
|
12137
|
+
return encodeURIComponent(escapeJsonPointer(str2));
|
|
12138
12138
|
}
|
|
12139
12139
|
exports.escapeFragment = escapeFragment;
|
|
12140
|
-
function escapeJsonPointer(
|
|
12141
|
-
if (typeof
|
|
12142
|
-
return `${
|
|
12143
|
-
return
|
|
12140
|
+
function escapeJsonPointer(str2) {
|
|
12141
|
+
if (typeof str2 == "number")
|
|
12142
|
+
return `${str2}`;
|
|
12143
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
12144
12144
|
}
|
|
12145
12145
|
exports.escapeJsonPointer = escapeJsonPointer;
|
|
12146
|
-
function unescapeJsonPointer(
|
|
12147
|
-
return
|
|
12146
|
+
function unescapeJsonPointer(str2) {
|
|
12147
|
+
return str2.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
12148
12148
|
}
|
|
12149
12149
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
12150
12150
|
function eachItem(xs, f) {
|
|
@@ -13134,8 +13134,8 @@ var require_json_schema_traverse2 = __commonJS({
|
|
|
13134
13134
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
13135
13135
|
}
|
|
13136
13136
|
}
|
|
13137
|
-
function escapeJsonPtr(
|
|
13138
|
-
return
|
|
13137
|
+
function escapeJsonPtr(str2) {
|
|
13138
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
13139
13139
|
}
|
|
13140
13140
|
}
|
|
13141
13141
|
});
|
|
@@ -14130,7 +14130,7 @@ var require_core4 = __commonJS({
|
|
|
14130
14130
|
var util_1 = require_util2();
|
|
14131
14131
|
var $dataRefSchema = require_data2();
|
|
14132
14132
|
var uri_1 = require_uri2();
|
|
14133
|
-
var defaultRegExp = (
|
|
14133
|
+
var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
|
|
14134
14134
|
defaultRegExp.code = "new RegExp";
|
|
14135
14135
|
var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
14136
14136
|
var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -14925,16 +14925,16 @@ var require_ucs2length2 = __commonJS({
|
|
|
14925
14925
|
"../../node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
|
|
14926
14926
|
"use strict";
|
|
14927
14927
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14928
|
-
function ucs2length(
|
|
14929
|
-
const len =
|
|
14928
|
+
function ucs2length(str2) {
|
|
14929
|
+
const len = str2.length;
|
|
14930
14930
|
let length = 0;
|
|
14931
14931
|
let pos = 0;
|
|
14932
14932
|
let value;
|
|
14933
14933
|
while (pos < len) {
|
|
14934
14934
|
length++;
|
|
14935
|
-
value =
|
|
14935
|
+
value = str2.charCodeAt(pos++);
|
|
14936
14936
|
if (value >= 55296 && value <= 56319 && pos < len) {
|
|
14937
|
-
value =
|
|
14937
|
+
value = str2.charCodeAt(pos);
|
|
14938
14938
|
if ((value & 64512) === 56320)
|
|
14939
14939
|
pos++;
|
|
14940
14940
|
}
|
|
@@ -19443,7 +19443,8 @@ async function getConf() {
|
|
|
19443
19443
|
workspace: { type: "string" },
|
|
19444
19444
|
env: { type: "string" },
|
|
19445
19445
|
authProvider: { type: "string" },
|
|
19446
|
-
authUrl: { type: "string" }
|
|
19446
|
+
authUrl: { type: "string" },
|
|
19447
|
+
authClientId: { type: "string" }
|
|
19447
19448
|
}
|
|
19448
19449
|
}
|
|
19449
19450
|
}
|
|
@@ -19724,7 +19725,7 @@ var init_package = __esm({
|
|
|
19724
19725
|
"package.json"() {
|
|
19725
19726
|
package_default = {
|
|
19726
19727
|
name: "@inworld/cli",
|
|
19727
|
-
version: "2.
|
|
19728
|
+
version: "2.3.0",
|
|
19728
19729
|
type: "module",
|
|
19729
19730
|
main: "dist/index.js",
|
|
19730
19731
|
bin: {
|
|
@@ -19732,7 +19733,7 @@ var init_package = __esm({
|
|
|
19732
19733
|
"inworld-mcp": "dist/cli/inworld-mcp.js"
|
|
19733
19734
|
},
|
|
19734
19735
|
scripts: {
|
|
19735
|
-
postversion: "npm install && git add ../../package-lock.json",
|
|
19736
|
+
postversion: "npm install --package-lock-only --ignore-scripts && git add ../../package-lock.json",
|
|
19736
19737
|
"copy:release-it-config": "node ../../scripts/copy-release-it-config.js",
|
|
19737
19738
|
clean: "shx rm -rf dist",
|
|
19738
19739
|
build: "npm run clean && node esbuild.config.js && npm run copy:release-it-config",
|
|
@@ -19803,33 +19804,45 @@ var init_package = __esm({
|
|
|
19803
19804
|
}
|
|
19804
19805
|
});
|
|
19805
19806
|
|
|
19806
|
-
// src/constants.ts
|
|
19807
|
-
|
|
19807
|
+
// src/mcp/auth/constants.ts
|
|
19808
|
+
function resolveDeployment(environment) {
|
|
19809
|
+
const deployment = environment?.toUpperCase();
|
|
19810
|
+
return deployment === "DEV" || deployment === "STAGE" ? deployment : "PROD";
|
|
19811
|
+
}
|
|
19812
|
+
function getMcpHttpAuthMode() {
|
|
19813
|
+
const v = (process.env.INWORLD_MCP_HTTP_AUTH || "session").toLowerCase();
|
|
19814
|
+
if (v === "bearer") return "bearer";
|
|
19815
|
+
return "session";
|
|
19816
|
+
}
|
|
19817
|
+
var INWORLD_ENV, PLATFORM_ENDPOINTS, PLATFORM_URL, CLIENT_ID_PLACEHOLDER, CLI_CLIENT_IDS, INWORLD_CLI_CLIENT_ID;
|
|
19808
19818
|
var init_constants5 = __esm({
|
|
19819
|
+
"src/mcp/auth/constants.ts"() {
|
|
19820
|
+
"use strict";
|
|
19821
|
+
INWORLD_ENV = resolveDeployment(process.env.INWORLD_ENV);
|
|
19822
|
+
PLATFORM_ENDPOINTS = {
|
|
19823
|
+
DEV: "https://platform.dev.inworld.ai",
|
|
19824
|
+
STAGE: "https://platform.stage.inworld.ai",
|
|
19825
|
+
PROD: "https://platform.inworld.ai"
|
|
19826
|
+
};
|
|
19827
|
+
PLATFORM_URL = process.env.INWORLD_PLATFORM_URL || PLATFORM_ENDPOINTS[INWORLD_ENV];
|
|
19828
|
+
CLIENT_ID_PLACEHOLDER = "TODO_REGISTER_CLIENT";
|
|
19829
|
+
CLI_CLIENT_IDS = {
|
|
19830
|
+
DEV: "d278a440-a58a-4002-bc0d-e589d594b053",
|
|
19831
|
+
STAGE: CLIENT_ID_PLACEHOLDER,
|
|
19832
|
+
PROD: "af94ff96-cd1e-4024-a284-cc7ba3de04c4"
|
|
19833
|
+
};
|
|
19834
|
+
INWORLD_CLI_CLIENT_ID = process.env.INWORLD_CLI_CLIENT_ID?.trim() || (process.env.INWORLD_PLATFORM_URL || process.env.INWORLD_AUTH_URL?.trim() ? "" : CLI_CLIENT_IDS[INWORLD_ENV]);
|
|
19835
|
+
}
|
|
19836
|
+
});
|
|
19837
|
+
|
|
19838
|
+
// src/constants.ts
|
|
19839
|
+
var WORKSPACES_LIST_SIZE, MIXPANEL_TOKEN, CLI_VERSION;
|
|
19840
|
+
var init_constants6 = __esm({
|
|
19809
19841
|
"src/constants.ts"() {
|
|
19810
19842
|
"use strict";
|
|
19811
19843
|
init_package();
|
|
19812
|
-
|
|
19813
|
-
resolvePlatformUrl = () => {
|
|
19814
|
-
if (process.env.INWORLD_PLATFORM_URL) {
|
|
19815
|
-
return process.env.INWORLD_PLATFORM_URL;
|
|
19816
|
-
}
|
|
19817
|
-
const env3 = (process.env.INWORLD_ENV || "").toUpperCase();
|
|
19818
|
-
switch (env3) {
|
|
19819
|
-
case "DEV":
|
|
19820
|
-
return "https://platform.dev.inworld.ai";
|
|
19821
|
-
case "STAGE":
|
|
19822
|
-
return "https://platform.stage.inworld.ai";
|
|
19823
|
-
case "PROD":
|
|
19824
|
-
return "https://platform.inworld.ai";
|
|
19825
|
-
default:
|
|
19826
|
-
return DEFAULT_PLATFORM_ENDPOINT;
|
|
19827
|
-
}
|
|
19828
|
-
};
|
|
19829
|
-
INWORLD_ENV = process.env.INWORLD_ENV || "PROD";
|
|
19844
|
+
init_constants5();
|
|
19830
19845
|
WORKSPACES_LIST_SIZE = 100;
|
|
19831
|
-
PLATFORM_URL = resolvePlatformUrl();
|
|
19832
|
-
INWORLD_CLI_AUTH_URL = process.env.INWORLD_CLI_AUTH_URL || `${PLATFORM_URL.replace(/\/$/, "")}/cli-auth/login`;
|
|
19833
19846
|
MIXPANEL_TOKEN = process.env.INWORLD_MIXPANEL_TOKEN || "2cf13116e9701343ac27ddc452adfbbc";
|
|
19834
19847
|
CLI_VERSION = package_default.version;
|
|
19835
19848
|
}
|
|
@@ -19840,7 +19853,7 @@ var CLIENT_INFO_HEADER, CLI_APP, OS_NAMES, safeToken, buildClientInfo, CLIENT_IN
|
|
|
19840
19853
|
var init_client_info = __esm({
|
|
19841
19854
|
"src/utils/client_info.ts"() {
|
|
19842
19855
|
"use strict";
|
|
19843
|
-
|
|
19856
|
+
init_constants6();
|
|
19844
19857
|
CLIENT_INFO_HEADER = "x-user-agent";
|
|
19845
19858
|
CLI_APP = "inworld-cli";
|
|
19846
19859
|
OS_NAMES = {
|
|
@@ -19872,42 +19885,7 @@ var init_client_info = __esm({
|
|
|
19872
19885
|
}
|
|
19873
19886
|
});
|
|
19874
19887
|
|
|
19875
|
-
// src/mcp/auth/constants.ts
|
|
19876
|
-
function getMcpHttpAuthMode() {
|
|
19877
|
-
const v = (process.env.INWORLD_MCP_HTTP_AUTH || "session").toLowerCase();
|
|
19878
|
-
if (v === "bearer") return "bearer";
|
|
19879
|
-
return "session";
|
|
19880
|
-
}
|
|
19881
|
-
var DEFAULT_PLATFORM_ENDPOINT2, resolvePlatformUrl2, INWORLD_ENV2, PLATFORM_URL2, INWORLD_CLI_AUTH_URL2;
|
|
19882
|
-
var init_constants6 = __esm({
|
|
19883
|
-
"src/mcp/auth/constants.ts"() {
|
|
19884
|
-
"use strict";
|
|
19885
|
-
DEFAULT_PLATFORM_ENDPOINT2 = "https://platform.inworld.ai";
|
|
19886
|
-
resolvePlatformUrl2 = () => {
|
|
19887
|
-
if (process.env.INWORLD_PLATFORM_URL) {
|
|
19888
|
-
return process.env.INWORLD_PLATFORM_URL;
|
|
19889
|
-
}
|
|
19890
|
-
const env3 = (process.env.INWORLD_ENV || "").toUpperCase();
|
|
19891
|
-
switch (env3) {
|
|
19892
|
-
case "DEV":
|
|
19893
|
-
return "https://platform.dev.inworld.ai";
|
|
19894
|
-
case "STAGE":
|
|
19895
|
-
return "https://platform.stage.inworld.ai";
|
|
19896
|
-
case "PROD":
|
|
19897
|
-
return "https://platform.inworld.ai";
|
|
19898
|
-
default:
|
|
19899
|
-
return DEFAULT_PLATFORM_ENDPOINT2;
|
|
19900
|
-
}
|
|
19901
|
-
};
|
|
19902
|
-
INWORLD_ENV2 = process.env.INWORLD_ENV || "PROD";
|
|
19903
|
-
PLATFORM_URL2 = resolvePlatformUrl2();
|
|
19904
|
-
INWORLD_CLI_AUTH_URL2 = process.env.INWORLD_CLI_AUTH_URL || `${PLATFORM_URL2.replace(/\/$/, "")}/cli-auth/login`;
|
|
19905
|
-
}
|
|
19906
|
-
});
|
|
19907
|
-
|
|
19908
19888
|
// src/mcp/auth/identity.ts
|
|
19909
|
-
import { createHash as createHash2, randomBytes, timingSafeEqual } from "node:crypto";
|
|
19910
|
-
import * as http from "node:http";
|
|
19911
19889
|
function decodeJwtPayload(jwt) {
|
|
19912
19890
|
const parts = jwt.split(".");
|
|
19913
19891
|
if (parts.length < 2) return null;
|
|
@@ -19927,7 +19905,8 @@ function isIssuedBy(idToken, source) {
|
|
|
19927
19905
|
return tokenIssuer(idToken) === source.authUrl;
|
|
19928
19906
|
}
|
|
19929
19907
|
function identitySourceOfStore(stored) {
|
|
19930
|
-
|
|
19908
|
+
if (stored.authProvider !== "supabase" || !stored.authUrl) return null;
|
|
19909
|
+
return stored.authClientId ? { authUrl: stored.authUrl, clientId: stored.authClientId } : { authUrl: stored.authUrl };
|
|
19931
19910
|
}
|
|
19932
19911
|
function parseConfigJs(text) {
|
|
19933
19912
|
const pick2 = (key) => new RegExp(`["']?${key}["']?\\s*:\\s*["']([^"']+)["']`).exec(text)?.[1];
|
|
@@ -19957,46 +19936,77 @@ function gotrueErrorMessage(data, fallback) {
|
|
|
19957
19936
|
}
|
|
19958
19937
|
return fallback;
|
|
19959
19938
|
}
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
const res = await fetch(url, {
|
|
19939
|
+
function postForm(url, fields, signal) {
|
|
19940
|
+
return fetch(url, {
|
|
19963
19941
|
method: "POST",
|
|
19964
19942
|
headers: {
|
|
19965
|
-
"Content-Type": "application/
|
|
19943
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
19966
19944
|
[CLIENT_INFO_HEADER]: CLIENT_INFO
|
|
19967
19945
|
},
|
|
19968
|
-
body:
|
|
19946
|
+
body: new URLSearchParams(fields).toString(),
|
|
19969
19947
|
signal
|
|
19970
19948
|
});
|
|
19949
|
+
}
|
|
19950
|
+
async function readJsonBody(res) {
|
|
19971
19951
|
const text = await res.text();
|
|
19972
|
-
let data = {};
|
|
19973
19952
|
try {
|
|
19974
|
-
data
|
|
19953
|
+
return { data: text ? JSON.parse(text) : {}, text };
|
|
19975
19954
|
} catch {
|
|
19976
|
-
|
|
19977
|
-
`Supabase token (${grantType}): expected JSON (${res.status}): ${text.slice(0, 200)}`
|
|
19978
|
-
);
|
|
19955
|
+
return { data: null, text };
|
|
19979
19956
|
}
|
|
19980
|
-
|
|
19957
|
+
}
|
|
19958
|
+
function identityTokensOf(data, label) {
|
|
19959
|
+
const session = data ?? {};
|
|
19960
|
+
if (!session.access_token || !session.refresh_token) {
|
|
19961
|
+
throw new Error(`${label}: response missing access or refresh token`);
|
|
19962
|
+
}
|
|
19963
|
+
const claim2 = decodeJwtPayload(session.access_token)?.email;
|
|
19964
|
+
return {
|
|
19965
|
+
idToken: session.access_token,
|
|
19966
|
+
refreshToken: session.refresh_token,
|
|
19967
|
+
// `/oauth/token` responses carry no `user`; the access token names it.
|
|
19968
|
+
email: session.user?.email ?? (typeof claim2 === "string" ? claim2 : void 0)
|
|
19969
|
+
};
|
|
19970
|
+
}
|
|
19971
|
+
async function refreshIdentityToken(source, refreshToken) {
|
|
19972
|
+
const label = "Supabase token (refresh_token)";
|
|
19973
|
+
let res;
|
|
19974
|
+
if (source.clientId) {
|
|
19975
|
+
const url = `${source.authUrl}/oauth/token`;
|
|
19976
|
+
const fields = {
|
|
19977
|
+
grant_type: "refresh_token",
|
|
19978
|
+
refresh_token: refreshToken,
|
|
19979
|
+
client_id: source.clientId
|
|
19980
|
+
};
|
|
19981
|
+
res = await postForm(url, fields);
|
|
19982
|
+
for (const delayMs of [1e3, 2e3, 4e3]) {
|
|
19983
|
+
if (res.status !== 429) break;
|
|
19984
|
+
void res.body?.cancel().catch(() => void 0);
|
|
19985
|
+
await new Promise((resolve6) => setTimeout(resolve6, delayMs));
|
|
19986
|
+
res = await postForm(url, fields);
|
|
19987
|
+
}
|
|
19988
|
+
} else {
|
|
19989
|
+
res = await fetch(`${source.authUrl}/token?grant_type=refresh_token`, {
|
|
19990
|
+
method: "POST",
|
|
19991
|
+
headers: {
|
|
19992
|
+
"Content-Type": "application/json",
|
|
19993
|
+
[CLIENT_INFO_HEADER]: CLIENT_INFO
|
|
19994
|
+
},
|
|
19995
|
+
body: JSON.stringify({ refresh_token: refreshToken })
|
|
19996
|
+
});
|
|
19997
|
+
}
|
|
19998
|
+
const { data, text } = await readJsonBody(res);
|
|
19999
|
+
if (data === null) {
|
|
19981
20000
|
throw new Error(
|
|
19982
|
-
|
|
20001
|
+
`${label}: expected JSON (${res.status}): ${text.slice(0, 200)}`
|
|
19983
20002
|
);
|
|
19984
20003
|
}
|
|
19985
|
-
if (!
|
|
20004
|
+
if (!res.ok) {
|
|
19986
20005
|
throw new Error(
|
|
19987
|
-
|
|
20006
|
+
`${label} failed: ${gotrueErrorMessage(data, `HTTP ${res.status}`)}`
|
|
19988
20007
|
);
|
|
19989
20008
|
}
|
|
19990
|
-
return
|
|
19991
|
-
idToken: data.access_token,
|
|
19992
|
-
refreshToken: data.refresh_token,
|
|
19993
|
-
email: data.user?.email
|
|
19994
|
-
};
|
|
19995
|
-
}
|
|
19996
|
-
async function refreshIdentityToken(source, refreshToken) {
|
|
19997
|
-
return gotrueToken(source.authUrl, "refresh_token", {
|
|
19998
|
-
refresh_token: refreshToken
|
|
19999
|
-
});
|
|
20009
|
+
return identityTokensOf(data, label);
|
|
20000
20010
|
}
|
|
20001
20011
|
async function revokeSession(source, refreshToken) {
|
|
20002
20012
|
const { idToken } = await refreshIdentityToken(source, refreshToken);
|
|
@@ -20019,258 +20029,7 @@ async function revokeSession(source, refreshToken) {
|
|
|
20019
20029
|
);
|
|
20020
20030
|
}
|
|
20021
20031
|
}
|
|
20022
|
-
|
|
20023
|
-
const verifier = base64url(randomBytes(32));
|
|
20024
|
-
const challenge = base64url(createHash2("sha256").update(verifier).digest());
|
|
20025
|
-
return { verifier, challenge };
|
|
20026
|
-
}
|
|
20027
|
-
function gotrueAuthorizeUrl(authUrl, oauthProvider, redirectTo, challenge) {
|
|
20028
|
-
const u2 = new URL(`${authUrl}/authorize`);
|
|
20029
|
-
u2.searchParams.set("provider", oauthProvider);
|
|
20030
|
-
u2.searchParams.set("redirect_to", redirectTo);
|
|
20031
|
-
u2.searchParams.set("code_challenge", challenge);
|
|
20032
|
-
u2.searchParams.set("code_challenge_method", "s256");
|
|
20033
|
-
return u2.toString();
|
|
20034
|
-
}
|
|
20035
|
-
function gotrueCallbackPort() {
|
|
20036
|
-
const fixed = process.env.INWORLD_CLI_AUTH_CALLBACK_PORT?.trim();
|
|
20037
|
-
return fixed ? parseInt(fixed, 10) : 0;
|
|
20038
|
-
}
|
|
20039
|
-
function sameSecret(a2, b) {
|
|
20040
|
-
if (!a2) return false;
|
|
20041
|
-
const x = Buffer.from(a2);
|
|
20042
|
-
const y = Buffer.from(b);
|
|
20043
|
-
return x.length === y.length && timingSafeEqual(x, y);
|
|
20044
|
-
}
|
|
20045
|
-
function readForm(req) {
|
|
20046
|
-
return new Promise((resolve6, reject) => {
|
|
20047
|
-
let size = 0;
|
|
20048
|
-
const chunks = [];
|
|
20049
|
-
req.on("data", (chunk) => {
|
|
20050
|
-
size += chunk.length;
|
|
20051
|
-
if (size > MAX_FORM_BYTES) {
|
|
20052
|
-
reject(new Error("Form body too large"));
|
|
20053
|
-
req.destroy();
|
|
20054
|
-
return;
|
|
20055
|
-
}
|
|
20056
|
-
chunks.push(chunk);
|
|
20057
|
-
});
|
|
20058
|
-
req.on(
|
|
20059
|
-
"end",
|
|
20060
|
-
() => resolve6(new URLSearchParams(Buffer.concat(chunks).toString("utf8")))
|
|
20061
|
-
);
|
|
20062
|
-
req.on("error", reject);
|
|
20063
|
-
});
|
|
20064
|
-
}
|
|
20065
|
-
function signInResultUrl(pageUrl, error2) {
|
|
20066
|
-
const u2 = new URL(pageUrl);
|
|
20067
|
-
u2.search = "";
|
|
20068
|
-
if (error2) {
|
|
20069
|
-
u2.searchParams.set("result", "error");
|
|
20070
|
-
u2.searchParams.set("message", error2.slice(0, 300));
|
|
20071
|
-
} else {
|
|
20072
|
-
u2.searchParams.set("result", "success");
|
|
20073
|
-
}
|
|
20074
|
-
return u2.toString();
|
|
20075
|
-
}
|
|
20076
|
-
async function startLoopbackReceiver(options) {
|
|
20077
|
-
const state = base64url(randomBytes(32));
|
|
20078
|
-
const pageOrigin = new URL(options.pageUrl).origin;
|
|
20079
|
-
let settle;
|
|
20080
|
-
const done = new Promise((resolve6, reject) => {
|
|
20081
|
-
settle = { resolve: resolve6, reject };
|
|
20082
|
-
});
|
|
20083
|
-
let claimed = false;
|
|
20084
|
-
let ended = false;
|
|
20085
|
-
let failure2;
|
|
20086
|
-
const redemption = new AbortController();
|
|
20087
|
-
const end = (outcome) => {
|
|
20088
|
-
if (ended) return false;
|
|
20089
|
-
ended = true;
|
|
20090
|
-
claimed = true;
|
|
20091
|
-
if (outcome instanceof Error) {
|
|
20092
|
-
failure2 = outcome;
|
|
20093
|
-
redemption.abort();
|
|
20094
|
-
settle.reject(outcome);
|
|
20095
|
-
} else {
|
|
20096
|
-
settle.resolve(outcome);
|
|
20097
|
-
}
|
|
20098
|
-
return true;
|
|
20099
|
-
};
|
|
20100
|
-
const finish = (redeem, answer = () => {
|
|
20101
|
-
}) => {
|
|
20102
|
-
claimed = true;
|
|
20103
|
-
redeem(redemption.signal).then(
|
|
20104
|
-
// A result after cancel or the timeout is dropped. Ending closes the
|
|
20105
|
-
// listener first, so a browser still waiting gets no result page: its
|
|
20106
|
-
// connection is reset, and `answer` finds it gone.
|
|
20107
|
-
(tokens) => {
|
|
20108
|
-
end(tokens);
|
|
20109
|
-
answer(signInResultUrl(options.pageUrl, failure2?.message));
|
|
20110
|
-
},
|
|
20111
|
-
(error2) => {
|
|
20112
|
-
end(error2);
|
|
20113
|
-
answer(signInResultUrl(options.pageUrl, failure2?.message));
|
|
20114
|
-
}
|
|
20115
|
-
);
|
|
20116
|
-
};
|
|
20117
|
-
const answerWith = (res, status) => {
|
|
20118
|
-
return (location) => {
|
|
20119
|
-
if (res.headersSent || res.destroyed) return;
|
|
20120
|
-
res.writeHead(status, { Location: location });
|
|
20121
|
-
res.end();
|
|
20122
|
-
};
|
|
20123
|
-
};
|
|
20124
|
-
const redeemRedirect = (params) => {
|
|
20125
|
-
const error2 = params.get("error_description") ?? params.get("error");
|
|
20126
|
-
const code = params.get("code");
|
|
20127
|
-
if (error2 || !code) {
|
|
20128
|
-
const msg = error2 ?? "No authorization code in the redirect.";
|
|
20129
|
-
return () => Promise.reject(new Error(msg));
|
|
20130
|
-
}
|
|
20131
|
-
return (signal) => options.redeemCode(code, signal);
|
|
20132
|
-
};
|
|
20133
|
-
const handler = (req, res) => {
|
|
20134
|
-
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
20135
|
-
if (url.pathname !== "/") {
|
|
20136
|
-
res.writeHead(404).end();
|
|
20137
|
-
return;
|
|
20138
|
-
}
|
|
20139
|
-
if (claimed) {
|
|
20140
|
-
res.writeHead(409).end("Sign-in already completed.");
|
|
20141
|
-
return;
|
|
20142
|
-
}
|
|
20143
|
-
if (req.method === "GET") {
|
|
20144
|
-
if (!sameSecret(url.searchParams.get("state"), state)) {
|
|
20145
|
-
res.writeHead(400).end("Unknown sign-in.");
|
|
20146
|
-
return;
|
|
20147
|
-
}
|
|
20148
|
-
finish(redeemRedirect(url.searchParams), answerWith(res, 302));
|
|
20149
|
-
return;
|
|
20150
|
-
}
|
|
20151
|
-
if (req.method === "POST") {
|
|
20152
|
-
if (req.headers.origin !== pageOrigin) {
|
|
20153
|
-
res.writeHead(403).end("Unknown origin.");
|
|
20154
|
-
return;
|
|
20155
|
-
}
|
|
20156
|
-
readForm(req).then(
|
|
20157
|
-
(form) => {
|
|
20158
|
-
if (claimed) {
|
|
20159
|
-
res.writeHead(409).end("Sign-in already completed.");
|
|
20160
|
-
return;
|
|
20161
|
-
}
|
|
20162
|
-
if (!sameSecret(form.get("state"), state)) {
|
|
20163
|
-
res.writeHead(400).end("Unknown sign-in.");
|
|
20164
|
-
return;
|
|
20165
|
-
}
|
|
20166
|
-
const refreshToken = form.get("refresh_token");
|
|
20167
|
-
if (!refreshToken) {
|
|
20168
|
-
res.writeHead(400).end("Missing refresh_token.");
|
|
20169
|
-
return;
|
|
20170
|
-
}
|
|
20171
|
-
finish(
|
|
20172
|
-
(signal) => options.redeemRefreshToken(refreshToken, signal),
|
|
20173
|
-
answerWith(res, 303)
|
|
20174
|
-
);
|
|
20175
|
-
},
|
|
20176
|
-
() => {
|
|
20177
|
-
if (!res.headersSent) res.writeHead(413).end();
|
|
20178
|
-
}
|
|
20179
|
-
);
|
|
20180
|
-
return;
|
|
20181
|
-
}
|
|
20182
|
-
res.writeHead(405).end();
|
|
20183
|
-
};
|
|
20184
|
-
const server = http.createServer({ keepAlive: false }, handler);
|
|
20185
|
-
await new Promise((resolve6, reject) => {
|
|
20186
|
-
server.once("error", reject);
|
|
20187
|
-
server.listen(options.port, "127.0.0.1", () => resolve6());
|
|
20188
|
-
});
|
|
20189
|
-
const { port } = server.address();
|
|
20190
|
-
const timer = setTimeout(() => {
|
|
20191
|
-
end(
|
|
20192
|
-
new Error(
|
|
20193
|
-
`Sign-in timed out after ${OAUTH_SIGN_IN_TIMEOUT_MS / 6e4} minutes. Run the login again.`
|
|
20194
|
-
)
|
|
20195
|
-
);
|
|
20196
|
-
}, OAUTH_SIGN_IN_TIMEOUT_MS);
|
|
20197
|
-
timer.unref();
|
|
20198
|
-
const loopback = new URL(`http://127.0.0.1:${port}/`);
|
|
20199
|
-
loopback.searchParams.set("state", state);
|
|
20200
|
-
const pasteRedirect = (address) => {
|
|
20201
|
-
if (claimed) return false;
|
|
20202
|
-
let url;
|
|
20203
|
-
try {
|
|
20204
|
-
url = new URL(address.trim());
|
|
20205
|
-
} catch {
|
|
20206
|
-
return false;
|
|
20207
|
-
}
|
|
20208
|
-
if (url.origin !== loopback.origin || url.pathname !== loopback.pathname || !sameSecret(url.searchParams.get("state"), state) || !(url.searchParams.get("code") || url.searchParams.get("error") || url.searchParams.get("error_description"))) {
|
|
20209
|
-
return false;
|
|
20210
|
-
}
|
|
20211
|
-
finish(redeemRedirect(url.searchParams));
|
|
20212
|
-
return true;
|
|
20213
|
-
};
|
|
20214
|
-
const cancel = () => {
|
|
20215
|
-
end(new Error("Sign-in cancelled."));
|
|
20216
|
-
};
|
|
20217
|
-
return {
|
|
20218
|
-
state,
|
|
20219
|
-
port,
|
|
20220
|
-
redirectTo: loopback.toString(),
|
|
20221
|
-
done,
|
|
20222
|
-
pasteRedirect,
|
|
20223
|
-
cancel,
|
|
20224
|
-
close: () => {
|
|
20225
|
-
claimed = true;
|
|
20226
|
-
clearTimeout(timer);
|
|
20227
|
-
server.close();
|
|
20228
|
-
server.closeAllConnections?.();
|
|
20229
|
-
}
|
|
20230
|
-
};
|
|
20231
|
-
}
|
|
20232
|
-
async function startBrowserSignIn(options) {
|
|
20233
|
-
const { verifier, challenge } = createPkcePair();
|
|
20234
|
-
const receiver = await startLoopbackReceiver({
|
|
20235
|
-
port: options.port ?? gotrueCallbackPort(),
|
|
20236
|
-
pageUrl: options.pageUrl,
|
|
20237
|
-
redeemCode: (code, signal) => gotrueToken(
|
|
20238
|
-
options.authUrl,
|
|
20239
|
-
"pkce",
|
|
20240
|
-
{ auth_code: code, code_verifier: verifier },
|
|
20241
|
-
signal
|
|
20242
|
-
),
|
|
20243
|
-
redeemRefreshToken: (refreshToken, signal) => gotrueToken(
|
|
20244
|
-
options.authUrl,
|
|
20245
|
-
"refresh_token",
|
|
20246
|
-
{ refresh_token: refreshToken },
|
|
20247
|
-
signal
|
|
20248
|
-
)
|
|
20249
|
-
});
|
|
20250
|
-
let url;
|
|
20251
|
-
if (options.oauthProvider) {
|
|
20252
|
-
url = gotrueAuthorizeUrl(
|
|
20253
|
-
options.authUrl,
|
|
20254
|
-
options.oauthProvider,
|
|
20255
|
-
receiver.redirectTo,
|
|
20256
|
-
challenge
|
|
20257
|
-
);
|
|
20258
|
-
} else {
|
|
20259
|
-
const page = new URL(options.pageUrl);
|
|
20260
|
-
page.searchParams.set("version", options.version);
|
|
20261
|
-
page.searchParams.set("port", String(receiver.port));
|
|
20262
|
-
page.searchParams.set("code_challenge", challenge);
|
|
20263
|
-
page.searchParams.set("state", receiver.state);
|
|
20264
|
-
url = page.toString();
|
|
20265
|
-
}
|
|
20266
|
-
return {
|
|
20267
|
-
url,
|
|
20268
|
-
done: receiver.done.finally(receiver.close),
|
|
20269
|
-
pasteRedirect: receiver.pasteRedirect,
|
|
20270
|
-
cancel: receiver.cancel
|
|
20271
|
-
};
|
|
20272
|
-
}
|
|
20273
|
-
var BEARER_TYPE_HEADER, IDENTITY_BEARER_TYPE, IDENTITY_AUTH_TYPE, GOTRUE_OAUTH_PROVIDERS, LEGACY_SIGN_IN_MESSAGE, base64url, OAUTH_SIGN_IN_TIMEOUT_MS, MAX_FORM_BYTES;
|
|
20032
|
+
var BEARER_TYPE_HEADER, IDENTITY_BEARER_TYPE, IDENTITY_AUTH_TYPE, LEGACY_SIGN_IN_MESSAGE;
|
|
20274
20033
|
var init_identity = __esm({
|
|
20275
20034
|
"src/mcp/auth/identity.ts"() {
|
|
20276
20035
|
"use strict";
|
|
@@ -20278,11 +20037,7 @@ var init_identity = __esm({
|
|
|
20278
20037
|
BEARER_TYPE_HEADER = "Grpc-Metadata-X-Authorization-Bearer-Type";
|
|
20279
20038
|
IDENTITY_BEARER_TYPE = "supabase";
|
|
20280
20039
|
IDENTITY_AUTH_TYPE = "AUTH_TYPE_SUPABASE";
|
|
20281
|
-
GOTRUE_OAUTH_PROVIDERS = ["google", "github", "azure"];
|
|
20282
20040
|
LEGACY_SIGN_IN_MESSAGE = "Your saved sign-in comes from an older Inworld CLI and no longer works. Run `inworld login` to sign in again.";
|
|
20283
|
-
base64url = (buf) => buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
20284
|
-
OAUTH_SIGN_IN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
20285
|
-
MAX_FORM_BYTES = 16 * 1024;
|
|
20286
20041
|
}
|
|
20287
20042
|
});
|
|
20288
20043
|
|
|
@@ -20312,7 +20067,7 @@ function extractGatewayErrorMessage(data, fallback) {
|
|
|
20312
20067
|
return fallback;
|
|
20313
20068
|
}
|
|
20314
20069
|
async function exchangeIdentityToken(identityToken) {
|
|
20315
|
-
const base =
|
|
20070
|
+
const base = PLATFORM_URL.replace(/\/$/, "");
|
|
20316
20071
|
const url = `${base}/v1alpha/users:generateTokenUser`;
|
|
20317
20072
|
const body = JSON.stringify({
|
|
20318
20073
|
type: IDENTITY_AUTH_TYPE,
|
|
@@ -20361,7 +20116,7 @@ var init_exchange = __esm({
|
|
|
20361
20116
|
"src/mcp/auth/exchange.ts"() {
|
|
20362
20117
|
"use strict";
|
|
20363
20118
|
init_client_info();
|
|
20364
|
-
|
|
20119
|
+
init_constants5();
|
|
20365
20120
|
init_identity();
|
|
20366
20121
|
}
|
|
20367
20122
|
});
|
|
@@ -20498,6 +20253,7 @@ async function hydrateMcpSessionFromCliStore() {
|
|
|
20498
20253
|
identityRefreshToken: rt.refreshToken,
|
|
20499
20254
|
authProvider: "supabase",
|
|
20500
20255
|
authUrl: source.authUrl,
|
|
20256
|
+
...source.clientId ? { authClientId: source.clientId } : {},
|
|
20501
20257
|
email: c3.email ?? exchanged.email
|
|
20502
20258
|
};
|
|
20503
20259
|
return await saveSessionUnlessLoggedOut(merged) ? merged : null;
|
|
@@ -20764,7 +20520,7 @@ var init_runtime_credential = __esm({
|
|
|
20764
20520
|
"src/auth/runtime_credential.ts"() {
|
|
20765
20521
|
"use strict";
|
|
20766
20522
|
init_dist4();
|
|
20767
|
-
|
|
20523
|
+
init_constants6();
|
|
20768
20524
|
init_client_info();
|
|
20769
20525
|
init_tokens_pb();
|
|
20770
20526
|
RuntimeCredentialError = class extends Error {
|
|
@@ -23077,9 +22833,9 @@ var require_adm_zip = __commonJS({
|
|
|
23077
22833
|
}
|
|
23078
22834
|
zipPath = zipPath ? fixPath(zipPath) : "";
|
|
23079
22835
|
if (namefix == "latin1") {
|
|
23080
|
-
namefix = (
|
|
22836
|
+
namefix = (str2) => str2.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, "");
|
|
23081
22837
|
}
|
|
23082
|
-
if (typeof namefix !== "function") namefix = (
|
|
22838
|
+
if (typeof namefix !== "function") namefix = (str2) => str2;
|
|
23083
22839
|
const relPathFix = (entry) => pth.join(zipPath, namefix(relativePath(localPath, entry)));
|
|
23084
22840
|
const fileNameFix = (entry) => pth.win32.basename(pth.win32.normalize(namefix(entry)));
|
|
23085
22841
|
filetools.fs.open(localPath, "r", function(err) {
|
|
@@ -23949,203 +23705,6 @@ var require_cross_spawn = __commonJS({
|
|
|
23949
23705
|
}
|
|
23950
23706
|
});
|
|
23951
23707
|
|
|
23952
|
-
// src/mcp/auth/second_factor.ts
|
|
23953
|
-
function askHidden(prompt, input = process.stdin, output = process.stdout) {
|
|
23954
|
-
return new Promise((resolve6, reject) => {
|
|
23955
|
-
const raw = Boolean(input.isTTY && input.setRawMode);
|
|
23956
|
-
let typed = "";
|
|
23957
|
-
const finish = (settle) => {
|
|
23958
|
-
input.removeListener("data", onData);
|
|
23959
|
-
input.removeListener("end", onEnd);
|
|
23960
|
-
if (raw) input.setRawMode?.(false);
|
|
23961
|
-
input.pause();
|
|
23962
|
-
output.write("\n");
|
|
23963
|
-
settle();
|
|
23964
|
-
};
|
|
23965
|
-
const onData = (chunk) => {
|
|
23966
|
-
for (const ch of chunk.toString()) {
|
|
23967
|
-
if (ch === "\r" || ch === "\n") return finish(() => resolve6(typed));
|
|
23968
|
-
if (ch === "") {
|
|
23969
|
-
return finish(() => reject(new Error("Sign-in cancelled.")));
|
|
23970
|
-
}
|
|
23971
|
-
if (ch === "" && !typed) {
|
|
23972
|
-
return finish(() => reject(new Error(INPUT_ENDED_MESSAGE)));
|
|
23973
|
-
}
|
|
23974
|
-
if (ch === "\x7F" || ch === "\b") typed = typed.slice(0, -1);
|
|
23975
|
-
else typed += ch;
|
|
23976
|
-
}
|
|
23977
|
-
};
|
|
23978
|
-
const onEnd = () => finish(() => reject(new Error(INPUT_ENDED_MESSAGE)));
|
|
23979
|
-
if (raw) input.setRawMode?.(true);
|
|
23980
|
-
output.write(prompt);
|
|
23981
|
-
input.on("data", onData);
|
|
23982
|
-
input.on("end", onEnd);
|
|
23983
|
-
input.resume();
|
|
23984
|
-
});
|
|
23985
|
-
}
|
|
23986
|
-
function maskEmail(address) {
|
|
23987
|
-
const at = address.lastIndexOf("@");
|
|
23988
|
-
if (at < 1) return "your email address";
|
|
23989
|
-
return `${address[0]}***${address.slice(at)}`;
|
|
23990
|
-
}
|
|
23991
|
-
async function gotrueJson(url, init) {
|
|
23992
|
-
const res = await fetch(url, {
|
|
23993
|
-
method: init.method,
|
|
23994
|
-
headers: {
|
|
23995
|
-
Authorization: `Bearer ${init.accessToken}`,
|
|
23996
|
-
"Content-Type": "application/json",
|
|
23997
|
-
[CLIENT_INFO_HEADER]: CLIENT_INFO
|
|
23998
|
-
},
|
|
23999
|
-
body: init.body === void 0 ? void 0 : JSON.stringify(init.body)
|
|
24000
|
-
});
|
|
24001
|
-
const text = await res.text();
|
|
24002
|
-
let data = {};
|
|
24003
|
-
try {
|
|
24004
|
-
const parsed = text ? JSON.parse(text) : {};
|
|
24005
|
-
if (parsed && typeof parsed === "object") {
|
|
24006
|
-
data = parsed;
|
|
24007
|
-
}
|
|
24008
|
-
} catch {
|
|
24009
|
-
}
|
|
24010
|
-
return { status: res.status, data };
|
|
24011
|
-
}
|
|
24012
|
-
function failure(step, status, data) {
|
|
24013
|
-
return new Error(
|
|
24014
|
-
`${step} failed: ${gotrueErrorMessage(data, `HTTP ${status}`)}`
|
|
24015
|
-
);
|
|
24016
|
-
}
|
|
24017
|
-
function signedInIndependently(accessToken) {
|
|
24018
|
-
const amr = decodeJwtPayload(accessToken)?.amr;
|
|
24019
|
-
return Array.isArray(amr) && amr.some(
|
|
24020
|
-
(entry) => typeof entry === "object" && entry !== null && INDEPENDENT_FIRST_FACTORS.has(
|
|
24021
|
-
String(entry.method)
|
|
24022
|
-
)
|
|
24023
|
-
);
|
|
24024
|
-
}
|
|
24025
|
-
function chooseFactor(factors, accessToken) {
|
|
24026
|
-
const verified = factors.filter((f) => f.status === "verified");
|
|
24027
|
-
if (verified.length === 0) return null;
|
|
24028
|
-
const owed = verified.filter((f) => f.factor_type !== "recovery_code");
|
|
24029
|
-
const totp = owed.find((f) => f.factor_type === "totp");
|
|
24030
|
-
if (totp) return totp;
|
|
24031
|
-
const email2 = owed.find((f) => f.factor_type === "email");
|
|
24032
|
-
const onlyEmail = verified.every((f) => f.factor_type === "email");
|
|
24033
|
-
if (email2 && (onlyEmail || signedInIndependently(accessToken))) return email2;
|
|
24034
|
-
throw new Error(UNSUPPORTED_MESSAGE);
|
|
24035
|
-
}
|
|
24036
|
-
async function stepUpSecondFactor(source, tokens, io) {
|
|
24037
|
-
if (decodeJwtPayload(tokens.idToken)?.aal !== "aal1") return tokens;
|
|
24038
|
-
const accessToken = tokens.idToken;
|
|
24039
|
-
const user = await gotrueJson(`${source.authUrl}/user`, {
|
|
24040
|
-
method: "GET",
|
|
24041
|
-
accessToken
|
|
24042
|
-
});
|
|
24043
|
-
if (!succeeded(user.status)) {
|
|
24044
|
-
throw failure(
|
|
24045
|
-
"Reading the account's second factors",
|
|
24046
|
-
user.status,
|
|
24047
|
-
user.data
|
|
24048
|
-
);
|
|
24049
|
-
}
|
|
24050
|
-
const factor = chooseFactor(
|
|
24051
|
-
Array.isArray(user.data.factors) ? user.data.factors : [],
|
|
24052
|
-
accessToken
|
|
24053
|
-
);
|
|
24054
|
-
if (!factor) return tokens;
|
|
24055
|
-
const interactive = io.interactive ?? (Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY));
|
|
24056
|
-
if (!interactive) throw new Error(NO_TERMINAL_MESSAGE);
|
|
24057
|
-
const ask = io.ask ?? ((prompt2) => askHidden(prompt2));
|
|
24058
|
-
const address = typeof user.data.email === "string" ? user.data.email : tokens.email;
|
|
24059
|
-
const prompt = factor.factor_type === "email" ? `Enter the code we emailed to ${address ? maskEmail(address) : "your email address"}: ` : "Enter the 6-digit code from your authenticator app: ";
|
|
24060
|
-
const factorUrl = `${source.authUrl}/factors/${encodeURIComponent(factor.id)}`;
|
|
24061
|
-
io.print("This account has a second factor.");
|
|
24062
|
-
let wrongCodes = 0;
|
|
24063
|
-
for (let challenges = 0; challenges < MAX_CHALLENGES; challenges++) {
|
|
24064
|
-
const challenge = await gotrueJson(`${factorUrl}/challenge`, {
|
|
24065
|
-
method: "POST",
|
|
24066
|
-
accessToken,
|
|
24067
|
-
body: {}
|
|
24068
|
-
});
|
|
24069
|
-
const challengeId = challenge.data.id;
|
|
24070
|
-
if (!succeeded(challenge.status) || typeof challengeId !== "string") {
|
|
24071
|
-
throw failure(
|
|
24072
|
-
"Starting the second-factor challenge",
|
|
24073
|
-
challenge.status,
|
|
24074
|
-
challenge.data
|
|
24075
|
-
);
|
|
24076
|
-
}
|
|
24077
|
-
if (factor.factor_type === "email") io.print("We emailed you a code.");
|
|
24078
|
-
for (; ; ) {
|
|
24079
|
-
const code = (await ask(prompt)).replace(/\s+/g, "");
|
|
24080
|
-
if (!/^\d+$/.test(code)) {
|
|
24081
|
-
io.print("The code is digits only. Try again.");
|
|
24082
|
-
continue;
|
|
24083
|
-
}
|
|
24084
|
-
const verified = await gotrueJson(`${factorUrl}/verify`, {
|
|
24085
|
-
method: "POST",
|
|
24086
|
-
accessToken,
|
|
24087
|
-
body: { challenge_id: challengeId, code }
|
|
24088
|
-
});
|
|
24089
|
-
if (succeeded(verified.status)) {
|
|
24090
|
-
const { access_token, refresh_token } = verified.data;
|
|
24091
|
-
if (typeof access_token !== "string" || typeof refresh_token !== "string") {
|
|
24092
|
-
throw new Error(
|
|
24093
|
-
"Second-factor verification: response missing access or refresh token"
|
|
24094
|
-
);
|
|
24095
|
-
}
|
|
24096
|
-
const verifiedUser = verified.data.user;
|
|
24097
|
-
return {
|
|
24098
|
-
idToken: access_token,
|
|
24099
|
-
refreshToken: refresh_token,
|
|
24100
|
-
email: verifiedUser?.email ?? tokens.email
|
|
24101
|
-
};
|
|
24102
|
-
}
|
|
24103
|
-
if (verified.data.error_code === "mfa_challenge_expired") {
|
|
24104
|
-
io.print("That code expired. Sending a new one.");
|
|
24105
|
-
break;
|
|
24106
|
-
}
|
|
24107
|
-
if (isWrongCode(verified.status, verified.data)) {
|
|
24108
|
-
if (++wrongCodes >= MAX_CODE_ATTEMPTS) {
|
|
24109
|
-
throw new Error(
|
|
24110
|
-
"Too many incorrect codes. Run `inworld login` to try again."
|
|
24111
|
-
);
|
|
24112
|
-
}
|
|
24113
|
-
io.print("That code is not correct. Try again.");
|
|
24114
|
-
continue;
|
|
24115
|
-
}
|
|
24116
|
-
throw failure(
|
|
24117
|
-
"Second-factor verification",
|
|
24118
|
-
verified.status,
|
|
24119
|
-
verified.data
|
|
24120
|
-
);
|
|
24121
|
-
}
|
|
24122
|
-
}
|
|
24123
|
-
throw new Error(
|
|
24124
|
-
"The second-factor code expired too many times. Run `inworld login` to try again."
|
|
24125
|
-
);
|
|
24126
|
-
}
|
|
24127
|
-
var MAX_CODE_ATTEMPTS, MAX_CHALLENGES, NO_TERMINAL_MESSAGE, UNSUPPORTED_MESSAGE, INPUT_ENDED_MESSAGE, succeeded, isWrongCode, INDEPENDENT_FIRST_FACTORS;
|
|
24128
|
-
var init_second_factor = __esm({
|
|
24129
|
-
"src/mcp/auth/second_factor.ts"() {
|
|
24130
|
-
"use strict";
|
|
24131
|
-
init_client_info();
|
|
24132
|
-
init_identity();
|
|
24133
|
-
MAX_CODE_ATTEMPTS = 5;
|
|
24134
|
-
MAX_CHALLENGES = 5;
|
|
24135
|
-
NO_TERMINAL_MESSAGE = "This account needs a second-factor code; run `inworld login` in an interactive terminal.";
|
|
24136
|
-
UNSUPPORTED_MESSAGE = "This account's second factor cannot be completed in the CLI after this sign-in. Set up an authenticator app in your Inworld account settings and run `inworld login` again, or contact support.";
|
|
24137
|
-
INPUT_ENDED_MESSAGE = "Input ended before a code was entered.";
|
|
24138
|
-
succeeded = (status) => status >= 200 && status < 300;
|
|
24139
|
-
isWrongCode = (status, data) => data.error_code === "mfa_verification_failed" || status === 422 && !data.error_code;
|
|
24140
|
-
INDEPENDENT_FIRST_FACTORS = /* @__PURE__ */ new Set([
|
|
24141
|
-
"password",
|
|
24142
|
-
"sso/saml",
|
|
24143
|
-
"passkey",
|
|
24144
|
-
"web3"
|
|
24145
|
-
]);
|
|
24146
|
-
}
|
|
24147
|
-
});
|
|
24148
|
-
|
|
24149
23708
|
// src/mcp/auth/browser.ts
|
|
24150
23709
|
import { execFile } from "node:child_process";
|
|
24151
23710
|
import { promisify as promisify4 } from "node:util";
|
|
@@ -24158,6 +23717,11 @@ async function openInBrowser(url) {
|
|
|
24158
23717
|
await execFileAsync("xdg-open", [url]);
|
|
24159
23718
|
}
|
|
24160
23719
|
}
|
|
23720
|
+
function hasLocalBrowser(env3 = process.env, platform2 = process.platform) {
|
|
23721
|
+
if (env3.SSH_CONNECTION || env3.SSH_CLIENT || env3.SSH_TTY) return false;
|
|
23722
|
+
if (platform2 === "linux") return Boolean(env3.DISPLAY || env3.WAYLAND_DISPLAY);
|
|
23723
|
+
return true;
|
|
23724
|
+
}
|
|
24161
23725
|
var execFileAsync;
|
|
24162
23726
|
var init_browser = __esm({
|
|
24163
23727
|
"src/mcp/auth/browser.ts"() {
|
|
@@ -24168,17 +23732,8 @@ var init_browser = __esm({
|
|
|
24168
23732
|
|
|
24169
23733
|
// src/mcp/auth/sign_in_prompt.ts
|
|
24170
23734
|
import * as readline2 from "node:readline";
|
|
24171
|
-
|
|
24172
|
-
const { url,
|
|
24173
|
-
const printLink2 = out.printLink ?? out.print;
|
|
24174
|
-
const printError2 = out.printError ?? out.print;
|
|
24175
|
-
out.print("Please visit the following URL to authenticate:");
|
|
24176
|
-
printLink2(url);
|
|
24177
|
-
out.print("");
|
|
24178
|
-
out.print(
|
|
24179
|
-
"Browser on another machine? Sign in there with Google, GitHub, Microsoft or SSO. It then fails to load an http://127.0.0.1 address: copy that address and paste it here. Email sign-in needs a browser on this machine."
|
|
24180
|
-
);
|
|
24181
|
-
out.print("");
|
|
23735
|
+
function promptToOpenBrowser(options) {
|
|
23736
|
+
const { url, out, onCancel } = options;
|
|
24182
23737
|
const terminal = readline2.createInterface({
|
|
24183
23738
|
input: process.stdin,
|
|
24184
23739
|
output: out.output
|
|
@@ -24189,47 +23744,34 @@ async function promptForSignIn(signIn2, out) {
|
|
|
24189
23744
|
closed = true;
|
|
24190
23745
|
});
|
|
24191
23746
|
terminal.on("SIGINT", () => {
|
|
24192
|
-
|
|
23747
|
+
onCancel();
|
|
24193
23748
|
terminal.close();
|
|
24194
23749
|
});
|
|
24195
|
-
const ask = (
|
|
23750
|
+
const ask = () => {
|
|
24196
23751
|
if (closed) return;
|
|
24197
|
-
terminal.setPrompt(
|
|
23752
|
+
terminal.setPrompt("Press Enter to open the link in your browser: ");
|
|
24198
23753
|
terminal.prompt();
|
|
24199
23754
|
};
|
|
24200
23755
|
terminal.on("line", async (line) => {
|
|
24201
|
-
|
|
24202
|
-
if (
|
|
24203
|
-
|
|
24204
|
-
|
|
24205
|
-
|
|
24206
|
-
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24211
|
-
);
|
|
24212
|
-
}
|
|
24213
|
-
out.print("");
|
|
24214
|
-
out.print("Waiting for authentication...");
|
|
24215
|
-
}
|
|
24216
|
-
ask("Paste the address here if the browser could not load it: ");
|
|
24217
|
-
return;
|
|
23756
|
+
if (line.trim()) return ask();
|
|
23757
|
+
if (opened) return;
|
|
23758
|
+
opened = true;
|
|
23759
|
+
try {
|
|
23760
|
+
await openInBrowser(url);
|
|
23761
|
+
out.print("\u2713 Browser opened");
|
|
23762
|
+
} catch {
|
|
23763
|
+
out.print(
|
|
23764
|
+
"\u26A0 Could not open browser automatically. Please open the link manually."
|
|
23765
|
+
);
|
|
24218
23766
|
}
|
|
24219
|
-
|
|
24220
|
-
|
|
23767
|
+
out.print("Waiting for you to approve the sign-in...");
|
|
23768
|
+
});
|
|
23769
|
+
ask();
|
|
23770
|
+
return {
|
|
23771
|
+
close: () => {
|
|
24221
23772
|
terminal.close();
|
|
24222
|
-
return;
|
|
24223
23773
|
}
|
|
24224
|
-
|
|
24225
|
-
"That is not this sign-in's address. Paste the whole address from the browser's address bar; it starts with http://127.0.0.1:"
|
|
24226
|
-
);
|
|
24227
|
-
ask("Paste the address: ");
|
|
24228
|
-
});
|
|
24229
|
-
ask("Press Enter to open your browser, or paste the address: ");
|
|
24230
|
-
await done.catch(() => {
|
|
24231
|
-
});
|
|
24232
|
-
terminal.close();
|
|
23774
|
+
};
|
|
24233
23775
|
}
|
|
24234
23776
|
var init_sign_in_prompt = __esm({
|
|
24235
23777
|
"src/mcp/auth/sign_in_prompt.ts"() {
|
|
@@ -24238,6 +23780,255 @@ var init_sign_in_prompt = __esm({
|
|
|
24238
23780
|
}
|
|
24239
23781
|
});
|
|
24240
23782
|
|
|
23783
|
+
// src/mcp/auth/device_flow.ts
|
|
23784
|
+
function validateVerificationUri(value, expected, allowHttpLoopback) {
|
|
23785
|
+
const address = str(value);
|
|
23786
|
+
const invalid = () => new Error("Device authorization returned an invalid verification address.");
|
|
23787
|
+
if (!address || !/^https?:\/\//i.test(address)) throw invalid();
|
|
23788
|
+
let url;
|
|
23789
|
+
try {
|
|
23790
|
+
url = new URL(address);
|
|
23791
|
+
} catch {
|
|
23792
|
+
throw invalid();
|
|
23793
|
+
}
|
|
23794
|
+
const loopback = url.hostname === "localhost" || url.hostname === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(url.hostname);
|
|
23795
|
+
if (url.username || url.password || url.href !== expected.href || url.protocol !== "https:" && !(allowHttpLoopback && loopback)) {
|
|
23796
|
+
throw invalid();
|
|
23797
|
+
}
|
|
23798
|
+
return url.href;
|
|
23799
|
+
}
|
|
23800
|
+
async function postFormJson(url, form, signal) {
|
|
23801
|
+
signal.throwIfAborted();
|
|
23802
|
+
const own = new AbortController();
|
|
23803
|
+
const abort = () => own.abort();
|
|
23804
|
+
const timer = setTimeout(abort, REQUEST_TIMEOUT_MS);
|
|
23805
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
23806
|
+
try {
|
|
23807
|
+
const res = await postForm(url, form, own.signal);
|
|
23808
|
+
const { data } = await readJsonBody(res);
|
|
23809
|
+
return { res, data };
|
|
23810
|
+
} finally {
|
|
23811
|
+
clearTimeout(timer);
|
|
23812
|
+
signal.removeEventListener("abort", abort);
|
|
23813
|
+
}
|
|
23814
|
+
}
|
|
23815
|
+
function sleep(ms, signal) {
|
|
23816
|
+
return new Promise((resolve6, reject) => {
|
|
23817
|
+
if (signal.aborted) return reject(new Error(CANCELLED));
|
|
23818
|
+
const done = () => {
|
|
23819
|
+
signal.removeEventListener("abort", cancel);
|
|
23820
|
+
resolve6();
|
|
23821
|
+
};
|
|
23822
|
+
const cancel = () => {
|
|
23823
|
+
clearTimeout(timer);
|
|
23824
|
+
reject(new Error(CANCELLED));
|
|
23825
|
+
};
|
|
23826
|
+
const timer = setTimeout(done, ms);
|
|
23827
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
23828
|
+
});
|
|
23829
|
+
}
|
|
23830
|
+
async function requestDeviceAuthorization(source, platformUrl, clientId, allowHttpLoopback, signal) {
|
|
23831
|
+
let res;
|
|
23832
|
+
let data;
|
|
23833
|
+
try {
|
|
23834
|
+
({ res, data } = await postFormJson(
|
|
23835
|
+
`${source.authUrl}/oauth/device_authorization`,
|
|
23836
|
+
{ client_id: clientId, scope: "offline_access" },
|
|
23837
|
+
signal
|
|
23838
|
+
));
|
|
23839
|
+
} catch (error2) {
|
|
23840
|
+
if (signal.aborted) throw new Error(CANCELLED);
|
|
23841
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
23842
|
+
const cause = error2 instanceof Error ? error2.cause : void 0;
|
|
23843
|
+
let detail = "";
|
|
23844
|
+
if (cause instanceof Error) {
|
|
23845
|
+
const { code } = cause;
|
|
23846
|
+
detail = (typeof code === "string" && code ? code : cause.message).replace(/\s+/g, " ").trim();
|
|
23847
|
+
}
|
|
23848
|
+
throw new Error(
|
|
23849
|
+
`Could not reach the sign-in server: ${message.replace(/\s+/g, " ")}${detail ? ` (${detail})` : ""}`
|
|
23850
|
+
);
|
|
23851
|
+
}
|
|
23852
|
+
if (!res.ok) {
|
|
23853
|
+
throw new Error(
|
|
23854
|
+
`Device authorization failed: ${gotrueErrorMessage(data, `HTTP ${res.status}`)}`
|
|
23855
|
+
);
|
|
23856
|
+
}
|
|
23857
|
+
const o2 = data ?? {};
|
|
23858
|
+
const deviceCode = str(o2.device_code);
|
|
23859
|
+
const userCode = str(o2.user_code);
|
|
23860
|
+
if (!deviceCode || !userCode || !str(o2.verification_uri)) {
|
|
23861
|
+
throw new Error(
|
|
23862
|
+
"Device authorization response is missing the device code, user code or verification address."
|
|
23863
|
+
);
|
|
23864
|
+
}
|
|
23865
|
+
const expectedUri = new URL("/cli/activate", platformUrl);
|
|
23866
|
+
const expectedCompleteUri = new URL(expectedUri);
|
|
23867
|
+
expectedCompleteUri.searchParams.set("user_code", userCode);
|
|
23868
|
+
const verificationUriComplete = o2.verification_uri_complete;
|
|
23869
|
+
return {
|
|
23870
|
+
deviceCode,
|
|
23871
|
+
userCode,
|
|
23872
|
+
verificationUri: validateVerificationUri(
|
|
23873
|
+
o2.verification_uri,
|
|
23874
|
+
expectedUri,
|
|
23875
|
+
allowHttpLoopback
|
|
23876
|
+
),
|
|
23877
|
+
verificationUriComplete: verificationUriComplete == null || verificationUriComplete === "" ? void 0 : validateVerificationUri(
|
|
23878
|
+
verificationUriComplete,
|
|
23879
|
+
expectedCompleteUri,
|
|
23880
|
+
allowHttpLoopback
|
|
23881
|
+
),
|
|
23882
|
+
expiresIn: positive(o2.expires_in) ?? DEFAULT_EXPIRES_IN_S,
|
|
23883
|
+
interval: positive(o2.interval) ?? DEFAULT_INTERVAL_S
|
|
23884
|
+
};
|
|
23885
|
+
}
|
|
23886
|
+
function expiryText(seconds) {
|
|
23887
|
+
if (seconds < 60) {
|
|
23888
|
+
const n3 = Math.round(seconds);
|
|
23889
|
+
return `${n3} second${n3 === 1 ? "" : "s"}`;
|
|
23890
|
+
}
|
|
23891
|
+
const n2 = Math.round(seconds / 60);
|
|
23892
|
+
return `${n2} minute${n2 === 1 ? "" : "s"}`;
|
|
23893
|
+
}
|
|
23894
|
+
function showDeviceCode(auth, out) {
|
|
23895
|
+
const printLink2 = out.printLink ?? out.print;
|
|
23896
|
+
out.print(
|
|
23897
|
+
`To sign in, open ${auth.verificationUri} and enter the code ${auth.userCode}`
|
|
23898
|
+
);
|
|
23899
|
+
if (auth.verificationUriComplete) {
|
|
23900
|
+
out.print("Or open this link, which already has the code in it:");
|
|
23901
|
+
printLink2(auth.verificationUriComplete);
|
|
23902
|
+
}
|
|
23903
|
+
out.print("");
|
|
23904
|
+
out.print(`The code expires in ${expiryText(auth.expiresIn)}.`);
|
|
23905
|
+
out.print("No browser here? Open the link on any device.");
|
|
23906
|
+
out.print("");
|
|
23907
|
+
}
|
|
23908
|
+
async function pollForTokens(source, clientId, auth, signal) {
|
|
23909
|
+
const deadline = Date.now() + auth.expiresIn * 1e3;
|
|
23910
|
+
let intervalS = auth.interval;
|
|
23911
|
+
let failures = 0;
|
|
23912
|
+
let replyMayBeLost = false;
|
|
23913
|
+
for (; ; ) {
|
|
23914
|
+
const backoffMs = failures ? Math.min(2 ** failures * 1e3, MAX_BACKOFF_MS) : 0;
|
|
23915
|
+
const waitMs = intervalS * 1e3 + backoffMs;
|
|
23916
|
+
await sleep(Math.min(waitMs, Math.max(0, deadline - Date.now())), signal);
|
|
23917
|
+
if (Date.now() >= deadline) throw new Error(EXPIRED);
|
|
23918
|
+
let res;
|
|
23919
|
+
let data;
|
|
23920
|
+
try {
|
|
23921
|
+
({ res, data } = await postFormJson(
|
|
23922
|
+
`${source.authUrl}/oauth/token`,
|
|
23923
|
+
{
|
|
23924
|
+
grant_type: DEVICE_GRANT,
|
|
23925
|
+
device_code: auth.deviceCode,
|
|
23926
|
+
client_id: clientId
|
|
23927
|
+
},
|
|
23928
|
+
signal
|
|
23929
|
+
));
|
|
23930
|
+
} catch {
|
|
23931
|
+
if (signal.aborted) throw new Error(CANCELLED);
|
|
23932
|
+
replyMayBeLost = true;
|
|
23933
|
+
failures++;
|
|
23934
|
+
continue;
|
|
23935
|
+
}
|
|
23936
|
+
if (res.ok) return identityTokensOf(data, "Sign-in");
|
|
23937
|
+
if (res.status >= 500 || res.status === 429) {
|
|
23938
|
+
replyMayBeLost ||= res.status >= 500;
|
|
23939
|
+
failures++;
|
|
23940
|
+
continue;
|
|
23941
|
+
}
|
|
23942
|
+
failures = 0;
|
|
23943
|
+
const error2 = str(data?.error);
|
|
23944
|
+
if (error2 === "invalid_grant" && replyMayBeLost) {
|
|
23945
|
+
throw new Error(
|
|
23946
|
+
"The sign-in may have completed but its reply was lost. Run `inworld login` again."
|
|
23947
|
+
);
|
|
23948
|
+
}
|
|
23949
|
+
switch (error2) {
|
|
23950
|
+
case "authorization_pending":
|
|
23951
|
+
replyMayBeLost = false;
|
|
23952
|
+
break;
|
|
23953
|
+
case "slow_down":
|
|
23954
|
+
replyMayBeLost = false;
|
|
23955
|
+
intervalS += SLOW_DOWN_STEP_S;
|
|
23956
|
+
break;
|
|
23957
|
+
case "access_denied":
|
|
23958
|
+
throw new Error("Sign-in was denied in the browser.");
|
|
23959
|
+
case "expired_token":
|
|
23960
|
+
throw new Error(EXPIRED);
|
|
23961
|
+
default:
|
|
23962
|
+
throw new Error(
|
|
23963
|
+
gotrueErrorMessage(data, `Sign-in failed (HTTP ${res.status}).`)
|
|
23964
|
+
);
|
|
23965
|
+
}
|
|
23966
|
+
}
|
|
23967
|
+
}
|
|
23968
|
+
async function signInWithDeviceCode(options) {
|
|
23969
|
+
const { source, platformUrl, clientId, env: env3, out } = options;
|
|
23970
|
+
if (!clientId) {
|
|
23971
|
+
throw new Error(
|
|
23972
|
+
"Set INWORLD_CLI_CLIENT_ID to the deployment's OAuth client id when overriding INWORLD_PLATFORM_URL or INWORLD_AUTH_URL."
|
|
23973
|
+
);
|
|
23974
|
+
}
|
|
23975
|
+
if (clientId === CLIENT_ID_PLACEHOLDER) {
|
|
23976
|
+
throw new Error(
|
|
23977
|
+
`Sign-in is not available yet: no OAuth client id is registered for ${env3}. Set INWORLD_CLI_CLIENT_ID to the CLI's client id for this deployment.`
|
|
23978
|
+
);
|
|
23979
|
+
}
|
|
23980
|
+
const cancel = new AbortController();
|
|
23981
|
+
const onSigint = () => cancel.abort();
|
|
23982
|
+
process.on("SIGINT", onSigint);
|
|
23983
|
+
const onCallerAbort = () => cancel.abort();
|
|
23984
|
+
options.signal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
23985
|
+
if (options.signal?.aborted) cancel.abort();
|
|
23986
|
+
let prompt;
|
|
23987
|
+
try {
|
|
23988
|
+
const auth = await requestDeviceAuthorization(
|
|
23989
|
+
source,
|
|
23990
|
+
platformUrl,
|
|
23991
|
+
clientId,
|
|
23992
|
+
env3.toUpperCase() === "DEV",
|
|
23993
|
+
cancel.signal
|
|
23994
|
+
);
|
|
23995
|
+
showDeviceCode(auth, out);
|
|
23996
|
+
const interactive = options.interactive ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
23997
|
+
if (interactive && hasLocalBrowser()) {
|
|
23998
|
+
prompt = promptToOpenBrowser({
|
|
23999
|
+
url: auth.verificationUriComplete ?? auth.verificationUri,
|
|
24000
|
+
out,
|
|
24001
|
+
onCancel: () => cancel.abort()
|
|
24002
|
+
});
|
|
24003
|
+
}
|
|
24004
|
+
return await pollForTokens(source, clientId, auth, cancel.signal);
|
|
24005
|
+
} finally {
|
|
24006
|
+
prompt?.close();
|
|
24007
|
+
process.off("SIGINT", onSigint);
|
|
24008
|
+
options.signal?.removeEventListener("abort", onCallerAbort);
|
|
24009
|
+
}
|
|
24010
|
+
}
|
|
24011
|
+
var DEVICE_GRANT, DEFAULT_INTERVAL_S, SLOW_DOWN_STEP_S, DEFAULT_EXPIRES_IN_S, REQUEST_TIMEOUT_MS, MAX_BACKOFF_MS, CANCELLED, EXPIRED, str, positive;
|
|
24012
|
+
var init_device_flow = __esm({
|
|
24013
|
+
"src/mcp/auth/device_flow.ts"() {
|
|
24014
|
+
"use strict";
|
|
24015
|
+
init_browser();
|
|
24016
|
+
init_constants5();
|
|
24017
|
+
init_identity();
|
|
24018
|
+
init_sign_in_prompt();
|
|
24019
|
+
DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
|
|
24020
|
+
DEFAULT_INTERVAL_S = 5;
|
|
24021
|
+
SLOW_DOWN_STEP_S = 5;
|
|
24022
|
+
DEFAULT_EXPIRES_IN_S = 900;
|
|
24023
|
+
REQUEST_TIMEOUT_MS = 15e3;
|
|
24024
|
+
MAX_BACKOFF_MS = 3e4;
|
|
24025
|
+
CANCELLED = "Sign-in cancelled.";
|
|
24026
|
+
EXPIRED = "The code expired. Run `inworld login` again.";
|
|
24027
|
+
str = (v) => typeof v === "string" && v ? v : void 0;
|
|
24028
|
+
positive = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 ? v : void 0;
|
|
24029
|
+
}
|
|
24030
|
+
});
|
|
24031
|
+
|
|
24241
24032
|
// ../../node_modules/ms/index.js
|
|
24242
24033
|
var require_ms = __commonJS({
|
|
24243
24034
|
"../../node_modules/ms/index.js"(exports, module) {
|
|
@@ -24259,13 +24050,13 @@ var require_ms = __commonJS({
|
|
|
24259
24050
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
24260
24051
|
);
|
|
24261
24052
|
};
|
|
24262
|
-
function parse3(
|
|
24263
|
-
|
|
24264
|
-
if (
|
|
24053
|
+
function parse3(str2) {
|
|
24054
|
+
str2 = String(str2);
|
|
24055
|
+
if (str2.length > 100) {
|
|
24265
24056
|
return;
|
|
24266
24057
|
}
|
|
24267
24058
|
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
24268
|
-
|
|
24059
|
+
str2
|
|
24269
24060
|
);
|
|
24270
24061
|
if (!match) {
|
|
24271
24062
|
return;
|
|
@@ -24981,7 +24772,7 @@ var require_node = __commonJS({
|
|
|
24981
24772
|
var { formatters } = module.exports;
|
|
24982
24773
|
formatters.o = function(v) {
|
|
24983
24774
|
this.inspectOpts.colors = this.useColors;
|
|
24984
|
-
return util2.inspect(v, this.inspectOpts).split("\n").map((
|
|
24775
|
+
return util2.inspect(v, this.inspectOpts).split("\n").map((str2) => str2.trim()).join(" ");
|
|
24985
24776
|
};
|
|
24986
24777
|
formatters.O = function(v) {
|
|
24987
24778
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -26157,7 +25948,7 @@ var require_mixpanel_node = __commonJS({
|
|
|
26157
25948
|
"../../node_modules/mixpanel/lib/mixpanel-node.js"(exports, module) {
|
|
26158
25949
|
var querystring = __require("querystring");
|
|
26159
25950
|
var Buffer5 = __require("buffer").Buffer;
|
|
26160
|
-
var
|
|
25951
|
+
var http = __require("http");
|
|
26161
25952
|
var https = __require("https");
|
|
26162
25953
|
var HttpsProxyAgent = require_dist2();
|
|
26163
25954
|
var url = __require("url");
|
|
@@ -26188,9 +25979,9 @@ var require_mixpanel_node = __commonJS({
|
|
|
26188
25979
|
};
|
|
26189
25980
|
const { keepAlive } = metrics.config;
|
|
26190
25981
|
const MAX_BATCH_SIZE = 50;
|
|
26191
|
-
const REQUEST_LIBS = { http
|
|
25982
|
+
const REQUEST_LIBS = { http, https };
|
|
26192
25983
|
const REQUEST_AGENTS = {
|
|
26193
|
-
http: new
|
|
25984
|
+
http: new http.Agent({ keepAlive }),
|
|
26194
25985
|
https: new https.Agent({ keepAlive })
|
|
26195
25986
|
};
|
|
26196
25987
|
const proxyPath = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
@@ -26416,8 +26207,8 @@ var require_depd = __commonJS({
|
|
|
26416
26207
|
var relative = __require("path").relative;
|
|
26417
26208
|
module.exports = depd;
|
|
26418
26209
|
var basePath = process.cwd();
|
|
26419
|
-
function containsNamespace(
|
|
26420
|
-
var vals =
|
|
26210
|
+
function containsNamespace(str2, namespace) {
|
|
26211
|
+
var vals = str2.split(/[ ,]+/);
|
|
26421
26212
|
var ns = String(namespace).toLowerCase();
|
|
26422
26213
|
for (var i2 = 0; i2 < vals.length; i2++) {
|
|
26423
26214
|
var val = vals[i2];
|
|
@@ -26444,21 +26235,21 @@ var require_depd = __commonJS({
|
|
|
26444
26235
|
return descriptor;
|
|
26445
26236
|
}
|
|
26446
26237
|
function createArgumentsString(arity) {
|
|
26447
|
-
var
|
|
26238
|
+
var str2 = "";
|
|
26448
26239
|
for (var i2 = 0; i2 < arity; i2++) {
|
|
26449
|
-
|
|
26240
|
+
str2 += ", arg" + i2;
|
|
26450
26241
|
}
|
|
26451
|
-
return
|
|
26242
|
+
return str2.substr(2);
|
|
26452
26243
|
}
|
|
26453
26244
|
function createStackString(stack) {
|
|
26454
|
-
var
|
|
26245
|
+
var str2 = this.name + ": " + this.namespace;
|
|
26455
26246
|
if (this.message) {
|
|
26456
|
-
|
|
26247
|
+
str2 += " deprecated " + this.message;
|
|
26457
26248
|
}
|
|
26458
26249
|
for (var i2 = 0; i2 < stack.length; i2++) {
|
|
26459
|
-
|
|
26250
|
+
str2 += "\n at " + stack[i2].toString();
|
|
26460
26251
|
}
|
|
26461
|
-
return
|
|
26252
|
+
return str2;
|
|
26462
26253
|
}
|
|
26463
26254
|
function depd(namespace) {
|
|
26464
26255
|
if (!namespace) {
|
|
@@ -26487,15 +26278,15 @@ var require_depd = __commonJS({
|
|
|
26487
26278
|
if (process.noDeprecation) {
|
|
26488
26279
|
return true;
|
|
26489
26280
|
}
|
|
26490
|
-
var
|
|
26491
|
-
return containsNamespace(
|
|
26281
|
+
var str2 = process.env.NO_DEPRECATION || "";
|
|
26282
|
+
return containsNamespace(str2, namespace);
|
|
26492
26283
|
}
|
|
26493
26284
|
function istraced(namespace) {
|
|
26494
26285
|
if (process.traceDeprecation) {
|
|
26495
26286
|
return true;
|
|
26496
26287
|
}
|
|
26497
|
-
var
|
|
26498
|
-
return containsNamespace(
|
|
26288
|
+
var str2 = process.env.TRACE_DEPRECATION || "";
|
|
26289
|
+
return containsNamespace(str2, namespace);
|
|
26499
26290
|
}
|
|
26500
26291
|
function log(message, site) {
|
|
26501
26292
|
var haslisteners = eehaslisteners(process, "deprecation");
|
|
@@ -26929,8 +26720,8 @@ var require_toidentifier = __commonJS({
|
|
|
26929
26720
|
"../../node_modules/toidentifier/index.js"(exports, module) {
|
|
26930
26721
|
"use strict";
|
|
26931
26722
|
module.exports = toIdentifier;
|
|
26932
|
-
function toIdentifier(
|
|
26933
|
-
return
|
|
26723
|
+
function toIdentifier(str2) {
|
|
26724
|
+
return str2.split(" ").map(function(token) {
|
|
26934
26725
|
return token.slice(0, 1).toUpperCase() + token.slice(1);
|
|
26935
26726
|
}).join("").replace(/[^ _0-9a-z]/gi, "");
|
|
26936
26727
|
}
|
|
@@ -27154,16 +26945,16 @@ var require_bytes = __commonJS({
|
|
|
27154
26945
|
}
|
|
27155
26946
|
}
|
|
27156
26947
|
var val = value / map[unit.toLowerCase()];
|
|
27157
|
-
var
|
|
26948
|
+
var str2 = val.toFixed(decimalPlaces);
|
|
27158
26949
|
if (!fixedDecimals) {
|
|
27159
|
-
|
|
26950
|
+
str2 = str2.replace(formatDecimalsRegExp, "$1");
|
|
27160
26951
|
}
|
|
27161
26952
|
if (thousandsSeparator) {
|
|
27162
|
-
|
|
26953
|
+
str2 = str2.split(".").map(function(s, i2) {
|
|
27163
26954
|
return i2 === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s;
|
|
27164
26955
|
}).join(".");
|
|
27165
26956
|
}
|
|
27166
|
-
return
|
|
26957
|
+
return str2 + unitSeparator + unit;
|
|
27167
26958
|
}
|
|
27168
26959
|
function parse3(val) {
|
|
27169
26960
|
if (typeof val === "number" && !isNaN(val)) {
|
|
@@ -27268,12 +27059,12 @@ var require_bom_handling = __commonJS({
|
|
|
27268
27059
|
this.encoder = encoder;
|
|
27269
27060
|
this.addBOM = true;
|
|
27270
27061
|
}
|
|
27271
|
-
PrependBOMWrapper.prototype.write = function(
|
|
27062
|
+
PrependBOMWrapper.prototype.write = function(str2) {
|
|
27272
27063
|
if (this.addBOM) {
|
|
27273
|
-
|
|
27064
|
+
str2 = BOMChar + str2;
|
|
27274
27065
|
this.addBOM = false;
|
|
27275
27066
|
}
|
|
27276
|
-
return this.encoder.write(
|
|
27067
|
+
return this.encoder.write(str2);
|
|
27277
27068
|
};
|
|
27278
27069
|
PrependBOMWrapper.prototype.end = function() {
|
|
27279
27070
|
return this.encoder.end();
|
|
@@ -27372,31 +27163,31 @@ var require_internal = __commonJS({
|
|
|
27372
27163
|
function InternalEncoder(options, codec) {
|
|
27373
27164
|
this.enc = codec.enc;
|
|
27374
27165
|
}
|
|
27375
|
-
InternalEncoder.prototype.write = function(
|
|
27376
|
-
return Buffer5.from(
|
|
27166
|
+
InternalEncoder.prototype.write = function(str2) {
|
|
27167
|
+
return Buffer5.from(str2, this.enc);
|
|
27377
27168
|
};
|
|
27378
27169
|
InternalEncoder.prototype.end = function() {
|
|
27379
27170
|
};
|
|
27380
27171
|
function InternalEncoderBase64(options, codec) {
|
|
27381
27172
|
this.prevStr = "";
|
|
27382
27173
|
}
|
|
27383
|
-
InternalEncoderBase64.prototype.write = function(
|
|
27384
|
-
|
|
27385
|
-
var completeQuads =
|
|
27386
|
-
this.prevStr =
|
|
27387
|
-
|
|
27388
|
-
return Buffer5.from(
|
|
27174
|
+
InternalEncoderBase64.prototype.write = function(str2) {
|
|
27175
|
+
str2 = this.prevStr + str2;
|
|
27176
|
+
var completeQuads = str2.length - str2.length % 4;
|
|
27177
|
+
this.prevStr = str2.slice(completeQuads);
|
|
27178
|
+
str2 = str2.slice(0, completeQuads);
|
|
27179
|
+
return Buffer5.from(str2, "base64");
|
|
27389
27180
|
};
|
|
27390
27181
|
InternalEncoderBase64.prototype.end = function() {
|
|
27391
27182
|
return Buffer5.from(this.prevStr, "base64");
|
|
27392
27183
|
};
|
|
27393
27184
|
function InternalEncoderCesu8(options, codec) {
|
|
27394
27185
|
}
|
|
27395
|
-
InternalEncoderCesu8.prototype.write = function(
|
|
27396
|
-
var buf = Buffer5.alloc(
|
|
27186
|
+
InternalEncoderCesu8.prototype.write = function(str2) {
|
|
27187
|
+
var buf = Buffer5.alloc(str2.length * 3);
|
|
27397
27188
|
var bufIdx = 0;
|
|
27398
|
-
for (var i2 = 0; i2 <
|
|
27399
|
-
var charCode =
|
|
27189
|
+
for (var i2 = 0; i2 < str2.length; i2++) {
|
|
27190
|
+
var charCode = str2.charCodeAt(i2);
|
|
27400
27191
|
if (charCode < 128) {
|
|
27401
27192
|
buf[bufIdx++] = charCode;
|
|
27402
27193
|
} else if (charCode < 2048) {
|
|
@@ -27477,25 +27268,25 @@ var require_internal = __commonJS({
|
|
|
27477
27268
|
function InternalEncoderUtf8(options, codec) {
|
|
27478
27269
|
this.highSurrogate = "";
|
|
27479
27270
|
}
|
|
27480
|
-
InternalEncoderUtf8.prototype.write = function(
|
|
27271
|
+
InternalEncoderUtf8.prototype.write = function(str2) {
|
|
27481
27272
|
if (this.highSurrogate) {
|
|
27482
|
-
|
|
27273
|
+
str2 = this.highSurrogate + str2;
|
|
27483
27274
|
this.highSurrogate = "";
|
|
27484
27275
|
}
|
|
27485
|
-
if (
|
|
27486
|
-
var charCode =
|
|
27276
|
+
if (str2.length > 0) {
|
|
27277
|
+
var charCode = str2.charCodeAt(str2.length - 1);
|
|
27487
27278
|
if (charCode >= 55296 && charCode < 56320) {
|
|
27488
|
-
this.highSurrogate =
|
|
27489
|
-
|
|
27279
|
+
this.highSurrogate = str2[str2.length - 1];
|
|
27280
|
+
str2 = str2.slice(0, str2.length - 1);
|
|
27490
27281
|
}
|
|
27491
27282
|
}
|
|
27492
|
-
return Buffer5.from(
|
|
27283
|
+
return Buffer5.from(str2, this.enc);
|
|
27493
27284
|
};
|
|
27494
27285
|
InternalEncoderUtf8.prototype.end = function() {
|
|
27495
27286
|
if (this.highSurrogate) {
|
|
27496
|
-
var
|
|
27287
|
+
var str2 = this.highSurrogate;
|
|
27497
27288
|
this.highSurrogate = "";
|
|
27498
|
-
return Buffer5.from(
|
|
27289
|
+
return Buffer5.from(str2, this.enc);
|
|
27499
27290
|
}
|
|
27500
27291
|
};
|
|
27501
27292
|
}
|
|
@@ -27522,8 +27313,8 @@ var require_utf32 = __commonJS({
|
|
|
27522
27313
|
this.isLE = codec.isLE;
|
|
27523
27314
|
this.highSurrogate = 0;
|
|
27524
27315
|
}
|
|
27525
|
-
Utf32Encoder.prototype.write = function(
|
|
27526
|
-
var src = Buffer5.from(
|
|
27316
|
+
Utf32Encoder.prototype.write = function(str2) {
|
|
27317
|
+
var src = Buffer5.from(str2, "ucs2");
|
|
27527
27318
|
var dst = Buffer5.alloc(src.length * 2);
|
|
27528
27319
|
var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
|
|
27529
27320
|
var offset = 0;
|
|
@@ -27644,8 +27435,8 @@ var require_utf32 = __commonJS({
|
|
|
27644
27435
|
}
|
|
27645
27436
|
this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
|
|
27646
27437
|
}
|
|
27647
|
-
Utf32AutoEncoder.prototype.write = function(
|
|
27648
|
-
return this.encoder.write(
|
|
27438
|
+
Utf32AutoEncoder.prototype.write = function(str2) {
|
|
27439
|
+
return this.encoder.write(str2);
|
|
27649
27440
|
};
|
|
27650
27441
|
Utf32AutoEncoder.prototype.end = function() {
|
|
27651
27442
|
return this.encoder.end();
|
|
@@ -27745,8 +27536,8 @@ var require_utf16 = __commonJS({
|
|
|
27745
27536
|
Utf16BECodec.prototype.bomAware = true;
|
|
27746
27537
|
function Utf16BEEncoder() {
|
|
27747
27538
|
}
|
|
27748
|
-
Utf16BEEncoder.prototype.write = function(
|
|
27749
|
-
var buf = Buffer5.from(
|
|
27539
|
+
Utf16BEEncoder.prototype.write = function(str2) {
|
|
27540
|
+
var buf = Buffer5.from(str2, "ucs2");
|
|
27750
27541
|
for (var i2 = 0; i2 < buf.length; i2 += 2) {
|
|
27751
27542
|
var tmp = buf[i2];
|
|
27752
27543
|
buf[i2] = buf[i2 + 1];
|
|
@@ -27795,8 +27586,8 @@ var require_utf16 = __commonJS({
|
|
|
27795
27586
|
}
|
|
27796
27587
|
this.encoder = codec.iconv.getEncoder("utf-16le", options);
|
|
27797
27588
|
}
|
|
27798
|
-
Utf16Encoder.prototype.write = function(
|
|
27799
|
-
return this.encoder.write(
|
|
27589
|
+
Utf16Encoder.prototype.write = function(str2) {
|
|
27590
|
+
return this.encoder.write(str2);
|
|
27800
27591
|
};
|
|
27801
27592
|
Utf16Encoder.prototype.end = function() {
|
|
27802
27593
|
return this.encoder.end();
|
|
@@ -27892,8 +27683,8 @@ var require_utf7 = __commonJS({
|
|
|
27892
27683
|
function Utf7Encoder(options, codec) {
|
|
27893
27684
|
this.iconv = codec.iconv;
|
|
27894
27685
|
}
|
|
27895
|
-
Utf7Encoder.prototype.write = function(
|
|
27896
|
-
return Buffer5.from(
|
|
27686
|
+
Utf7Encoder.prototype.write = function(str2) {
|
|
27687
|
+
return Buffer5.from(str2.replace(nonDirectChars, function(chunk) {
|
|
27897
27688
|
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
|
|
27898
27689
|
}.bind(this)));
|
|
27899
27690
|
};
|
|
@@ -27977,14 +27768,14 @@ var require_utf7 = __commonJS({
|
|
|
27977
27768
|
this.base64Accum = Buffer5.alloc(6);
|
|
27978
27769
|
this.base64AccumIdx = 0;
|
|
27979
27770
|
}
|
|
27980
|
-
Utf7IMAPEncoder.prototype.write = function(
|
|
27771
|
+
Utf7IMAPEncoder.prototype.write = function(str2) {
|
|
27981
27772
|
var inBase64 = this.inBase64;
|
|
27982
27773
|
var base64Accum = this.base64Accum;
|
|
27983
27774
|
var base64AccumIdx = this.base64AccumIdx;
|
|
27984
|
-
var buf = Buffer5.alloc(
|
|
27775
|
+
var buf = Buffer5.alloc(str2.length * 5 + 10);
|
|
27985
27776
|
var bufIdx = 0;
|
|
27986
|
-
for (var i3 = 0; i3 <
|
|
27987
|
-
var uChar =
|
|
27777
|
+
for (var i3 = 0; i3 < str2.length; i3++) {
|
|
27778
|
+
var uChar = str2.charCodeAt(i3);
|
|
27988
27779
|
if (uChar >= 32 && uChar <= 126) {
|
|
27989
27780
|
if (inBase64) {
|
|
27990
27781
|
if (base64AccumIdx > 0) {
|
|
@@ -28125,10 +27916,10 @@ var require_sbcs_codec = __commonJS({
|
|
|
28125
27916
|
function SBCSEncoder(options, codec) {
|
|
28126
27917
|
this.encodeBuf = codec.encodeBuf;
|
|
28127
27918
|
}
|
|
28128
|
-
SBCSEncoder.prototype.write = function(
|
|
28129
|
-
var buf = Buffer5.alloc(
|
|
28130
|
-
for (var i2 = 0; i2 <
|
|
28131
|
-
buf[i2] = this.encodeBuf[
|
|
27919
|
+
SBCSEncoder.prototype.write = function(str2) {
|
|
27920
|
+
var buf = Buffer5.alloc(str2.length);
|
|
27921
|
+
for (var i2 = 0; i2 < str2.length; i2++) {
|
|
27922
|
+
buf[i2] = this.encodeBuf[str2.charCodeAt(i2)];
|
|
28132
27923
|
}
|
|
28133
27924
|
return buf;
|
|
28134
27925
|
};
|
|
@@ -29002,8 +28793,8 @@ var require_dbcs_codec = __commonJS({
|
|
|
29002
28793
|
this.defaultCharSingleByte = codec.defCharSB;
|
|
29003
28794
|
this.gb18030 = codec.gb18030;
|
|
29004
28795
|
}
|
|
29005
|
-
DBCSEncoder.prototype.write = function(
|
|
29006
|
-
var newBuf = Buffer5.alloc(
|
|
28796
|
+
DBCSEncoder.prototype.write = function(str2) {
|
|
28797
|
+
var newBuf = Buffer5.alloc(str2.length * (this.gb18030 ? 4 : 3));
|
|
29007
28798
|
var leadSurrogate = this.leadSurrogate;
|
|
29008
28799
|
var seqObj = this.seqObj;
|
|
29009
28800
|
var nextChar = -1;
|
|
@@ -29011,8 +28802,8 @@ var require_dbcs_codec = __commonJS({
|
|
|
29011
28802
|
var j = 0;
|
|
29012
28803
|
while (true) {
|
|
29013
28804
|
if (nextChar === -1) {
|
|
29014
|
-
if (i3 ==
|
|
29015
|
-
var uCode =
|
|
28805
|
+
if (i3 == str2.length) break;
|
|
28806
|
+
var uCode = str2.charCodeAt(i3++);
|
|
29016
28807
|
} else {
|
|
29017
28808
|
var uCode = nextChar;
|
|
29018
28809
|
nextChar = -1;
|
|
@@ -30850,10 +30641,10 @@ var require_lib = __commonJS({
|
|
|
30850
30641
|
module.exports.encodings = null;
|
|
30851
30642
|
module.exports.defaultCharUnicode = "\uFFFD";
|
|
30852
30643
|
module.exports.defaultCharSingleByte = "?";
|
|
30853
|
-
module.exports.encode = function encode(
|
|
30854
|
-
|
|
30644
|
+
module.exports.encode = function encode(str2, encoding, options) {
|
|
30645
|
+
str2 = "" + (str2 || "");
|
|
30855
30646
|
var encoder = module.exports.getEncoder(encoding, options);
|
|
30856
|
-
var res = encoder.write(
|
|
30647
|
+
var res = encoder.write(str2);
|
|
30857
30648
|
var trail = encoder.end();
|
|
30858
30649
|
return trail && trail.length > 0 ? Buffer5.concat([res, trail]) : res;
|
|
30859
30650
|
};
|
|
@@ -31447,14 +31238,14 @@ var require_content_type = __commonJS({
|
|
|
31447
31238
|
return header;
|
|
31448
31239
|
}
|
|
31449
31240
|
function qstring(val) {
|
|
31450
|
-
var
|
|
31451
|
-
if (TOKEN_REGEXP.test(
|
|
31452
|
-
return
|
|
31241
|
+
var str2 = String(val);
|
|
31242
|
+
if (TOKEN_REGEXP.test(str2)) {
|
|
31243
|
+
return str2;
|
|
31453
31244
|
}
|
|
31454
|
-
if (
|
|
31245
|
+
if (str2.length > 0 && !TEXT_REGEXP.test(str2)) {
|
|
31455
31246
|
throw new TypeError("invalid parameter value");
|
|
31456
31247
|
}
|
|
31457
|
-
return '"' +
|
|
31248
|
+
return '"' + str2.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
31458
31249
|
}
|
|
31459
31250
|
function ContentType(type) {
|
|
31460
31251
|
this.parameters = /* @__PURE__ */ Object.create(null);
|
|
@@ -40894,11 +40685,11 @@ var require_mime_types = __commonJS({
|
|
|
40894
40685
|
}
|
|
40895
40686
|
return false;
|
|
40896
40687
|
}
|
|
40897
|
-
function contentType(
|
|
40898
|
-
if (!
|
|
40688
|
+
function contentType(str2) {
|
|
40689
|
+
if (!str2 || typeof str2 !== "string") {
|
|
40899
40690
|
return false;
|
|
40900
40691
|
}
|
|
40901
|
-
var mime =
|
|
40692
|
+
var mime = str2.indexOf("/") === -1 ? exports.lookup(str2) : str2;
|
|
40902
40693
|
if (!mime) {
|
|
40903
40694
|
return false;
|
|
40904
40695
|
}
|
|
@@ -41279,14 +41070,14 @@ var require_read = __commonJS({
|
|
|
41279
41070
|
return;
|
|
41280
41071
|
}
|
|
41281
41072
|
}
|
|
41282
|
-
var
|
|
41073
|
+
var str2 = body;
|
|
41283
41074
|
try {
|
|
41284
41075
|
debug("parse body");
|
|
41285
|
-
|
|
41286
|
-
req.body = parse3(
|
|
41076
|
+
str2 = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
|
|
41077
|
+
req.body = parse3(str2, encoding);
|
|
41287
41078
|
} catch (err) {
|
|
41288
41079
|
next(createError(400, err, {
|
|
41289
|
-
body:
|
|
41080
|
+
body: str2,
|
|
41290
41081
|
type: err.type || "entity.parse.failed"
|
|
41291
41082
|
}));
|
|
41292
41083
|
return;
|
|
@@ -41386,11 +41177,11 @@ var require_json = __commonJS({
|
|
|
41386
41177
|
read(req, res, next, parse3, debug, readOptions);
|
|
41387
41178
|
};
|
|
41388
41179
|
}
|
|
41389
|
-
function createStrictSyntaxError(
|
|
41390
|
-
var index =
|
|
41180
|
+
function createStrictSyntaxError(str2, char) {
|
|
41181
|
+
var index = str2.indexOf(char);
|
|
41391
41182
|
var partial2 = "";
|
|
41392
41183
|
if (index !== -1) {
|
|
41393
|
-
partial2 =
|
|
41184
|
+
partial2 = str2.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str2.length - index);
|
|
41394
41185
|
}
|
|
41395
41186
|
try {
|
|
41396
41187
|
JSON.parse(partial2);
|
|
@@ -41398,14 +41189,14 @@ var require_json = __commonJS({
|
|
|
41398
41189
|
} catch (e) {
|
|
41399
41190
|
return normalizeJsonSyntaxError(e, {
|
|
41400
41191
|
message: e.message.replace(JSON_SYNTAX_REGEXP, function(placeholder) {
|
|
41401
|
-
return
|
|
41192
|
+
return str2.substring(index, index + placeholder.length);
|
|
41402
41193
|
}),
|
|
41403
41194
|
stack: e.stack
|
|
41404
41195
|
});
|
|
41405
41196
|
}
|
|
41406
41197
|
}
|
|
41407
|
-
function firstchar(
|
|
41408
|
-
var match = FIRST_CHAR_REGEXP.exec(
|
|
41198
|
+
function firstchar(str2) {
|
|
41199
|
+
var match = FIRST_CHAR_REGEXP.exec(str2);
|
|
41409
41200
|
return match ? match[1] : void 0;
|
|
41410
41201
|
}
|
|
41411
41202
|
function normalizeJsonSyntaxError(error2, obj) {
|
|
@@ -41516,20 +41307,20 @@ var require_object_inspect = __commonJS({
|
|
|
41516
41307
|
var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) {
|
|
41517
41308
|
return O.__proto__;
|
|
41518
41309
|
} : null);
|
|
41519
|
-
function addNumericSeparator(num,
|
|
41520
|
-
if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/,
|
|
41521
|
-
return
|
|
41310
|
+
function addNumericSeparator(num, str2) {
|
|
41311
|
+
if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str2)) {
|
|
41312
|
+
return str2;
|
|
41522
41313
|
}
|
|
41523
41314
|
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
41524
41315
|
if (typeof num === "number") {
|
|
41525
41316
|
var int2 = num < 0 ? -$floor(-num) : $floor(num);
|
|
41526
41317
|
if (int2 !== num) {
|
|
41527
41318
|
var intStr = String(int2);
|
|
41528
|
-
var dec = $slice.call(
|
|
41319
|
+
var dec = $slice.call(str2, intStr.length + 1);
|
|
41529
41320
|
return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, "");
|
|
41530
41321
|
}
|
|
41531
41322
|
}
|
|
41532
|
-
return $replace.call(
|
|
41323
|
+
return $replace.call(str2, sepRegex, "$&_");
|
|
41533
41324
|
}
|
|
41534
41325
|
var utilInspect = require_util_inspect();
|
|
41535
41326
|
var inspectCustom = utilInspect.custom;
|
|
@@ -41579,8 +41370,8 @@ var require_object_inspect = __commonJS({
|
|
|
41579
41370
|
if (obj === 0) {
|
|
41580
41371
|
return Infinity / obj > 0 ? "0" : "-0";
|
|
41581
41372
|
}
|
|
41582
|
-
var
|
|
41583
|
-
return numericSeparator ? addNumericSeparator(obj,
|
|
41373
|
+
var str2 = String(obj);
|
|
41374
|
+
return numericSeparator ? addNumericSeparator(obj, str2) : str2;
|
|
41584
41375
|
}
|
|
41585
41376
|
if (typeof obj === "bigint") {
|
|
41586
41377
|
var bigIntStr = String(obj) + "n";
|
|
@@ -41900,15 +41691,15 @@ var require_object_inspect = __commonJS({
|
|
|
41900
41691
|
}
|
|
41901
41692
|
return typeof x.nodeName === "string" && typeof x.getAttribute === "function";
|
|
41902
41693
|
}
|
|
41903
|
-
function inspectString(
|
|
41904
|
-
if (
|
|
41905
|
-
var remaining =
|
|
41694
|
+
function inspectString(str2, opts) {
|
|
41695
|
+
if (str2.length > opts.maxStringLength) {
|
|
41696
|
+
var remaining = str2.length - opts.maxStringLength;
|
|
41906
41697
|
var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : "");
|
|
41907
|
-
return inspectString($slice.call(
|
|
41698
|
+
return inspectString($slice.call(str2, 0, opts.maxStringLength), opts) + trailer;
|
|
41908
41699
|
}
|
|
41909
41700
|
var quoteRE = quoteREs[opts.quoteStyle || "single"];
|
|
41910
41701
|
quoteRE.lastIndex = 0;
|
|
41911
|
-
var s = $replace.call($replace.call(
|
|
41702
|
+
var s = $replace.call($replace.call(str2, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
|
|
41912
41703
|
return wrapQuotes(s, "single", opts);
|
|
41913
41704
|
}
|
|
41914
41705
|
function lowbyte(c3) {
|
|
@@ -41925,8 +41716,8 @@ var require_object_inspect = __commonJS({
|
|
|
41925
41716
|
}
|
|
41926
41717
|
return "\\x" + (n2 < 16 ? "0" : "") + $toUpperCase.call(n2.toString(16));
|
|
41927
41718
|
}
|
|
41928
|
-
function markBoxed(
|
|
41929
|
-
return "Object(" +
|
|
41719
|
+
function markBoxed(str2) {
|
|
41720
|
+
return "Object(" + str2 + ")";
|
|
41930
41721
|
}
|
|
41931
41722
|
function weakCollectionOf(type) {
|
|
41932
41723
|
return type + " { ? }";
|
|
@@ -42391,14 +42182,14 @@ var require_implementation = __commonJS({
|
|
|
42391
42182
|
return arr;
|
|
42392
42183
|
};
|
|
42393
42184
|
var joiny = function(arr, joiner) {
|
|
42394
|
-
var
|
|
42185
|
+
var str2 = "";
|
|
42395
42186
|
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
42396
|
-
|
|
42187
|
+
str2 += arr[i2];
|
|
42397
42188
|
if (i2 + 1 < arr.length) {
|
|
42398
|
-
|
|
42189
|
+
str2 += joiner;
|
|
42399
42190
|
}
|
|
42400
42191
|
}
|
|
42401
|
-
return
|
|
42192
|
+
return str2;
|
|
42402
42193
|
};
|
|
42403
42194
|
module.exports = function bind(that) {
|
|
42404
42195
|
var target = this;
|
|
@@ -43252,8 +43043,8 @@ var require_utils5 = __commonJS({
|
|
|
43252
43043
|
return acc;
|
|
43253
43044
|
}, target);
|
|
43254
43045
|
};
|
|
43255
|
-
var decode = function(
|
|
43256
|
-
var strWithoutPlus =
|
|
43046
|
+
var decode = function(str2, defaultDecoder, charset) {
|
|
43047
|
+
var strWithoutPlus = str2.replace(/\+/g, " ");
|
|
43257
43048
|
if (charset === "iso-8859-1") {
|
|
43258
43049
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
43259
43050
|
}
|
|
@@ -43264,15 +43055,15 @@ var require_utils5 = __commonJS({
|
|
|
43264
43055
|
}
|
|
43265
43056
|
};
|
|
43266
43057
|
var limit = 1024;
|
|
43267
|
-
var encode = function encode2(
|
|
43268
|
-
if (
|
|
43269
|
-
return
|
|
43058
|
+
var encode = function encode2(str2, defaultEncoder, charset, kind, format2) {
|
|
43059
|
+
if (str2.length === 0) {
|
|
43060
|
+
return str2;
|
|
43270
43061
|
}
|
|
43271
|
-
var string3 =
|
|
43272
|
-
if (typeof
|
|
43273
|
-
string3 = Symbol.prototype.toString.call(
|
|
43274
|
-
} else if (typeof
|
|
43275
|
-
string3 = String(
|
|
43062
|
+
var string3 = str2;
|
|
43063
|
+
if (typeof str2 === "symbol") {
|
|
43064
|
+
string3 = Symbol.prototype.toString.call(str2);
|
|
43065
|
+
} else if (typeof str2 !== "string") {
|
|
43066
|
+
string3 = String(str2);
|
|
43276
43067
|
}
|
|
43277
43068
|
if (charset === "iso-8859-1") {
|
|
43278
43069
|
return escape(string3).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
@@ -43691,8 +43482,8 @@ var require_parse3 = __commonJS({
|
|
|
43691
43482
|
strictNullHandling: false,
|
|
43692
43483
|
throwOnLimitExceeded: false
|
|
43693
43484
|
};
|
|
43694
|
-
var interpretNumericEntities = function(
|
|
43695
|
-
return
|
|
43485
|
+
var interpretNumericEntities = function(str2) {
|
|
43486
|
+
return str2.replace(/&#(\d+);/g, function($0, numberStr) {
|
|
43696
43487
|
return String.fromCharCode(parseInt(numberStr, 10));
|
|
43697
43488
|
});
|
|
43698
43489
|
};
|
|
@@ -43707,9 +43498,9 @@ var require_parse3 = __commonJS({
|
|
|
43707
43498
|
};
|
|
43708
43499
|
var isoSentinel = "utf8=%26%2310003%3B";
|
|
43709
43500
|
var charsetSentinel = "utf8=%E2%9C%93";
|
|
43710
|
-
var parseValues = function parseQueryStringValues(
|
|
43501
|
+
var parseValues = function parseQueryStringValues(str2, options) {
|
|
43711
43502
|
var obj = { __proto__: null };
|
|
43712
|
-
var cleanStr = options.ignoreQueryPrefix ?
|
|
43503
|
+
var cleanStr = options.ignoreQueryPrefix ? str2.replace(/^\?/, "") : str2;
|
|
43713
43504
|
cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
43714
43505
|
var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
|
|
43715
43506
|
var parts = cleanStr.split(
|
|
@@ -43938,17 +43729,17 @@ var require_parse3 = __commonJS({
|
|
|
43938
43729
|
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
|
|
43939
43730
|
};
|
|
43940
43731
|
};
|
|
43941
|
-
module.exports = function(
|
|
43732
|
+
module.exports = function(str2, opts) {
|
|
43942
43733
|
var options = normalizeParseOptions(opts);
|
|
43943
|
-
if (
|
|
43734
|
+
if (str2 === "" || str2 === null || typeof str2 === "undefined") {
|
|
43944
43735
|
return options.plainObjects ? { __proto__: null } : {};
|
|
43945
43736
|
}
|
|
43946
|
-
var tempObj = typeof
|
|
43737
|
+
var tempObj = typeof str2 === "string" ? parseValues(str2, options) : str2;
|
|
43947
43738
|
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
43948
43739
|
var keys = Object.keys(tempObj);
|
|
43949
43740
|
for (var i2 = 0; i2 < keys.length; ++i2) {
|
|
43950
43741
|
var key = keys[i2];
|
|
43951
|
-
var newObj = parseKeys(key, tempObj[key], options, typeof
|
|
43742
|
+
var newObj = parseKeys(key, tempObj[key], options, typeof str2 === "string");
|
|
43952
43743
|
obj = utils.merge(obj, newObj, options);
|
|
43953
43744
|
}
|
|
43954
43745
|
if (options.allowSparse === true) {
|
|
@@ -44138,17 +43929,17 @@ var require_escape_html = __commonJS({
|
|
|
44138
43929
|
var matchHtmlRegExp = /["'&<>]/;
|
|
44139
43930
|
module.exports = escapeHtml;
|
|
44140
43931
|
function escapeHtml(string3) {
|
|
44141
|
-
var
|
|
44142
|
-
var match = matchHtmlRegExp.exec(
|
|
43932
|
+
var str2 = "" + string3;
|
|
43933
|
+
var match = matchHtmlRegExp.exec(str2);
|
|
44143
43934
|
if (!match) {
|
|
44144
|
-
return
|
|
43935
|
+
return str2;
|
|
44145
43936
|
}
|
|
44146
43937
|
var escape2;
|
|
44147
43938
|
var html = "";
|
|
44148
43939
|
var index = 0;
|
|
44149
43940
|
var lastIndex = 0;
|
|
44150
|
-
for (index = match.index; index <
|
|
44151
|
-
switch (
|
|
43941
|
+
for (index = match.index; index < str2.length; index++) {
|
|
43942
|
+
switch (str2.charCodeAt(index)) {
|
|
44152
43943
|
case 34:
|
|
44153
43944
|
escape2 = """;
|
|
44154
43945
|
break;
|
|
@@ -44168,12 +43959,12 @@ var require_escape_html = __commonJS({
|
|
|
44168
43959
|
continue;
|
|
44169
43960
|
}
|
|
44170
43961
|
if (lastIndex !== index) {
|
|
44171
|
-
html +=
|
|
43962
|
+
html += str2.substring(lastIndex, index);
|
|
44172
43963
|
}
|
|
44173
43964
|
lastIndex = index + 1;
|
|
44174
43965
|
html += escape2;
|
|
44175
43966
|
}
|
|
44176
|
-
return lastIndex !== index ? html +
|
|
43967
|
+
return lastIndex !== index ? html + str2.substring(lastIndex, index) : html;
|
|
44177
43968
|
}
|
|
44178
43969
|
}
|
|
44179
43970
|
});
|
|
@@ -44213,20 +44004,20 @@ var require_parseurl = __commonJS({
|
|
|
44213
44004
|
parsed._raw = url2;
|
|
44214
44005
|
return req._parsedOriginalUrl = parsed;
|
|
44215
44006
|
}
|
|
44216
|
-
function fastparse(
|
|
44217
|
-
if (typeof
|
|
44218
|
-
return parse3(
|
|
44007
|
+
function fastparse(str2) {
|
|
44008
|
+
if (typeof str2 !== "string" || str2.charCodeAt(0) !== 47) {
|
|
44009
|
+
return parse3(str2);
|
|
44219
44010
|
}
|
|
44220
|
-
var pathname =
|
|
44011
|
+
var pathname = str2;
|
|
44221
44012
|
var query = null;
|
|
44222
44013
|
var search = null;
|
|
44223
|
-
for (var i2 = 1; i2 <
|
|
44224
|
-
switch (
|
|
44014
|
+
for (var i2 = 1; i2 < str2.length; i2++) {
|
|
44015
|
+
switch (str2.charCodeAt(i2)) {
|
|
44225
44016
|
case 63:
|
|
44226
44017
|
if (search === null) {
|
|
44227
|
-
pathname =
|
|
44228
|
-
query =
|
|
44229
|
-
search =
|
|
44018
|
+
pathname = str2.substring(0, i2);
|
|
44019
|
+
query = str2.substring(i2 + 1);
|
|
44020
|
+
search = str2.substring(i2);
|
|
44230
44021
|
}
|
|
44231
44022
|
break;
|
|
44232
44023
|
case 9:
|
|
@@ -44243,12 +44034,12 @@ var require_parseurl = __commonJS({
|
|
|
44243
44034
|
/* # */
|
|
44244
44035
|
case 160:
|
|
44245
44036
|
case 65279:
|
|
44246
|
-
return parse3(
|
|
44037
|
+
return parse3(str2);
|
|
44247
44038
|
}
|
|
44248
44039
|
}
|
|
44249
44040
|
var url2 = Url !== void 0 ? new Url() : {};
|
|
44250
|
-
url2.path =
|
|
44251
|
-
url2.href =
|
|
44041
|
+
url2.path = str2;
|
|
44042
|
+
url2.href = str2;
|
|
44252
44043
|
url2.pathname = pathname;
|
|
44253
44044
|
if (search !== null) {
|
|
44254
44045
|
url2.query = query;
|
|
@@ -45261,11 +45052,11 @@ var require_proxy_addr = __commonJS({
|
|
|
45261
45052
|
}
|
|
45262
45053
|
function parseipNotation(note) {
|
|
45263
45054
|
var pos = note.lastIndexOf("/");
|
|
45264
|
-
var
|
|
45265
|
-
if (!isip(
|
|
45266
|
-
throw new TypeError("invalid IP address: " +
|
|
45055
|
+
var str2 = pos !== -1 ? note.substring(0, pos) : note;
|
|
45056
|
+
if (!isip(str2)) {
|
|
45057
|
+
throw new TypeError("invalid IP address: " + str2);
|
|
45267
45058
|
}
|
|
45268
|
-
var ip = parseip(
|
|
45059
|
+
var ip = parseip(str2);
|
|
45269
45060
|
if (pos === -1 && ip.kind() === "ipv6" && ip.isIPv4MappedAddress()) {
|
|
45270
45061
|
ip = ip.toIPv4Address();
|
|
45271
45062
|
}
|
|
@@ -45374,22 +45165,22 @@ var require_utils6 = __commonJS({
|
|
|
45374
45165
|
exports.normalizeTypes = function(types) {
|
|
45375
45166
|
return types.map(exports.normalizeType);
|
|
45376
45167
|
};
|
|
45377
|
-
function acceptParams(
|
|
45378
|
-
var length =
|
|
45379
|
-
var colonIndex =
|
|
45168
|
+
function acceptParams(str2) {
|
|
45169
|
+
var length = str2.length;
|
|
45170
|
+
var colonIndex = str2.indexOf(";");
|
|
45380
45171
|
var index = colonIndex === -1 ? length : colonIndex;
|
|
45381
|
-
var ret = { value:
|
|
45172
|
+
var ret = { value: str2.slice(0, index).trim(), quality: 1, params: {} };
|
|
45382
45173
|
while (index < length) {
|
|
45383
|
-
var splitIndex =
|
|
45174
|
+
var splitIndex = str2.indexOf("=", index);
|
|
45384
45175
|
if (splitIndex === -1) break;
|
|
45385
|
-
var colonIndex =
|
|
45176
|
+
var colonIndex = str2.indexOf(";", index);
|
|
45386
45177
|
var endIndex = colonIndex === -1 ? length : colonIndex;
|
|
45387
45178
|
if (splitIndex > endIndex) {
|
|
45388
|
-
index =
|
|
45179
|
+
index = str2.lastIndexOf(";", splitIndex - 1) + 1;
|
|
45389
45180
|
continue;
|
|
45390
45181
|
}
|
|
45391
|
-
var key =
|
|
45392
|
-
var value =
|
|
45182
|
+
var key = str2.slice(index, splitIndex).trim();
|
|
45183
|
+
var value = str2.slice(splitIndex + 1, endIndex).trim();
|
|
45393
45184
|
if (key === "q") {
|
|
45394
45185
|
ret.quality = parseFloat(value);
|
|
45395
45186
|
} else {
|
|
@@ -45472,8 +45263,8 @@ var require_utils6 = __commonJS({
|
|
|
45472
45263
|
return etag(buf, options);
|
|
45473
45264
|
};
|
|
45474
45265
|
}
|
|
45475
|
-
function parseExtendedQueryString(
|
|
45476
|
-
return qs.parse(
|
|
45266
|
+
function parseExtendedQueryString(str2) {
|
|
45267
|
+
return qs.parse(str2, {
|
|
45477
45268
|
allowPrototypes: true
|
|
45478
45269
|
});
|
|
45479
45270
|
}
|
|
@@ -45581,11 +45372,11 @@ var require_dist3 = __commonJS({
|
|
|
45581
45372
|
var ID_START = /^[$_\p{ID_Start}]$/u;
|
|
45582
45373
|
var ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
|
|
45583
45374
|
var ID = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
|
|
45584
|
-
function escapeText(
|
|
45585
|
-
return
|
|
45375
|
+
function escapeText(str2) {
|
|
45376
|
+
return str2.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
|
|
45586
45377
|
}
|
|
45587
|
-
function escape2(
|
|
45588
|
-
return
|
|
45378
|
+
function escape2(str2) {
|
|
45379
|
+
return str2.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
45589
45380
|
}
|
|
45590
45381
|
var TokenData = class {
|
|
45591
45382
|
constructor(tokens, originalPath) {
|
|
@@ -45605,9 +45396,9 @@ var require_dist3 = __commonJS({
|
|
|
45605
45396
|
}
|
|
45606
45397
|
};
|
|
45607
45398
|
exports.PathError = PathError;
|
|
45608
|
-
function parse3(
|
|
45399
|
+
function parse3(str2, options = {}) {
|
|
45609
45400
|
const { encodePath = NOOP_VALUE } = options;
|
|
45610
|
-
const chars = [...
|
|
45401
|
+
const chars = [...str2];
|
|
45611
45402
|
let index = 0;
|
|
45612
45403
|
function consumeUntil(end) {
|
|
45613
45404
|
const output = [];
|
|
@@ -45629,7 +45420,7 @@ var require_dist3 = __commonJS({
|
|
|
45629
45420
|
}
|
|
45630
45421
|
if (value === "\\") {
|
|
45631
45422
|
if (index === chars.length) {
|
|
45632
|
-
throw new PathError(`Unexpected end after \\ at index ${index}`,
|
|
45423
|
+
throw new PathError(`Unexpected end after \\ at index ${index}`, str2);
|
|
45633
45424
|
}
|
|
45634
45425
|
path13 += chars[index++];
|
|
45635
45426
|
continue;
|
|
@@ -45654,11 +45445,11 @@ var require_dist3 = __commonJS({
|
|
|
45654
45445
|
name += chars[index];
|
|
45655
45446
|
}
|
|
45656
45447
|
if (quoteStart) {
|
|
45657
|
-
throw new PathError(`Unterminated quote at index ${quoteStart}`,
|
|
45448
|
+
throw new PathError(`Unterminated quote at index ${quoteStart}`, str2);
|
|
45658
45449
|
}
|
|
45659
45450
|
}
|
|
45660
45451
|
if (!name) {
|
|
45661
|
-
throw new PathError(`Missing parameter name at index ${index}`,
|
|
45452
|
+
throw new PathError(`Missing parameter name at index ${index}`, str2);
|
|
45662
45453
|
}
|
|
45663
45454
|
writePath();
|
|
45664
45455
|
output.push({ type, name });
|
|
@@ -45673,17 +45464,17 @@ var require_dist3 = __commonJS({
|
|
|
45673
45464
|
continue;
|
|
45674
45465
|
}
|
|
45675
45466
|
if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") {
|
|
45676
|
-
throw new PathError(`Unexpected ${value} at index ${index - 1}`,
|
|
45467
|
+
throw new PathError(`Unexpected ${value} at index ${index - 1}`, str2);
|
|
45677
45468
|
}
|
|
45678
45469
|
path13 += value;
|
|
45679
45470
|
}
|
|
45680
45471
|
if (end) {
|
|
45681
|
-
throw new PathError(`Unexpected end at index ${index}, expected ${end}`,
|
|
45472
|
+
throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str2);
|
|
45682
45473
|
}
|
|
45683
45474
|
writePath();
|
|
45684
45475
|
return output;
|
|
45685
45476
|
}
|
|
45686
|
-
return new TokenData(consumeUntil(""),
|
|
45477
|
+
return new TokenData(consumeUntil(""), str2);
|
|
45687
45478
|
}
|
|
45688
45479
|
function compile(path13, options = {}) {
|
|
45689
45480
|
const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
@@ -46609,7 +46400,7 @@ var require_application = __commonJS({
|
|
|
46609
46400
|
var finalhandler = require_finalhandler();
|
|
46610
46401
|
var debug = require_src()("express:application");
|
|
46611
46402
|
var View = require_view();
|
|
46612
|
-
var
|
|
46403
|
+
var http = __require("node:http");
|
|
46613
46404
|
var methods = require_utils6().methods;
|
|
46614
46405
|
var compileETag = require_utils6().compileETag;
|
|
46615
46406
|
var compileQueryParser = require_utils6().compileQueryParser;
|
|
@@ -46842,7 +46633,7 @@ var require_application = __commonJS({
|
|
|
46842
46633
|
tryRender(view, renderOptions, done);
|
|
46843
46634
|
};
|
|
46844
46635
|
app.listen = function listen() {
|
|
46845
|
-
var server =
|
|
46636
|
+
var server = http.createServer(this);
|
|
46846
46637
|
var args = slice.call(arguments);
|
|
46847
46638
|
if (typeof args[args.length - 1] === "function") {
|
|
46848
46639
|
var done = args[args.length - 1] = once9(args[args.length - 1]);
|
|
@@ -46881,8 +46672,8 @@ var require_charset = __commonJS({
|
|
|
46881
46672
|
accepts.length = j;
|
|
46882
46673
|
return accepts;
|
|
46883
46674
|
}
|
|
46884
|
-
function parseCharset(
|
|
46885
|
-
var match = simpleCharsetRegExp.exec(
|
|
46675
|
+
function parseCharset(str2, i2) {
|
|
46676
|
+
var match = simpleCharsetRegExp.exec(str2);
|
|
46886
46677
|
if (!match) return null;
|
|
46887
46678
|
var charset = match[1];
|
|
46888
46679
|
var q = 1;
|
|
@@ -46979,8 +46770,8 @@ var require_encoding = __commonJS({
|
|
|
46979
46770
|
accepts.length = j;
|
|
46980
46771
|
return accepts;
|
|
46981
46772
|
}
|
|
46982
|
-
function parseEncoding(
|
|
46983
|
-
var match = simpleEncodingRegExp.exec(
|
|
46773
|
+
function parseEncoding(str2, i2) {
|
|
46774
|
+
var match = simpleEncodingRegExp.exec(str2);
|
|
46984
46775
|
if (!match) return null;
|
|
46985
46776
|
var encoding = match[1];
|
|
46986
46777
|
var q = 1;
|
|
@@ -47081,8 +46872,8 @@ var require_language = __commonJS({
|
|
|
47081
46872
|
accepts.length = j;
|
|
47082
46873
|
return accepts;
|
|
47083
46874
|
}
|
|
47084
|
-
function parseLanguage(
|
|
47085
|
-
var match = simpleLanguageRegExp.exec(
|
|
46875
|
+
function parseLanguage(str2, i2) {
|
|
46876
|
+
var match = simpleLanguageRegExp.exec(str2);
|
|
47086
46877
|
if (!match) return null;
|
|
47087
46878
|
var prefix = match[1];
|
|
47088
46879
|
var suffix = match[2];
|
|
@@ -47176,8 +46967,8 @@ var require_mediaType = __commonJS({
|
|
|
47176
46967
|
accepts.length = j;
|
|
47177
46968
|
return accepts;
|
|
47178
46969
|
}
|
|
47179
|
-
function parseMediaType(
|
|
47180
|
-
var match = simpleMediaTypeRegExp.exec(
|
|
46970
|
+
function parseMediaType(str2, i2) {
|
|
46971
|
+
var match = simpleMediaTypeRegExp.exec(str2);
|
|
47181
46972
|
if (!match) return null;
|
|
47182
46973
|
var params = /* @__PURE__ */ Object.create(null);
|
|
47183
46974
|
var q = 1;
|
|
@@ -47278,15 +47069,15 @@ var require_mediaType = __commonJS({
|
|
|
47278
47069
|
}
|
|
47279
47070
|
return count2;
|
|
47280
47071
|
}
|
|
47281
|
-
function splitKeyValuePair(
|
|
47282
|
-
var index =
|
|
47072
|
+
function splitKeyValuePair(str2) {
|
|
47073
|
+
var index = str2.indexOf("=");
|
|
47283
47074
|
var key;
|
|
47284
47075
|
var val;
|
|
47285
47076
|
if (index === -1) {
|
|
47286
|
-
key =
|
|
47077
|
+
key = str2;
|
|
47287
47078
|
} else {
|
|
47288
|
-
key =
|
|
47289
|
-
val =
|
|
47079
|
+
key = str2.slice(0, index);
|
|
47080
|
+
val = str2.slice(index + 1);
|
|
47290
47081
|
}
|
|
47291
47082
|
return [key, val];
|
|
47292
47083
|
}
|
|
@@ -47302,8 +47093,8 @@ var require_mediaType = __commonJS({
|
|
|
47302
47093
|
accepts.length = j + 1;
|
|
47303
47094
|
return accepts;
|
|
47304
47095
|
}
|
|
47305
|
-
function splitParameters(
|
|
47306
|
-
var parameters =
|
|
47096
|
+
function splitParameters(str2) {
|
|
47097
|
+
var parameters = str2.split(";");
|
|
47307
47098
|
for (var i2 = 1, j = 0; i2 < parameters.length; i2++) {
|
|
47308
47099
|
if (quoteCount(parameters[j]) % 2 == 0) {
|
|
47309
47100
|
parameters[++j] = parameters[i2];
|
|
@@ -47503,19 +47294,19 @@ var require_fresh = __commonJS({
|
|
|
47503
47294
|
var timestamp = date3 && Date.parse(date3);
|
|
47504
47295
|
return typeof timestamp === "number" ? timestamp : NaN;
|
|
47505
47296
|
}
|
|
47506
|
-
function parseTokenList(
|
|
47297
|
+
function parseTokenList(str2) {
|
|
47507
47298
|
var end = 0;
|
|
47508
47299
|
var list = [];
|
|
47509
47300
|
var start = 0;
|
|
47510
|
-
for (var i2 = 0, len =
|
|
47511
|
-
switch (
|
|
47301
|
+
for (var i2 = 0, len = str2.length; i2 < len; i2++) {
|
|
47302
|
+
switch (str2.charCodeAt(i2)) {
|
|
47512
47303
|
case 32:
|
|
47513
47304
|
if (start === end) {
|
|
47514
47305
|
start = end = i2 + 1;
|
|
47515
47306
|
}
|
|
47516
47307
|
break;
|
|
47517
47308
|
case 44:
|
|
47518
|
-
list.push(
|
|
47309
|
+
list.push(str2.substring(start, end));
|
|
47519
47310
|
start = end = i2 + 1;
|
|
47520
47311
|
break;
|
|
47521
47312
|
default:
|
|
@@ -47523,7 +47314,7 @@ var require_fresh = __commonJS({
|
|
|
47523
47314
|
break;
|
|
47524
47315
|
}
|
|
47525
47316
|
}
|
|
47526
|
-
list.push(
|
|
47317
|
+
list.push(str2.substring(start, end));
|
|
47527
47318
|
return list;
|
|
47528
47319
|
}
|
|
47529
47320
|
}
|
|
@@ -47534,17 +47325,17 @@ var require_range_parser = __commonJS({
|
|
|
47534
47325
|
"../../node_modules/range-parser/index.js"(exports, module) {
|
|
47535
47326
|
"use strict";
|
|
47536
47327
|
module.exports = rangeParser;
|
|
47537
|
-
function rangeParser(size,
|
|
47538
|
-
if (typeof
|
|
47328
|
+
function rangeParser(size, str2, options) {
|
|
47329
|
+
if (typeof str2 !== "string") {
|
|
47539
47330
|
throw new TypeError("argument str must be a string");
|
|
47540
47331
|
}
|
|
47541
|
-
var index =
|
|
47332
|
+
var index = str2.indexOf("=");
|
|
47542
47333
|
if (index === -1) {
|
|
47543
47334
|
return -2;
|
|
47544
47335
|
}
|
|
47545
|
-
var arr =
|
|
47336
|
+
var arr = str2.slice(index + 1).split(",");
|
|
47546
47337
|
var ranges = [];
|
|
47547
|
-
ranges.type =
|
|
47338
|
+
ranges.type = str2.slice(0, index);
|
|
47548
47339
|
for (var i2 = 0; i2 < arr.length; i2++) {
|
|
47549
47340
|
var range = arr[i2].split("-");
|
|
47550
47341
|
var start = parseInt(range[0], 10);
|
|
@@ -47617,12 +47408,12 @@ var require_request = __commonJS({
|
|
|
47617
47408
|
var accepts = require_accepts();
|
|
47618
47409
|
var isIP = __require("node:net").isIP;
|
|
47619
47410
|
var typeis = require_type_is();
|
|
47620
|
-
var
|
|
47411
|
+
var http = __require("node:http");
|
|
47621
47412
|
var fresh = require_fresh();
|
|
47622
47413
|
var parseRange = require_range_parser();
|
|
47623
47414
|
var parse3 = require_parseurl();
|
|
47624
47415
|
var proxyaddr = require_proxy_addr();
|
|
47625
|
-
var req = Object.create(
|
|
47416
|
+
var req = Object.create(http.IncomingMessage.prototype);
|
|
47626
47417
|
module.exports = req;
|
|
47627
47418
|
req.get = req.header = function header(name) {
|
|
47628
47419
|
if (!name) {
|
|
@@ -47827,8 +47618,8 @@ var require_content_disposition = __commonJS({
|
|
|
47827
47618
|
}
|
|
47828
47619
|
return string3;
|
|
47829
47620
|
}
|
|
47830
|
-
function decodefield(
|
|
47831
|
-
const match = EXT_VALUE_REGEXP.exec(
|
|
47621
|
+
function decodefield(str2) {
|
|
47622
|
+
const match = EXT_VALUE_REGEXP.exec(str2);
|
|
47832
47623
|
if (!match) {
|
|
47833
47624
|
throw new TypeError("invalid extended field value");
|
|
47834
47625
|
}
|
|
@@ -47907,12 +47698,12 @@ var require_content_disposition = __commonJS({
|
|
|
47907
47698
|
return "%" + String(char).charCodeAt(0).toString(16).toUpperCase();
|
|
47908
47699
|
}
|
|
47909
47700
|
function qstring(val) {
|
|
47910
|
-
var
|
|
47911
|
-
return '"' +
|
|
47701
|
+
var str2 = String(val);
|
|
47702
|
+
return '"' + str2.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
47912
47703
|
}
|
|
47913
47704
|
function ustring(val) {
|
|
47914
|
-
var
|
|
47915
|
-
var encoded = encodeURIComponent(
|
|
47705
|
+
var str2 = String(val);
|
|
47706
|
+
var encoded = encodeURIComponent(str2).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
|
|
47916
47707
|
return "UTF-8''" + encoded;
|
|
47917
47708
|
}
|
|
47918
47709
|
function ContentDisposition(type, parameters) {
|
|
@@ -47940,26 +47731,26 @@ var require_content_disposition = __commonJS({
|
|
|
47940
47731
|
code >= 65 && code <= 70 || // A-F
|
|
47941
47732
|
code >= 97 && code <= 102;
|
|
47942
47733
|
}
|
|
47943
|
-
function hasHexEscape(
|
|
47944
|
-
const maxIndex =
|
|
47734
|
+
function hasHexEscape(str2) {
|
|
47735
|
+
const maxIndex = str2.length - 3;
|
|
47945
47736
|
let lastIndex = -1;
|
|
47946
|
-
while ((lastIndex =
|
|
47947
|
-
if (isHexDigit(
|
|
47737
|
+
while ((lastIndex = str2.indexOf("%", lastIndex + 1)) !== -1 && lastIndex <= maxIndex) {
|
|
47738
|
+
if (isHexDigit(str2[lastIndex + 1]) && isHexDigit(str2[lastIndex + 2])) {
|
|
47948
47739
|
return true;
|
|
47949
47740
|
}
|
|
47950
47741
|
}
|
|
47951
47742
|
return false;
|
|
47952
47743
|
}
|
|
47953
|
-
function decodeHexEscapes(
|
|
47954
|
-
const firstEscape =
|
|
47955
|
-
if (firstEscape === -1) return
|
|
47956
|
-
let result =
|
|
47957
|
-
for (let idx = firstEscape; idx <
|
|
47958
|
-
if (
|
|
47959
|
-
result += String.fromCharCode(Number.parseInt(
|
|
47744
|
+
function decodeHexEscapes(str2) {
|
|
47745
|
+
const firstEscape = str2.indexOf("%");
|
|
47746
|
+
if (firstEscape === -1) return str2;
|
|
47747
|
+
let result = str2.slice(0, firstEscape);
|
|
47748
|
+
for (let idx = firstEscape; idx < str2.length; idx++) {
|
|
47749
|
+
if (str2[idx] === "%" && idx + 2 < str2.length && isHexDigit(str2[idx + 1]) && isHexDigit(str2[idx + 2])) {
|
|
47750
|
+
result += String.fromCharCode(Number.parseInt(str2[idx + 1] + str2[idx + 2], 16));
|
|
47960
47751
|
idx += 2;
|
|
47961
47752
|
} else {
|
|
47962
|
-
result +=
|
|
47753
|
+
result += str2[idx];
|
|
47963
47754
|
}
|
|
47964
47755
|
}
|
|
47965
47756
|
return result;
|
|
@@ -47997,54 +47788,54 @@ var require_cookie = __commonJS({
|
|
|
47997
47788
|
var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
|
|
47998
47789
|
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
47999
47790
|
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
48000
|
-
function parse3(
|
|
48001
|
-
if (typeof
|
|
47791
|
+
function parse3(str2, opt) {
|
|
47792
|
+
if (typeof str2 !== "string") {
|
|
48002
47793
|
throw new TypeError("argument str must be a string");
|
|
48003
47794
|
}
|
|
48004
47795
|
var obj = {};
|
|
48005
|
-
var len =
|
|
47796
|
+
var len = str2.length;
|
|
48006
47797
|
if (len < 2) return obj;
|
|
48007
47798
|
var dec = opt && opt.decode || decode;
|
|
48008
47799
|
var index = 0;
|
|
48009
47800
|
var eqIdx = 0;
|
|
48010
47801
|
var endIdx = 0;
|
|
48011
47802
|
do {
|
|
48012
|
-
eqIdx =
|
|
47803
|
+
eqIdx = str2.indexOf("=", index);
|
|
48013
47804
|
if (eqIdx === -1) break;
|
|
48014
|
-
endIdx =
|
|
47805
|
+
endIdx = str2.indexOf(";", index);
|
|
48015
47806
|
if (endIdx === -1) {
|
|
48016
47807
|
endIdx = len;
|
|
48017
47808
|
} else if (eqIdx > endIdx) {
|
|
48018
|
-
index =
|
|
47809
|
+
index = str2.lastIndexOf(";", eqIdx - 1) + 1;
|
|
48019
47810
|
continue;
|
|
48020
47811
|
}
|
|
48021
|
-
var keyStartIdx = startIndex(
|
|
48022
|
-
var keyEndIdx = endIndex(
|
|
48023
|
-
var key =
|
|
47812
|
+
var keyStartIdx = startIndex(str2, index, eqIdx);
|
|
47813
|
+
var keyEndIdx = endIndex(str2, eqIdx, keyStartIdx);
|
|
47814
|
+
var key = str2.slice(keyStartIdx, keyEndIdx);
|
|
48024
47815
|
if (!__hasOwnProperty.call(obj, key)) {
|
|
48025
|
-
var valStartIdx = startIndex(
|
|
48026
|
-
var valEndIdx = endIndex(
|
|
48027
|
-
if (
|
|
47816
|
+
var valStartIdx = startIndex(str2, eqIdx + 1, endIdx);
|
|
47817
|
+
var valEndIdx = endIndex(str2, endIdx, valStartIdx);
|
|
47818
|
+
if (str2.charCodeAt(valStartIdx) === 34 && str2.charCodeAt(valEndIdx - 1) === 34) {
|
|
48028
47819
|
valStartIdx++;
|
|
48029
47820
|
valEndIdx--;
|
|
48030
47821
|
}
|
|
48031
|
-
var val =
|
|
47822
|
+
var val = str2.slice(valStartIdx, valEndIdx);
|
|
48032
47823
|
obj[key] = tryDecode(val, dec);
|
|
48033
47824
|
}
|
|
48034
47825
|
index = endIdx + 1;
|
|
48035
47826
|
} while (index < len);
|
|
48036
47827
|
return obj;
|
|
48037
47828
|
}
|
|
48038
|
-
function startIndex(
|
|
47829
|
+
function startIndex(str2, index, max) {
|
|
48039
47830
|
do {
|
|
48040
|
-
var code =
|
|
47831
|
+
var code = str2.charCodeAt(index);
|
|
48041
47832
|
if (code !== 32 && code !== 9) return index;
|
|
48042
47833
|
} while (++index < max);
|
|
48043
47834
|
return max;
|
|
48044
47835
|
}
|
|
48045
|
-
function endIndex(
|
|
47836
|
+
function endIndex(str2, index, min) {
|
|
48046
47837
|
while (index > min) {
|
|
48047
|
-
var code =
|
|
47838
|
+
var code = str2.charCodeAt(--index);
|
|
48048
47839
|
if (code !== 32 && code !== 9) return index + 1;
|
|
48049
47840
|
}
|
|
48050
47841
|
return min;
|
|
@@ -48061,54 +47852,54 @@ var require_cookie = __commonJS({
|
|
|
48061
47852
|
if (!cookieValueRegExp.test(value)) {
|
|
48062
47853
|
throw new TypeError("argument val is invalid");
|
|
48063
47854
|
}
|
|
48064
|
-
var
|
|
48065
|
-
if (!opt) return
|
|
47855
|
+
var str2 = name + "=" + value;
|
|
47856
|
+
if (!opt) return str2;
|
|
48066
47857
|
if (null != opt.maxAge) {
|
|
48067
47858
|
var maxAge = Math.floor(opt.maxAge);
|
|
48068
47859
|
if (!isFinite(maxAge)) {
|
|
48069
47860
|
throw new TypeError("option maxAge is invalid");
|
|
48070
47861
|
}
|
|
48071
|
-
|
|
47862
|
+
str2 += "; Max-Age=" + maxAge;
|
|
48072
47863
|
}
|
|
48073
47864
|
if (opt.domain) {
|
|
48074
47865
|
if (!domainValueRegExp.test(opt.domain)) {
|
|
48075
47866
|
throw new TypeError("option domain is invalid");
|
|
48076
47867
|
}
|
|
48077
|
-
|
|
47868
|
+
str2 += "; Domain=" + opt.domain;
|
|
48078
47869
|
}
|
|
48079
47870
|
if (opt.path) {
|
|
48080
47871
|
if (!pathValueRegExp.test(opt.path)) {
|
|
48081
47872
|
throw new TypeError("option path is invalid");
|
|
48082
47873
|
}
|
|
48083
|
-
|
|
47874
|
+
str2 += "; Path=" + opt.path;
|
|
48084
47875
|
}
|
|
48085
47876
|
if (opt.expires) {
|
|
48086
47877
|
var expires = opt.expires;
|
|
48087
47878
|
if (!isDate(expires) || isNaN(expires.valueOf())) {
|
|
48088
47879
|
throw new TypeError("option expires is invalid");
|
|
48089
47880
|
}
|
|
48090
|
-
|
|
47881
|
+
str2 += "; Expires=" + expires.toUTCString();
|
|
48091
47882
|
}
|
|
48092
47883
|
if (opt.httpOnly) {
|
|
48093
|
-
|
|
47884
|
+
str2 += "; HttpOnly";
|
|
48094
47885
|
}
|
|
48095
47886
|
if (opt.secure) {
|
|
48096
|
-
|
|
47887
|
+
str2 += "; Secure";
|
|
48097
47888
|
}
|
|
48098
47889
|
if (opt.partitioned) {
|
|
48099
|
-
|
|
47890
|
+
str2 += "; Partitioned";
|
|
48100
47891
|
}
|
|
48101
47892
|
if (opt.priority) {
|
|
48102
47893
|
var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
|
|
48103
47894
|
switch (priority) {
|
|
48104
47895
|
case "low":
|
|
48105
|
-
|
|
47896
|
+
str2 += "; Priority=Low";
|
|
48106
47897
|
break;
|
|
48107
47898
|
case "medium":
|
|
48108
|
-
|
|
47899
|
+
str2 += "; Priority=Medium";
|
|
48109
47900
|
break;
|
|
48110
47901
|
case "high":
|
|
48111
|
-
|
|
47902
|
+
str2 += "; Priority=High";
|
|
48112
47903
|
break;
|
|
48113
47904
|
default:
|
|
48114
47905
|
throw new TypeError("option priority is invalid");
|
|
@@ -48118,34 +47909,34 @@ var require_cookie = __commonJS({
|
|
|
48118
47909
|
var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
48119
47910
|
switch (sameSite) {
|
|
48120
47911
|
case true:
|
|
48121
|
-
|
|
47912
|
+
str2 += "; SameSite=Strict";
|
|
48122
47913
|
break;
|
|
48123
47914
|
case "lax":
|
|
48124
|
-
|
|
47915
|
+
str2 += "; SameSite=Lax";
|
|
48125
47916
|
break;
|
|
48126
47917
|
case "strict":
|
|
48127
|
-
|
|
47918
|
+
str2 += "; SameSite=Strict";
|
|
48128
47919
|
break;
|
|
48129
47920
|
case "none":
|
|
48130
|
-
|
|
47921
|
+
str2 += "; SameSite=None";
|
|
48131
47922
|
break;
|
|
48132
47923
|
default:
|
|
48133
47924
|
throw new TypeError("option sameSite is invalid");
|
|
48134
47925
|
}
|
|
48135
47926
|
}
|
|
48136
|
-
return
|
|
47927
|
+
return str2;
|
|
48137
47928
|
}
|
|
48138
|
-
function decode(
|
|
48139
|
-
return
|
|
47929
|
+
function decode(str2) {
|
|
47930
|
+
return str2.indexOf("%") !== -1 ? decodeURIComponent(str2) : str2;
|
|
48140
47931
|
}
|
|
48141
47932
|
function isDate(val) {
|
|
48142
47933
|
return __toString.call(val) === "[object Date]";
|
|
48143
47934
|
}
|
|
48144
|
-
function tryDecode(
|
|
47935
|
+
function tryDecode(str2, decode2) {
|
|
48145
47936
|
try {
|
|
48146
|
-
return decode2(
|
|
47937
|
+
return decode2(str2);
|
|
48147
47938
|
} catch (e) {
|
|
48148
|
-
return
|
|
47939
|
+
return str2;
|
|
48149
47940
|
}
|
|
48150
47941
|
}
|
|
48151
47942
|
}
|
|
@@ -48544,13 +48335,13 @@ var require_send = __commonJS({
|
|
|
48544
48335
|
res.removeHeader(header);
|
|
48545
48336
|
}
|
|
48546
48337
|
}
|
|
48547
|
-
function collapseLeadingSlashes(
|
|
48548
|
-
for (var i2 = 0; i2 <
|
|
48549
|
-
if (
|
|
48338
|
+
function collapseLeadingSlashes(str2) {
|
|
48339
|
+
for (var i2 = 0; i2 < str2.length; i2++) {
|
|
48340
|
+
if (str2[i2] !== "/") {
|
|
48550
48341
|
break;
|
|
48551
48342
|
}
|
|
48552
48343
|
}
|
|
48553
|
-
return i2 > 1 ? "/" +
|
|
48344
|
+
return i2 > 1 ? "/" + str2.substr(i2) : str2;
|
|
48554
48345
|
}
|
|
48555
48346
|
function containsDotFile(parts) {
|
|
48556
48347
|
for (var i2 = 0; i2 < parts.length; i2++) {
|
|
@@ -48597,12 +48388,12 @@ var require_send = __commonJS({
|
|
|
48597
48388
|
var timestamp = date3 && Date.parse(date3);
|
|
48598
48389
|
return typeof timestamp === "number" ? timestamp : NaN;
|
|
48599
48390
|
}
|
|
48600
|
-
function parseTokenList(
|
|
48391
|
+
function parseTokenList(str2) {
|
|
48601
48392
|
var end = 0;
|
|
48602
48393
|
var list = [];
|
|
48603
48394
|
var start = 0;
|
|
48604
|
-
for (var i2 = 0, len =
|
|
48605
|
-
switch (
|
|
48395
|
+
for (var i2 = 0, len = str2.length; i2 < len; i2++) {
|
|
48396
|
+
switch (str2.charCodeAt(i2)) {
|
|
48606
48397
|
case 32:
|
|
48607
48398
|
if (start === end) {
|
|
48608
48399
|
start = end = i2 + 1;
|
|
@@ -48610,7 +48401,7 @@ var require_send = __commonJS({
|
|
|
48610
48401
|
break;
|
|
48611
48402
|
case 44:
|
|
48612
48403
|
if (start !== end) {
|
|
48613
|
-
list.push(
|
|
48404
|
+
list.push(str2.substring(start, end));
|
|
48614
48405
|
}
|
|
48615
48406
|
start = end = i2 + 1;
|
|
48616
48407
|
break;
|
|
@@ -48620,7 +48411,7 @@ var require_send = __commonJS({
|
|
|
48620
48411
|
}
|
|
48621
48412
|
}
|
|
48622
48413
|
if (start !== end) {
|
|
48623
|
-
list.push(
|
|
48414
|
+
list.push(str2.substring(start, end));
|
|
48624
48415
|
}
|
|
48625
48416
|
return list;
|
|
48626
48417
|
}
|
|
@@ -48716,7 +48507,7 @@ var require_response = __commonJS({
|
|
|
48716
48507
|
var deprecate = require_depd()("express");
|
|
48717
48508
|
var encodeUrl = require_encodeurl();
|
|
48718
48509
|
var escapeHtml = require_escape_html();
|
|
48719
|
-
var
|
|
48510
|
+
var http = __require("node:http");
|
|
48720
48511
|
var onFinished = require_on_finished();
|
|
48721
48512
|
var mime = require_mime_types();
|
|
48722
48513
|
var path13 = __require("node:path");
|
|
@@ -48732,7 +48523,7 @@ var require_response = __commonJS({
|
|
|
48732
48523
|
var resolve6 = path13.resolve;
|
|
48733
48524
|
var vary = require_vary();
|
|
48734
48525
|
var { Buffer: Buffer5 } = __require("node:buffer");
|
|
48735
|
-
var res = Object.create(
|
|
48526
|
+
var res = Object.create(http.ServerResponse.prototype);
|
|
48736
48527
|
module.exports = res;
|
|
48737
48528
|
res.status = function status(code) {
|
|
48738
48529
|
if (!Number.isInteger(code)) {
|
|
@@ -49084,9 +48875,9 @@ var require_response = __commonJS({
|
|
|
49084
48875
|
opts = {};
|
|
49085
48876
|
}
|
|
49086
48877
|
opts._locals = self.locals;
|
|
49087
|
-
done = done || function(err,
|
|
48878
|
+
done = done || function(err, str2) {
|
|
49088
48879
|
if (err) return req.next(err);
|
|
49089
|
-
self.send(
|
|
48880
|
+
self.send(str2);
|
|
49090
48881
|
};
|
|
49091
48882
|
app.render(view, opts, done);
|
|
49092
48883
|
};
|
|
@@ -49242,13 +49033,13 @@ var require_serve_static = __commonJS({
|
|
|
49242
49033
|
stream.pipe(res);
|
|
49243
49034
|
};
|
|
49244
49035
|
}
|
|
49245
|
-
function collapseLeadingSlashes(
|
|
49246
|
-
for (var i2 = 0; i2 <
|
|
49247
|
-
if (
|
|
49036
|
+
function collapseLeadingSlashes(str2) {
|
|
49037
|
+
for (var i2 = 0; i2 < str2.length; i2++) {
|
|
49038
|
+
if (str2.charCodeAt(i2) !== 47) {
|
|
49248
49039
|
break;
|
|
49249
49040
|
}
|
|
49250
49041
|
}
|
|
49251
|
-
return i2 > 1 ? "/" +
|
|
49042
|
+
return i2 > 1 ? "/" + str2.substr(i2) : str2;
|
|
49252
49043
|
}
|
|
49253
49044
|
function createHtmlDocument(title, body) {
|
|
49254
49045
|
return '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>' + title + "</title>\n</head>\n<body>\n<pre>" + body + "</pre>\n</body>\n</html>\n";
|
|
@@ -53729,14 +53520,14 @@ function promiseAllObject(promisesObj) {
|
|
|
53729
53520
|
}
|
|
53730
53521
|
function randomString(length = 10) {
|
|
53731
53522
|
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
53732
|
-
let
|
|
53523
|
+
let str2 = "";
|
|
53733
53524
|
for (let i2 = 0; i2 < length; i2++) {
|
|
53734
|
-
|
|
53525
|
+
str2 += chars[Math.floor(Math.random() * chars.length)];
|
|
53735
53526
|
}
|
|
53736
|
-
return
|
|
53527
|
+
return str2;
|
|
53737
53528
|
}
|
|
53738
|
-
function esc(
|
|
53739
|
-
return JSON.stringify(
|
|
53529
|
+
function esc(str2) {
|
|
53530
|
+
return JSON.stringify(str2);
|
|
53740
53531
|
}
|
|
53741
53532
|
function isObject3(data) {
|
|
53742
53533
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
@@ -53764,8 +53555,8 @@ function numKeys(data) {
|
|
|
53764
53555
|
}
|
|
53765
53556
|
return keyCount;
|
|
53766
53557
|
}
|
|
53767
|
-
function escapeRegex(
|
|
53768
|
-
return
|
|
53558
|
+
function escapeRegex(str2) {
|
|
53559
|
+
return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
53769
53560
|
}
|
|
53770
53561
|
function clone(inst, def, params) {
|
|
53771
53562
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
@@ -54265,7 +54056,7 @@ function datetime(args) {
|
|
|
54265
54056
|
const timeRegex2 = `${time3}(?:${opts.join("|")})`;
|
|
54266
54057
|
return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
|
|
54267
54058
|
}
|
|
54268
|
-
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64,
|
|
54059
|
+
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, hostname, e164, dateSource, date, string, integer, number, boolean, _null, lowercase, uppercase;
|
|
54269
54060
|
var init_regexes = __esm({
|
|
54270
54061
|
"../../node_modules/zod/v4/core/regexes.js"() {
|
|
54271
54062
|
cuid = /^[cC][^\s-]{8,}$/;
|
|
@@ -54288,7 +54079,7 @@ var init_regexes = __esm({
|
|
|
54288
54079
|
cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
54289
54080
|
cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
54290
54081
|
base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
54291
|
-
|
|
54082
|
+
base64url = /^[A-Za-z0-9_-]*$/;
|
|
54292
54083
|
hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
54293
54084
|
e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
54294
54085
|
dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
@@ -54766,7 +54557,7 @@ function isValidBase64(data) {
|
|
|
54766
54557
|
}
|
|
54767
54558
|
}
|
|
54768
54559
|
function isValidBase64URL(data) {
|
|
54769
|
-
if (!
|
|
54560
|
+
if (!base64url.test(data))
|
|
54770
54561
|
return false;
|
|
54771
54562
|
const base642 = data.replace(/[-_]/g, (c3) => c3 === "-" ? "+" : "/");
|
|
54772
54563
|
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
@@ -55261,7 +55052,7 @@ var init_schemas = __esm({
|
|
|
55261
55052
|
};
|
|
55262
55053
|
});
|
|
55263
55054
|
$ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
55264
|
-
def.pattern ?? (def.pattern =
|
|
55055
|
+
def.pattern ?? (def.pattern = base64url);
|
|
55265
55056
|
$ZodStringFormat.init(inst, def);
|
|
55266
55057
|
inst._zod.onattach.push((inst2) => {
|
|
55267
55058
|
inst2._zod.bag.contentEncoding = "base64url";
|
|
@@ -62671,7 +62462,7 @@ var require_code5 = __commonJS({
|
|
|
62671
62462
|
}
|
|
62672
62463
|
exports._ = _;
|
|
62673
62464
|
var plus = new _Code("+");
|
|
62674
|
-
function
|
|
62465
|
+
function str2(strs, ...args) {
|
|
62675
62466
|
const expr = [safeStringify(strs[0])];
|
|
62676
62467
|
let i2 = 0;
|
|
62677
62468
|
while (i2 < args.length) {
|
|
@@ -62682,7 +62473,7 @@ var require_code5 = __commonJS({
|
|
|
62682
62473
|
optimize(expr);
|
|
62683
62474
|
return new _Code(expr);
|
|
62684
62475
|
}
|
|
62685
|
-
exports.str =
|
|
62476
|
+
exports.str = str2;
|
|
62686
62477
|
function addCodeArg(code, arg) {
|
|
62687
62478
|
if (arg instanceof _Code)
|
|
62688
62479
|
code.push(...arg._items);
|
|
@@ -62725,7 +62516,7 @@ var require_code5 = __commonJS({
|
|
|
62725
62516
|
return;
|
|
62726
62517
|
}
|
|
62727
62518
|
function strConcat(c1, c22) {
|
|
62728
|
-
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 :
|
|
62519
|
+
return c22.emptyStr() ? c1 : c1.emptyStr() ? c22 : str2`${c1}${c22}`;
|
|
62729
62520
|
}
|
|
62730
62521
|
exports.strConcat = strConcat;
|
|
62731
62522
|
function interpolate(x) {
|
|
@@ -63687,22 +63478,22 @@ var require_util4 = __commonJS({
|
|
|
63687
63478
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
63688
63479
|
}
|
|
63689
63480
|
exports.schemaRefOrVal = schemaRefOrVal;
|
|
63690
|
-
function unescapeFragment(
|
|
63691
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
63481
|
+
function unescapeFragment(str2) {
|
|
63482
|
+
return unescapeJsonPointer(decodeURIComponent(str2));
|
|
63692
63483
|
}
|
|
63693
63484
|
exports.unescapeFragment = unescapeFragment;
|
|
63694
|
-
function escapeFragment(
|
|
63695
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
63485
|
+
function escapeFragment(str2) {
|
|
63486
|
+
return encodeURIComponent(escapeJsonPointer(str2));
|
|
63696
63487
|
}
|
|
63697
63488
|
exports.escapeFragment = escapeFragment;
|
|
63698
|
-
function escapeJsonPointer(
|
|
63699
|
-
if (typeof
|
|
63700
|
-
return `${
|
|
63701
|
-
return
|
|
63489
|
+
function escapeJsonPointer(str2) {
|
|
63490
|
+
if (typeof str2 == "number")
|
|
63491
|
+
return `${str2}`;
|
|
63492
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
63702
63493
|
}
|
|
63703
63494
|
exports.escapeJsonPointer = escapeJsonPointer;
|
|
63704
|
-
function unescapeJsonPointer(
|
|
63705
|
-
return
|
|
63495
|
+
function unescapeJsonPointer(str2) {
|
|
63496
|
+
return str2.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
63706
63497
|
}
|
|
63707
63498
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
63708
63499
|
function eachItem(xs, f) {
|
|
@@ -64692,8 +64483,8 @@ var require_json_schema_traverse3 = __commonJS({
|
|
|
64692
64483
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
64693
64484
|
}
|
|
64694
64485
|
}
|
|
64695
|
-
function escapeJsonPtr(
|
|
64696
|
-
return
|
|
64486
|
+
function escapeJsonPtr(str2) {
|
|
64487
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
64697
64488
|
}
|
|
64698
64489
|
}
|
|
64699
64490
|
});
|
|
@@ -65688,7 +65479,7 @@ var require_core6 = __commonJS({
|
|
|
65688
65479
|
var util_1 = require_util4();
|
|
65689
65480
|
var $dataRefSchema = require_data3();
|
|
65690
65481
|
var uri_1 = require_uri4();
|
|
65691
|
-
var defaultRegExp = (
|
|
65482
|
+
var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
|
|
65692
65483
|
defaultRegExp.code = "new RegExp";
|
|
65693
65484
|
var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
65694
65485
|
var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -66483,16 +66274,16 @@ var require_ucs2length3 = __commonJS({
|
|
|
66483
66274
|
"../../node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
|
|
66484
66275
|
"use strict";
|
|
66485
66276
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66486
|
-
function ucs2length(
|
|
66487
|
-
const len =
|
|
66277
|
+
function ucs2length(str2) {
|
|
66278
|
+
const len = str2.length;
|
|
66488
66279
|
let length = 0;
|
|
66489
66280
|
let pos = 0;
|
|
66490
66281
|
let value;
|
|
66491
66282
|
while (pos < len) {
|
|
66492
66283
|
length++;
|
|
66493
|
-
value =
|
|
66284
|
+
value = str2.charCodeAt(pos++);
|
|
66494
66285
|
if (value >= 55296 && value <= 56319 && pos < len) {
|
|
66495
|
-
value =
|
|
66286
|
+
value = str2.charCodeAt(pos);
|
|
66496
66287
|
if ((value & 64512) === 56320)
|
|
66497
66288
|
pos++;
|
|
66498
66289
|
}
|
|
@@ -71444,12 +71235,12 @@ async function currentRefreshToken(s, source) {
|
|
|
71444
71235
|
const c3 = await readStoredCredentials();
|
|
71445
71236
|
const stored = c3 ? identitySourceOfStore(c3) : null;
|
|
71446
71237
|
if (c3?.refreshToken && stored?.authUrl === source.authUrl) {
|
|
71447
|
-
return { token: c3.refreshToken.trim(), email: c3.email };
|
|
71238
|
+
return { token: c3.refreshToken.trim(), email: c3.email, source: stored };
|
|
71448
71239
|
}
|
|
71449
71240
|
} catch {
|
|
71450
71241
|
}
|
|
71451
71242
|
const own = s.identityRefreshToken?.trim();
|
|
71452
|
-
return own ? { token: own, email: s.email } : void 0;
|
|
71243
|
+
return own ? { token: own, email: s.email, source } : void 0;
|
|
71453
71244
|
}
|
|
71454
71245
|
async function getValidSession() {
|
|
71455
71246
|
const fromReq = getRequestSession();
|
|
@@ -71473,7 +71264,7 @@ async function getValidSession() {
|
|
|
71473
71264
|
return isSessionActive(s) ? s : null;
|
|
71474
71265
|
}
|
|
71475
71266
|
try {
|
|
71476
|
-
const rt = await refreshIdentityToken(source, refresh.token);
|
|
71267
|
+
const rt = await refreshIdentityToken(refresh.source, refresh.token);
|
|
71477
71268
|
if (!await persistRotatedRefreshToken(refresh.token, rt.refreshToken)) {
|
|
71478
71269
|
return null;
|
|
71479
71270
|
}
|
|
@@ -71483,7 +71274,8 @@ async function getValidSession() {
|
|
|
71483
71274
|
identityToken: rt.idToken,
|
|
71484
71275
|
identityRefreshToken: rt.refreshToken,
|
|
71485
71276
|
authProvider: "supabase",
|
|
71486
|
-
authUrl: source.authUrl,
|
|
71277
|
+
authUrl: refresh.source.authUrl,
|
|
71278
|
+
...refresh.source.clientId ? { authClientId: refresh.source.clientId } : {},
|
|
71487
71279
|
// Whose the redeemed refresh token was, which is not always the user of
|
|
71488
71280
|
// the session being replaced.
|
|
71489
71281
|
email: refresh.email || rt.email
|
|
@@ -71552,7 +71344,7 @@ function extractErrorMessage(data, fallback) {
|
|
|
71552
71344
|
return fallback;
|
|
71553
71345
|
}
|
|
71554
71346
|
function platformBase() {
|
|
71555
|
-
return
|
|
71347
|
+
return PLATFORM_URL.replace(/\/$/, "");
|
|
71556
71348
|
}
|
|
71557
71349
|
async function requireSession() {
|
|
71558
71350
|
const session = await getValidSession();
|
|
@@ -71640,7 +71432,7 @@ async function inworldGatewayPostJson(path13, body) {
|
|
|
71640
71432
|
var init_gateway_http = __esm({
|
|
71641
71433
|
"src/mcp/inworld/gateway-http.ts"() {
|
|
71642
71434
|
"use strict";
|
|
71643
|
-
|
|
71435
|
+
init_constants5();
|
|
71644
71436
|
init_inworld_headers();
|
|
71645
71437
|
init_session_refresh();
|
|
71646
71438
|
}
|
|
@@ -71774,25 +71566,25 @@ var init_credential = __esm({
|
|
|
71774
71566
|
throw new RuntimeCredentialError(PER_REQUEST_SIGN_IN);
|
|
71775
71567
|
}
|
|
71776
71568
|
const stored = await readStoredCredentials().catch(() => null);
|
|
71777
|
-
const
|
|
71778
|
-
if (!stored?.refreshToken?.trim() || !
|
|
71569
|
+
const signIn = stored ? identitySourceOfStore(stored) : null;
|
|
71570
|
+
if (!stored?.refreshToken?.trim() || !signIn) return null;
|
|
71779
71571
|
return {
|
|
71780
71572
|
user: accountOf(stored.inworldToken),
|
|
71781
|
-
deployment:
|
|
71573
|
+
deployment: signIn.authUrl,
|
|
71782
71574
|
workspace: stored.workspace ?? null
|
|
71783
71575
|
};
|
|
71784
71576
|
},
|
|
71785
71577
|
async platformAuth() {
|
|
71786
71578
|
const stored = await readStoredCredentials().catch(() => null);
|
|
71787
|
-
const
|
|
71788
|
-
if (!stored || !
|
|
71579
|
+
const signIn = stored ? identitySourceOfStore(stored) : null;
|
|
71580
|
+
if (!stored || !signIn) return null;
|
|
71789
71581
|
const onDisk = loadSession();
|
|
71790
|
-
if (onDisk && identitySourceOfStore(onDisk)?.authUrl !==
|
|
71582
|
+
if (onDisk && identitySourceOfStore(onDisk)?.authUrl !== signIn.authUrl) {
|
|
71791
71583
|
throw new RuntimeCredentialError(DIFFERENT_DEPLOYMENTS);
|
|
71792
71584
|
}
|
|
71793
71585
|
let session = await getValidSession();
|
|
71794
71586
|
if (!session) return null;
|
|
71795
|
-
if (identitySourceOfStore(session)?.authUrl !==
|
|
71587
|
+
if (identitySourceOfStore(session)?.authUrl !== signIn.authUrl) {
|
|
71796
71588
|
throw new RuntimeCredentialError(DIFFERENT_DEPLOYMENTS);
|
|
71797
71589
|
}
|
|
71798
71590
|
const signedInAccount = accountOf(stored.inworldToken);
|
|
@@ -71803,7 +71595,7 @@ var init_credential = __esm({
|
|
|
71803
71595
|
}
|
|
71804
71596
|
return {
|
|
71805
71597
|
user: accountOf(session.token),
|
|
71806
|
-
deployment:
|
|
71598
|
+
deployment: signIn.authUrl,
|
|
71807
71599
|
headers: headersForInworldSession(session)
|
|
71808
71600
|
};
|
|
71809
71601
|
}
|
|
@@ -72012,7 +71804,7 @@ async function fetchWorkspaceEngineSession(workspaceId) {
|
|
|
72012
71804
|
"Session has no identity token (needed for workspace engine session). Run `inworld-mcp login` again, or use session-file auth instead of bearer-only HTTP."
|
|
72013
71805
|
);
|
|
72014
71806
|
}
|
|
72015
|
-
const base =
|
|
71807
|
+
const base = PLATFORM_URL.replace(/\/$/, "");
|
|
72016
71808
|
const parent = workspaceResourceName(workspaceId);
|
|
72017
71809
|
const id = workspaceId.trim();
|
|
72018
71810
|
const path13 = `/v1alpha/workspaces/${encodeURIComponent(id)}/token:generate`;
|
|
@@ -72046,7 +71838,7 @@ async function fetchWorkspaceEngineSession(workspaceId) {
|
|
|
72046
71838
|
var init_engine_session = __esm({
|
|
72047
71839
|
"src/mcp/voice/engine-session.ts"() {
|
|
72048
71840
|
"use strict";
|
|
72049
|
-
|
|
71841
|
+
init_constants5();
|
|
72050
71842
|
init_inworld_headers();
|
|
72051
71843
|
init_session_refresh();
|
|
72052
71844
|
init_gateway();
|
|
@@ -73231,25 +73023,21 @@ var init_schemas4 = __esm({
|
|
|
73231
73023
|
|
|
73232
73024
|
// src/mcp/cli/login.ts
|
|
73233
73025
|
async function runLogin() {
|
|
73234
|
-
const source = await resolveIdentitySource(
|
|
73235
|
-
|
|
73236
|
-
|
|
73237
|
-
|
|
73238
|
-
`INWORLD_AUTH_OAUTH_PROVIDER=${oauthProvider} is not supported by inworld-mcp login (use ${GOTRUE_OAUTH_PROVIDERS.join(", ")}, or unset it to choose on the sign-in page).`
|
|
73026
|
+
const source = await resolveIdentitySource(PLATFORM_URL);
|
|
73027
|
+
if (process.env.INWORLD_AUTH_OAUTH_PROVIDER) {
|
|
73028
|
+
console.error(
|
|
73029
|
+
"Note: INWORLD_AUTH_OAUTH_PROVIDER is ignored. Choose the sign-in method in the browser."
|
|
73239
73030
|
);
|
|
73240
73031
|
}
|
|
73241
|
-
const
|
|
73242
|
-
|
|
73243
|
-
|
|
73244
|
-
|
|
73245
|
-
|
|
73246
|
-
|
|
73247
|
-
|
|
73248
|
-
|
|
73249
|
-
|
|
73250
|
-
});
|
|
73251
|
-
const tokens = await stepUpSecondFactor(source, await signIn2.done, {
|
|
73252
|
-
print: (line) => console.error(line)
|
|
73032
|
+
const tokens = await signInWithDeviceCode({
|
|
73033
|
+
source,
|
|
73034
|
+
platformUrl: PLATFORM_URL,
|
|
73035
|
+
clientId: INWORLD_CLI_CLIENT_ID,
|
|
73036
|
+
env: INWORLD_ENV,
|
|
73037
|
+
out: {
|
|
73038
|
+
print: (line) => console.error(line),
|
|
73039
|
+
output: process.stdout
|
|
73040
|
+
}
|
|
73253
73041
|
});
|
|
73254
73042
|
console.error();
|
|
73255
73043
|
console.error("Exchanging for Inworld session...");
|
|
@@ -73260,6 +73048,7 @@ async function runLogin() {
|
|
|
73260
73048
|
identityRefreshToken: tokens.refreshToken,
|
|
73261
73049
|
authProvider: "supabase",
|
|
73262
73050
|
authUrl: source.authUrl,
|
|
73051
|
+
authClientId: INWORLD_CLI_CLIENT_ID,
|
|
73263
73052
|
email: tokens.email
|
|
73264
73053
|
};
|
|
73265
73054
|
saveSession(merged);
|
|
@@ -73269,9 +73058,10 @@ async function runLogin() {
|
|
|
73269
73058
|
email: tokens.email ?? "",
|
|
73270
73059
|
inworldToken: merged.token ?? "",
|
|
73271
73060
|
expiresAt,
|
|
73272
|
-
env:
|
|
73061
|
+
env: INWORLD_ENV,
|
|
73273
73062
|
authProvider: "supabase",
|
|
73274
|
-
authUrl: source.authUrl
|
|
73063
|
+
authUrl: source.authUrl,
|
|
73064
|
+
authClientId: INWORLD_CLI_CLIENT_ID
|
|
73275
73065
|
});
|
|
73276
73066
|
await clearStoredRuntimeToken();
|
|
73277
73067
|
console.error();
|
|
@@ -73287,13 +73077,11 @@ var init_login = __esm({
|
|
|
73287
73077
|
"use strict";
|
|
73288
73078
|
init_dist4();
|
|
73289
73079
|
init_constants5();
|
|
73290
|
-
|
|
73080
|
+
init_device_flow();
|
|
73291
73081
|
init_exchange();
|
|
73292
73082
|
init_identity();
|
|
73293
73083
|
init_paths();
|
|
73294
|
-
init_second_factor();
|
|
73295
73084
|
init_session();
|
|
73296
|
-
init_sign_in_prompt();
|
|
73297
73085
|
}
|
|
73298
73086
|
});
|
|
73299
73087
|
|
|
@@ -74315,7 +74103,7 @@ var init_mcp2 = __esm({
|
|
|
74315
74103
|
init_streamableHttp();
|
|
74316
74104
|
init_zod();
|
|
74317
74105
|
init_bearer();
|
|
74318
|
-
|
|
74106
|
+
init_constants5();
|
|
74319
74107
|
init_gate();
|
|
74320
74108
|
init_request_session();
|
|
74321
74109
|
init_session();
|
|
@@ -75220,12 +75008,13 @@ import { join as join4, resolve } from "path";
|
|
|
75220
75008
|
|
|
75221
75009
|
// src/auth/manager.ts
|
|
75222
75010
|
init_dist4();
|
|
75223
|
-
|
|
75011
|
+
init_constants6();
|
|
75224
75012
|
init_cli_store_bridge();
|
|
75013
|
+
init_constants5();
|
|
75225
75014
|
init_identity();
|
|
75226
75015
|
|
|
75227
75016
|
// src/utils/ui.ts
|
|
75228
|
-
|
|
75017
|
+
init_constants6();
|
|
75229
75018
|
function printHeader(message) {
|
|
75230
75019
|
console.log(source_default.bold(message));
|
|
75231
75020
|
}
|
|
@@ -75265,7 +75054,7 @@ function link(message) {
|
|
|
75265
75054
|
function printBox(lines, options) {
|
|
75266
75055
|
const color = options?.color || "yellow";
|
|
75267
75056
|
const padding = options?.padding ?? 2;
|
|
75268
|
-
const stripAnsi = (
|
|
75057
|
+
const stripAnsi = (str2) => str2.replace(/\x1b\[[0-9;]*m/g, "");
|
|
75269
75058
|
const maxContentWidth = Math.max(
|
|
75270
75059
|
...lines.map((line) => stripAnsi(line).length)
|
|
75271
75060
|
);
|
|
@@ -75559,7 +75348,8 @@ var AuthManager = class {
|
|
|
75559
75348
|
expiresAt,
|
|
75560
75349
|
env: env3,
|
|
75561
75350
|
authProvider: "supabase",
|
|
75562
|
-
authUrl: source.authUrl
|
|
75351
|
+
authUrl: source.authUrl,
|
|
75352
|
+
...source.clientId ? { authClientId: source.clientId } : {}
|
|
75563
75353
|
};
|
|
75564
75354
|
await clearStoredRuntimeToken();
|
|
75565
75355
|
await this.saveCredentials(credentials);
|
|
@@ -75590,12 +75380,13 @@ var AuthManager = class {
|
|
|
75590
75380
|
print(LEGACY_SIGN_IN_MESSAGE);
|
|
75591
75381
|
return false;
|
|
75592
75382
|
}
|
|
75593
|
-
|
|
75383
|
+
const storedEnvironment = credentials?.env ? resolveDeployment(credentials.env) : void 0;
|
|
75384
|
+
if (storedEnvironment && storedEnvironment !== INWORLD_ENV) {
|
|
75594
75385
|
print(
|
|
75595
75386
|
`Warning: Currently saved credentials might not match current Inworld CLI environment.
|
|
75596
75387
|
|
|
75597
75388
|
Current Inworld CLI environment is ${INWORLD_ENV}
|
|
75598
|
-
Environment of current credentials is ${
|
|
75389
|
+
Environment of current credentials is ${storedEnvironment}
|
|
75599
75390
|
|
|
75600
75391
|
You can run "inworld login --force" to login with the correct environment.`
|
|
75601
75392
|
);
|
|
@@ -75607,7 +75398,7 @@ var authManager = new AuthManager();
|
|
|
75607
75398
|
|
|
75608
75399
|
// src/auth/utils.ts
|
|
75609
75400
|
init_runtime_credential();
|
|
75610
|
-
|
|
75401
|
+
init_constants6();
|
|
75611
75402
|
init_client_info();
|
|
75612
75403
|
async function requireAuth() {
|
|
75613
75404
|
const isAuthenticated = await authManager.isAuthenticated();
|
|
@@ -75644,10 +75435,10 @@ var cliSession = {
|
|
|
75644
75435
|
const token = await authManager.getValidToken();
|
|
75645
75436
|
if (!token) return null;
|
|
75646
75437
|
const credentials = await authManager.getCredentials();
|
|
75647
|
-
const
|
|
75438
|
+
const signIn = credentials?.inworldToken === token ? credentials : null;
|
|
75648
75439
|
return {
|
|
75649
75440
|
user: accountOf(token),
|
|
75650
|
-
deployment:
|
|
75441
|
+
deployment: signIn ? signIn.authUrl ?? "" : null,
|
|
75651
75442
|
headers: {
|
|
75652
75443
|
Authorization: `Bearer ${token}`,
|
|
75653
75444
|
"Grpc-Metadata-X-Authorization-Bearer-Type": "inworld"
|
|
@@ -75687,7 +75478,7 @@ var authenticatedInworldRequest = async (pb, req, inworldToken, signal) => {
|
|
|
75687
75478
|
};
|
|
75688
75479
|
|
|
75689
75480
|
// src/services/tts_service.ts
|
|
75690
|
-
|
|
75481
|
+
init_constants6();
|
|
75691
75482
|
init_client_info();
|
|
75692
75483
|
|
|
75693
75484
|
// src/utils/resource_name_helper.ts
|
|
@@ -76006,7 +75797,7 @@ var ttsService = new TTSService();
|
|
|
76006
75797
|
// src/services/tts_websocket.ts
|
|
76007
75798
|
init_runtime_credential();
|
|
76008
75799
|
import WebSocket from "ws";
|
|
76009
|
-
|
|
75800
|
+
init_constants6();
|
|
76010
75801
|
init_client_info();
|
|
76011
75802
|
|
|
76012
75803
|
// src/utils/wav.ts
|
|
@@ -83953,14 +83744,14 @@ async function writeChapterPcm(path13, segments, synthesize, chapterIndex, attem
|
|
|
83953
83744
|
}
|
|
83954
83745
|
|
|
83955
83746
|
// src/commands/audiobook/state_file.ts
|
|
83956
|
-
import { createHash as
|
|
83747
|
+
import { createHash as createHash2 } from "crypto";
|
|
83957
83748
|
import { rename, writeFile as writeFile3 } from "fs/promises";
|
|
83958
83749
|
import { readFile as readFile2 } from "fs/promises";
|
|
83959
83750
|
import { join as join3 } from "path";
|
|
83960
83751
|
var STATE_FILE_NAME = "state.json";
|
|
83961
83752
|
var STATE_FILE_VERSION = 1;
|
|
83962
83753
|
function sha256(buffer) {
|
|
83963
|
-
return
|
|
83754
|
+
return createHash2("sha256").update(buffer).digest("hex");
|
|
83964
83755
|
}
|
|
83965
83756
|
function statePath(workDir) {
|
|
83966
83757
|
return join3(workDir, STATE_FILE_NAME);
|
|
@@ -84434,15 +84225,14 @@ var audiobookCommand = new Command("audiobook").description("Audiobook generatio
|
|
|
84434
84225
|
});
|
|
84435
84226
|
|
|
84436
84227
|
// src/commands/auth/login_command.ts
|
|
84437
|
-
|
|
84228
|
+
init_constants6();
|
|
84229
|
+
init_device_flow();
|
|
84438
84230
|
init_identity();
|
|
84439
|
-
init_second_factor();
|
|
84440
|
-
init_sign_in_prompt();
|
|
84441
84231
|
|
|
84442
84232
|
// src/services/workspace_service.ts
|
|
84443
84233
|
import { open as open2, unlink } from "node:fs/promises";
|
|
84444
84234
|
import { resolve as resolve2 } from "node:path";
|
|
84445
|
-
|
|
84235
|
+
init_constants6();
|
|
84446
84236
|
|
|
84447
84237
|
// proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.ts
|
|
84448
84238
|
init_fetch_pb();
|
|
@@ -84840,23 +84630,6 @@ async function createKeyFile(path13) {
|
|
|
84840
84630
|
}
|
|
84841
84631
|
|
|
84842
84632
|
// src/commands/auth/login_command.ts
|
|
84843
|
-
var signIn = async (source, provider) => {
|
|
84844
|
-
const browserSignIn = await startBrowserSignIn({
|
|
84845
|
-
authUrl: source.authUrl,
|
|
84846
|
-
pageUrl: INWORLD_CLI_AUTH_URL,
|
|
84847
|
-
version: CLI_VERSION,
|
|
84848
|
-
oauthProvider: provider === "email" ? void 0 : provider
|
|
84849
|
-
});
|
|
84850
|
-
await promptForSignIn(browserSignIn, {
|
|
84851
|
-
print,
|
|
84852
|
-
printLink,
|
|
84853
|
-
printError,
|
|
84854
|
-
output: process.stdout
|
|
84855
|
-
});
|
|
84856
|
-
return stepUpSecondFactor(source, await browserSignIn.done, {
|
|
84857
|
-
print
|
|
84858
|
-
});
|
|
84859
|
-
};
|
|
84860
84633
|
var loginAction = async (options) => {
|
|
84861
84634
|
try {
|
|
84862
84635
|
if (!options.force && await authManager.isAuthenticated()) {
|
|
@@ -84889,8 +84662,26 @@ var loginAction = async (options) => {
|
|
|
84889
84662
|
print("Let's get you authenticated.");
|
|
84890
84663
|
console.log();
|
|
84891
84664
|
}
|
|
84665
|
+
const ignored = options.provider ? "--provider is deprecated and" : process.env.INWORLD_AUTH_OAUTH_PROVIDER ? "INWORLD_AUTH_OAUTH_PROVIDER is" : void 0;
|
|
84666
|
+
if (ignored) {
|
|
84667
|
+
print(
|
|
84668
|
+
`Note: ${ignored} ignored. Choose the sign-in method in the browser.`
|
|
84669
|
+
);
|
|
84670
|
+
console.log();
|
|
84671
|
+
}
|
|
84892
84672
|
const source = await resolveIdentitySource(PLATFORM_URL);
|
|
84893
|
-
const tokens = await
|
|
84673
|
+
const tokens = await signInWithDeviceCode({
|
|
84674
|
+
source,
|
|
84675
|
+
platformUrl: PLATFORM_URL,
|
|
84676
|
+
clientId: INWORLD_CLI_CLIENT_ID,
|
|
84677
|
+
env: INWORLD_ENV,
|
|
84678
|
+
out: {
|
|
84679
|
+
print,
|
|
84680
|
+
printLink,
|
|
84681
|
+
printError,
|
|
84682
|
+
output: process.stdout
|
|
84683
|
+
}
|
|
84684
|
+
});
|
|
84894
84685
|
console.log();
|
|
84895
84686
|
success("\u2713 Authentication successful!");
|
|
84896
84687
|
console.log();
|
|
@@ -84901,7 +84692,9 @@ var loginAction = async (options) => {
|
|
|
84901
84692
|
tokens.idToken,
|
|
84902
84693
|
tokens.refreshToken,
|
|
84903
84694
|
tokens.email ?? "",
|
|
84904
|
-
|
|
84695
|
+
// The client id is stored with the session, so it refreshes through
|
|
84696
|
+
// `/oauth/token` as it signed in.
|
|
84697
|
+
{ ...source, clientId: INWORLD_CLI_CLIENT_ID },
|
|
84905
84698
|
/* workspace */
|
|
84906
84699
|
void 0,
|
|
84907
84700
|
INWORLD_ENV
|
|
@@ -84924,8 +84717,8 @@ var loginAction = async (options) => {
|
|
|
84924
84717
|
process.exit(0);
|
|
84925
84718
|
} catch (error2) {
|
|
84926
84719
|
console.log();
|
|
84927
|
-
|
|
84928
|
-
|
|
84720
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
84721
|
+
printError(`Authentication failed. ${message}`);
|
|
84929
84722
|
process.exit(1);
|
|
84930
84723
|
}
|
|
84931
84724
|
};
|
|
@@ -84933,8 +84726,8 @@ var makeLoginCommand = (description) => {
|
|
|
84933
84726
|
return new Command("login").description(description).option("-f, --force", "Force re-authentication even if already logged in").addOption(
|
|
84934
84727
|
new Option(
|
|
84935
84728
|
"-p, --provider <provider>",
|
|
84936
|
-
"
|
|
84937
|
-
).
|
|
84729
|
+
"Deprecated and ignored: choose the sign-in method in the browser"
|
|
84730
|
+
).hideHelp()
|
|
84938
84731
|
).action(loginAction);
|
|
84939
84732
|
};
|
|
84940
84733
|
var loginCommand = makeLoginCommand(
|
|
@@ -85058,6 +84851,7 @@ var logoutCommand = makeLogoutCommand(
|
|
|
85058
84851
|
|
|
85059
84852
|
// src/commands/auth/status_command.ts
|
|
85060
84853
|
init_runtime_credential();
|
|
84854
|
+
init_constants5();
|
|
85061
84855
|
var statusAction = async () => {
|
|
85062
84856
|
try {
|
|
85063
84857
|
const credentials = await authManager.getCredentials();
|
|
@@ -85076,8 +84870,9 @@ INWORLD_API_KEY environment variable: ${trimBase64Key(apiKey)} (active)`
|
|
|
85076
84870
|
}
|
|
85077
84871
|
printBright("Authentication:");
|
|
85078
84872
|
print(` Email: ${credentials.email}`);
|
|
85079
|
-
|
|
85080
|
-
|
|
84873
|
+
const environment = resolveDeployment(credentials.env);
|
|
84874
|
+
if (environment !== "PROD") {
|
|
84875
|
+
print(` Environment: ${environment}`);
|
|
85081
84876
|
}
|
|
85082
84877
|
if (credentials.inworldToken) {
|
|
85083
84878
|
const isExpired = credentials.expiresAt && Date.now() > credentials.expiresAt;
|
|
@@ -85133,7 +84928,7 @@ var statusCommandAlias = makeStatusCommand(
|
|
|
85133
84928
|
// src/services/analytics.ts
|
|
85134
84929
|
init_source();
|
|
85135
84930
|
var import_mixpanel = __toESM(require_mixpanel_node(), 1);
|
|
85136
|
-
|
|
84931
|
+
init_constants6();
|
|
85137
84932
|
var Analytics = class _Analytics {
|
|
85138
84933
|
static CONF_ENTRY_NAME = "analytics";
|
|
85139
84934
|
conf;
|
|
@@ -85290,7 +85085,7 @@ var enableTelemetryAction = async () => {
|
|
|
85290
85085
|
var enableTelemetryCommand = new Command("enable_cli_telemetry").description("Enable anonymous CLI usage analytics").action(enableTelemetryAction);
|
|
85291
85086
|
|
|
85292
85087
|
// src/commands/auth/login_ci_command.ts
|
|
85293
|
-
|
|
85088
|
+
init_constants6();
|
|
85294
85089
|
init_identity();
|
|
85295
85090
|
var loginCiAction = async (options) => {
|
|
85296
85091
|
try {
|
|
@@ -85361,7 +85156,7 @@ var authCommand = new Command("auth").description("Manage Inworld authentication
|
|
|
85361
85156
|
});
|
|
85362
85157
|
|
|
85363
85158
|
// src/services/llm_service.ts
|
|
85364
|
-
|
|
85159
|
+
init_constants6();
|
|
85365
85160
|
init_client_info();
|
|
85366
85161
|
var LLMService = class {
|
|
85367
85162
|
get apiBaseUrl() {
|
|
@@ -85604,7 +85399,7 @@ var mcpCommand = new Command("mcp").description(
|
|
|
85604
85399
|
import { readFile as readFile5 } from "fs/promises";
|
|
85605
85400
|
|
|
85606
85401
|
// src/services/stt_service.ts
|
|
85607
|
-
|
|
85402
|
+
init_constants6();
|
|
85608
85403
|
init_client_info();
|
|
85609
85404
|
var STT_MODELS = {
|
|
85610
85405
|
INWORLD_STT_1: "inworld/inworld-stt-1",
|
|
@@ -86600,12 +86395,12 @@ var workspaceCommand = new Command("workspace").description("Manage Inworld work
|
|
|
86600
86395
|
});
|
|
86601
86396
|
|
|
86602
86397
|
// src/index.ts
|
|
86603
|
-
|
|
86398
|
+
init_constants6();
|
|
86604
86399
|
|
|
86605
86400
|
// src/services/update_checker.ts
|
|
86606
86401
|
init_source();
|
|
86607
86402
|
var semver2 = __toESM(require_semver2(), 1);
|
|
86608
|
-
|
|
86403
|
+
init_constants6();
|
|
86609
86404
|
var UpdateChecker = class _UpdateChecker {
|
|
86610
86405
|
static PACKAGE_NAME = "@inworld/cli";
|
|
86611
86406
|
static CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
|
|
@@ -86754,8 +86549,8 @@ var InworldCLI = class {
|
|
|
86754
86549
|
}
|
|
86755
86550
|
setupProgram() {
|
|
86756
86551
|
this.program.name("inworld").description("Inworld CLI").version(version2, "--version").configureOutput({
|
|
86757
|
-
writeOut: (
|
|
86758
|
-
writeErr: (
|
|
86552
|
+
writeOut: (str2) => process.stdout.write(str2),
|
|
86553
|
+
writeErr: (str2) => process.stderr.write(str2),
|
|
86759
86554
|
getOutHelpWidth: () => process.stdout.columns || 80,
|
|
86760
86555
|
getErrHelpWidth: () => process.stderr.columns || 80
|
|
86761
86556
|
}).hook("preAction", (_thisCommand, actionCommand) => {
|