@devkong/cli 0.0.67-alpha.25 → 0.0.67-alpha.26
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/index.js +891 -610
- package/package.json +1 -1
- package/packages/kong-cli/src/commands/connectCommand.d.ts +29 -0
- package/packages/kong-cli/src/commands/listAliasesCommand.d.ts +1 -1
- package/packages/kong-cli/src/commands/listVersionsCommand.d.ts +1 -1
- package/packages/kong-cli/src/services/managementClient.d.ts +3 -1
- package/packages/kong-spec/src/index.d.ts +1 -1
- package/packages/kong-spec/src/lib/kongSpec.d.ts +2 -1
- package/packages/kong-ts/src/index.d.ts +3 -1
- package/packages/kong-ts/src/lib/connect.d.ts +31 -0
- package/packages/kong-ts/src/lib/id.d.ts +1 -0
- package/packages/kong-ts-contract/src/index.d.ts +3 -3
- package/packages/kong-ts-contract/src/lib/appDependency.d.ts +2 -3
- package/packages/kong-ts-contract/src/lib/appExtension.d.ts +3 -0
- package/packages/kong-ts-contract/src/lib/appSecret.d.ts +3 -4
- package/packages/kong-ts-contract/src/lib/appSecretType.d.ts +1 -1
package/index.js
CHANGED
|
@@ -1104,9 +1104,9 @@ var require_cronstrue = __commonJS({
|
|
|
1104
1104
|
// node_modules/dotenv/lib/main.js
|
|
1105
1105
|
var require_main = __commonJS({
|
|
1106
1106
|
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1109
|
-
var
|
|
1107
|
+
var fs7 = require("fs");
|
|
1108
|
+
var path10 = require("path");
|
|
1109
|
+
var os4 = require("os");
|
|
1110
1110
|
var crypto3 = require("crypto");
|
|
1111
1111
|
var TIPS = [
|
|
1112
1112
|
"\u25C8 encrypted .env [www.dotenvx.com]",
|
|
@@ -1236,7 +1236,7 @@ var require_main = __commonJS({
|
|
|
1236
1236
|
if (options && options.path && options.path.length > 0) {
|
|
1237
1237
|
if (Array.isArray(options.path)) {
|
|
1238
1238
|
for (const filepath of options.path) {
|
|
1239
|
-
if (
|
|
1239
|
+
if (fs7.existsSync(filepath)) {
|
|
1240
1240
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
@@ -1244,15 +1244,15 @@ var require_main = __commonJS({
|
|
|
1244
1244
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
1245
1245
|
}
|
|
1246
1246
|
} else {
|
|
1247
|
-
possibleVaultPath =
|
|
1247
|
+
possibleVaultPath = path10.resolve(process.cwd(), ".env.vault");
|
|
1248
1248
|
}
|
|
1249
|
-
if (
|
|
1249
|
+
if (fs7.existsSync(possibleVaultPath)) {
|
|
1250
1250
|
return possibleVaultPath;
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
1254
1254
|
function _resolveHome(envPath) {
|
|
1255
|
-
return envPath[0] === "~" ?
|
|
1255
|
+
return envPath[0] === "~" ? path10.join(os4.homedir(), envPath.slice(1)) : envPath;
|
|
1256
1256
|
}
|
|
1257
1257
|
function _configVault(options) {
|
|
1258
1258
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -1269,7 +1269,7 @@ var require_main = __commonJS({
|
|
|
1269
1269
|
return { parsed };
|
|
1270
1270
|
}
|
|
1271
1271
|
function configDotenv(options) {
|
|
1272
|
-
const dotenvPath =
|
|
1272
|
+
const dotenvPath = path10.resolve(process.cwd(), ".env");
|
|
1273
1273
|
let encoding = "utf8";
|
|
1274
1274
|
let processEnv = process.env;
|
|
1275
1275
|
if (options && options.processEnv != null) {
|
|
@@ -1297,13 +1297,13 @@ var require_main = __commonJS({
|
|
|
1297
1297
|
}
|
|
1298
1298
|
let lastError;
|
|
1299
1299
|
const parsedAll = {};
|
|
1300
|
-
for (const
|
|
1300
|
+
for (const path11 of optionPaths) {
|
|
1301
1301
|
try {
|
|
1302
|
-
const parsed = DotenvModule.parse(
|
|
1302
|
+
const parsed = DotenvModule.parse(fs7.readFileSync(path11, { encoding }));
|
|
1303
1303
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
1304
1304
|
} catch (e) {
|
|
1305
1305
|
if (debug) {
|
|
1306
|
-
_debug(`failed to load ${
|
|
1306
|
+
_debug(`failed to load ${path11} ${e.message}`);
|
|
1307
1307
|
}
|
|
1308
1308
|
lastError = e;
|
|
1309
1309
|
}
|
|
@@ -1316,7 +1316,7 @@ var require_main = __commonJS({
|
|
|
1316
1316
|
const shortPaths = [];
|
|
1317
1317
|
for (const filePath of optionPaths) {
|
|
1318
1318
|
try {
|
|
1319
|
-
const relative =
|
|
1319
|
+
const relative = path10.relative(process.cwd(), filePath);
|
|
1320
1320
|
shortPaths.push(relative);
|
|
1321
1321
|
} catch (e) {
|
|
1322
1322
|
if (debug) {
|
|
@@ -7488,10 +7488,10 @@ var require_lib4 = __commonJS({
|
|
|
7488
7488
|
exports2.analyse = analyse;
|
|
7489
7489
|
var detectFile = (filepath, opts = {}) => new Promise((resolve2, reject) => {
|
|
7490
7490
|
let fd;
|
|
7491
|
-
const
|
|
7491
|
+
const fs7 = (0, node_1.default)();
|
|
7492
7492
|
const handler = (err, buffer) => {
|
|
7493
7493
|
if (fd) {
|
|
7494
|
-
|
|
7494
|
+
fs7.closeSync(fd);
|
|
7495
7495
|
}
|
|
7496
7496
|
if (err) {
|
|
7497
7497
|
reject(err);
|
|
@@ -7503,9 +7503,9 @@ var require_lib4 = __commonJS({
|
|
|
7503
7503
|
};
|
|
7504
7504
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
7505
7505
|
if (sampleSize > 0) {
|
|
7506
|
-
fd =
|
|
7506
|
+
fd = fs7.openSync(filepath, "r");
|
|
7507
7507
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
7508
|
-
|
|
7508
|
+
fs7.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
7509
7509
|
if (err) {
|
|
7510
7510
|
handler(err, null);
|
|
7511
7511
|
} else {
|
|
@@ -7517,22 +7517,22 @@ var require_lib4 = __commonJS({
|
|
|
7517
7517
|
});
|
|
7518
7518
|
return;
|
|
7519
7519
|
}
|
|
7520
|
-
|
|
7520
|
+
fs7.readFile(filepath, handler);
|
|
7521
7521
|
});
|
|
7522
7522
|
exports2.detectFile = detectFile;
|
|
7523
7523
|
var detectFileSync = (filepath, opts = {}) => {
|
|
7524
|
-
const
|
|
7524
|
+
const fs7 = (0, node_1.default)();
|
|
7525
7525
|
if (opts && opts.sampleSize) {
|
|
7526
|
-
const fd =
|
|
7526
|
+
const fd = fs7.openSync(filepath, "r");
|
|
7527
7527
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
7528
|
-
const bytesRead =
|
|
7528
|
+
const bytesRead = fs7.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
7529
7529
|
if (bytesRead < opts.sampleSize) {
|
|
7530
7530
|
sample = sample.subarray(0, bytesRead);
|
|
7531
7531
|
}
|
|
7532
|
-
|
|
7532
|
+
fs7.closeSync(fd);
|
|
7533
7533
|
return (0, exports2.detect)(sample);
|
|
7534
7534
|
}
|
|
7535
|
-
return (0, exports2.detect)(
|
|
7535
|
+
return (0, exports2.detect)(fs7.readFileSync(filepath));
|
|
7536
7536
|
};
|
|
7537
7537
|
exports2.detectFileSync = detectFileSync;
|
|
7538
7538
|
exports2.default = {
|
|
@@ -20282,11 +20282,11 @@ var require_mime_types = __commonJS({
|
|
|
20282
20282
|
}
|
|
20283
20283
|
return exts[0];
|
|
20284
20284
|
}
|
|
20285
|
-
function lookup(
|
|
20286
|
-
if (!
|
|
20285
|
+
function lookup(path10) {
|
|
20286
|
+
if (!path10 || typeof path10 !== "string") {
|
|
20287
20287
|
return false;
|
|
20288
20288
|
}
|
|
20289
|
-
var extension2 = extname("x." +
|
|
20289
|
+
var extension2 = extname("x." + path10).toLowerCase().substr(1);
|
|
20290
20290
|
if (!extension2) {
|
|
20291
20291
|
return false;
|
|
20292
20292
|
}
|
|
@@ -21391,11 +21391,11 @@ var require_form_data = __commonJS({
|
|
|
21391
21391
|
"use strict";
|
|
21392
21392
|
var CombinedStream = require_combined_stream();
|
|
21393
21393
|
var util4 = require("util");
|
|
21394
|
-
var
|
|
21395
|
-
var
|
|
21394
|
+
var path10 = require("path");
|
|
21395
|
+
var http4 = require("http");
|
|
21396
21396
|
var https2 = require("https");
|
|
21397
21397
|
var parseUrl2 = require("url").parse;
|
|
21398
|
-
var
|
|
21398
|
+
var fs7 = require("fs");
|
|
21399
21399
|
var Stream = require("stream").Stream;
|
|
21400
21400
|
var crypto3 = require("crypto");
|
|
21401
21401
|
var mime = require_mime_types();
|
|
@@ -21465,7 +21465,7 @@ var require_form_data = __commonJS({
|
|
|
21465
21465
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
21466
21466
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
21467
21467
|
} else {
|
|
21468
|
-
|
|
21468
|
+
fs7.stat(value.path, function(err, stat) {
|
|
21469
21469
|
if (err) {
|
|
21470
21470
|
callback(err);
|
|
21471
21471
|
return;
|
|
@@ -21522,11 +21522,11 @@ var require_form_data = __commonJS({
|
|
|
21522
21522
|
FormData3.prototype._getContentDisposition = function(value, options) {
|
|
21523
21523
|
var filename;
|
|
21524
21524
|
if (typeof options.filepath === "string") {
|
|
21525
|
-
filename =
|
|
21525
|
+
filename = path10.normalize(options.filepath).replace(/\\/g, "/");
|
|
21526
21526
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
21527
|
-
filename =
|
|
21527
|
+
filename = path10.basename(options.filename || value && (value.name || value.path));
|
|
21528
21528
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
21529
|
-
filename =
|
|
21529
|
+
filename = path10.basename(value.client._httpMessage.path || "");
|
|
21530
21530
|
}
|
|
21531
21531
|
if (filename) {
|
|
21532
21532
|
return 'filename="' + escapeHeaderParam(filename) + '"';
|
|
@@ -21667,7 +21667,7 @@ var require_form_data = __commonJS({
|
|
|
21667
21667
|
if (options.protocol === "https:") {
|
|
21668
21668
|
request = https2.request(options);
|
|
21669
21669
|
} else {
|
|
21670
|
-
request =
|
|
21670
|
+
request = http4.request(options);
|
|
21671
21671
|
}
|
|
21672
21672
|
this.getLength(function(err, length) {
|
|
21673
21673
|
if (err && err !== "Unknown stream") {
|
|
@@ -22187,7 +22187,7 @@ var require_has_flag = __commonJS({
|
|
|
22187
22187
|
var require_supports_color = __commonJS({
|
|
22188
22188
|
"node_modules/supports-color/index.js"(exports2, module2) {
|
|
22189
22189
|
"use strict";
|
|
22190
|
-
var
|
|
22190
|
+
var os4 = require("os");
|
|
22191
22191
|
var tty = require("tty");
|
|
22192
22192
|
var hasFlag = require_has_flag();
|
|
22193
22193
|
var { env } = process;
|
|
@@ -22235,7 +22235,7 @@ var require_supports_color = __commonJS({
|
|
|
22235
22235
|
return min;
|
|
22236
22236
|
}
|
|
22237
22237
|
if (process.platform === "win32") {
|
|
22238
|
-
const osRelease =
|
|
22238
|
+
const osRelease = os4.release().split(".");
|
|
22239
22239
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
22240
22240
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
22241
22241
|
}
|
|
@@ -22945,7 +22945,7 @@ var require_follow_redirects = __commonJS({
|
|
|
22945
22945
|
"node_modules/follow-redirects/index.js"(exports2, module2) {
|
|
22946
22946
|
var url2 = require("url");
|
|
22947
22947
|
var URL2 = url2.URL;
|
|
22948
|
-
var
|
|
22948
|
+
var http4 = require("http");
|
|
22949
22949
|
var https2 = require("https");
|
|
22950
22950
|
var Writable2 = require("stream").Writable;
|
|
22951
22951
|
var assert = require("assert");
|
|
@@ -23446,7 +23446,7 @@ var require_follow_redirects = __commonJS({
|
|
|
23446
23446
|
function escapeRegex2(regex4) {
|
|
23447
23447
|
return regex4.replace(/[\]\\/()*+?.$]/g, "\\$&");
|
|
23448
23448
|
}
|
|
23449
|
-
module2.exports = wrap({ http:
|
|
23449
|
+
module2.exports = wrap({ http: http4, https: https2 });
|
|
23450
23450
|
module2.exports.wrap = wrap;
|
|
23451
23451
|
}
|
|
23452
23452
|
});
|
|
@@ -26647,8 +26647,8 @@ var require_utils2 = __commonJS({
|
|
|
26647
26647
|
}
|
|
26648
26648
|
return ind;
|
|
26649
26649
|
}
|
|
26650
|
-
function removeDotSegments(
|
|
26651
|
-
let input =
|
|
26650
|
+
function removeDotSegments(path10) {
|
|
26651
|
+
let input = path10;
|
|
26652
26652
|
const output = [];
|
|
26653
26653
|
let nextSlash = -1;
|
|
26654
26654
|
let len = 0;
|
|
@@ -26900,8 +26900,8 @@ var require_schemes = __commonJS({
|
|
|
26900
26900
|
wsComponent.secure = void 0;
|
|
26901
26901
|
}
|
|
26902
26902
|
if (wsComponent.resourceName) {
|
|
26903
|
-
const [
|
|
26904
|
-
wsComponent.path =
|
|
26903
|
+
const [path10, query] = wsComponent.resourceName.split("?");
|
|
26904
|
+
wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
|
|
26905
26905
|
wsComponent.query = query;
|
|
26906
26906
|
wsComponent.resourceName = void 0;
|
|
26907
26907
|
}
|
|
@@ -26960,7 +26960,7 @@ var require_schemes = __commonJS({
|
|
|
26960
26960
|
urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
|
|
26961
26961
|
return urnComponent;
|
|
26962
26962
|
}
|
|
26963
|
-
var
|
|
26963
|
+
var http4 = (
|
|
26964
26964
|
/** @type {SchemeHandler} */
|
|
26965
26965
|
{
|
|
26966
26966
|
scheme: "http",
|
|
@@ -26973,7 +26973,7 @@ var require_schemes = __commonJS({
|
|
|
26973
26973
|
/** @type {SchemeHandler} */
|
|
26974
26974
|
{
|
|
26975
26975
|
scheme: "https",
|
|
26976
|
-
domainHost:
|
|
26976
|
+
domainHost: http4.domainHost,
|
|
26977
26977
|
parse: httpParse,
|
|
26978
26978
|
serialize: httpSerialize
|
|
26979
26979
|
}
|
|
@@ -27017,7 +27017,7 @@ var require_schemes = __commonJS({
|
|
|
27017
27017
|
var SCHEMES = (
|
|
27018
27018
|
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
27019
27019
|
{
|
|
27020
|
-
http:
|
|
27020
|
+
http: http4,
|
|
27021
27021
|
https: https2,
|
|
27022
27022
|
ws,
|
|
27023
27023
|
wss,
|
|
@@ -35073,7 +35073,7 @@ function isEmpty(value) {
|
|
|
35073
35073
|
module3.exports = resolveExternal;
|
|
35074
35074
|
}, { "./parse": 6, "./pointer": 11, "./ref": 12, "./util/url": 18 }], 15: [function(require2, module3, exports3) {
|
|
35075
35075
|
"use strict";
|
|
35076
|
-
var
|
|
35076
|
+
var fs7 = require2("fs"), ono = require2("ono"), url2 = require2("../util/url");
|
|
35077
35077
|
module3.exports = { order: 100, canRead: function(r) {
|
|
35078
35078
|
return url2.isFileSystemPath(r.url);
|
|
35079
35079
|
}, read: function(r) {
|
|
@@ -35085,7 +35085,7 @@ function isEmpty(value) {
|
|
|
35085
35085
|
o(ono.uri(e2, "Malformed URI: %s", r.url));
|
|
35086
35086
|
}
|
|
35087
35087
|
try {
|
|
35088
|
-
|
|
35088
|
+
fs7.readFile(n, function(r2, u) {
|
|
35089
35089
|
r2 ? o(ono(r2, 'Error opening file "%s"', n)) : e(u);
|
|
35090
35090
|
});
|
|
35091
35091
|
} catch (r2) {
|
|
@@ -35096,7 +35096,7 @@ function isEmpty(value) {
|
|
|
35096
35096
|
}, { "../util/url": 18, fs: 21, ono: 64 }], 16: [function(require2, module3, exports3) {
|
|
35097
35097
|
(function(process10, Buffer2) {
|
|
35098
35098
|
"use strict";
|
|
35099
|
-
var
|
|
35099
|
+
var http4 = require2("http"), https2 = require2("https"), ono = require2("ono"), url2 = require2("../util/url");
|
|
35100
35100
|
function download(t, o, e) {
|
|
35101
35101
|
return new Promise(function(r, n) {
|
|
35102
35102
|
t = url2.parse(t), (e = e || []).push(t.href), get(t, o).then(function(s) {
|
|
@@ -35114,7 +35114,7 @@ function isEmpty(value) {
|
|
|
35114
35114
|
}
|
|
35115
35115
|
function get(t, o) {
|
|
35116
35116
|
return new Promise(function(e, r) {
|
|
35117
|
-
var n = ("https:" === t.protocol ? https2 :
|
|
35117
|
+
var n = ("https:" === t.protocol ? https2 : http4).get({ hostname: t.hostname, port: t.port, path: t.path, auth: t.auth, protocol: t.protocol, headers: o.headers || {}, withCredentials: o.withCredentials });
|
|
35118
35118
|
"function" == typeof n.setTimeout && n.setTimeout(o.timeout), n.on("timeout", function() {
|
|
35119
35119
|
n.abort();
|
|
35120
35120
|
}), n.on("error", r), n.once("response", function(t2) {
|
|
@@ -36242,16 +36242,16 @@ function isEmpty(value) {
|
|
|
36242
36242
|
}
|
|
36243
36243
|
module3.exports = format4;
|
|
36244
36244
|
}, {}], 29: [function(require2, module3, exports3) {
|
|
36245
|
-
var
|
|
36246
|
-
for (var key in
|
|
36245
|
+
var http4 = require2("http"), url2 = require2("url"), https2 = module3.exports;
|
|
36246
|
+
for (var key in http4) http4.hasOwnProperty(key) && (https2[key] = http4[key]);
|
|
36247
36247
|
function validateParams(t) {
|
|
36248
36248
|
if ("string" == typeof t && (t = url2.parse(t)), t.protocol || (t.protocol = "https:"), "https:" !== t.protocol) throw new Error('Protocol "' + t.protocol + '" not supported. Expected "https:"');
|
|
36249
36249
|
return t;
|
|
36250
36250
|
}
|
|
36251
36251
|
https2.request = function(t, r) {
|
|
36252
|
-
return t = validateParams(t),
|
|
36252
|
+
return t = validateParams(t), http4.request.call(this, t, r);
|
|
36253
36253
|
}, https2.get = function(t, r) {
|
|
36254
|
-
return t = validateParams(t),
|
|
36254
|
+
return t = validateParams(t), http4.get.call(this, t, r);
|
|
36255
36255
|
};
|
|
36256
36256
|
}, { http: 80, url: 87 }], 30: [function(require2, module3, exports3) {
|
|
36257
36257
|
exports3.read = function(a, o, t, r, h) {
|
|
@@ -38174,18 +38174,18 @@ function isEmpty(value) {
|
|
|
38174
38174
|
};
|
|
38175
38175
|
}, { buffer: 23 }], 80: [function(require2, module3, exports3) {
|
|
38176
38176
|
(function(global4) {
|
|
38177
|
-
var ClientRequest = require2("./lib/request"), response = require2("./lib/response"), extend2 = require2("xtend"), statusCodes = require2("builtin-status-codes"), url2 = require2("url"),
|
|
38178
|
-
|
|
38177
|
+
var ClientRequest = require2("./lib/request"), response = require2("./lib/response"), extend2 = require2("xtend"), statusCodes = require2("builtin-status-codes"), url2 = require2("url"), http4 = exports3;
|
|
38178
|
+
http4.request = function(e, t) {
|
|
38179
38179
|
e = "string" == typeof e ? url2.parse(e) : extend2(e);
|
|
38180
38180
|
var r = -1 === global4.location.protocol.search(/^https?:$/) ? "http:" : "", s = e.protocol || r, n = e.hostname || e.host, o = e.port, p = e.path || "/";
|
|
38181
38181
|
n && -1 !== n.indexOf(":") && (n = "[" + n + "]"), e.url = (n ? s + "//" + n : "") + (o ? ":" + o : "") + p, e.method = (e.method || "GET").toUpperCase(), e.headers = e.headers || {};
|
|
38182
38182
|
var u = new ClientRequest(e);
|
|
38183
38183
|
return t && u.on("response", t), u;
|
|
38184
|
-
},
|
|
38185
|
-
var r =
|
|
38184
|
+
}, http4.get = function(e, t) {
|
|
38185
|
+
var r = http4.request(e, t);
|
|
38186
38186
|
return r.end(), r;
|
|
38187
|
-
},
|
|
38188
|
-
},
|
|
38187
|
+
}, http4.ClientRequest = ClientRequest, http4.IncomingMessage = response.IncomingMessage, http4.Agent = function() {
|
|
38188
|
+
}, http4.Agent.defaultMaxSockets = 4, http4.globalAgent = new http4.Agent(), http4.STATUS_CODES = statusCodes, http4.METHODS = ["CHECKOUT", "CONNECT", "COPY", "DELETE", "GET", "HEAD", "LOCK", "M-SEARCH", "MERGE", "MKACTIVITY", "MKCOL", "MOVE", "NOTIFY", "OPTIONS", "PATCH", "POST", "PROPFIND", "PROPPATCH", "PURGE", "PUT", "REPORT", "SEARCH", "SUBSCRIBE", "TRACE", "UNLOCK", "UNSUBSCRIBE"];
|
|
38189
38189
|
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
|
|
38190
38190
|
}, { "./lib/request": 82, "./lib/response": 83, "builtin-status-codes": 24, url: 87, xtend: 90 }], 81: [function(require2, module3, exports3) {
|
|
38191
38191
|
(function(global4) {
|
|
@@ -41011,10 +41011,10 @@ ${indent2}${str}`;
|
|
|
41011
41011
|
return String(this.value);
|
|
41012
41012
|
}
|
|
41013
41013
|
};
|
|
41014
|
-
function collectionFromPath(schema,
|
|
41014
|
+
function collectionFromPath(schema, path10, value) {
|
|
41015
41015
|
let v = value;
|
|
41016
|
-
for (let i =
|
|
41017
|
-
const k =
|
|
41016
|
+
for (let i = path10.length - 1; i >= 0; --i) {
|
|
41017
|
+
const k = path10[i];
|
|
41018
41018
|
if (Number.isInteger(k) && k >= 0) {
|
|
41019
41019
|
const a = [];
|
|
41020
41020
|
a[k] = v;
|
|
@@ -41032,18 +41032,18 @@ ${indent2}${str}`;
|
|
|
41032
41032
|
}
|
|
41033
41033
|
return schema.createNode(v, false);
|
|
41034
41034
|
}
|
|
41035
|
-
var isEmptyPath = (
|
|
41035
|
+
var isEmptyPath = (path10) => path10 == null || typeof path10 === "object" && path10[Symbol.iterator]().next().done;
|
|
41036
41036
|
var Collection2 = class _Collection extends Node2 {
|
|
41037
41037
|
constructor(schema) {
|
|
41038
41038
|
super();
|
|
41039
41039
|
PlainValue._defineProperty(this, "items", []);
|
|
41040
41040
|
this.schema = schema;
|
|
41041
41041
|
}
|
|
41042
|
-
addIn(
|
|
41043
|
-
if (isEmptyPath(
|
|
41042
|
+
addIn(path10, value) {
|
|
41043
|
+
if (isEmptyPath(path10))
|
|
41044
41044
|
this.add(value);
|
|
41045
41045
|
else {
|
|
41046
|
-
const [key, ...rest] =
|
|
41046
|
+
const [key, ...rest] = path10;
|
|
41047
41047
|
const node = this.get(key, true);
|
|
41048
41048
|
if (node instanceof _Collection)
|
|
41049
41049
|
node.addIn(rest, value);
|
|
@@ -43273,8 +43273,8 @@ ${pair.comment}` : item.comment;
|
|
|
43273
43273
|
}
|
|
43274
43274
|
function warnFileDeprecation(filename) {
|
|
43275
43275
|
if (shouldWarn(true)) {
|
|
43276
|
-
const
|
|
43277
|
-
warn(`The endpoint 'yaml/${
|
|
43276
|
+
const path10 = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
|
|
43277
|
+
warn(`The endpoint 'yaml/${path10}' will be removed in a future release.`, "DeprecationWarning");
|
|
43278
43278
|
}
|
|
43279
43279
|
}
|
|
43280
43280
|
var warned = {};
|
|
@@ -44004,16 +44004,16 @@ var random_default = {
|
|
|
44004
44004
|
randexp: _randexp
|
|
44005
44005
|
};
|
|
44006
44006
|
var RE_NUMERIC = /^(0|[1-9][0-9]*)$/;
|
|
44007
|
-
function getLocalRef(obj,
|
|
44008
|
-
|
|
44009
|
-
if (refs && refs[
|
|
44010
|
-
return clone(refs[
|
|
44011
|
-
const keyElements =
|
|
44007
|
+
function getLocalRef(obj, path10, refs) {
|
|
44008
|
+
path10 = decodeURIComponent(path10);
|
|
44009
|
+
if (refs && refs[path10])
|
|
44010
|
+
return clone(refs[path10]);
|
|
44011
|
+
const keyElements = path10.replace("#/", "/").split("/");
|
|
44012
44012
|
let schema = obj.$ref && refs && refs[obj.$ref] || obj;
|
|
44013
44013
|
if (!schema && !keyElements[0]) {
|
|
44014
44014
|
keyElements[0] = obj.$ref.split("#/")[0];
|
|
44015
44015
|
}
|
|
44016
|
-
if (refs &&
|
|
44016
|
+
if (refs && path10.includes("#/") && refs[keyElements[0]]) {
|
|
44017
44017
|
schema = refs[keyElements.shift()];
|
|
44018
44018
|
}
|
|
44019
44019
|
if (!keyElements[0])
|
|
@@ -44021,7 +44021,7 @@ function getLocalRef(obj, path9, refs) {
|
|
|
44021
44021
|
while (schema && keyElements.length > 0) {
|
|
44022
44022
|
const prop = keyElements.shift();
|
|
44023
44023
|
if (!schema[prop]) {
|
|
44024
|
-
throw new Error(`Prop not found: ${prop} (${
|
|
44024
|
+
throw new Error(`Prop not found: ${prop} (${path10})`);
|
|
44025
44025
|
}
|
|
44026
44026
|
schema = schema[prop];
|
|
44027
44027
|
}
|
|
@@ -44512,14 +44512,14 @@ function formatAPI(nameOrFormatMap, callback) {
|
|
|
44512
44512
|
}
|
|
44513
44513
|
var format_default = formatAPI;
|
|
44514
44514
|
var ParseError = class extends Error {
|
|
44515
|
-
constructor(message2,
|
|
44515
|
+
constructor(message2, path10) {
|
|
44516
44516
|
super();
|
|
44517
44517
|
if (Error.captureStackTrace) {
|
|
44518
44518
|
Error.captureStackTrace(this, this.constructor);
|
|
44519
44519
|
}
|
|
44520
44520
|
this.name = "ParseError";
|
|
44521
44521
|
this.message = message2;
|
|
44522
|
-
this.path =
|
|
44522
|
+
this.path = path10;
|
|
44523
44523
|
}
|
|
44524
44524
|
};
|
|
44525
44525
|
var error_default = ParseError;
|
|
@@ -44596,7 +44596,7 @@ function nullGenerator() {
|
|
|
44596
44596
|
var null_default = nullGenerator;
|
|
44597
44597
|
var nullType = null_default;
|
|
44598
44598
|
var null_default2 = nullType;
|
|
44599
|
-
function unique(
|
|
44599
|
+
function unique(path10, items, value, sample, resolve2, traverseCallback) {
|
|
44600
44600
|
const tmp = [];
|
|
44601
44601
|
const seen = [];
|
|
44602
44602
|
function walk(obj) {
|
|
@@ -44611,7 +44611,7 @@ function unique(path9, items, value, sample, resolve2, traverseCallback) {
|
|
|
44611
44611
|
items.forEach(walk);
|
|
44612
44612
|
let limit = 100;
|
|
44613
44613
|
while (tmp.length !== items.length) {
|
|
44614
|
-
if (!walk(traverseCallback(value.items || sample,
|
|
44614
|
+
if (!walk(traverseCallback(value.items || sample, path10, resolve2))) {
|
|
44615
44615
|
limit -= 1;
|
|
44616
44616
|
}
|
|
44617
44617
|
if (!limit) {
|
|
@@ -44620,19 +44620,19 @@ function unique(path9, items, value, sample, resolve2, traverseCallback) {
|
|
|
44620
44620
|
}
|
|
44621
44621
|
return tmp;
|
|
44622
44622
|
}
|
|
44623
|
-
function arrayType(value,
|
|
44623
|
+
function arrayType(value, path10, resolve2, traverseCallback) {
|
|
44624
44624
|
const items = [];
|
|
44625
44625
|
if (!(value.items || value.additionalItems)) {
|
|
44626
44626
|
if (utils_default.hasProperties(value, "minItems", "maxItems", "uniqueItems")) {
|
|
44627
44627
|
if (value.minItems !== 0 || value.maxItems !== 0) {
|
|
44628
|
-
throw new error_default(`missing items for ${utils_default.short(value)}`,
|
|
44628
|
+
throw new error_default(`missing items for ${utils_default.short(value)}`, path10);
|
|
44629
44629
|
}
|
|
44630
44630
|
}
|
|
44631
44631
|
return items;
|
|
44632
44632
|
}
|
|
44633
44633
|
if (Array.isArray(value.items)) {
|
|
44634
44634
|
return value.items.map((item, key) => {
|
|
44635
|
-
const itemSubpath =
|
|
44635
|
+
const itemSubpath = path10.concat(["items", key]);
|
|
44636
44636
|
return traverseCallback(item, itemSubpath, resolve2);
|
|
44637
44637
|
});
|
|
44638
44638
|
}
|
|
@@ -44660,16 +44660,16 @@ function arrayType(value, path9, resolve2, traverseCallback) {
|
|
|
44660
44660
|
}
|
|
44661
44661
|
const sample = typeof value.additionalItems === "object" ? value.additionalItems : {};
|
|
44662
44662
|
for (let current = items.length; current < length; current += 1) {
|
|
44663
|
-
const itemSubpath =
|
|
44663
|
+
const itemSubpath = path10.concat(["items", current]);
|
|
44664
44664
|
const element = traverseCallback(value.items || sample, itemSubpath, resolve2);
|
|
44665
44665
|
items.push(element);
|
|
44666
44666
|
}
|
|
44667
44667
|
if (value.contains && length > 0) {
|
|
44668
44668
|
const idx = random_default.number(0, length - 1);
|
|
44669
|
-
items[idx] = traverseCallback(value.contains,
|
|
44669
|
+
items[idx] = traverseCallback(value.contains, path10.concat(["items", idx]), resolve2);
|
|
44670
44670
|
}
|
|
44671
44671
|
if (value.uniqueItems) {
|
|
44672
|
-
return unique(
|
|
44672
|
+
return unique(path10.concat(["items"]), items, value, sample, resolve2, traverseCallback);
|
|
44673
44673
|
}
|
|
44674
44674
|
return items;
|
|
44675
44675
|
}
|
|
@@ -44730,7 +44730,7 @@ function wordsGenerator(length) {
|
|
|
44730
44730
|
}
|
|
44731
44731
|
var words_default = wordsGenerator;
|
|
44732
44732
|
var anyType = { type: constants_default.ALLOWED_TYPES };
|
|
44733
|
-
function objectType(value,
|
|
44733
|
+
function objectType(value, path10, resolve2, traverseCallback) {
|
|
44734
44734
|
const props = {};
|
|
44735
44735
|
const properties = value.properties || {};
|
|
44736
44736
|
const patternProperties = value.patternProperties || {};
|
|
@@ -44754,7 +44754,7 @@ function objectType(value, path9, resolve2, traverseCallback) {
|
|
|
44754
44754
|
props[key] = properties[key];
|
|
44755
44755
|
}
|
|
44756
44756
|
});
|
|
44757
|
-
return traverseCallback(props,
|
|
44757
|
+
return traverseCallback(props, path10.concat(["properties"]), resolve2, value);
|
|
44758
44758
|
}
|
|
44759
44759
|
const optionalsProbability = option_default("alwaysFakeOptionals") === true ? 1 : option_default("optionalsProbability");
|
|
44760
44760
|
const fixedProbabilities = option_default("alwaysFakeOptionals") || option_default("fixedProbabilities") || false;
|
|
@@ -44804,7 +44804,7 @@ function objectType(value, path9, resolve2, traverseCallback) {
|
|
|
44804
44804
|
delete value.dependencies;
|
|
44805
44805
|
return traverseCallback({
|
|
44806
44806
|
allOf: _defns.concat(value)
|
|
44807
|
-
},
|
|
44807
|
+
}, path10.concat(["properties"]), resolve2, value);
|
|
44808
44808
|
}
|
|
44809
44809
|
}
|
|
44810
44810
|
const skipped = [];
|
|
@@ -44935,13 +44935,13 @@ function objectType(value, path9, resolve2, traverseCallback) {
|
|
|
44935
44935
|
return memo;
|
|
44936
44936
|
}, {});
|
|
44937
44937
|
}
|
|
44938
|
-
const result = traverseCallback(sortedObj,
|
|
44938
|
+
const result = traverseCallback(sortedObj, path10.concat(["properties"]), resolve2, value);
|
|
44939
44939
|
_deps.forEach((dep) => {
|
|
44940
44940
|
for (const sub of dep.values) {
|
|
44941
44941
|
if (utils_default.hasValue(sub.properties[dep.prop], result.value[dep.prop])) {
|
|
44942
44942
|
Object.keys(sub.properties).forEach((next) => {
|
|
44943
44943
|
if (next !== dep.prop) {
|
|
44944
|
-
utils_default.merge(result.value, traverseCallback(sub.properties,
|
|
44944
|
+
utils_default.merge(result.value, traverseCallback(sub.properties, path10.concat(["properties"]), resolve2, value).value);
|
|
44945
44945
|
}
|
|
44946
44946
|
});
|
|
44947
44947
|
break;
|
|
@@ -45086,19 +45086,19 @@ function getMeta({ $comment: comment, title, description }) {
|
|
|
45086
45086
|
return memo;
|
|
45087
45087
|
}, {});
|
|
45088
45088
|
}
|
|
45089
|
-
function traverse(schema,
|
|
45090
|
-
schema = resolve2(schema, null,
|
|
45089
|
+
function traverse(schema, path10, resolve2, rootSchema) {
|
|
45090
|
+
schema = resolve2(schema, null, path10);
|
|
45091
45091
|
if (schema && (schema.oneOf || schema.anyOf || schema.allOf)) {
|
|
45092
|
-
schema = resolve2(schema, null,
|
|
45092
|
+
schema = resolve2(schema, null, path10);
|
|
45093
45093
|
}
|
|
45094
45094
|
if (!schema) {
|
|
45095
|
-
throw new Error(`Cannot traverse at '${
|
|
45095
|
+
throw new Error(`Cannot traverse at '${path10.join(".")}', given '${JSON.stringify(rootSchema)}'`);
|
|
45096
45096
|
}
|
|
45097
45097
|
const context = {
|
|
45098
45098
|
...getMeta(schema),
|
|
45099
|
-
schemaPath:
|
|
45099
|
+
schemaPath: path10
|
|
45100
45100
|
};
|
|
45101
|
-
if (
|
|
45101
|
+
if (path10[path10.length - 1] !== "properties") {
|
|
45102
45102
|
if (option_default("useExamplesValue") && Array.isArray(schema.examples)) {
|
|
45103
45103
|
const fixedExamples = schema.examples.concat("default" in schema ? [schema.default] : []);
|
|
45104
45104
|
return { value: utils_default.typecast(null, schema, () => random_default.pick(fixedExamples)), context };
|
|
@@ -45121,12 +45121,12 @@ function traverse(schema, path9, resolve2, rootSchema) {
|
|
|
45121
45121
|
if (schema.not && typeof schema.not === "object") {
|
|
45122
45122
|
schema = utils_default.notValue(schema.not, utils_default.omitProps(schema, ["not"]));
|
|
45123
45123
|
if (schema.type && schema.type === "object") {
|
|
45124
|
-
const { value, context: innerContext } = traverse(schema,
|
|
45124
|
+
const { value, context: innerContext } = traverse(schema, path10.concat(["not"]), resolve2, rootSchema);
|
|
45125
45125
|
return { value: utils_default.clean(value, schema, false), context: { ...context, items: innerContext } };
|
|
45126
45126
|
}
|
|
45127
45127
|
}
|
|
45128
45128
|
if (typeof schema.thunk === "function") {
|
|
45129
|
-
const { value, context: innerContext } = traverse(schema.thunk(rootSchema),
|
|
45129
|
+
const { value, context: innerContext } = traverse(schema.thunk(rootSchema), path10, resolve2);
|
|
45130
45130
|
return { value, context: { ...context, items: innerContext } };
|
|
45131
45131
|
}
|
|
45132
45132
|
if (schema.jsonPath) {
|
|
@@ -45136,13 +45136,13 @@ function traverse(schema, path9, resolve2, rootSchema) {
|
|
|
45136
45136
|
if (Array.isArray(type)) {
|
|
45137
45137
|
type = random_default.pick(type);
|
|
45138
45138
|
} else if (typeof type === "undefined") {
|
|
45139
|
-
type = infer_default(schema,
|
|
45139
|
+
type = infer_default(schema, path10) || type;
|
|
45140
45140
|
if (type) {
|
|
45141
45141
|
schema.type = type;
|
|
45142
45142
|
}
|
|
45143
45143
|
}
|
|
45144
45144
|
if (typeof schema.generate === "function") {
|
|
45145
|
-
const retVal = utils_default.typecast(null, schema, () => schema.generate(rootSchema,
|
|
45145
|
+
const retVal = utils_default.typecast(null, schema, () => schema.generate(rootSchema, path10));
|
|
45146
45146
|
const retType = retVal === null ? "null" : typeof retVal;
|
|
45147
45147
|
if (retType === type || retType === "number" && type === "integer" || Array.isArray(retVal) && type === "array") {
|
|
45148
45148
|
return { value: retVal, context };
|
|
@@ -45157,17 +45157,17 @@ function traverse(schema, path9, resolve2, rootSchema) {
|
|
|
45157
45157
|
if (typeof type === "string") {
|
|
45158
45158
|
if (!types_default[type]) {
|
|
45159
45159
|
if (option_default("failOnInvalidTypes")) {
|
|
45160
|
-
throw new error_default(`unknown primitive ${utils_default.short(type)}`,
|
|
45160
|
+
throw new error_default(`unknown primitive ${utils_default.short(type)}`, path10.concat(["type"]));
|
|
45161
45161
|
} else {
|
|
45162
45162
|
const value = option_default("defaultInvalidTypeProduct");
|
|
45163
45163
|
if (typeof value === "string" && types_default[value]) {
|
|
45164
|
-
return { value: types_default[value](schema,
|
|
45164
|
+
return { value: types_default[value](schema, path10, resolve2, traverse), context };
|
|
45165
45165
|
}
|
|
45166
45166
|
return { value, context };
|
|
45167
45167
|
}
|
|
45168
45168
|
} else {
|
|
45169
45169
|
try {
|
|
45170
|
-
const innerResult = types_default[type](schema,
|
|
45170
|
+
const innerResult = types_default[type](schema, path10, resolve2, traverse);
|
|
45171
45171
|
if (type === "array") {
|
|
45172
45172
|
return {
|
|
45173
45173
|
value: innerResult.map(({ value }) => value),
|
|
@@ -45189,7 +45189,7 @@ function traverse(schema, path9, resolve2, rootSchema) {
|
|
|
45189
45189
|
return { value: innerResult, context };
|
|
45190
45190
|
} catch (e) {
|
|
45191
45191
|
if (typeof e.path === "undefined") {
|
|
45192
|
-
throw new error_default(e.stack,
|
|
45192
|
+
throw new error_default(e.stack, path10);
|
|
45193
45193
|
}
|
|
45194
45194
|
throw e;
|
|
45195
45195
|
}
|
|
@@ -45207,7 +45207,7 @@ function traverse(schema, path9, resolve2, rootSchema) {
|
|
|
45207
45207
|
if (schema[prop] === null)
|
|
45208
45208
|
return;
|
|
45209
45209
|
if (typeof schema[prop] === "object" && prop !== "definitions") {
|
|
45210
|
-
const { value, context: innerContext } = traverse(schema[prop],
|
|
45210
|
+
const { value, context: innerContext } = traverse(schema[prop], path10.concat([prop]), resolve2, valueCopy);
|
|
45211
45211
|
valueCopy[prop] = utils_default.clean(value, schema[prop], false);
|
|
45212
45212
|
contextCopy[prop] = innerContext;
|
|
45213
45213
|
if (valueCopy[prop] === null && option_default("omitNulls")) {
|
|
@@ -45441,11 +45441,11 @@ var Pair = import_types2.default.Pair;
|
|
|
45441
45441
|
var Scalar = import_types2.default.Scalar;
|
|
45442
45442
|
var YAMLMap = import_types2.default.YAMLMap;
|
|
45443
45443
|
var YAMLSeq = import_types2.default.YAMLSeq;
|
|
45444
|
-
function getIn(obj,
|
|
45445
|
-
return
|
|
45444
|
+
function getIn(obj, path10) {
|
|
45445
|
+
return path10.reduce((v, k) => k in v ? v[k] : {}, obj);
|
|
45446
45446
|
}
|
|
45447
|
-
function addComments(context,
|
|
45448
|
-
const { title, description, comment } = getIn(context,
|
|
45447
|
+
function addComments(context, path10, commentNode, iterNode = commentNode) {
|
|
45448
|
+
const { title, description, comment } = getIn(context, path10);
|
|
45449
45449
|
const lines = [];
|
|
45450
45450
|
if (option_default("renderTitle") && title) {
|
|
45451
45451
|
lines.push(` ${title}`, "");
|
|
@@ -45459,11 +45459,11 @@ function addComments(context, path9, commentNode, iterNode = commentNode) {
|
|
|
45459
45459
|
commentNode.commentBefore = lines.join("\n");
|
|
45460
45460
|
if (iterNode instanceof YAMLMap) {
|
|
45461
45461
|
iterNode.items.forEach((n) => {
|
|
45462
|
-
addComments(context, [...
|
|
45462
|
+
addComments(context, [...path10, "items", n.key.value], n.key, n.value);
|
|
45463
45463
|
});
|
|
45464
45464
|
} else if (iterNode instanceof YAMLSeq) {
|
|
45465
45465
|
iterNode.items.forEach((n, i) => {
|
|
45466
|
-
addComments(context, [...
|
|
45466
|
+
addComments(context, [...path10, "items", i], n);
|
|
45467
45467
|
});
|
|
45468
45468
|
}
|
|
45469
45469
|
}
|
|
@@ -47978,6 +47978,10 @@ var globalThisPolyfill = (function() {
|
|
|
47978
47978
|
}
|
|
47979
47979
|
})();
|
|
47980
47980
|
|
|
47981
|
+
// packages/kong-ts/src/lib/connect.ts
|
|
47982
|
+
var KONG_CONNECT_PORT = 41321;
|
|
47983
|
+
var KONG_CONNECT_BASE_URL = `http://localhost:${KONG_CONNECT_PORT}`;
|
|
47984
|
+
|
|
47981
47985
|
// packages/kong-ts/src/lib/cron.ts
|
|
47982
47986
|
var import_cronstrue = __toESM(require_cronstrue());
|
|
47983
47987
|
|
|
@@ -51360,9 +51364,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
51360
51364
|
* @param {string} [path]
|
|
51361
51365
|
* @return {(string|null|Command)}
|
|
51362
51366
|
*/
|
|
51363
|
-
executableDir(
|
|
51364
|
-
if (
|
|
51365
|
-
this._executableDir =
|
|
51367
|
+
executableDir(path10) {
|
|
51368
|
+
if (path10 === void 0) return this._executableDir;
|
|
51369
|
+
this._executableDir = path10;
|
|
51366
51370
|
return this;
|
|
51367
51371
|
}
|
|
51368
51372
|
/**
|
|
@@ -51620,7 +51624,7 @@ var program = new Command();
|
|
|
51620
51624
|
// packages/kong-cli/src/index.ts
|
|
51621
51625
|
var import_dotenv = __toESM(require_main());
|
|
51622
51626
|
var import_dotenv_expand = __toESM(require_main2());
|
|
51623
|
-
var
|
|
51627
|
+
var import_path7 = __toESM(require("path"));
|
|
51624
51628
|
|
|
51625
51629
|
// packages/kong-cli/src/commands/configureCommand.ts
|
|
51626
51630
|
var import_keyring = __toESM(require_keyring());
|
|
@@ -54721,9 +54725,9 @@ function observableToAsyncIterable(source) {
|
|
|
54721
54725
|
|
|
54722
54726
|
// node_modules/inquirer/dist/ui/prompt.js
|
|
54723
54727
|
var _ = {
|
|
54724
|
-
set: (obj,
|
|
54728
|
+
set: (obj, path10 = "", value) => {
|
|
54725
54729
|
let pointer = obj;
|
|
54726
|
-
|
|
54730
|
+
path10.split(".").forEach((key, index, arr) => {
|
|
54727
54731
|
if (key === "__proto__" || key === "constructor")
|
|
54728
54732
|
return;
|
|
54729
54733
|
if (index === arr.length - 1) {
|
|
@@ -54734,8 +54738,8 @@ var _ = {
|
|
|
54734
54738
|
pointer = pointer[key];
|
|
54735
54739
|
});
|
|
54736
54740
|
},
|
|
54737
|
-
get: (obj,
|
|
54738
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
54741
|
+
get: (obj, path10 = "", defaultValue) => {
|
|
54742
|
+
const travel = (regexp) => String.prototype.split.call(path10, regexp).filter(Boolean).reduce(
|
|
54739
54743
|
// @ts-expect-error implicit any on res[key]
|
|
54740
54744
|
(res, key) => res == null ? res : res[key],
|
|
54741
54745
|
obj
|
|
@@ -55978,9 +55982,9 @@ function isVisitable(thing) {
|
|
|
55978
55982
|
function removeBrackets(key) {
|
|
55979
55983
|
return utils_default2.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
55980
55984
|
}
|
|
55981
|
-
function renderKey(
|
|
55982
|
-
if (!
|
|
55983
|
-
return
|
|
55985
|
+
function renderKey(path10, key, dots) {
|
|
55986
|
+
if (!path10) return key;
|
|
55987
|
+
return path10.concat(key).map(function each(token, i) {
|
|
55984
55988
|
token = removeBrackets(token);
|
|
55985
55989
|
return !dots && i ? "[" + token + "]" : token;
|
|
55986
55990
|
}).join(dots ? "." : "");
|
|
@@ -56066,13 +56070,13 @@ function toFormData(obj, formData, options) {
|
|
|
56066
56070
|
return currentValue;
|
|
56067
56071
|
});
|
|
56068
56072
|
}
|
|
56069
|
-
function defaultVisitor(value, key,
|
|
56073
|
+
function defaultVisitor(value, key, path10) {
|
|
56070
56074
|
let arr = value;
|
|
56071
56075
|
if (utils_default2.isReactNative(formData) && utils_default2.isReactNativeBlob(value)) {
|
|
56072
|
-
formData.append(renderKey(
|
|
56076
|
+
formData.append(renderKey(path10, key, dots), convertValue(value));
|
|
56073
56077
|
return false;
|
|
56074
56078
|
}
|
|
56075
|
-
if (value && !
|
|
56079
|
+
if (value && !path10 && typeof value === "object") {
|
|
56076
56080
|
if (utils_default2.endsWith(key, "{}")) {
|
|
56077
56081
|
key = metaTokens ? key : key.slice(0, -2);
|
|
56078
56082
|
value = stringifyWithDepthLimit(value, 1);
|
|
@@ -56091,7 +56095,7 @@ function toFormData(obj, formData, options) {
|
|
|
56091
56095
|
if (isVisitable(value)) {
|
|
56092
56096
|
return true;
|
|
56093
56097
|
}
|
|
56094
|
-
formData.append(renderKey(
|
|
56098
|
+
formData.append(renderKey(path10, key, dots), convertValue(value));
|
|
56095
56099
|
return false;
|
|
56096
56100
|
}
|
|
56097
56101
|
const exposedHelpers = Object.assign(predicates, {
|
|
@@ -56099,17 +56103,17 @@ function toFormData(obj, formData, options) {
|
|
|
56099
56103
|
convertValue,
|
|
56100
56104
|
isVisitable
|
|
56101
56105
|
});
|
|
56102
|
-
function build(value,
|
|
56106
|
+
function build(value, path10, depth = 0) {
|
|
56103
56107
|
if (utils_default2.isUndefined(value)) return;
|
|
56104
56108
|
throwIfMaxDepthExceeded(depth);
|
|
56105
56109
|
if (stack.indexOf(value) !== -1) {
|
|
56106
|
-
throw new Error("Circular reference detected in " +
|
|
56110
|
+
throw new Error("Circular reference detected in " + path10.join("."));
|
|
56107
56111
|
}
|
|
56108
56112
|
stack.push(value);
|
|
56109
56113
|
utils_default2.forEach(value, function each(el, key) {
|
|
56110
|
-
const result = !(utils_default2.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default2.isString(key) ? key.trim() : key,
|
|
56114
|
+
const result = !(utils_default2.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default2.isString(key) ? key.trim() : key, path10, exposedHelpers);
|
|
56111
56115
|
if (result === true) {
|
|
56112
|
-
build(el,
|
|
56116
|
+
build(el, path10 ? path10.concat(key) : [key], depth + 1);
|
|
56113
56117
|
}
|
|
56114
56118
|
});
|
|
56115
56119
|
stack.pop();
|
|
@@ -56321,7 +56325,7 @@ var platform_default = {
|
|
|
56321
56325
|
// node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
56322
56326
|
function toURLEncodedForm(data, options) {
|
|
56323
56327
|
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
|
|
56324
|
-
visitor: function(value, key,
|
|
56328
|
+
visitor: function(value, key, path10, helpers) {
|
|
56325
56329
|
if (platform_default.isNode && utils_default2.isBuffer(value)) {
|
|
56326
56330
|
this.append(key, value.toString("base64"));
|
|
56327
56331
|
return false;
|
|
@@ -56343,14 +56347,14 @@ function throwIfDepthExceeded(index) {
|
|
|
56343
56347
|
}
|
|
56344
56348
|
}
|
|
56345
56349
|
function parsePropPath(name) {
|
|
56346
|
-
const
|
|
56350
|
+
const path10 = [];
|
|
56347
56351
|
const pattern = /\w+|\[(\w*)]/g;
|
|
56348
56352
|
let match2;
|
|
56349
56353
|
while ((match2 = pattern.exec(name)) !== null) {
|
|
56350
|
-
throwIfDepthExceeded(
|
|
56351
|
-
|
|
56354
|
+
throwIfDepthExceeded(path10.length);
|
|
56355
|
+
path10.push(match2[0] === "[]" ? "" : match2[1] || match2[0]);
|
|
56352
56356
|
}
|
|
56353
|
-
return
|
|
56357
|
+
return path10;
|
|
56354
56358
|
}
|
|
56355
56359
|
function arrayToObject(arr) {
|
|
56356
56360
|
const obj = {};
|
|
@@ -56365,12 +56369,12 @@ function arrayToObject(arr) {
|
|
|
56365
56369
|
return obj;
|
|
56366
56370
|
}
|
|
56367
56371
|
function formDataToJSON(formData) {
|
|
56368
|
-
function buildPath(
|
|
56372
|
+
function buildPath(path10, value, target, index) {
|
|
56369
56373
|
throwIfDepthExceeded(index);
|
|
56370
|
-
let name =
|
|
56374
|
+
let name = path10[index++];
|
|
56371
56375
|
if (name === "__proto__") return true;
|
|
56372
56376
|
const isNumericKey = Number.isFinite(+name);
|
|
56373
|
-
const isLast = index >=
|
|
56377
|
+
const isLast = index >= path10.length;
|
|
56374
56378
|
name = !name && utils_default2.isArray(target) ? target.length : name;
|
|
56375
56379
|
if (isLast) {
|
|
56376
56380
|
if (utils_default2.hasOwnProp(target, name)) {
|
|
@@ -56383,7 +56387,7 @@ function formDataToJSON(formData) {
|
|
|
56383
56387
|
if (!utils_default2.hasOwnProp(target, name) || !utils_default2.isObject(target[name])) {
|
|
56384
56388
|
target[name] = [];
|
|
56385
56389
|
}
|
|
56386
|
-
const result = buildPath(
|
|
56390
|
+
const result = buildPath(path10, value, target[name], index);
|
|
56387
56391
|
if (result && utils_default2.isArray(target[name])) {
|
|
56388
56392
|
target[name] = arrayToObject(target[name]);
|
|
56389
56393
|
}
|
|
@@ -57977,9 +57981,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
57977
57981
|
auth = urlUsername + ":" + urlPassword;
|
|
57978
57982
|
}
|
|
57979
57983
|
auth && headers.delete("authorization");
|
|
57980
|
-
let
|
|
57984
|
+
let path10;
|
|
57981
57985
|
try {
|
|
57982
|
-
|
|
57986
|
+
path10 = buildURL(
|
|
57983
57987
|
parsed.pathname + parsed.search,
|
|
57984
57988
|
own2("params"),
|
|
57985
57989
|
own2("paramsSerializer")
|
|
@@ -57998,7 +58002,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
57998
58002
|
false
|
|
57999
58003
|
);
|
|
58000
58004
|
const options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
58001
|
-
path:
|
|
58005
|
+
path: path10,
|
|
58002
58006
|
method,
|
|
58003
58007
|
headers: toByteStringHeaderObject(headers),
|
|
58004
58008
|
agents: { http: httpAgent, https: httpsAgent },
|
|
@@ -58400,14 +58404,14 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
|
|
|
58400
58404
|
var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
58401
58405
|
// Standard browser envs support document.cookie
|
|
58402
58406
|
{
|
|
58403
|
-
write(name, value, expires,
|
|
58407
|
+
write(name, value, expires, path10, domain, secure, sameSite) {
|
|
58404
58408
|
if (typeof document === "undefined") return;
|
|
58405
58409
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
58406
58410
|
if (utils_default2.isNumber(expires)) {
|
|
58407
58411
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
58408
58412
|
}
|
|
58409
|
-
if (utils_default2.isString(
|
|
58410
|
-
cookie.push(`path=${
|
|
58413
|
+
if (utils_default2.isString(path10)) {
|
|
58414
|
+
cookie.push(`path=${path10}`);
|
|
58411
58415
|
}
|
|
58412
58416
|
if (utils_default2.isString(domain)) {
|
|
58413
58417
|
cookie.push(`domain=${domain}`);
|
|
@@ -60893,12 +60897,470 @@ var ConfigureCommand = class {
|
|
|
60893
60897
|
}
|
|
60894
60898
|
};
|
|
60895
60899
|
|
|
60900
|
+
// packages/kong-cli/src/commands/connectCommand.ts
|
|
60901
|
+
var import_child_process2 = require("child_process");
|
|
60902
|
+
var import_fs3 = __toESM(require("fs"));
|
|
60903
|
+
var import_http4 = __toESM(require("http"));
|
|
60904
|
+
var import_os2 = __toESM(require("os"));
|
|
60905
|
+
var import_path4 = __toESM(require("path"));
|
|
60906
|
+
|
|
60907
|
+
// packages/kong-cli/src/services/api.ts
|
|
60908
|
+
var import_keyring2 = __toESM(require_keyring());
|
|
60909
|
+
|
|
60910
|
+
// node_modules/jwt-decode/build/esm/index.js
|
|
60911
|
+
var InvalidTokenError = class extends Error {
|
|
60912
|
+
};
|
|
60913
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
60914
|
+
function b64DecodeUnicode(str) {
|
|
60915
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
60916
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
60917
|
+
if (code.length < 2) {
|
|
60918
|
+
code = "0" + code;
|
|
60919
|
+
}
|
|
60920
|
+
return "%" + code;
|
|
60921
|
+
}));
|
|
60922
|
+
}
|
|
60923
|
+
function base64UrlDecode(str) {
|
|
60924
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
60925
|
+
switch (output.length % 4) {
|
|
60926
|
+
case 0:
|
|
60927
|
+
break;
|
|
60928
|
+
case 2:
|
|
60929
|
+
output += "==";
|
|
60930
|
+
break;
|
|
60931
|
+
case 3:
|
|
60932
|
+
output += "=";
|
|
60933
|
+
break;
|
|
60934
|
+
default:
|
|
60935
|
+
throw new Error("base64 string is not of the correct length");
|
|
60936
|
+
}
|
|
60937
|
+
try {
|
|
60938
|
+
return b64DecodeUnicode(output);
|
|
60939
|
+
} catch (err) {
|
|
60940
|
+
return atob(output);
|
|
60941
|
+
}
|
|
60942
|
+
}
|
|
60943
|
+
function jwtDecode(token, options) {
|
|
60944
|
+
if (typeof token !== "string") {
|
|
60945
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
60946
|
+
}
|
|
60947
|
+
options || (options = {});
|
|
60948
|
+
const pos = options.header === true ? 0 : 1;
|
|
60949
|
+
const part = token.split(".")[pos];
|
|
60950
|
+
if (typeof part !== "string") {
|
|
60951
|
+
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
60952
|
+
}
|
|
60953
|
+
let decoded;
|
|
60954
|
+
try {
|
|
60955
|
+
decoded = base64UrlDecode(part);
|
|
60956
|
+
} catch (e) {
|
|
60957
|
+
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
60958
|
+
}
|
|
60959
|
+
try {
|
|
60960
|
+
return JSON.parse(decoded);
|
|
60961
|
+
} catch (e) {
|
|
60962
|
+
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
60963
|
+
}
|
|
60964
|
+
}
|
|
60965
|
+
|
|
60966
|
+
// packages/kong-cli/src/services/api.ts
|
|
60967
|
+
function requestConfigProvider(profile) {
|
|
60968
|
+
const cached = {
|
|
60969
|
+
headers: {
|
|
60970
|
+
"Content-Type": "application/json",
|
|
60971
|
+
"X-App-Tenant": parseTenant(profile.kongBaseUrl)
|
|
60972
|
+
}
|
|
60973
|
+
};
|
|
60974
|
+
return async () => {
|
|
60975
|
+
if (cached.headers?.Authorization) {
|
|
60976
|
+
try {
|
|
60977
|
+
const auth = cached.headers.Authorization;
|
|
60978
|
+
const accessToken = auth.split("Bearer ")[1]?.trim();
|
|
60979
|
+
if (accessToken) {
|
|
60980
|
+
const decoded = jwtDecode(accessToken);
|
|
60981
|
+
if (decoded.exp !== void 0) {
|
|
60982
|
+
const nowSeconds = Date.now() / 1e3;
|
|
60983
|
+
if (decoded.exp > nowSeconds + 60) {
|
|
60984
|
+
return cached;
|
|
60985
|
+
}
|
|
60986
|
+
}
|
|
60987
|
+
}
|
|
60988
|
+
} catch (ex) {
|
|
60989
|
+
console.warn("failed to use cached token, fetching new one", ex);
|
|
60990
|
+
}
|
|
60991
|
+
}
|
|
60992
|
+
const url2 = joinUrlAndPath(
|
|
60993
|
+
profile.kongBaseUrl,
|
|
60994
|
+
"api/keycloak/realms/kong/protocol/openid-connect/token"
|
|
60995
|
+
);
|
|
60996
|
+
const entry = new import_keyring2.Entry(profile.kongBaseUrl, profile.userName);
|
|
60997
|
+
const password = entry.getPassword();
|
|
60998
|
+
if (!password) {
|
|
60999
|
+
throw new Error("No password found in keyring for user: " + profile.userName);
|
|
61000
|
+
}
|
|
61001
|
+
const params = new URLSearchParams({
|
|
61002
|
+
grant_type: "password",
|
|
61003
|
+
client_id: "kong-web",
|
|
61004
|
+
username: profile.userName,
|
|
61005
|
+
password
|
|
61006
|
+
});
|
|
61007
|
+
const response = await axios_default.post(url2, params, {
|
|
61008
|
+
headers: {
|
|
61009
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
61010
|
+
}
|
|
61011
|
+
});
|
|
61012
|
+
cached.headers = {
|
|
61013
|
+
...cached.headers,
|
|
61014
|
+
["Authorization"]: `Bearer ${response.data.access_token}`
|
|
61015
|
+
};
|
|
61016
|
+
return cached;
|
|
61017
|
+
};
|
|
61018
|
+
}
|
|
61019
|
+
|
|
61020
|
+
// packages/kong-cli/src/services/managementClient.ts
|
|
61021
|
+
var ManagementClient = class {
|
|
61022
|
+
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
61023
|
+
this.requestConfigProvider = requestConfigProvider2;
|
|
61024
|
+
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/management");
|
|
61025
|
+
}
|
|
61026
|
+
async updateExtension(extension) {
|
|
61027
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
|
|
61028
|
+
await axios_default.put(url2, extension, await this.requestConfigProvider());
|
|
61029
|
+
}
|
|
61030
|
+
async createExtensionSnapshot(extensionId, snapshot) {
|
|
61031
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
|
|
61032
|
+
await axios_default.post(url2, snapshot, await this.requestConfigProvider());
|
|
61033
|
+
}
|
|
61034
|
+
async getExtensionSnapshot(extensionId, extensionSnapshotVersion) {
|
|
61035
|
+
const url2 = joinUrlAndPath(
|
|
61036
|
+
this.baseUrl,
|
|
61037
|
+
"v1/extensions",
|
|
61038
|
+
extensionId,
|
|
61039
|
+
"snapshots",
|
|
61040
|
+
extensionSnapshotVersion
|
|
61041
|
+
);
|
|
61042
|
+
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
61043
|
+
}
|
|
61044
|
+
async getExtensionSnapshotVersions(extensionId) {
|
|
61045
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
|
|
61046
|
+
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
61047
|
+
}
|
|
61048
|
+
async getExtensionSnapshotAliases(extensionId) {
|
|
61049
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
|
|
61050
|
+
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
61051
|
+
}
|
|
61052
|
+
async getDocumentSnapshotVersions(documentId) {
|
|
61053
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/documents", documentId, "/snapshots/versions");
|
|
61054
|
+
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
61055
|
+
}
|
|
61056
|
+
async getProcessAliases(documentId) {
|
|
61057
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/processes", documentId, "/aliases");
|
|
61058
|
+
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
61059
|
+
}
|
|
61060
|
+
async getAuditLog(objectType2, objectId, createdAfter) {
|
|
61061
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/audit");
|
|
61062
|
+
const config = await this.requestConfigProvider();
|
|
61063
|
+
const response = await axios_default.get(url2, {
|
|
61064
|
+
...config,
|
|
61065
|
+
params: { ...config.params, objectType: objectType2, objectId, createdAfter }
|
|
61066
|
+
});
|
|
61067
|
+
return response.data;
|
|
61068
|
+
}
|
|
61069
|
+
};
|
|
61070
|
+
|
|
61071
|
+
// packages/kong-cli/src/services/registryClient.ts
|
|
61072
|
+
var RegistryClient = class {
|
|
61073
|
+
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
61074
|
+
this.requestConfigProvider = requestConfigProvider2;
|
|
61075
|
+
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/registry");
|
|
61076
|
+
}
|
|
61077
|
+
async getPublishDetails(appName) {
|
|
61078
|
+
const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
|
|
61079
|
+
return (await axios_default.post(url2, {}, await this.requestConfigProvider())).data;
|
|
61080
|
+
}
|
|
61081
|
+
};
|
|
61082
|
+
|
|
61083
|
+
// packages/kong-cli/src/commands/connectCommand.ts
|
|
61084
|
+
var DOCKERFILE = `# syntax=docker/dockerfile:1
|
|
61085
|
+
FROM --platform=linux/amd64 python:3.13.1-slim-bookworm
|
|
61086
|
+
|
|
61087
|
+
ENV APP_DIR=/deployments/app \\
|
|
61088
|
+
PYTHONUNBUFFERED=1 \\
|
|
61089
|
+
PYTHONDONTWRITEBYTECODE=1
|
|
61090
|
+
|
|
61091
|
+
WORKDIR $APP_DIR
|
|
61092
|
+
|
|
61093
|
+
COPY --chown=1001:root ./requirements.txt ./requirements.txt
|
|
61094
|
+
RUN pip install --upgrade pip && \\
|
|
61095
|
+
pip install -r requirements.txt
|
|
61096
|
+
|
|
61097
|
+
COPY --chown=1001:root ./src ./src
|
|
61098
|
+
|
|
61099
|
+
RUN useradd --uid 1001 --gid root --create-home app \\
|
|
61100
|
+
&& chown 1001:root $APP_DIR \\
|
|
61101
|
+
&& chmod "g+rwX" $APP_DIR
|
|
61102
|
+
|
|
61103
|
+
USER 1001
|
|
61104
|
+
|
|
61105
|
+
CMD ["python", "./src/main.py"]
|
|
61106
|
+
`;
|
|
61107
|
+
var PYPROJECT = `[tool.pytest.ini_options]
|
|
61108
|
+
asyncio_mode = "auto"
|
|
61109
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
61110
|
+
`;
|
|
61111
|
+
var TEST_DEPENDENCIES = ["pytest==9.1.1", "pytest-asyncio==1.4.0"];
|
|
61112
|
+
var ConnectCommand = class {
|
|
61113
|
+
constructor(profileName, profile) {
|
|
61114
|
+
this.profileName = profileName;
|
|
61115
|
+
this.profile = profile;
|
|
61116
|
+
this.isWin = process.platform === "win32";
|
|
61117
|
+
const provider = requestConfigProvider(profile);
|
|
61118
|
+
this.registryClient = new RegistryClient(profile.kongBaseUrl, provider);
|
|
61119
|
+
this.managementClient = new ManagementClient(profile.kongBaseUrl, provider);
|
|
61120
|
+
}
|
|
61121
|
+
async execute() {
|
|
61122
|
+
const server = import_http4.default.createServer((request, response) => {
|
|
61123
|
+
this.handle(request, response).catch((ex) => {
|
|
61124
|
+
console.error("request failed", ex);
|
|
61125
|
+
if (!response.headersSent) {
|
|
61126
|
+
this.json(response, 500, { error: String(ex) });
|
|
61127
|
+
}
|
|
61128
|
+
});
|
|
61129
|
+
});
|
|
61130
|
+
server.listen(KONG_CONNECT_PORT, () => {
|
|
61131
|
+
console.info(
|
|
61132
|
+
`kong connect is listening on http://localhost:${KONG_CONNECT_PORT} (profile=${this.profileName}, baseUrl=${this.profile.kongBaseUrl})`
|
|
61133
|
+
);
|
|
61134
|
+
console.info("keep this terminal open while working in the kong ui; ctrl+c to stop");
|
|
61135
|
+
});
|
|
61136
|
+
}
|
|
61137
|
+
async handle(request, response) {
|
|
61138
|
+
response.setHeader("Access-Control-Allow-Origin", "*");
|
|
61139
|
+
response.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
61140
|
+
response.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
61141
|
+
if (request.method === "OPTIONS") {
|
|
61142
|
+
response.writeHead(204);
|
|
61143
|
+
response.end();
|
|
61144
|
+
return;
|
|
61145
|
+
}
|
|
61146
|
+
const url2 = new URL(request.url ?? "/", `http://localhost:${KONG_CONNECT_PORT}`);
|
|
61147
|
+
if (request.method === "GET" && url2.pathname === "/v1/profile") {
|
|
61148
|
+
this.json(response, 200, this.profileInfo());
|
|
61149
|
+
return;
|
|
61150
|
+
}
|
|
61151
|
+
if (request.method === "POST" && url2.pathname === "/v1/tests") {
|
|
61152
|
+
const body = await this.readBody(request);
|
|
61153
|
+
this.json(response, 200, await this.runTests(body));
|
|
61154
|
+
return;
|
|
61155
|
+
}
|
|
61156
|
+
if (request.method === "POST" && url2.pathname === "/v1/deployments") {
|
|
61157
|
+
const body = await this.readBody(request);
|
|
61158
|
+
this.json(response, 200, await this.deploy(body));
|
|
61159
|
+
return;
|
|
61160
|
+
}
|
|
61161
|
+
this.json(response, 404, { error: `unknown route ${request.method} ${url2.pathname}` });
|
|
61162
|
+
}
|
|
61163
|
+
profileInfo() {
|
|
61164
|
+
return {
|
|
61165
|
+
profile: this.profileName,
|
|
61166
|
+
baseUrl: this.profile.kongBaseUrl,
|
|
61167
|
+
userName: this.profile.userName,
|
|
61168
|
+
docker: !(0, import_child_process2.spawnSync)("docker", ["--version"]).error,
|
|
61169
|
+
python: !(0, import_child_process2.spawnSync)(this.pythonBin(), ["--version"]).error
|
|
61170
|
+
};
|
|
61171
|
+
}
|
|
61172
|
+
/** Runs only src/main_test.py in a fresh venv and returns the raw output. */
|
|
61173
|
+
async runTests(request) {
|
|
61174
|
+
const workDir = this.materialize(request.files);
|
|
61175
|
+
try {
|
|
61176
|
+
const log = [];
|
|
61177
|
+
const prepared = await this.prepareVenv(workDir, log);
|
|
61178
|
+
if (prepared.exitCode !== 0) {
|
|
61179
|
+
return { passed: false, output: log.join("\n") };
|
|
61180
|
+
}
|
|
61181
|
+
const result = await this.run(
|
|
61182
|
+
this.venvPython(workDir),
|
|
61183
|
+
["-m", "pytest", import_path4.default.join("src", "main_test.py"), "-v"],
|
|
61184
|
+
workDir
|
|
61185
|
+
);
|
|
61186
|
+
log.push(result.output);
|
|
61187
|
+
return { passed: result.exitCode === 0, output: log.join("\n") };
|
|
61188
|
+
} finally {
|
|
61189
|
+
import_fs3.default.rmSync(workDir, { recursive: true, force: true });
|
|
61190
|
+
}
|
|
61191
|
+
}
|
|
61192
|
+
/**
|
|
61193
|
+
* The client-side twin of the kong-build pipeline: docker build + push from
|
|
61194
|
+
* this machine (requirements.txt applied), schema generated locally with
|
|
61195
|
+
* `main.py --schema`, then the snapshot registered in kong-management.
|
|
61196
|
+
*/
|
|
61197
|
+
async deploy(request) {
|
|
61198
|
+
const workDir = this.materialize(request.files);
|
|
61199
|
+
try {
|
|
61200
|
+
const log = [];
|
|
61201
|
+
import_fs3.default.writeFileSync(import_path4.default.join(workDir, "Dockerfile"), DOCKERFILE);
|
|
61202
|
+
const prepared = await this.prepareVenv(workDir, log);
|
|
61203
|
+
if (prepared.exitCode !== 0) {
|
|
61204
|
+
throw new Error(`dependency install failed:
|
|
61205
|
+
${log.join("\n")}`);
|
|
61206
|
+
}
|
|
61207
|
+
const schema = await this.run(
|
|
61208
|
+
this.venvPython(workDir),
|
|
61209
|
+
[import_path4.default.join("src", "main.py"), "--schema"],
|
|
61210
|
+
workDir
|
|
61211
|
+
);
|
|
61212
|
+
if (schema.exitCode !== 0) {
|
|
61213
|
+
throw new Error(`schema generation failed:
|
|
61214
|
+
${schema.output}`);
|
|
61215
|
+
}
|
|
61216
|
+
const contract = JSON.parse(schema.output);
|
|
61217
|
+
const tenant = parseTenant(this.profile.kongBaseUrl);
|
|
61218
|
+
const publishDetails = await this.registryClient.getPublishDetails(
|
|
61219
|
+
`${tenant}-k-extension-${request.extensionId}`
|
|
61220
|
+
);
|
|
61221
|
+
const registryUrl = publishDetails.repoName === "docker-registry:5000" ? "localhost:5000" : publishDetails.repoName;
|
|
61222
|
+
const imageName = `${registryUrl}/${publishDetails.imageName}:${publishDetails.imageVersion}`;
|
|
61223
|
+
for (const step of [
|
|
61224
|
+
{
|
|
61225
|
+
title: "docker login",
|
|
61226
|
+
command: "docker",
|
|
61227
|
+
args: ["login", "-u", publishDetails.userName, "--password-stdin", registryUrl],
|
|
61228
|
+
stdin: publishDetails.token
|
|
61229
|
+
},
|
|
61230
|
+
{
|
|
61231
|
+
title: "docker build",
|
|
61232
|
+
command: "docker",
|
|
61233
|
+
args: ["build", "--network=host", "-t", imageName, "-f", "Dockerfile", "."]
|
|
61234
|
+
},
|
|
61235
|
+
{ title: "docker push", command: "docker", args: ["push", imageName] }
|
|
61236
|
+
]) {
|
|
61237
|
+
log.push(`> ${step.title}`);
|
|
61238
|
+
const result = await this.run(step.command, step.args, workDir, step.stdin);
|
|
61239
|
+
log.push(result.output);
|
|
61240
|
+
if (result.exitCode !== 0) {
|
|
61241
|
+
throw new Error(`${step.title} failed:
|
|
61242
|
+
${log.join("\n")}`);
|
|
61243
|
+
}
|
|
61244
|
+
}
|
|
61245
|
+
const version = Number(publishDetails.imageVersion);
|
|
61246
|
+
await this.managementClient.createExtensionSnapshot(
|
|
61247
|
+
request.extensionId,
|
|
61248
|
+
this.snapshotFor(request, version, contract)
|
|
61249
|
+
);
|
|
61250
|
+
log.push(`the version ${version} has been successfully published!`);
|
|
61251
|
+
return { version, output: log.join("\n") };
|
|
61252
|
+
} finally {
|
|
61253
|
+
import_fs3.default.rmSync(workDir, { recursive: true, force: true });
|
|
61254
|
+
}
|
|
61255
|
+
}
|
|
61256
|
+
snapshotFor(request, version, contract) {
|
|
61257
|
+
return {
|
|
61258
|
+
extensionId: request.extensionId,
|
|
61259
|
+
extensionName: request.extensionName,
|
|
61260
|
+
sdk: "python",
|
|
61261
|
+
inputSchema: contract.input,
|
|
61262
|
+
outputSchema: contract.output,
|
|
61263
|
+
metadata: {
|
|
61264
|
+
id: request.extensionId,
|
|
61265
|
+
name: request.extensionName,
|
|
61266
|
+
sdk: "python",
|
|
61267
|
+
settings: {
|
|
61268
|
+
input: { filter: jqFilter(""), schema: contract.input },
|
|
61269
|
+
output: { filter: jqFilter(""), schema: contract.output }
|
|
61270
|
+
}
|
|
61271
|
+
},
|
|
61272
|
+
version,
|
|
61273
|
+
notes: request.notes ?? "",
|
|
61274
|
+
checkpoint: "",
|
|
61275
|
+
created: utcNow(DEFAULT_TIMEZONE),
|
|
61276
|
+
createdBy: ""
|
|
61277
|
+
};
|
|
61278
|
+
}
|
|
61279
|
+
/** Writes the bundle to a fresh temp folder, decoding binary entries. */
|
|
61280
|
+
materialize(files) {
|
|
61281
|
+
const workDir = import_fs3.default.mkdtempSync(import_path4.default.join(import_os2.default.tmpdir(), `kong-connect-${generateShortId()}-`));
|
|
61282
|
+
for (const file of files) {
|
|
61283
|
+
const target = import_path4.default.resolve(workDir, file.name);
|
|
61284
|
+
if (!target.startsWith(workDir)) {
|
|
61285
|
+
continue;
|
|
61286
|
+
}
|
|
61287
|
+
import_fs3.default.mkdirSync(import_path4.default.dirname(target), { recursive: true });
|
|
61288
|
+
import_fs3.default.writeFileSync(
|
|
61289
|
+
target,
|
|
61290
|
+
file.binary === true ? Buffer.from(file.content, "base64") : file.content
|
|
61291
|
+
);
|
|
61292
|
+
}
|
|
61293
|
+
import_fs3.default.writeFileSync(import_path4.default.join(workDir, "pyproject.toml"), PYPROJECT);
|
|
61294
|
+
return workDir;
|
|
61295
|
+
}
|
|
61296
|
+
async prepareVenv(workDir, log) {
|
|
61297
|
+
const venv = await this.run(this.pythonBin(), ["-m", "venv", "--clear", ".venv"], workDir);
|
|
61298
|
+
log.push(venv.output);
|
|
61299
|
+
if (venv.exitCode !== 0) {
|
|
61300
|
+
return venv;
|
|
61301
|
+
}
|
|
61302
|
+
const install = await this.run(
|
|
61303
|
+
this.venvPython(workDir),
|
|
61304
|
+
[
|
|
61305
|
+
"-m",
|
|
61306
|
+
"pip",
|
|
61307
|
+
"install",
|
|
61308
|
+
"--default-timeout=120",
|
|
61309
|
+
"-r",
|
|
61310
|
+
"requirements.txt",
|
|
61311
|
+
...TEST_DEPENDENCIES
|
|
61312
|
+
],
|
|
61313
|
+
workDir
|
|
61314
|
+
);
|
|
61315
|
+
log.push(install.output);
|
|
61316
|
+
return install;
|
|
61317
|
+
}
|
|
61318
|
+
pythonBin() {
|
|
61319
|
+
return (0, import_child_process2.spawnSync)("python", ["--version"]).error ? "python3" : "python";
|
|
61320
|
+
}
|
|
61321
|
+
venvPython(workDir) {
|
|
61322
|
+
return this.isWin ? import_path4.default.join(workDir, ".venv", "Scripts", "python.exe") : import_path4.default.join(workDir, ".venv", "bin", "python");
|
|
61323
|
+
}
|
|
61324
|
+
run(command, args, cwd, stdin) {
|
|
61325
|
+
return new Promise((resolve2) => {
|
|
61326
|
+
const child = (0, import_child_process2.spawn)(command, args, { cwd });
|
|
61327
|
+
const chunks = [];
|
|
61328
|
+
child.stdout.on("data", (data) => chunks.push(String(data)));
|
|
61329
|
+
child.stderr.on("data", (data) => chunks.push(String(data)));
|
|
61330
|
+
child.on("error", (error) => resolve2({ exitCode: -1, output: String(error) }));
|
|
61331
|
+
child.on("close", (exitCode) => resolve2({ exitCode: exitCode ?? -1, output: chunks.join("") }));
|
|
61332
|
+
if (stdin !== void 0) {
|
|
61333
|
+
child.stdin.write(stdin);
|
|
61334
|
+
}
|
|
61335
|
+
child.stdin.end();
|
|
61336
|
+
});
|
|
61337
|
+
}
|
|
61338
|
+
readBody(request) {
|
|
61339
|
+
return new Promise((resolve2, reject) => {
|
|
61340
|
+
const chunks = [];
|
|
61341
|
+
request.on("data", (chunk) => chunks.push(chunk));
|
|
61342
|
+
request.on("error", reject);
|
|
61343
|
+
request.on("end", () => {
|
|
61344
|
+
try {
|
|
61345
|
+
resolve2(JSON.parse(Buffer.concat(chunks).toString("utf-8") || "{}"));
|
|
61346
|
+
} catch (ex) {
|
|
61347
|
+
reject(ex instanceof Error ? ex : new Error(String(ex)));
|
|
61348
|
+
}
|
|
61349
|
+
});
|
|
61350
|
+
});
|
|
61351
|
+
}
|
|
61352
|
+
json(response, status, body) {
|
|
61353
|
+
response.writeHead(status, { "Content-Type": "application/json" });
|
|
61354
|
+
response.end(JSON.stringify(body));
|
|
61355
|
+
}
|
|
61356
|
+
};
|
|
61357
|
+
|
|
60896
61358
|
// packages/kong-cli/src/commands/generateCommand.ts
|
|
60897
61359
|
var import_create_nx_workspace = require("create-nx-workspace");
|
|
60898
61360
|
|
|
60899
61361
|
// packages/kong-cli/src/common/kongJson.ts
|
|
60900
61362
|
var import_ajv = __toESM(require_ajv());
|
|
60901
|
-
var
|
|
61363
|
+
var import_fs4 = __toESM(require("fs"));
|
|
60902
61364
|
|
|
60903
61365
|
// packages/kong-cli/src/common/kongJsonSchema.ts
|
|
60904
61366
|
var KONG_JSON_SCHEMA = {
|
|
@@ -61059,7 +61521,7 @@ function validateKongJson(kongJson) {
|
|
|
61059
61521
|
function getKongJson() {
|
|
61060
61522
|
const kongJsonPath = resolveProjectPath("kong.json");
|
|
61061
61523
|
try {
|
|
61062
|
-
const fileContent =
|
|
61524
|
+
const fileContent = import_fs4.default.readFileSync(kongJsonPath, "utf-8");
|
|
61063
61525
|
const kongJson = JSON.parse(fileContent);
|
|
61064
61526
|
return validateKongJson(kongJson);
|
|
61065
61527
|
} catch (ex) {
|
|
@@ -61124,52 +61586,15 @@ var eventemitter3_default = import_index.default;
|
|
|
61124
61586
|
// node_modules/listr2/dist/index.mjs
|
|
61125
61587
|
var import_node_util11 = require("node:util");
|
|
61126
61588
|
var import_util4 = require("util");
|
|
61127
|
-
var
|
|
61589
|
+
var import_os3 = require("os");
|
|
61128
61590
|
var import_string_decoder = require("string_decoder");
|
|
61129
61591
|
var import_stream5 = require("stream");
|
|
61130
61592
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
61131
61593
|
var import_crypto2 = require("crypto");
|
|
61132
|
-
var ANSI_ESCAPE2 = "\x1B[";
|
|
61133
61594
|
var ANSI_ESCAPE_CODES = {
|
|
61134
|
-
CURSOR_HIDE:
|
|
61135
|
-
CURSOR_SHOW:
|
|
61595
|
+
CURSOR_HIDE: "\x1B[?25l",
|
|
61596
|
+
CURSOR_SHOW: "\x1B[?25h"
|
|
61136
61597
|
};
|
|
61137
|
-
var ListrEnvironmentVariables = /* @__PURE__ */ (function(ListrEnvironmentVariables2) {
|
|
61138
|
-
ListrEnvironmentVariables2["FORCE_UNICODE"] = "LISTR_FORCE_UNICODE";
|
|
61139
|
-
ListrEnvironmentVariables2["FORCE_TTY"] = "LISTR_FORCE_TTY";
|
|
61140
|
-
ListrEnvironmentVariables2["DISABLE_COLOR"] = "NO_COLOR";
|
|
61141
|
-
ListrEnvironmentVariables2["FORCE_COLOR"] = "FORCE_COLOR";
|
|
61142
|
-
return ListrEnvironmentVariables2;
|
|
61143
|
-
})({});
|
|
61144
|
-
var ListrErrorTypes = /* @__PURE__ */ (function(ListrErrorTypes2) {
|
|
61145
|
-
ListrErrorTypes2["WILL_RETRY"] = "WILL_RETRY";
|
|
61146
|
-
ListrErrorTypes2["WILL_ROLLBACK"] = "WILL_ROLLBACK";
|
|
61147
|
-
ListrErrorTypes2["HAS_FAILED_TO_ROLLBACK"] = "HAS_FAILED_TO_ROLLBACK";
|
|
61148
|
-
ListrErrorTypes2["HAS_FAILED"] = "HAS_FAILED";
|
|
61149
|
-
ListrErrorTypes2["HAS_FAILED_WITHOUT_ERROR"] = "HAS_FAILED_WITHOUT_ERROR";
|
|
61150
|
-
return ListrErrorTypes2;
|
|
61151
|
-
})({});
|
|
61152
|
-
var ListrEventType = /* @__PURE__ */ (function(ListrEventType2) {
|
|
61153
|
-
ListrEventType2["SHOULD_REFRESH_RENDER"] = "SHOUD_REFRESH_RENDER";
|
|
61154
|
-
return ListrEventType2;
|
|
61155
|
-
})({});
|
|
61156
|
-
var ListrRendererSelection = /* @__PURE__ */ (function(ListrRendererSelection2) {
|
|
61157
|
-
ListrRendererSelection2["PRIMARY"] = "PRIMARY";
|
|
61158
|
-
ListrRendererSelection2["SECONDARY"] = "SECONDARY";
|
|
61159
|
-
ListrRendererSelection2["SILENT"] = "SILENT";
|
|
61160
|
-
return ListrRendererSelection2;
|
|
61161
|
-
})({});
|
|
61162
|
-
var ListrTaskEventType = /* @__PURE__ */ (function(ListrTaskEventType2) {
|
|
61163
|
-
ListrTaskEventType2["TITLE"] = "TITLE";
|
|
61164
|
-
ListrTaskEventType2["STATE"] = "STATE";
|
|
61165
|
-
ListrTaskEventType2["ENABLED"] = "ENABLED";
|
|
61166
|
-
ListrTaskEventType2["SUBTASK"] = "SUBTASK";
|
|
61167
|
-
ListrTaskEventType2["PROMPT"] = "PROMPT";
|
|
61168
|
-
ListrTaskEventType2["OUTPUT"] = "OUTPUT";
|
|
61169
|
-
ListrTaskEventType2["MESSAGE"] = "MESSAGE";
|
|
61170
|
-
ListrTaskEventType2["CLOSED"] = "CLOSED";
|
|
61171
|
-
return ListrTaskEventType2;
|
|
61172
|
-
})({});
|
|
61173
61598
|
var ListrTaskState = /* @__PURE__ */ (function(ListrTaskState2) {
|
|
61174
61599
|
ListrTaskState2["WAITING"] = "WAITING";
|
|
61175
61600
|
ListrTaskState2["STARTED"] = "STARTED";
|
|
@@ -61210,7 +61635,7 @@ function isReadable(obj) {
|
|
|
61210
61635
|
return !!obj && typeof obj === "object" && obj.readable === true && typeof obj.read === "function" && typeof obj.on === "function";
|
|
61211
61636
|
}
|
|
61212
61637
|
function isUnicodeSupported2() {
|
|
61213
|
-
return !!process.env[
|
|
61638
|
+
return !!process.env["LISTR_FORCE_UNICODE"] || process.platform !== "win32" || !!process.env.CI || !!process.env.WT_SESSION || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty";
|
|
61214
61639
|
}
|
|
61215
61640
|
var CLEAR_LINE_REGEX = "(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+";
|
|
61216
61641
|
var BELL_REGEX = /\u0007/;
|
|
@@ -61246,47 +61671,35 @@ var figures2 = isUnicodeSupported2() ? FIGURES_MAIN : FIGURES_FALLBACK;
|
|
|
61246
61671
|
function splat(message2, ...splat2) {
|
|
61247
61672
|
return (0, import_util4.format)(String(message2), ...splat2);
|
|
61248
61673
|
}
|
|
61249
|
-
var ListrLogLevels = /* @__PURE__ */ (function(ListrLogLevels2) {
|
|
61250
|
-
ListrLogLevels2["STARTED"] = "STARTED";
|
|
61251
|
-
ListrLogLevels2["COMPLETED"] = "COMPLETED";
|
|
61252
|
-
ListrLogLevels2["FAILED"] = "FAILED";
|
|
61253
|
-
ListrLogLevels2["SKIPPED"] = "SKIPPED";
|
|
61254
|
-
ListrLogLevels2["OUTPUT"] = "OUTPUT";
|
|
61255
|
-
ListrLogLevels2["TITLE"] = "TITLE";
|
|
61256
|
-
ListrLogLevels2["ROLLBACK"] = "ROLLBACK";
|
|
61257
|
-
ListrLogLevels2["RETRY"] = "RETRY";
|
|
61258
|
-
ListrLogLevels2["PROMPT"] = "PROMPT";
|
|
61259
|
-
ListrLogLevels2["PAUSED"] = "PAUSED";
|
|
61260
|
-
return ListrLogLevels2;
|
|
61261
|
-
})({});
|
|
61262
61674
|
var LISTR_LOGGER_STYLE = {
|
|
61263
61675
|
icon: {
|
|
61264
|
-
[
|
|
61265
|
-
[
|
|
61266
|
-
[
|
|
61267
|
-
[
|
|
61268
|
-
[
|
|
61269
|
-
[
|
|
61270
|
-
[
|
|
61271
|
-
[
|
|
61272
|
-
[
|
|
61676
|
+
["STARTED"]: figures2.pointer,
|
|
61677
|
+
["FAILED"]: figures2.cross,
|
|
61678
|
+
["SKIPPED"]: figures2.arrowDown,
|
|
61679
|
+
["COMPLETED"]: figures2.tick,
|
|
61680
|
+
["OUTPUT"]: figures2.pointerSmall,
|
|
61681
|
+
["TITLE"]: figures2.arrowRight,
|
|
61682
|
+
["RETRY"]: figures2.warning,
|
|
61683
|
+
["ROLLBACK"]: figures2.arrowLeft,
|
|
61684
|
+
["PAUSED"]: figures2.squareSmallFilled
|
|
61273
61685
|
},
|
|
61274
61686
|
color: {
|
|
61275
|
-
[
|
|
61276
|
-
[
|
|
61277
|
-
[
|
|
61278
|
-
[
|
|
61279
|
-
[
|
|
61280
|
-
[
|
|
61281
|
-
[
|
|
61687
|
+
["STARTED"]: color.yellow,
|
|
61688
|
+
["FAILED"]: color.red,
|
|
61689
|
+
["SKIPPED"]: color.yellow,
|
|
61690
|
+
["COMPLETED"]: color.green,
|
|
61691
|
+
["RETRY"]: color.yellowBright,
|
|
61692
|
+
["ROLLBACK"]: color.redBright,
|
|
61693
|
+
["PAUSED"]: color.yellowBright
|
|
61282
61694
|
}
|
|
61283
61695
|
};
|
|
61284
61696
|
var LISTR_LOGGER_STDERR_LEVELS = [
|
|
61285
|
-
|
|
61286
|
-
|
|
61287
|
-
|
|
61697
|
+
"RETRY",
|
|
61698
|
+
"ROLLBACK",
|
|
61699
|
+
"FAILED"
|
|
61288
61700
|
];
|
|
61289
61701
|
var ListrLogger = class {
|
|
61702
|
+
options;
|
|
61290
61703
|
process;
|
|
61291
61704
|
constructor(options) {
|
|
61292
61705
|
this.options = options;
|
|
@@ -61365,12 +61778,12 @@ var ListrLogger = class {
|
|
|
61365
61778
|
}
|
|
61366
61779
|
format(level, message2, options) {
|
|
61367
61780
|
if (!Array.isArray(message2)) message2 = [message2];
|
|
61368
|
-
message2 = this.splat(message2.shift(), ...message2).toString().split(
|
|
61781
|
+
message2 = this.splat(message2.shift(), ...message2).toString().split(import_os3.EOL).filter((m) => !m || m.trim() !== "").map((m) => {
|
|
61369
61782
|
return this.style(level, this.fields(m, {
|
|
61370
61783
|
prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
|
|
61371
61784
|
suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
|
|
61372
61785
|
}));
|
|
61373
|
-
}).join(
|
|
61786
|
+
}).join(import_os3.EOL);
|
|
61374
61787
|
return message2;
|
|
61375
61788
|
}
|
|
61376
61789
|
style(level, message2) {
|
|
@@ -61388,6 +61801,7 @@ var ListrLogger = class {
|
|
|
61388
61801
|
}
|
|
61389
61802
|
};
|
|
61390
61803
|
var ProcessOutputBuffer = class {
|
|
61804
|
+
options;
|
|
61391
61805
|
buffer = [];
|
|
61392
61806
|
decoder = new import_string_decoder.StringDecoder();
|
|
61393
61807
|
constructor(options) {
|
|
@@ -61418,6 +61832,7 @@ var ProcessOutputBuffer = class {
|
|
|
61418
61832
|
}
|
|
61419
61833
|
};
|
|
61420
61834
|
var ProcessOutputStream = class {
|
|
61835
|
+
stream;
|
|
61421
61836
|
method;
|
|
61422
61837
|
buffer;
|
|
61423
61838
|
constructor(stream4) {
|
|
@@ -61446,6 +61861,7 @@ var ProcessOutputStream = class {
|
|
|
61446
61861
|
}
|
|
61447
61862
|
};
|
|
61448
61863
|
var ProcessOutput = class {
|
|
61864
|
+
options;
|
|
61449
61865
|
stream;
|
|
61450
61866
|
active;
|
|
61451
61867
|
constructor(stdout, stderr, options) {
|
|
@@ -61483,20 +61899,20 @@ var ProcessOutput = class {
|
|
|
61483
61899
|
};
|
|
61484
61900
|
}).filter((message2) => message2.entry);
|
|
61485
61901
|
if (output.length > 0) {
|
|
61486
|
-
if (this.options.leaveEmptyLine) this.stdout.write(
|
|
61902
|
+
if (this.options.leaveEmptyLine) this.stdout.write(import_os3.EOL);
|
|
61487
61903
|
output.forEach((message2) => {
|
|
61488
|
-
(message2.stream ?? this.stdout).write(message2.entry +
|
|
61904
|
+
(message2.stream ?? this.stdout).write(message2.entry + import_os3.EOL);
|
|
61489
61905
|
});
|
|
61490
61906
|
}
|
|
61491
61907
|
this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
|
|
61492
61908
|
this.active = false;
|
|
61493
61909
|
}
|
|
61494
61910
|
toStdout(buffer, eol = true) {
|
|
61495
|
-
if (eol) buffer = buffer +
|
|
61911
|
+
if (eol) buffer = buffer + import_os3.EOL;
|
|
61496
61912
|
return this.stream.stdout.write(buffer);
|
|
61497
61913
|
}
|
|
61498
61914
|
toStderr(buffer, eol = true) {
|
|
61499
|
-
if (eol) buffer = buffer +
|
|
61915
|
+
if (eol) buffer = buffer + import_os3.EOL;
|
|
61500
61916
|
return this.stream.stderr.write(buffer);
|
|
61501
61917
|
}
|
|
61502
61918
|
};
|
|
@@ -61550,56 +61966,38 @@ var Spinner = class {
|
|
|
61550
61966
|
this.id = void 0;
|
|
61551
61967
|
}
|
|
61552
61968
|
};
|
|
61553
|
-
var ListrDefaultRendererLogLevels = /* @__PURE__ */ (function(ListrDefaultRendererLogLevels2) {
|
|
61554
|
-
ListrDefaultRendererLogLevels2["SKIPPED_WITH_COLLAPSE"] = "SKIPPED_WITH_COLLAPSE";
|
|
61555
|
-
ListrDefaultRendererLogLevels2["SKIPPED_WITHOUT_COLLAPSE"] = "SKIPPED_WITHOUT_COLLAPSE";
|
|
61556
|
-
ListrDefaultRendererLogLevels2["OUTPUT"] = "OUTPUT";
|
|
61557
|
-
ListrDefaultRendererLogLevels2["OUTPUT_WITH_BOTTOMBAR"] = "OUTPUT_WITH_BOTTOMBAR";
|
|
61558
|
-
ListrDefaultRendererLogLevels2["PENDING"] = "PENDING";
|
|
61559
|
-
ListrDefaultRendererLogLevels2["COMPLETED"] = "COMPLETED";
|
|
61560
|
-
ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SUBTASKS"] = "COMPLETED_WITH_FAILED_SUBTASKS";
|
|
61561
|
-
ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SISTER_TASKS"] = "COMPLETED_WITH_SISTER_TASKS_FAILED";
|
|
61562
|
-
ListrDefaultRendererLogLevels2["RETRY"] = "RETRY";
|
|
61563
|
-
ListrDefaultRendererLogLevels2["ROLLING_BACK"] = "ROLLING_BACK";
|
|
61564
|
-
ListrDefaultRendererLogLevels2["ROLLED_BACK"] = "ROLLED_BACK";
|
|
61565
|
-
ListrDefaultRendererLogLevels2["FAILED"] = "FAILED";
|
|
61566
|
-
ListrDefaultRendererLogLevels2["FAILED_WITH_FAILED_SUBTASKS"] = "FAILED_WITH_SUBTASKS";
|
|
61567
|
-
ListrDefaultRendererLogLevels2["WAITING"] = "WAITING";
|
|
61568
|
-
ListrDefaultRendererLogLevels2["PAUSED"] = "PAUSED";
|
|
61569
|
-
return ListrDefaultRendererLogLevels2;
|
|
61570
|
-
})({});
|
|
61571
61969
|
var LISTR_DEFAULT_RENDERER_STYLE = {
|
|
61572
61970
|
icon: {
|
|
61573
|
-
[
|
|
61574
|
-
[
|
|
61575
|
-
[
|
|
61576
|
-
[
|
|
61577
|
-
[
|
|
61578
|
-
[
|
|
61579
|
-
[
|
|
61580
|
-
[
|
|
61581
|
-
[
|
|
61582
|
-
[
|
|
61583
|
-
[
|
|
61584
|
-
[
|
|
61585
|
-
[
|
|
61586
|
-
[
|
|
61587
|
-
[
|
|
61971
|
+
["SKIPPED_WITH_COLLAPSE"]: figures2.arrowDown,
|
|
61972
|
+
["SKIPPED_WITHOUT_COLLAPSE"]: figures2.warning,
|
|
61973
|
+
["OUTPUT"]: figures2.pointerSmall,
|
|
61974
|
+
["OUTPUT_WITH_BOTTOMBAR"]: figures2.pointerSmall,
|
|
61975
|
+
["PENDING"]: figures2.pointer,
|
|
61976
|
+
["COMPLETED"]: figures2.tick,
|
|
61977
|
+
["COMPLETED_WITH_FAILED_SUBTASKS"]: figures2.warning,
|
|
61978
|
+
["COMPLETED_WITH_SISTER_TASKS_FAILED"]: figures2.squareSmallFilled,
|
|
61979
|
+
["RETRY"]: figures2.warning,
|
|
61980
|
+
["ROLLING_BACK"]: figures2.warning,
|
|
61981
|
+
["ROLLED_BACK"]: figures2.arrowLeft,
|
|
61982
|
+
["FAILED"]: figures2.cross,
|
|
61983
|
+
["FAILED_WITH_SUBTASKS"]: figures2.pointer,
|
|
61984
|
+
["WAITING"]: figures2.squareSmallFilled,
|
|
61985
|
+
["PAUSED"]: figures2.squareSmallFilled
|
|
61588
61986
|
},
|
|
61589
61987
|
color: {
|
|
61590
|
-
[
|
|
61591
|
-
[
|
|
61592
|
-
[
|
|
61593
|
-
[
|
|
61594
|
-
[
|
|
61595
|
-
[
|
|
61596
|
-
[
|
|
61597
|
-
[
|
|
61598
|
-
[
|
|
61599
|
-
[
|
|
61600
|
-
[
|
|
61601
|
-
[
|
|
61602
|
-
[
|
|
61988
|
+
["SKIPPED_WITH_COLLAPSE"]: color.yellow,
|
|
61989
|
+
["SKIPPED_WITHOUT_COLLAPSE"]: color.yellow,
|
|
61990
|
+
["PENDING"]: color.yellow,
|
|
61991
|
+
["COMPLETED"]: color.green,
|
|
61992
|
+
["COMPLETED_WITH_FAILED_SUBTASKS"]: color.yellow,
|
|
61993
|
+
["COMPLETED_WITH_SISTER_TASKS_FAILED"]: color.red,
|
|
61994
|
+
["RETRY"]: color.yellowBright,
|
|
61995
|
+
["ROLLING_BACK"]: color.redBright,
|
|
61996
|
+
["ROLLED_BACK"]: color.redBright,
|
|
61997
|
+
["FAILED"]: color.red,
|
|
61998
|
+
["FAILED_WITH_SUBTASKS"]: color.red,
|
|
61999
|
+
["WAITING"]: color.dim,
|
|
62000
|
+
["PAUSED"]: color.yellowBright
|
|
61603
62001
|
}
|
|
61604
62002
|
};
|
|
61605
62003
|
function parseTimer(duration) {
|
|
@@ -61617,6 +62015,9 @@ var PRESET_TIMER = {
|
|
|
61617
62015
|
format: () => color.dim
|
|
61618
62016
|
};
|
|
61619
62017
|
var DefaultRenderer = class DefaultRenderer2 {
|
|
62018
|
+
tasks;
|
|
62019
|
+
options;
|
|
62020
|
+
events;
|
|
61620
62021
|
static nonTTY = false;
|
|
61621
62022
|
static rendererOptions = {
|
|
61622
62023
|
indentation: 2,
|
|
@@ -61689,7 +62090,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61689
62090
|
if (!this.options?.lazy) this.spinner.start(() => {
|
|
61690
62091
|
this.update();
|
|
61691
62092
|
});
|
|
61692
|
-
this.events.on(
|
|
62093
|
+
this.events.on("SHOUD_REFRESH_RENDER", () => {
|
|
61693
62094
|
this.update();
|
|
61694
62095
|
});
|
|
61695
62096
|
}
|
|
@@ -61723,31 +62124,31 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61723
62124
|
if (render.length > 0) render.push("");
|
|
61724
62125
|
render.push(...renderPrompt);
|
|
61725
62126
|
}
|
|
61726
|
-
return render.join(
|
|
62127
|
+
return render.join(import_os3.EOL);
|
|
61727
62128
|
}
|
|
61728
62129
|
style(task, output = false) {
|
|
61729
62130
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
61730
62131
|
if (task.isSkipped()) {
|
|
61731
|
-
if (output || rendererOptions.collapseSkips) return this.logger.icon(
|
|
61732
|
-
else if (rendererOptions.collapseSkips === false) return this.logger.icon(
|
|
62132
|
+
if (output || rendererOptions.collapseSkips) return this.logger.icon("SKIPPED_WITH_COLLAPSE");
|
|
62133
|
+
else if (rendererOptions.collapseSkips === false) return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE");
|
|
61733
62134
|
}
|
|
61734
62135
|
if (output) {
|
|
61735
|
-
if (this.shouldOutputToBottomBar(task)) return this.logger.icon(
|
|
61736
|
-
return this.logger.icon(
|
|
62136
|
+
if (this.shouldOutputToBottomBar(task)) return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");
|
|
62137
|
+
return this.logger.icon("OUTPUT");
|
|
61737
62138
|
}
|
|
61738
62139
|
if (task.hasSubtasks()) {
|
|
61739
|
-
if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) return this.logger.icon(
|
|
61740
|
-
else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) return this.logger.icon(
|
|
61741
|
-
else if (task.hasFailed()) return this.logger.icon(
|
|
61742
|
-
}
|
|
61743
|
-
if (task.isStarted() || task.isPrompt()) return this.logger.icon(
|
|
61744
|
-
else if (task.isCompleted()) return this.logger.icon(
|
|
61745
|
-
else if (task.isRetrying()) return this.logger.icon(
|
|
61746
|
-
else if (task.isRollingBack()) return this.logger.icon(
|
|
61747
|
-
else if (task.hasRolledBack()) return this.logger.icon(
|
|
61748
|
-
else if (task.hasFailed()) return this.logger.icon(
|
|
61749
|
-
else if (task.isPaused()) return this.logger.icon(
|
|
61750
|
-
return this.logger.icon(
|
|
62140
|
+
if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) return this.logger.icon("PENDING");
|
|
62141
|
+
else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");
|
|
62142
|
+
else if (task.hasFailed()) return this.logger.icon("FAILED_WITH_SUBTASKS");
|
|
62143
|
+
}
|
|
62144
|
+
if (task.isStarted() || task.isPrompt()) return this.logger.icon("PENDING", !this.options?.lazy && this.spinner.fetch());
|
|
62145
|
+
else if (task.isCompleted()) return this.logger.icon("COMPLETED");
|
|
62146
|
+
else if (task.isRetrying()) return this.logger.icon("RETRY", !this.options?.lazy && this.spinner.fetch());
|
|
62147
|
+
else if (task.isRollingBack()) return this.logger.icon("ROLLING_BACK", !this.options?.lazy && this.spinner.fetch());
|
|
62148
|
+
else if (task.hasRolledBack()) return this.logger.icon("ROLLED_BACK");
|
|
62149
|
+
else if (task.hasFailed()) return this.logger.icon("FAILED");
|
|
62150
|
+
else if (task.isPaused()) return this.logger.icon("PAUSED");
|
|
62151
|
+
return this.logger.icon("WAITING");
|
|
61751
62152
|
}
|
|
61752
62153
|
format(message2, icon, level) {
|
|
61753
62154
|
if (message2.trim() === "") return [];
|
|
@@ -61756,7 +62157,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61756
62157
|
const columns = (process.stdout.columns ?? 80) - level * this.options.indentation - 2;
|
|
61757
62158
|
switch (this.options.formatOutput) {
|
|
61758
62159
|
case "truncate":
|
|
61759
|
-
parsed = message2.split(
|
|
62160
|
+
parsed = message2.split(import_os3.EOL).map((s, i) => {
|
|
61760
62161
|
return this.truncate(this.indent(s, i), columns);
|
|
61761
62162
|
});
|
|
61762
62163
|
break;
|
|
@@ -61764,7 +62165,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61764
62165
|
parsed = this.wrap(message2, columns, {
|
|
61765
62166
|
hard: true,
|
|
61766
62167
|
trim: false
|
|
61767
|
-
}).split(
|
|
62168
|
+
}).split(import_os3.EOL).map((s, i) => this.indent(s, i));
|
|
61768
62169
|
break;
|
|
61769
62170
|
default:
|
|
61770
62171
|
throw new ListrRendererError("Format option for the renderer is wrong.");
|
|
@@ -61792,15 +62193,15 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61792
62193
|
if (task.isPrompt()) {
|
|
61793
62194
|
if (this.activePrompt && this.activePrompt !== task.id) throw new ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");
|
|
61794
62195
|
else if (!this.activePrompt) {
|
|
61795
|
-
task.on(
|
|
62196
|
+
task.on("PROMPT", (prompt2) => {
|
|
61796
62197
|
const cleansed = cleanseAnsi(prompt2);
|
|
61797
62198
|
if (cleansed) this.prompt = cleansed;
|
|
61798
62199
|
});
|
|
61799
|
-
task.on(
|
|
61800
|
-
if (state ===
|
|
62200
|
+
task.on("STATE", (state) => {
|
|
62201
|
+
if (state === "PROMPT_COMPLETED" || task.hasFinalized() || task.hasReset()) {
|
|
61801
62202
|
this.prompt = null;
|
|
61802
62203
|
this.activePrompt = null;
|
|
61803
|
-
task.off(
|
|
62204
|
+
task.off("PROMPT");
|
|
61804
62205
|
}
|
|
61805
62206
|
});
|
|
61806
62207
|
this.activePrompt = task.id;
|
|
@@ -61808,12 +62209,12 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61808
62209
|
}
|
|
61809
62210
|
if (task.hasTitle()) if (!(tasks.some((task2) => task2.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped()))) if (task.hasFailed() && rendererOptions.collapseErrors) output.push(...this.format(!task.hasSubtasks() && task.message.error && rendererOptions.showErrorMessage ? task.message.error : task.title, this.style(task), level));
|
|
61810
62211
|
else if (task.isSkipped() && rendererOptions.collapseSkips) output.push(...this.format(this.logger.suffix(task.message.skip && rendererOptions.showSkipMessage ? task.message.skip : task.title, {
|
|
61811
|
-
field:
|
|
62212
|
+
field: "SKIPPED",
|
|
61812
62213
|
condition: rendererOptions.suffixSkips,
|
|
61813
62214
|
format: () => color.dim
|
|
61814
62215
|
}), this.style(task), level));
|
|
61815
62216
|
else if (task.isRetrying()) output.push(...this.format(this.logger.suffix(task.title, {
|
|
61816
|
-
field: `${
|
|
62217
|
+
field: `${"RETRY"}:${task.message.retry.count}`,
|
|
61817
62218
|
format: () => color.yellow,
|
|
61818
62219
|
condition: rendererOptions.suffixRetries
|
|
61819
62220
|
}), this.style(task), level));
|
|
@@ -61826,10 +62227,10 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61826
62227
|
args: [task.message.paused - Date.now()]
|
|
61827
62228
|
}), this.style(task), level));
|
|
61828
62229
|
else output.push(...this.format(task.title, this.style(task), level));
|
|
61829
|
-
else output.push(...this.format(task.title, this.logger.icon(
|
|
62230
|
+
else output.push(...this.format(task.title, this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"), level));
|
|
61830
62231
|
if (!task.hasSubtasks() || !rendererOptions.showSubtasks) {
|
|
61831
|
-
if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level,
|
|
61832
|
-
else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level,
|
|
62232
|
+
if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, "FAILED"));
|
|
62233
|
+
else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, "SKIPPED"));
|
|
61833
62234
|
}
|
|
61834
62235
|
if (task.isPending() || rendererTaskOptions.persistentOutput) output.push(...this.renderOutputBar(task, level));
|
|
61835
62236
|
if (rendererOptions.showSubtasks !== false && task.hasSubtasks() && (task.isPending() || task.hasFinalized() && !task.hasTitle() || task.isCompleted() && rendererOptions.collapseSubtasks === false && !task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === true) || task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === false) || task.subtasks.some((subtask) => subtask.hasFailed()) || task.subtasks.some((subtask) => subtask.hasRolledBack()))) {
|
|
@@ -61853,7 +62254,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61853
62254
|
renderOutputBar(task, level) {
|
|
61854
62255
|
const output = this.buffer.output.get(task.id);
|
|
61855
62256
|
if (!output) return [];
|
|
61856
|
-
return output.all.flatMap((o) => this.dump(task, level,
|
|
62257
|
+
return output.all.flatMap((o) => this.dump(task, level, "OUTPUT", o.entry));
|
|
61857
62258
|
}
|
|
61858
62259
|
renderBottomBar() {
|
|
61859
62260
|
if (this.buffer.bottom.size === 0) return [];
|
|
@@ -61881,25 +62282,25 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61881
62282
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
61882
62283
|
if (this.shouldOutputToBottomBar(task) && !this.buffer.bottom.has(task.id)) {
|
|
61883
62284
|
this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
|
|
61884
|
-
task.on(
|
|
61885
|
-
const data = this.dump(task, -1,
|
|
61886
|
-
this.buffer.bottom.get(task.id).write(data.join(
|
|
62285
|
+
task.on("OUTPUT", (output) => {
|
|
62286
|
+
const data = this.dump(task, -1, "OUTPUT", output);
|
|
62287
|
+
this.buffer.bottom.get(task.id).write(data.join(import_os3.EOL));
|
|
61887
62288
|
});
|
|
61888
|
-
task.on(
|
|
62289
|
+
task.on("STATE", (state) => {
|
|
61889
62290
|
switch (state) {
|
|
61890
|
-
case
|
|
62291
|
+
case "RETRY":
|
|
61891
62292
|
this.buffer.bottom.delete(task.id);
|
|
61892
62293
|
break;
|
|
61893
62294
|
}
|
|
61894
62295
|
});
|
|
61895
62296
|
} else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
|
|
61896
62297
|
this.buffer.output.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.outputBar === "number" ? rendererTaskOptions.outputBar : 1 }));
|
|
61897
|
-
task.on(
|
|
62298
|
+
task.on("OUTPUT", (output) => {
|
|
61898
62299
|
this.buffer.output.get(task.id).write(output);
|
|
61899
62300
|
});
|
|
61900
|
-
task.on(
|
|
62301
|
+
task.on("STATE", (state) => {
|
|
61901
62302
|
switch (state) {
|
|
61902
|
-
case
|
|
62303
|
+
case "RETRY":
|
|
61903
62304
|
this.buffer.output.delete(task.id);
|
|
61904
62305
|
break;
|
|
61905
62306
|
}
|
|
@@ -61911,20 +62312,20 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61911
62312
|
this.cache.rendererTaskOptions.delete(task.id);
|
|
61912
62313
|
this.buffer.output.delete(task.id);
|
|
61913
62314
|
}
|
|
61914
|
-
dump(task, level, source =
|
|
62315
|
+
dump(task, level, source = "OUTPUT", data) {
|
|
61915
62316
|
if (!data) switch (source) {
|
|
61916
|
-
case
|
|
62317
|
+
case "OUTPUT":
|
|
61917
62318
|
data = task.output;
|
|
61918
62319
|
break;
|
|
61919
|
-
case
|
|
62320
|
+
case "SKIPPED":
|
|
61920
62321
|
data = task.message.skip;
|
|
61921
62322
|
break;
|
|
61922
|
-
case
|
|
62323
|
+
case "FAILED":
|
|
61923
62324
|
data = task.message.error;
|
|
61924
62325
|
break;
|
|
61925
62326
|
}
|
|
61926
|
-
if (task.hasTitle() && source ===
|
|
61927
|
-
if (source ===
|
|
62327
|
+
if (task.hasTitle() && source === "FAILED" && data === task.title || typeof data !== "string") return [];
|
|
62328
|
+
if (source === "OUTPUT") data = cleanseAnsi(data);
|
|
61928
62329
|
return this.format(data, this.style(task, true), level + 1);
|
|
61929
62330
|
}
|
|
61930
62331
|
indent(str, i) {
|
|
@@ -61932,6 +62333,8 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61932
62333
|
}
|
|
61933
62334
|
};
|
|
61934
62335
|
var SilentRenderer = class {
|
|
62336
|
+
tasks;
|
|
62337
|
+
options;
|
|
61935
62338
|
static nonTTY = true;
|
|
61936
62339
|
static rendererOptions;
|
|
61937
62340
|
static rendererTaskOptions;
|
|
@@ -61945,10 +62348,12 @@ var SilentRenderer = class {
|
|
|
61945
62348
|
}
|
|
61946
62349
|
};
|
|
61947
62350
|
var SimpleRenderer = class SimpleRenderer2 {
|
|
62351
|
+
tasks;
|
|
62352
|
+
options;
|
|
61948
62353
|
static nonTTY = true;
|
|
61949
62354
|
static rendererOptions = { pausedTimer: {
|
|
61950
62355
|
...PRESET_TIMER,
|
|
61951
|
-
field: (time) => `${
|
|
62356
|
+
field: (time) => `${"PAUSED"}:${time}`,
|
|
61952
62357
|
format: () => color.yellowBright
|
|
61953
62358
|
} };
|
|
61954
62359
|
static rendererTaskOptions = {};
|
|
@@ -61988,57 +62393,57 @@ var SimpleRenderer = class SimpleRenderer2 {
|
|
|
61988
62393
|
renderer(tasks) {
|
|
61989
62394
|
tasks.forEach((task) => {
|
|
61990
62395
|
this.calculate(task);
|
|
61991
|
-
task.once(
|
|
62396
|
+
task.once("CLOSED", () => {
|
|
61992
62397
|
this.reset(task);
|
|
61993
62398
|
});
|
|
61994
62399
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
61995
62400
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
61996
|
-
task.on(
|
|
62401
|
+
task.on("SUBTASK", (subtasks) => {
|
|
61997
62402
|
this.renderer(subtasks);
|
|
61998
62403
|
});
|
|
61999
|
-
task.on(
|
|
62404
|
+
task.on("STATE", (state) => {
|
|
62000
62405
|
if (!task.hasTitle()) return;
|
|
62001
|
-
if (state ===
|
|
62002
|
-
else if (state ===
|
|
62406
|
+
if (state === "STARTED") this.logger.log("STARTED", task.title);
|
|
62407
|
+
else if (state === "COMPLETED") {
|
|
62003
62408
|
const timer = rendererTaskOptions?.timer;
|
|
62004
|
-
this.logger.log(
|
|
62409
|
+
this.logger.log("COMPLETED", task.title, timer && { suffix: {
|
|
62005
62410
|
...timer,
|
|
62006
62411
|
condition: !!task.message?.duration && timer.condition,
|
|
62007
62412
|
args: [task.message.duration]
|
|
62008
62413
|
} });
|
|
62009
|
-
} else if (state ===
|
|
62414
|
+
} else if (state === "PROMPT") {
|
|
62010
62415
|
this.logger.process.hijack();
|
|
62011
|
-
task.on(
|
|
62416
|
+
task.on("PROMPT", (prompt2) => {
|
|
62012
62417
|
this.logger.process.toStderr(prompt2, false);
|
|
62013
62418
|
});
|
|
62014
|
-
} else if (state ===
|
|
62015
|
-
task.off(
|
|
62419
|
+
} else if (state === "PROMPT_COMPLETED") {
|
|
62420
|
+
task.off("PROMPT");
|
|
62016
62421
|
this.logger.process.release();
|
|
62017
62422
|
}
|
|
62018
62423
|
});
|
|
62019
|
-
task.on(
|
|
62020
|
-
this.logger.log(
|
|
62424
|
+
task.on("OUTPUT", (output) => {
|
|
62425
|
+
this.logger.log("OUTPUT", output);
|
|
62021
62426
|
});
|
|
62022
|
-
task.on(
|
|
62023
|
-
if (message2.error) this.logger.log(
|
|
62024
|
-
field: `${
|
|
62427
|
+
task.on("MESSAGE", (message2) => {
|
|
62428
|
+
if (message2.error) this.logger.log("FAILED", task.title, { suffix: {
|
|
62429
|
+
field: `${"FAILED"}: ${message2.error}`,
|
|
62025
62430
|
format: () => color.red
|
|
62026
62431
|
} });
|
|
62027
|
-
else if (message2.skip) this.logger.log(
|
|
62028
|
-
field: `${
|
|
62432
|
+
else if (message2.skip) this.logger.log("SKIPPED", task.title, { suffix: {
|
|
62433
|
+
field: `${"SKIPPED"}: ${message2.skip}`,
|
|
62029
62434
|
format: () => color.yellow
|
|
62030
62435
|
} });
|
|
62031
|
-
else if (message2.rollback) this.logger.log(
|
|
62032
|
-
field: `${
|
|
62436
|
+
else if (message2.rollback) this.logger.log("ROLLBACK", task.title, { suffix: {
|
|
62437
|
+
field: `${"ROLLBACK"}: ${message2.rollback}`,
|
|
62033
62438
|
format: () => color.red
|
|
62034
62439
|
} });
|
|
62035
|
-
else if (message2.retry) this.logger.log(
|
|
62036
|
-
field: `${
|
|
62440
|
+
else if (message2.retry) this.logger.log("RETRY", task.title, { suffix: {
|
|
62441
|
+
field: `${"RETRY"}:${message2.retry.count}`,
|
|
62037
62442
|
format: () => color.red
|
|
62038
62443
|
} });
|
|
62039
62444
|
else if (message2.paused) {
|
|
62040
62445
|
const timer = rendererOptions?.pausedTimer;
|
|
62041
|
-
this.logger.log(
|
|
62446
|
+
this.logger.log("PAUSED", task.title, timer && { suffix: {
|
|
62042
62447
|
...timer,
|
|
62043
62448
|
condition: !!message2?.paused && timer.condition,
|
|
62044
62449
|
args: [message2.paused - Date.now()]
|
|
@@ -62066,6 +62471,7 @@ var SimpleRenderer = class SimpleRenderer2 {
|
|
|
62066
62471
|
}
|
|
62067
62472
|
};
|
|
62068
62473
|
var TestRendererSerializer = class {
|
|
62474
|
+
options;
|
|
62069
62475
|
constructor(options) {
|
|
62070
62476
|
this.options = options;
|
|
62071
62477
|
}
|
|
@@ -62089,6 +62495,8 @@ var TestRendererSerializer = class {
|
|
|
62089
62495
|
}
|
|
62090
62496
|
};
|
|
62091
62497
|
var TestRenderer = class TestRenderer2 {
|
|
62498
|
+
tasks;
|
|
62499
|
+
options;
|
|
62092
62500
|
static nonTTY = true;
|
|
62093
62501
|
static rendererOptions = {
|
|
62094
62502
|
subtasks: true,
|
|
@@ -62149,27 +62557,27 @@ var TestRenderer = class TestRenderer2 {
|
|
|
62149
62557
|
}
|
|
62150
62558
|
renderer(tasks) {
|
|
62151
62559
|
tasks.forEach((task) => {
|
|
62152
|
-
if (this.options.subtasks) task.on(
|
|
62560
|
+
if (this.options.subtasks) task.on("SUBTASK", (subtasks) => {
|
|
62153
62561
|
this.renderer(subtasks);
|
|
62154
62562
|
});
|
|
62155
|
-
if (this.options.state) task.on(
|
|
62156
|
-
this.logger.toStdout(this.serializer.serialize(
|
|
62563
|
+
if (this.options.state) task.on("STATE", (state) => {
|
|
62564
|
+
this.logger.toStdout(this.serializer.serialize("STATE", state, task));
|
|
62157
62565
|
});
|
|
62158
|
-
if (this.options.output) task.on(
|
|
62159
|
-
this.logger.toStdout(this.serializer.serialize(
|
|
62566
|
+
if (this.options.output) task.on("OUTPUT", (data) => {
|
|
62567
|
+
this.logger.toStdout(this.serializer.serialize("OUTPUT", data, task));
|
|
62160
62568
|
});
|
|
62161
|
-
if (this.options.prompt) task.on(
|
|
62162
|
-
this.logger.toStdout(this.serializer.serialize(
|
|
62569
|
+
if (this.options.prompt) task.on("PROMPT", (prompt2) => {
|
|
62570
|
+
this.logger.toStdout(this.serializer.serialize("PROMPT", prompt2, task));
|
|
62163
62571
|
});
|
|
62164
|
-
if (this.options.title) task.on(
|
|
62165
|
-
this.logger.toStdout(this.serializer.serialize(
|
|
62572
|
+
if (this.options.title) task.on("TITLE", (title) => {
|
|
62573
|
+
this.logger.toStdout(this.serializer.serialize("TITLE", title, task));
|
|
62166
62574
|
});
|
|
62167
|
-
task.on(
|
|
62575
|
+
task.on("MESSAGE", (message2) => {
|
|
62168
62576
|
const parsed = Object.fromEntries(Object.entries(message2).map(([key, value]) => {
|
|
62169
62577
|
if (this.options.messages.includes(key)) return [key, value];
|
|
62170
62578
|
}).filter(Boolean));
|
|
62171
62579
|
if (Object.keys(parsed).length > 0) {
|
|
62172
|
-
const output = this.serializer.serialize(
|
|
62580
|
+
const output = this.serializer.serialize("MESSAGE", parsed, task);
|
|
62173
62581
|
if (this.options.messagesToStderr.some((state) => Object.keys(parsed).includes(state))) this.logger.toStderr(output);
|
|
62174
62582
|
else this.logger.toStdout(output);
|
|
62175
62583
|
}
|
|
@@ -62178,6 +62586,8 @@ var TestRenderer = class TestRenderer2 {
|
|
|
62178
62586
|
}
|
|
62179
62587
|
};
|
|
62180
62588
|
var VerboseRenderer = class VerboseRenderer2 {
|
|
62589
|
+
tasks;
|
|
62590
|
+
options;
|
|
62181
62591
|
static nonTTY = true;
|
|
62182
62592
|
static rendererOptions = {
|
|
62183
62593
|
logTitleChange: false,
|
|
@@ -62223,44 +62633,44 @@ var VerboseRenderer = class VerboseRenderer2 {
|
|
|
62223
62633
|
renderer(tasks) {
|
|
62224
62634
|
tasks.forEach((task) => {
|
|
62225
62635
|
this.calculate(task);
|
|
62226
|
-
task.once(
|
|
62636
|
+
task.once("CLOSED", () => {
|
|
62227
62637
|
this.reset(task);
|
|
62228
62638
|
});
|
|
62229
62639
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
62230
62640
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
62231
|
-
task.on(
|
|
62641
|
+
task.on("SUBTASK", (subtasks) => {
|
|
62232
62642
|
this.renderer(subtasks);
|
|
62233
62643
|
});
|
|
62234
|
-
task.on(
|
|
62644
|
+
task.on("STATE", (state) => {
|
|
62235
62645
|
if (!task.hasTitle()) return;
|
|
62236
|
-
if (state ===
|
|
62237
|
-
else if (state ===
|
|
62646
|
+
if (state === "STARTED") this.logger.log("STARTED", task.title);
|
|
62647
|
+
else if (state === "COMPLETED") {
|
|
62238
62648
|
const timer = rendererTaskOptions.timer;
|
|
62239
|
-
this.logger.log(
|
|
62649
|
+
this.logger.log("COMPLETED", task.title, timer && { suffix: {
|
|
62240
62650
|
...timer,
|
|
62241
62651
|
condition: !!task.message?.duration && timer.condition,
|
|
62242
62652
|
args: [task.message.duration]
|
|
62243
62653
|
} });
|
|
62244
62654
|
}
|
|
62245
62655
|
});
|
|
62246
|
-
task.on(
|
|
62247
|
-
this.logger.log(
|
|
62656
|
+
task.on("OUTPUT", (data) => {
|
|
62657
|
+
this.logger.log("OUTPUT", data);
|
|
62248
62658
|
});
|
|
62249
|
-
task.on(
|
|
62659
|
+
task.on("PROMPT", (prompt2) => {
|
|
62250
62660
|
const cleansed = cleanseAnsi(prompt2);
|
|
62251
|
-
if (cleansed) this.logger.log(
|
|
62661
|
+
if (cleansed) this.logger.log("PROMPT", cleansed);
|
|
62252
62662
|
});
|
|
62253
|
-
if (this.options?.logTitleChange !== false) task.on(
|
|
62254
|
-
this.logger.log(
|
|
62663
|
+
if (this.options?.logTitleChange !== false) task.on("TITLE", (title) => {
|
|
62664
|
+
this.logger.log("TITLE", title);
|
|
62255
62665
|
});
|
|
62256
|
-
task.on(
|
|
62257
|
-
if (message2?.error) this.logger.log(
|
|
62258
|
-
else if (message2?.skip) this.logger.log(
|
|
62259
|
-
else if (message2?.rollback) this.logger.log(
|
|
62260
|
-
else if (message2?.retry) this.logger.log(
|
|
62666
|
+
task.on("MESSAGE", (message2) => {
|
|
62667
|
+
if (message2?.error) this.logger.log("FAILED", message2.error);
|
|
62668
|
+
else if (message2?.skip) this.logger.log("SKIPPED", message2.skip);
|
|
62669
|
+
else if (message2?.rollback) this.logger.log("ROLLBACK", message2.rollback);
|
|
62670
|
+
else if (message2?.retry) this.logger.log("RETRY", task.title, { suffix: message2.retry.count.toString() });
|
|
62261
62671
|
else if (message2?.paused) {
|
|
62262
62672
|
const timer = rendererOptions?.pausedTimer;
|
|
62263
|
-
this.logger.log(
|
|
62673
|
+
this.logger.log("PAUSED", task.title, timer && { suffix: {
|
|
62264
62674
|
...timer,
|
|
62265
62675
|
condition: !!message2?.paused && timer.condition,
|
|
62266
62676
|
args: [message2.paused - Date.now()]
|
|
@@ -62304,17 +62714,17 @@ function getRendererClass(renderer) {
|
|
|
62304
62714
|
function getRenderer(options) {
|
|
62305
62715
|
if (assertFunctionOrSelf(options?.silentRendererCondition)) return {
|
|
62306
62716
|
renderer: getRendererClass("silent"),
|
|
62307
|
-
selection:
|
|
62717
|
+
selection: "SILENT"
|
|
62308
62718
|
};
|
|
62309
62719
|
const r = {
|
|
62310
62720
|
renderer: getRendererClass(options.renderer),
|
|
62311
62721
|
options: options.rendererOptions,
|
|
62312
|
-
selection:
|
|
62722
|
+
selection: "PRIMARY"
|
|
62313
62723
|
};
|
|
62314
62724
|
if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options?.fallbackRendererCondition)) return {
|
|
62315
62725
|
renderer: getRendererClass(options.fallbackRenderer),
|
|
62316
62726
|
options: options.fallbackRendererOptions,
|
|
62317
|
-
selection:
|
|
62727
|
+
selection: "SECONDARY"
|
|
62318
62728
|
};
|
|
62319
62729
|
return r;
|
|
62320
62730
|
}
|
|
@@ -62368,6 +62778,9 @@ function delay(time) {
|
|
|
62368
62778
|
});
|
|
62369
62779
|
}
|
|
62370
62780
|
var ListrError = class extends Error {
|
|
62781
|
+
error;
|
|
62782
|
+
type;
|
|
62783
|
+
task;
|
|
62371
62784
|
path;
|
|
62372
62785
|
ctx;
|
|
62373
62786
|
constructor(error, type, task) {
|
|
@@ -62389,6 +62802,7 @@ var ListrRendererError = class extends Error {
|
|
|
62389
62802
|
var PromptError = class extends Error {
|
|
62390
62803
|
};
|
|
62391
62804
|
var TaskWrapper = class {
|
|
62805
|
+
task;
|
|
62392
62806
|
constructor(task) {
|
|
62393
62807
|
this.task = task;
|
|
62394
62808
|
}
|
|
@@ -62450,7 +62864,7 @@ var TaskWrapper = class {
|
|
|
62450
62864
|
* @see {@link https://listr2.kilic.dev/task/skip.html}
|
|
62451
62865
|
*/
|
|
62452
62866
|
skip(message2, ...metadata) {
|
|
62453
|
-
this.task.state$ =
|
|
62867
|
+
this.task.state$ = "SKIPPED";
|
|
62454
62868
|
if (message2) this.task.message$ = { skip: message2 ? splat(message2, ...metadata) : this.task?.title };
|
|
62455
62869
|
}
|
|
62456
62870
|
/**
|
|
@@ -62483,7 +62897,7 @@ var TaskWrapper = class {
|
|
|
62483
62897
|
stdout(type) {
|
|
62484
62898
|
return createWritable((chunk) => {
|
|
62485
62899
|
switch (type) {
|
|
62486
|
-
case
|
|
62900
|
+
case "PROMPT":
|
|
62487
62901
|
this.promptOutput = chunk;
|
|
62488
62902
|
break;
|
|
62489
62903
|
default:
|
|
@@ -62499,10 +62913,15 @@ var TaskWrapper = class {
|
|
|
62499
62913
|
var ListrTaskEventManager = class extends EventManager {
|
|
62500
62914
|
};
|
|
62501
62915
|
var Task = class extends ListrTaskEventManager {
|
|
62916
|
+
listr;
|
|
62917
|
+
task;
|
|
62918
|
+
options;
|
|
62919
|
+
rendererOptions;
|
|
62920
|
+
rendererTaskOptions;
|
|
62502
62921
|
/** Unique id per task, can be used for identifying a Task. */
|
|
62503
62922
|
id = (0, import_crypto2.randomUUID)();
|
|
62504
62923
|
/** The current state of the task. */
|
|
62505
|
-
state =
|
|
62924
|
+
state = "WAITING";
|
|
62506
62925
|
/** Subtasks of the current task. */
|
|
62507
62926
|
subtasks;
|
|
62508
62927
|
/** Title of the task. */
|
|
@@ -62549,26 +62968,26 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62549
62968
|
*/
|
|
62550
62969
|
set state$(state) {
|
|
62551
62970
|
this.state = state;
|
|
62552
|
-
this.emit(
|
|
62971
|
+
this.emit("STATE", state);
|
|
62553
62972
|
if (this.hasSubtasks() && this.hasFailed()) {
|
|
62554
|
-
for (const subtask of this.subtasks) if (subtask.state ===
|
|
62973
|
+
for (const subtask of this.subtasks) if (subtask.state === "STARTED") subtask.state$ = "FAILED";
|
|
62555
62974
|
}
|
|
62556
|
-
this.listr.events.emit(
|
|
62975
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62557
62976
|
}
|
|
62558
62977
|
/**
|
|
62559
62978
|
* Update the current output of the Task and emit the neccassary events.
|
|
62560
62979
|
*/
|
|
62561
62980
|
set output$(data) {
|
|
62562
62981
|
this.output = data;
|
|
62563
|
-
this.emit(
|
|
62564
|
-
this.listr.events.emit(
|
|
62982
|
+
this.emit("OUTPUT", data);
|
|
62983
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62565
62984
|
}
|
|
62566
62985
|
/**
|
|
62567
62986
|
* Update the current prompt output of the Task and emit the neccassary events.
|
|
62568
62987
|
*/
|
|
62569
62988
|
set promptOutput$(data) {
|
|
62570
|
-
this.emit(
|
|
62571
|
-
if (cleanseAnsi(data)) this.listr.events.emit(
|
|
62989
|
+
this.emit("PROMPT", data);
|
|
62990
|
+
if (cleanseAnsi(data)) this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62572
62991
|
}
|
|
62573
62992
|
/**
|
|
62574
62993
|
* Update or extend the current message of the Task and emit the neccassary events.
|
|
@@ -62578,16 +62997,16 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62578
62997
|
...this.message,
|
|
62579
62998
|
...data
|
|
62580
62999
|
};
|
|
62581
|
-
this.emit(
|
|
62582
|
-
this.listr.events.emit(
|
|
63000
|
+
this.emit("MESSAGE", data);
|
|
63001
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62583
63002
|
}
|
|
62584
63003
|
/**
|
|
62585
63004
|
* Update the current title of the Task and emit the neccassary events.
|
|
62586
63005
|
*/
|
|
62587
63006
|
set title$(title) {
|
|
62588
63007
|
this.title = title;
|
|
62589
|
-
this.emit(
|
|
62590
|
-
this.listr.events.emit(
|
|
63008
|
+
this.emit("TITLE", title);
|
|
63009
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62591
63010
|
}
|
|
62592
63011
|
/**
|
|
62593
63012
|
* Current task path in the hierarchy.
|
|
@@ -62599,10 +63018,10 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62599
63018
|
* Checks whether the current task with the given context should be set as enabled.
|
|
62600
63019
|
*/
|
|
62601
63020
|
async check(ctx) {
|
|
62602
|
-
if (this.state ===
|
|
63021
|
+
if (this.state === "WAITING") {
|
|
62603
63022
|
this.enabled = await assertFunctionOrSelf(this.task?.enabled ?? true, ctx);
|
|
62604
|
-
this.emit(
|
|
62605
|
-
this.listr.events.emit(
|
|
63023
|
+
this.emit("ENABLED", this.enabled);
|
|
63024
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62606
63025
|
}
|
|
62607
63026
|
return this.enabled;
|
|
62608
63027
|
}
|
|
@@ -62620,35 +63039,35 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62620
63039
|
}
|
|
62621
63040
|
/** Returns whether this task has started. */
|
|
62622
63041
|
isStarted() {
|
|
62623
|
-
return this.state ===
|
|
63042
|
+
return this.state === "STARTED";
|
|
62624
63043
|
}
|
|
62625
63044
|
/** Returns whether this task is skipped. */
|
|
62626
63045
|
isSkipped() {
|
|
62627
|
-
return this.state ===
|
|
63046
|
+
return this.state === "SKIPPED";
|
|
62628
63047
|
}
|
|
62629
63048
|
/** Returns whether this task has been completed. */
|
|
62630
63049
|
isCompleted() {
|
|
62631
|
-
return this.state ===
|
|
63050
|
+
return this.state === "COMPLETED";
|
|
62632
63051
|
}
|
|
62633
63052
|
/** Returns whether this task has been failed. */
|
|
62634
63053
|
hasFailed() {
|
|
62635
|
-
return this.state ===
|
|
63054
|
+
return this.state === "FAILED";
|
|
62636
63055
|
}
|
|
62637
63056
|
/** Returns whether this task has an active rollback task going on. */
|
|
62638
63057
|
isRollingBack() {
|
|
62639
|
-
return this.state ===
|
|
63058
|
+
return this.state === "ROLLING_BACK";
|
|
62640
63059
|
}
|
|
62641
63060
|
/** Returns whether the rollback action was successful. */
|
|
62642
63061
|
hasRolledBack() {
|
|
62643
|
-
return this.state ===
|
|
63062
|
+
return this.state === "ROLLED_BACK";
|
|
62644
63063
|
}
|
|
62645
63064
|
/** Returns whether this task has an actively retrying task going on. */
|
|
62646
63065
|
isRetrying() {
|
|
62647
|
-
return this.state ===
|
|
63066
|
+
return this.state === "RETRY";
|
|
62648
63067
|
}
|
|
62649
63068
|
/** Returns whether this task has some kind of reset like retry and rollback going on. */
|
|
62650
63069
|
hasReset() {
|
|
62651
|
-
return this.state ===
|
|
63070
|
+
return this.state === "RETRY" || this.state === "ROLLING_BACK";
|
|
62652
63071
|
}
|
|
62653
63072
|
/** Returns whether enabled function resolves to true. */
|
|
62654
63073
|
isEnabled() {
|
|
@@ -62660,11 +63079,11 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62660
63079
|
}
|
|
62661
63080
|
/** Returns whether this task has a prompt inside. */
|
|
62662
63081
|
isPrompt() {
|
|
62663
|
-
return this.state ===
|
|
63082
|
+
return this.state === "PROMPT";
|
|
62664
63083
|
}
|
|
62665
63084
|
/** Returns whether this task is currently paused. */
|
|
62666
63085
|
isPaused() {
|
|
62667
|
-
return this.state ===
|
|
63086
|
+
return this.state === "PAUSED";
|
|
62668
63087
|
}
|
|
62669
63088
|
/** Returns whether this task is closed. */
|
|
62670
63089
|
isClosed() {
|
|
@@ -62673,7 +63092,7 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62673
63092
|
/** Pause the given task for certain time. */
|
|
62674
63093
|
async pause(time) {
|
|
62675
63094
|
const state = this.state;
|
|
62676
|
-
this.state$ =
|
|
63095
|
+
this.state$ = "PAUSED";
|
|
62677
63096
|
this.message$ = { paused: Date.now() + time };
|
|
62678
63097
|
await delay(time);
|
|
62679
63098
|
this.state$ = state;
|
|
@@ -62690,7 +63109,7 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62690
63109
|
result.rendererClass = getRendererClass("silent");
|
|
62691
63110
|
this.subtasks = result.tasks;
|
|
62692
63111
|
result.errors = this.listr.errors;
|
|
62693
|
-
this.emit(
|
|
63112
|
+
this.emit("SUBTASK", this.subtasks);
|
|
62694
63113
|
result = result.run(context);
|
|
62695
63114
|
} else if (result instanceof Promise) result = result.then(handleResult);
|
|
62696
63115
|
else if (isReadable(result)) result = new Promise((resolve2, reject) => {
|
|
@@ -62712,13 +63131,13 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62712
63131
|
return result;
|
|
62713
63132
|
};
|
|
62714
63133
|
const startTime = Date.now();
|
|
62715
|
-
this.state$ =
|
|
63134
|
+
this.state$ = "STARTED";
|
|
62716
63135
|
const skipped = await assertFunctionOrSelf(this.task?.skip ?? false, context);
|
|
62717
63136
|
if (skipped) {
|
|
62718
63137
|
if (typeof skipped === "string") this.message$ = { skip: skipped };
|
|
62719
63138
|
else if (this.hasTitle()) this.message$ = { skip: this.title };
|
|
62720
63139
|
else this.message$ = { skip: "Skipped task without a title." };
|
|
62721
|
-
this.state$ =
|
|
63140
|
+
this.state$ = "SKIPPED";
|
|
62722
63141
|
return;
|
|
62723
63142
|
}
|
|
62724
63143
|
try {
|
|
@@ -62736,27 +63155,27 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62736
63155
|
this.message$ = { retry: this.retry };
|
|
62737
63156
|
this.title$ = this.initialTitle;
|
|
62738
63157
|
this.output = void 0;
|
|
62739
|
-
wrapper.report(err,
|
|
62740
|
-
this.state$ =
|
|
63158
|
+
wrapper.report(err, "WILL_RETRY");
|
|
63159
|
+
this.state$ = "RETRY";
|
|
62741
63160
|
if (retryDelay) await this.pause(retryDelay);
|
|
62742
63161
|
} else throw err;
|
|
62743
63162
|
}
|
|
62744
63163
|
if (this.isStarted() || this.isRetrying()) {
|
|
62745
63164
|
this.message$ = { duration: Date.now() - startTime };
|
|
62746
|
-
this.state$ =
|
|
63165
|
+
this.state$ = "COMPLETED";
|
|
62747
63166
|
}
|
|
62748
63167
|
} catch (error) {
|
|
62749
63168
|
if (this.prompt instanceof PromptError) error = this.prompt;
|
|
62750
63169
|
if (this.task?.rollback) {
|
|
62751
|
-
wrapper.report(error,
|
|
63170
|
+
wrapper.report(error, "WILL_ROLLBACK");
|
|
62752
63171
|
try {
|
|
62753
|
-
this.state$ =
|
|
63172
|
+
this.state$ = "ROLLING_BACK";
|
|
62754
63173
|
await this.task.rollback(context, wrapper);
|
|
62755
63174
|
this.message$ = { rollback: this.title };
|
|
62756
|
-
this.state$ =
|
|
63175
|
+
this.state$ = "ROLLED_BACK";
|
|
62757
63176
|
} catch (err) {
|
|
62758
|
-
this.state$ =
|
|
62759
|
-
wrapper.report(err,
|
|
63177
|
+
this.state$ = "FAILED";
|
|
63178
|
+
wrapper.report(err, "HAS_FAILED_TO_ROLLBACK");
|
|
62760
63179
|
this.close();
|
|
62761
63180
|
throw err;
|
|
62762
63181
|
}
|
|
@@ -62765,26 +63184,29 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62765
63184
|
throw error;
|
|
62766
63185
|
}
|
|
62767
63186
|
} else {
|
|
62768
|
-
this.state$ =
|
|
63187
|
+
this.state$ = "FAILED";
|
|
62769
63188
|
if (this.listr.options.exitOnError !== false && await assertFunctionOrSelf(this.task?.exitOnError, context) !== false) {
|
|
62770
|
-
wrapper.report(error,
|
|
63189
|
+
wrapper.report(error, "HAS_FAILED");
|
|
62771
63190
|
this.close();
|
|
62772
63191
|
throw error;
|
|
62773
|
-
} else if (!this.hasSubtasks()) wrapper.report(error,
|
|
63192
|
+
} else if (!this.hasSubtasks()) wrapper.report(error, "HAS_FAILED_WITHOUT_ERROR");
|
|
62774
63193
|
}
|
|
62775
63194
|
} finally {
|
|
62776
63195
|
this.close();
|
|
62777
63196
|
}
|
|
62778
63197
|
}
|
|
62779
63198
|
close() {
|
|
62780
|
-
this.emit(
|
|
62781
|
-
this.listr.events.emit(
|
|
63199
|
+
this.emit("CLOSED");
|
|
63200
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62782
63201
|
this.complete();
|
|
62783
63202
|
}
|
|
62784
63203
|
};
|
|
62785
63204
|
var ListrEventManager = class extends EventManager {
|
|
62786
63205
|
};
|
|
62787
63206
|
var Listr = class {
|
|
63207
|
+
task;
|
|
63208
|
+
options;
|
|
63209
|
+
parentTask;
|
|
62788
63210
|
tasks = [];
|
|
62789
63211
|
errors = [];
|
|
62790
63212
|
ctx;
|
|
@@ -62820,11 +63242,11 @@ var Listr = class {
|
|
|
62820
63242
|
}
|
|
62821
63243
|
if (this.parentTask?.listr.events instanceof ListrEventManager) this.events = this.parentTask.listr.events;
|
|
62822
63244
|
else this.events = new ListrEventManager();
|
|
62823
|
-
if (this.options?.forceTTY || process.env[
|
|
63245
|
+
if (this.options?.forceTTY || process.env["LISTR_FORCE_TTY"]) {
|
|
62824
63246
|
process.stdout.isTTY = true;
|
|
62825
63247
|
process.stderr.isTTY = true;
|
|
62826
63248
|
}
|
|
62827
|
-
if (this.options?.forceUnicode) process.env[
|
|
63249
|
+
if (this.options?.forceUnicode) process.env["LISTR_FORCE_UNICODE"] = "1";
|
|
62828
63250
|
const renderer = getRenderer({
|
|
62829
63251
|
renderer: this.options.renderer,
|
|
62830
63252
|
rendererOptions: this.options.rendererOptions,
|
|
@@ -62889,8 +63311,8 @@ var Listr = class {
|
|
|
62889
63311
|
tasks = Array.isArray(tasks) ? tasks : [tasks];
|
|
62890
63312
|
return tasks.map((task) => {
|
|
62891
63313
|
let rendererTaskOptions;
|
|
62892
|
-
if (this.rendererSelection ===
|
|
62893
|
-
else if (this.rendererSelection ===
|
|
63314
|
+
if (this.rendererSelection === "PRIMARY") rendererTaskOptions = task.rendererOptions;
|
|
63315
|
+
else if (this.rendererSelection === "SECONDARY") rendererTaskOptions = task.fallbackRendererOptions;
|
|
62894
63316
|
return new Task(this, task, this.options, this.rendererClassOptions, rendererTaskOptions);
|
|
62895
63317
|
});
|
|
62896
63318
|
}
|
|
@@ -62900,7 +63322,7 @@ var Listr = class {
|
|
|
62900
63322
|
}
|
|
62901
63323
|
signalHandler() {
|
|
62902
63324
|
this.tasks?.forEach(async (task) => {
|
|
62903
|
-
if (task.isPending()) task.state$ =
|
|
63325
|
+
if (task.isPending()) task.state$ = "FAILED";
|
|
62904
63326
|
});
|
|
62905
63327
|
if (this.isRoot()) {
|
|
62906
63328
|
this.renderer?.end(/* @__PURE__ */ new Error("Interrupted."));
|
|
@@ -62913,7 +63335,7 @@ var Listr = class {
|
|
|
62913
63335
|
};
|
|
62914
63336
|
|
|
62915
63337
|
// packages/kong-cli/src/commands/installCommand.ts
|
|
62916
|
-
var
|
|
63338
|
+
var import_path5 = __toESM(require("path"));
|
|
62917
63339
|
|
|
62918
63340
|
// packages/kong-cli/src/common/listrTaskLogger.ts
|
|
62919
63341
|
var ListrTaskLogger = class {
|
|
@@ -62969,165 +63391,9 @@ var InstallCommand = class {
|
|
|
62969
63391
|
scriptPath() {
|
|
62970
63392
|
const scriptName = "python-install";
|
|
62971
63393
|
if (process.platform === "win32") {
|
|
62972
|
-
return
|
|
62973
|
-
}
|
|
62974
|
-
return import_path4.default.join(__dirname, "assets", `${scriptName}.sh`);
|
|
62975
|
-
}
|
|
62976
|
-
};
|
|
62977
|
-
|
|
62978
|
-
// packages/kong-cli/src/services/api.ts
|
|
62979
|
-
var import_keyring2 = __toESM(require_keyring());
|
|
62980
|
-
|
|
62981
|
-
// node_modules/jwt-decode/build/esm/index.js
|
|
62982
|
-
var InvalidTokenError = class extends Error {
|
|
62983
|
-
};
|
|
62984
|
-
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
62985
|
-
function b64DecodeUnicode(str) {
|
|
62986
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
62987
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
62988
|
-
if (code.length < 2) {
|
|
62989
|
-
code = "0" + code;
|
|
62990
|
-
}
|
|
62991
|
-
return "%" + code;
|
|
62992
|
-
}));
|
|
62993
|
-
}
|
|
62994
|
-
function base64UrlDecode(str) {
|
|
62995
|
-
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
62996
|
-
switch (output.length % 4) {
|
|
62997
|
-
case 0:
|
|
62998
|
-
break;
|
|
62999
|
-
case 2:
|
|
63000
|
-
output += "==";
|
|
63001
|
-
break;
|
|
63002
|
-
case 3:
|
|
63003
|
-
output += "=";
|
|
63004
|
-
break;
|
|
63005
|
-
default:
|
|
63006
|
-
throw new Error("base64 string is not of the correct length");
|
|
63007
|
-
}
|
|
63008
|
-
try {
|
|
63009
|
-
return b64DecodeUnicode(output);
|
|
63010
|
-
} catch (err) {
|
|
63011
|
-
return atob(output);
|
|
63012
|
-
}
|
|
63013
|
-
}
|
|
63014
|
-
function jwtDecode(token, options) {
|
|
63015
|
-
if (typeof token !== "string") {
|
|
63016
|
-
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
63017
|
-
}
|
|
63018
|
-
options || (options = {});
|
|
63019
|
-
const pos = options.header === true ? 0 : 1;
|
|
63020
|
-
const part = token.split(".")[pos];
|
|
63021
|
-
if (typeof part !== "string") {
|
|
63022
|
-
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
63023
|
-
}
|
|
63024
|
-
let decoded;
|
|
63025
|
-
try {
|
|
63026
|
-
decoded = base64UrlDecode(part);
|
|
63027
|
-
} catch (e) {
|
|
63028
|
-
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
63029
|
-
}
|
|
63030
|
-
try {
|
|
63031
|
-
return JSON.parse(decoded);
|
|
63032
|
-
} catch (e) {
|
|
63033
|
-
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
63034
|
-
}
|
|
63035
|
-
}
|
|
63036
|
-
|
|
63037
|
-
// packages/kong-cli/src/services/api.ts
|
|
63038
|
-
function requestConfigProvider(profile) {
|
|
63039
|
-
const cached = {
|
|
63040
|
-
headers: {
|
|
63041
|
-
"Content-Type": "application/json",
|
|
63042
|
-
"X-App-Tenant": parseTenant(profile.kongBaseUrl)
|
|
63043
|
-
}
|
|
63044
|
-
};
|
|
63045
|
-
return async () => {
|
|
63046
|
-
if (cached.headers?.Authorization) {
|
|
63047
|
-
try {
|
|
63048
|
-
const auth = cached.headers.Authorization;
|
|
63049
|
-
const accessToken = auth.split("Bearer ")[1]?.trim();
|
|
63050
|
-
if (accessToken) {
|
|
63051
|
-
const decoded = jwtDecode(accessToken);
|
|
63052
|
-
if (decoded.exp !== void 0) {
|
|
63053
|
-
const nowSeconds = Date.now() / 1e3;
|
|
63054
|
-
if (decoded.exp > nowSeconds + 60) {
|
|
63055
|
-
return cached;
|
|
63056
|
-
}
|
|
63057
|
-
}
|
|
63058
|
-
}
|
|
63059
|
-
} catch (ex) {
|
|
63060
|
-
console.warn("failed to use cached token, fetching new one", ex);
|
|
63061
|
-
}
|
|
63062
|
-
}
|
|
63063
|
-
const url2 = joinUrlAndPath(
|
|
63064
|
-
profile.kongBaseUrl,
|
|
63065
|
-
"api/keycloak/realms/kong/protocol/openid-connect/token"
|
|
63066
|
-
);
|
|
63067
|
-
const entry = new import_keyring2.Entry(profile.kongBaseUrl, profile.userName);
|
|
63068
|
-
const password = entry.getPassword();
|
|
63069
|
-
if (!password) {
|
|
63070
|
-
throw new Error("No password found in keyring for user: " + profile.userName);
|
|
63394
|
+
return import_path5.default.join(__dirname, "assets", `${scriptName}.bat`);
|
|
63071
63395
|
}
|
|
63072
|
-
|
|
63073
|
-
grant_type: "password",
|
|
63074
|
-
client_id: "kong-web",
|
|
63075
|
-
username: profile.userName,
|
|
63076
|
-
password
|
|
63077
|
-
});
|
|
63078
|
-
const response = await axios_default.post(url2, params, {
|
|
63079
|
-
headers: {
|
|
63080
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
63081
|
-
}
|
|
63082
|
-
});
|
|
63083
|
-
cached.headers = {
|
|
63084
|
-
...cached.headers,
|
|
63085
|
-
["Authorization"]: `Bearer ${response.data.access_token}`
|
|
63086
|
-
};
|
|
63087
|
-
return cached;
|
|
63088
|
-
};
|
|
63089
|
-
}
|
|
63090
|
-
|
|
63091
|
-
// packages/kong-cli/src/services/managementClient.ts
|
|
63092
|
-
var ManagementClient = class {
|
|
63093
|
-
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
63094
|
-
this.requestConfigProvider = requestConfigProvider2;
|
|
63095
|
-
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/management");
|
|
63096
|
-
}
|
|
63097
|
-
async updateExtension(extension) {
|
|
63098
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
|
|
63099
|
-
await axios_default.put(url2, extension, await this.requestConfigProvider());
|
|
63100
|
-
}
|
|
63101
|
-
async createExtensionSnapshot(extensionId, snapshot) {
|
|
63102
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
|
|
63103
|
-
await axios_default.post(url2, snapshot, await this.requestConfigProvider());
|
|
63104
|
-
}
|
|
63105
|
-
async getExtensionSnapshot(extensionId, extensionSnapshotVersion) {
|
|
63106
|
-
const url2 = joinUrlAndPath(
|
|
63107
|
-
this.baseUrl,
|
|
63108
|
-
"v1/extensions",
|
|
63109
|
-
extensionId,
|
|
63110
|
-
"snapshots",
|
|
63111
|
-
extensionSnapshotVersion
|
|
63112
|
-
);
|
|
63113
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63114
|
-
}
|
|
63115
|
-
async getExtensionSnapshotVersions(extensionId) {
|
|
63116
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
|
|
63117
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63118
|
-
}
|
|
63119
|
-
async getExtensionSnapshotAliases(extensionId) {
|
|
63120
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
|
|
63121
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63122
|
-
}
|
|
63123
|
-
async getAuditLog(objectType2, objectId, createdAfter) {
|
|
63124
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/audit");
|
|
63125
|
-
const config = await this.requestConfigProvider();
|
|
63126
|
-
const response = await axios_default.get(url2, {
|
|
63127
|
-
...config,
|
|
63128
|
-
params: { ...config.params, objectType: objectType2, objectId, createdAfter }
|
|
63129
|
-
});
|
|
63130
|
-
return response.data;
|
|
63396
|
+
return import_path5.default.join(__dirname, "assets", `${scriptName}.sh`);
|
|
63131
63397
|
}
|
|
63132
63398
|
};
|
|
63133
63399
|
|
|
@@ -63141,14 +63407,13 @@ var ListAliasesCommand = class {
|
|
|
63141
63407
|
requestConfigProvider(profile)
|
|
63142
63408
|
);
|
|
63143
63409
|
}
|
|
63144
|
-
async execute() {
|
|
63410
|
+
async execute(processId) {
|
|
63145
63411
|
await new Listr(
|
|
63146
63412
|
[
|
|
63147
63413
|
{
|
|
63148
|
-
title: "list extension aliases",
|
|
63414
|
+
title: processId ? `list process aliases (${processId})` : "list extension aliases",
|
|
63149
63415
|
task: async (ctx, task) => {
|
|
63150
|
-
const
|
|
63151
|
-
const aliases = await this.managementClient.getExtensionSnapshotAliases(kongJson.id);
|
|
63416
|
+
const aliases = processId ? await this.managementClient.getProcessAliases(processId) : await this.managementClient.getExtensionSnapshotAliases(getKongJson().id);
|
|
63152
63417
|
if (aliases.length === 0) {
|
|
63153
63418
|
task.output = "no aliases available";
|
|
63154
63419
|
} else {
|
|
@@ -63189,14 +63454,15 @@ var ListVersionsCommand = class {
|
|
|
63189
63454
|
requestConfigProvider(profile)
|
|
63190
63455
|
);
|
|
63191
63456
|
}
|
|
63192
|
-
async execute() {
|
|
63457
|
+
async execute(processId) {
|
|
63193
63458
|
await new Listr(
|
|
63194
63459
|
[
|
|
63195
63460
|
{
|
|
63196
|
-
title: "list extension snapshot versions",
|
|
63461
|
+
title: processId ? `list process snapshot versions (${processId})` : "list extension snapshot versions",
|
|
63197
63462
|
task: async (ctx, task) => {
|
|
63198
|
-
const
|
|
63199
|
-
|
|
63463
|
+
const versions = processId ? await this.managementClient.getDocumentSnapshotVersions(
|
|
63464
|
+
processId
|
|
63465
|
+
) : await this.managementClient.getExtensionSnapshotVersions(getKongJson().id);
|
|
63200
63466
|
if (versions.length === 0) {
|
|
63201
63467
|
task.output = "no versions available";
|
|
63202
63468
|
} else {
|
|
@@ -63227,7 +63493,7 @@ var ListVersionsCommand = class {
|
|
|
63227
63493
|
};
|
|
63228
63494
|
|
|
63229
63495
|
// packages/kong-cli/src/commands/publishVersionCommand.ts
|
|
63230
|
-
var
|
|
63496
|
+
var import_child_process3 = require("child_process");
|
|
63231
63497
|
|
|
63232
63498
|
// packages/kong-cli/src/common/extensionContract.ts
|
|
63233
63499
|
var import__ = __toESM(require__());
|
|
@@ -63243,18 +63509,6 @@ function getExtensionContract(filePath) {
|
|
|
63243
63509
|
return contract;
|
|
63244
63510
|
}
|
|
63245
63511
|
|
|
63246
|
-
// packages/kong-cli/src/services/registryClient.ts
|
|
63247
|
-
var RegistryClient = class {
|
|
63248
|
-
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
63249
|
-
this.requestConfigProvider = requestConfigProvider2;
|
|
63250
|
-
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/registry");
|
|
63251
|
-
}
|
|
63252
|
-
async getPublishDetails(appName) {
|
|
63253
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
|
|
63254
|
-
return (await axios_default.post(url2, {}, await this.requestConfigProvider())).data;
|
|
63255
|
-
}
|
|
63256
|
-
};
|
|
63257
|
-
|
|
63258
63512
|
// packages/kong-cli/src/commands/publishVersionCommand.ts
|
|
63259
63513
|
var PublishVersionCommand = class {
|
|
63260
63514
|
constructor(profile, verbose = false, contractPath = null) {
|
|
@@ -63269,7 +63523,7 @@ var PublishVersionCommand = class {
|
|
|
63269
63523
|
const clientRequestConfigProvider = requestConfigProvider(profile);
|
|
63270
63524
|
this.registryClient = new RegistryClient(profile.kongBaseUrl, clientRequestConfigProvider);
|
|
63271
63525
|
this.managementClient = new ManagementClient(profile.kongBaseUrl, clientRequestConfigProvider);
|
|
63272
|
-
const dockerVersion = (0,
|
|
63526
|
+
const dockerVersion = (0, import_child_process3.spawnSync)("docker", ["--version"]);
|
|
63273
63527
|
this.hasDocker = !dockerVersion.error;
|
|
63274
63528
|
}
|
|
63275
63529
|
get wslPrefix() {
|
|
@@ -63419,6 +63673,8 @@ var PublishVersionCommand = class {
|
|
|
63419
63673
|
name: kongJson.name,
|
|
63420
63674
|
category: kongJson.category,
|
|
63421
63675
|
deprecated: false,
|
|
63676
|
+
origin: "cli",
|
|
63677
|
+
checkpoint: void 0,
|
|
63422
63678
|
createdBy: "",
|
|
63423
63679
|
created: utcNow(DEFAULT_TIMEZONE),
|
|
63424
63680
|
updated: utcNow(DEFAULT_TIMEZONE),
|
|
@@ -63744,18 +64000,18 @@ var SetAliasCommand = class {
|
|
|
63744
64000
|
};
|
|
63745
64001
|
|
|
63746
64002
|
// packages/kong-cli/src/common/cli.ts
|
|
63747
|
-
var
|
|
63748
|
-
var
|
|
64003
|
+
var import_fs5 = __toESM(require("fs"));
|
|
64004
|
+
var import_path6 = __toESM(require("path"));
|
|
63749
64005
|
function getPresetVersion() {
|
|
63750
|
-
const packageJsonPath =
|
|
63751
|
-
if (!
|
|
64006
|
+
const packageJsonPath = import_path6.default.join(__dirname, "package.json");
|
|
64007
|
+
if (!import_fs5.default.existsSync(packageJsonPath)) {
|
|
63752
64008
|
throw new AppError(`package.json file was not found at path: ${packageJsonPath}`);
|
|
63753
64009
|
}
|
|
63754
64010
|
return require(packageJsonPath).version;
|
|
63755
64011
|
}
|
|
63756
64012
|
|
|
63757
64013
|
// packages/kong-cli/src/index.ts
|
|
63758
|
-
import_dotenv_expand.default.expand(import_dotenv.default.config({ path:
|
|
64014
|
+
import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_path7.default.join(__dirname, ".env"), quiet: true }));
|
|
63759
64015
|
async function main() {
|
|
63760
64016
|
const generateCommand = new Command("generate").description("Generate new extension").argument("name", "Extension name").addOption(
|
|
63761
64017
|
new Option("--sdk <name>", "Target sdk platform for extension").choices(["python", "kotlin"]).default("python")
|
|
@@ -63773,13 +64029,23 @@ async function main() {
|
|
|
63773
64029
|
printError("generate command failed", ex);
|
|
63774
64030
|
}
|
|
63775
64031
|
});
|
|
64032
|
+
const connectCommand = new Command("connect").description(
|
|
64033
|
+
"Start the local helper server the Kong UI uses to run extension tests and build snapshot images on this machine"
|
|
64034
|
+
).addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).action(async (options) => {
|
|
64035
|
+
try {
|
|
64036
|
+
printProfile(options.profile);
|
|
64037
|
+
await new ConnectCommand(options.profile, getProfile(options.profile)).execute();
|
|
64038
|
+
} catch (ex) {
|
|
64039
|
+
printError("connect command failed", ex);
|
|
64040
|
+
}
|
|
64041
|
+
});
|
|
63776
64042
|
const configureCommand = new Command("configure").description("Configure access to kong environments").action(async () => {
|
|
63777
64043
|
await new ConfigureCommand().execute();
|
|
63778
64044
|
});
|
|
63779
64045
|
const installCommand = new Command("install").description("Setup virtual environment and install dependencies").addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
|
|
63780
64046
|
try {
|
|
63781
64047
|
const kongJsonPath = resolveProjectPath("kong.json");
|
|
63782
|
-
const projectRoot =
|
|
64048
|
+
const projectRoot = import_path7.default.dirname(kongJsonPath);
|
|
63783
64049
|
await new InstallCommand(options.verbose).execute(projectRoot);
|
|
63784
64050
|
} catch (ex) {
|
|
63785
64051
|
printError("install command failed", ex);
|
|
@@ -63801,10 +64067,17 @@ async function main() {
|
|
|
63801
64067
|
printError("publish-version command failed", ex);
|
|
63802
64068
|
}
|
|
63803
64069
|
});
|
|
63804
|
-
const listVersionsCommand = new Command("list-versions").description("List available versions").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(
|
|
64070
|
+
const listVersionsCommand = new Command("list-versions").description("List available versions").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(
|
|
64071
|
+
new Option(
|
|
64072
|
+
"--process <documentId>",
|
|
64073
|
+
"List a workflow (process) document's snapshot versions instead of the current extension's (no kong.json needed)"
|
|
64074
|
+
)
|
|
64075
|
+
).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
|
|
63805
64076
|
try {
|
|
63806
64077
|
printProfile(options.profile);
|
|
63807
|
-
await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute(
|
|
64078
|
+
await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute(
|
|
64079
|
+
options.process
|
|
64080
|
+
);
|
|
63808
64081
|
} catch (ex) {
|
|
63809
64082
|
printError("list-versions command failed", ex);
|
|
63810
64083
|
}
|
|
@@ -63829,16 +64102,24 @@ async function main() {
|
|
|
63829
64102
|
printError("set-alias command failed", ex);
|
|
63830
64103
|
}
|
|
63831
64104
|
});
|
|
63832
|
-
const listAliasesCommand = new Command("list-aliases").description("List available extension aliases").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).
|
|
64105
|
+
const listAliasesCommand = new Command("list-aliases").description("List available extension aliases").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(
|
|
64106
|
+
new Option(
|
|
64107
|
+
"--process <documentId>",
|
|
64108
|
+
"List a workflow (process) document's aliases instead of the current extension's (no kong.json needed)"
|
|
64109
|
+
)
|
|
64110
|
+
).action(async (options) => {
|
|
63833
64111
|
try {
|
|
63834
64112
|
printProfile(options.profile);
|
|
63835
|
-
await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute(
|
|
64113
|
+
await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute(
|
|
64114
|
+
options.process
|
|
64115
|
+
);
|
|
63836
64116
|
} catch (ex) {
|
|
63837
64117
|
printError("list-aliases command failed", ex);
|
|
63838
64118
|
}
|
|
63839
64119
|
});
|
|
63840
64120
|
const cli = new Command().version(getPresetVersion()).description("CLI to support creating and publishing Kong extensions");
|
|
63841
64121
|
cli.addCommand(generateCommand);
|
|
64122
|
+
cli.addCommand(connectCommand);
|
|
63842
64123
|
cli.addCommand(configureCommand);
|
|
63843
64124
|
cli.addCommand(installCommand);
|
|
63844
64125
|
cli.addCommand(publishVersionCommand);
|