@devkong/cli 0.0.67-alpha.24 → 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 +899 -613
- package/package.json +1 -1
- package/packages/kong-cli/src/commands/connectCommand.d.ts +29 -0
- package/packages/kong-cli/src/commands/generateCommand.d.ts +1 -1
- 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 +3 -3
- package/packages/kong-spec/src/lib/kongSpec.d.ts +2 -2
- package/packages/kong-spec/src/lib/kongSpecUtils.d.ts +2 -10
- package/packages/kong-ts/src/index.d.ts +5 -3
- 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/src/lib/jq.d.ts +1 -0
- package/packages/kong-ts/src/lib/jsonSchema.d.ts +13 -0
- package/packages/kong-ts-contract/src/index.d.ts +3 -2
- package/packages/kong-ts-contract/src/lib/appAuditLog.d.ts +2 -1
- package/packages/kong-ts-contract/src/lib/appDependency.d.ts +9 -0
- package/packages/kong-ts-contract/src/lib/appExtension.d.ts +3 -0
- 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) {
|
|
@@ -61104,8 +61566,12 @@ var GenerateCommand = class {
|
|
|
61104
61566
|
choices: [
|
|
61105
61567
|
{ name: "basic - a single operation", value: "basic" },
|
|
61106
61568
|
{
|
|
61107
|
-
name: "
|
|
61108
|
-
value: "
|
|
61569
|
+
name: "with-secret - multiple operations with a secret example",
|
|
61570
|
+
value: "with-secret"
|
|
61571
|
+
},
|
|
61572
|
+
{
|
|
61573
|
+
name: "with-s3 - download a file from S3 using an s3 secret",
|
|
61574
|
+
value: "with-s3"
|
|
61109
61575
|
}
|
|
61110
61576
|
]
|
|
61111
61577
|
});
|
|
@@ -61120,52 +61586,15 @@ var eventemitter3_default = import_index.default;
|
|
|
61120
61586
|
// node_modules/listr2/dist/index.mjs
|
|
61121
61587
|
var import_node_util11 = require("node:util");
|
|
61122
61588
|
var import_util4 = require("util");
|
|
61123
|
-
var
|
|
61589
|
+
var import_os3 = require("os");
|
|
61124
61590
|
var import_string_decoder = require("string_decoder");
|
|
61125
61591
|
var import_stream5 = require("stream");
|
|
61126
61592
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
61127
61593
|
var import_crypto2 = require("crypto");
|
|
61128
|
-
var ANSI_ESCAPE2 = "\x1B[";
|
|
61129
61594
|
var ANSI_ESCAPE_CODES = {
|
|
61130
|
-
CURSOR_HIDE:
|
|
61131
|
-
CURSOR_SHOW:
|
|
61595
|
+
CURSOR_HIDE: "\x1B[?25l",
|
|
61596
|
+
CURSOR_SHOW: "\x1B[?25h"
|
|
61132
61597
|
};
|
|
61133
|
-
var ListrEnvironmentVariables = /* @__PURE__ */ (function(ListrEnvironmentVariables2) {
|
|
61134
|
-
ListrEnvironmentVariables2["FORCE_UNICODE"] = "LISTR_FORCE_UNICODE";
|
|
61135
|
-
ListrEnvironmentVariables2["FORCE_TTY"] = "LISTR_FORCE_TTY";
|
|
61136
|
-
ListrEnvironmentVariables2["DISABLE_COLOR"] = "NO_COLOR";
|
|
61137
|
-
ListrEnvironmentVariables2["FORCE_COLOR"] = "FORCE_COLOR";
|
|
61138
|
-
return ListrEnvironmentVariables2;
|
|
61139
|
-
})({});
|
|
61140
|
-
var ListrErrorTypes = /* @__PURE__ */ (function(ListrErrorTypes2) {
|
|
61141
|
-
ListrErrorTypes2["WILL_RETRY"] = "WILL_RETRY";
|
|
61142
|
-
ListrErrorTypes2["WILL_ROLLBACK"] = "WILL_ROLLBACK";
|
|
61143
|
-
ListrErrorTypes2["HAS_FAILED_TO_ROLLBACK"] = "HAS_FAILED_TO_ROLLBACK";
|
|
61144
|
-
ListrErrorTypes2["HAS_FAILED"] = "HAS_FAILED";
|
|
61145
|
-
ListrErrorTypes2["HAS_FAILED_WITHOUT_ERROR"] = "HAS_FAILED_WITHOUT_ERROR";
|
|
61146
|
-
return ListrErrorTypes2;
|
|
61147
|
-
})({});
|
|
61148
|
-
var ListrEventType = /* @__PURE__ */ (function(ListrEventType2) {
|
|
61149
|
-
ListrEventType2["SHOULD_REFRESH_RENDER"] = "SHOUD_REFRESH_RENDER";
|
|
61150
|
-
return ListrEventType2;
|
|
61151
|
-
})({});
|
|
61152
|
-
var ListrRendererSelection = /* @__PURE__ */ (function(ListrRendererSelection2) {
|
|
61153
|
-
ListrRendererSelection2["PRIMARY"] = "PRIMARY";
|
|
61154
|
-
ListrRendererSelection2["SECONDARY"] = "SECONDARY";
|
|
61155
|
-
ListrRendererSelection2["SILENT"] = "SILENT";
|
|
61156
|
-
return ListrRendererSelection2;
|
|
61157
|
-
})({});
|
|
61158
|
-
var ListrTaskEventType = /* @__PURE__ */ (function(ListrTaskEventType2) {
|
|
61159
|
-
ListrTaskEventType2["TITLE"] = "TITLE";
|
|
61160
|
-
ListrTaskEventType2["STATE"] = "STATE";
|
|
61161
|
-
ListrTaskEventType2["ENABLED"] = "ENABLED";
|
|
61162
|
-
ListrTaskEventType2["SUBTASK"] = "SUBTASK";
|
|
61163
|
-
ListrTaskEventType2["PROMPT"] = "PROMPT";
|
|
61164
|
-
ListrTaskEventType2["OUTPUT"] = "OUTPUT";
|
|
61165
|
-
ListrTaskEventType2["MESSAGE"] = "MESSAGE";
|
|
61166
|
-
ListrTaskEventType2["CLOSED"] = "CLOSED";
|
|
61167
|
-
return ListrTaskEventType2;
|
|
61168
|
-
})({});
|
|
61169
61598
|
var ListrTaskState = /* @__PURE__ */ (function(ListrTaskState2) {
|
|
61170
61599
|
ListrTaskState2["WAITING"] = "WAITING";
|
|
61171
61600
|
ListrTaskState2["STARTED"] = "STARTED";
|
|
@@ -61206,7 +61635,7 @@ function isReadable(obj) {
|
|
|
61206
61635
|
return !!obj && typeof obj === "object" && obj.readable === true && typeof obj.read === "function" && typeof obj.on === "function";
|
|
61207
61636
|
}
|
|
61208
61637
|
function isUnicodeSupported2() {
|
|
61209
|
-
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";
|
|
61210
61639
|
}
|
|
61211
61640
|
var CLEAR_LINE_REGEX = "(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+";
|
|
61212
61641
|
var BELL_REGEX = /\u0007/;
|
|
@@ -61242,47 +61671,35 @@ var figures2 = isUnicodeSupported2() ? FIGURES_MAIN : FIGURES_FALLBACK;
|
|
|
61242
61671
|
function splat(message2, ...splat2) {
|
|
61243
61672
|
return (0, import_util4.format)(String(message2), ...splat2);
|
|
61244
61673
|
}
|
|
61245
|
-
var ListrLogLevels = /* @__PURE__ */ (function(ListrLogLevels2) {
|
|
61246
|
-
ListrLogLevels2["STARTED"] = "STARTED";
|
|
61247
|
-
ListrLogLevels2["COMPLETED"] = "COMPLETED";
|
|
61248
|
-
ListrLogLevels2["FAILED"] = "FAILED";
|
|
61249
|
-
ListrLogLevels2["SKIPPED"] = "SKIPPED";
|
|
61250
|
-
ListrLogLevels2["OUTPUT"] = "OUTPUT";
|
|
61251
|
-
ListrLogLevels2["TITLE"] = "TITLE";
|
|
61252
|
-
ListrLogLevels2["ROLLBACK"] = "ROLLBACK";
|
|
61253
|
-
ListrLogLevels2["RETRY"] = "RETRY";
|
|
61254
|
-
ListrLogLevels2["PROMPT"] = "PROMPT";
|
|
61255
|
-
ListrLogLevels2["PAUSED"] = "PAUSED";
|
|
61256
|
-
return ListrLogLevels2;
|
|
61257
|
-
})({});
|
|
61258
61674
|
var LISTR_LOGGER_STYLE = {
|
|
61259
61675
|
icon: {
|
|
61260
|
-
[
|
|
61261
|
-
[
|
|
61262
|
-
[
|
|
61263
|
-
[
|
|
61264
|
-
[
|
|
61265
|
-
[
|
|
61266
|
-
[
|
|
61267
|
-
[
|
|
61268
|
-
[
|
|
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
|
|
61269
61685
|
},
|
|
61270
61686
|
color: {
|
|
61271
|
-
[
|
|
61272
|
-
[
|
|
61273
|
-
[
|
|
61274
|
-
[
|
|
61275
|
-
[
|
|
61276
|
-
[
|
|
61277
|
-
[
|
|
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
|
|
61278
61694
|
}
|
|
61279
61695
|
};
|
|
61280
61696
|
var LISTR_LOGGER_STDERR_LEVELS = [
|
|
61281
|
-
|
|
61282
|
-
|
|
61283
|
-
|
|
61697
|
+
"RETRY",
|
|
61698
|
+
"ROLLBACK",
|
|
61699
|
+
"FAILED"
|
|
61284
61700
|
];
|
|
61285
61701
|
var ListrLogger = class {
|
|
61702
|
+
options;
|
|
61286
61703
|
process;
|
|
61287
61704
|
constructor(options) {
|
|
61288
61705
|
this.options = options;
|
|
@@ -61361,12 +61778,12 @@ var ListrLogger = class {
|
|
|
61361
61778
|
}
|
|
61362
61779
|
format(level, message2, options) {
|
|
61363
61780
|
if (!Array.isArray(message2)) message2 = [message2];
|
|
61364
|
-
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) => {
|
|
61365
61782
|
return this.style(level, this.fields(m, {
|
|
61366
61783
|
prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
|
|
61367
61784
|
suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
|
|
61368
61785
|
}));
|
|
61369
|
-
}).join(
|
|
61786
|
+
}).join(import_os3.EOL);
|
|
61370
61787
|
return message2;
|
|
61371
61788
|
}
|
|
61372
61789
|
style(level, message2) {
|
|
@@ -61384,6 +61801,7 @@ var ListrLogger = class {
|
|
|
61384
61801
|
}
|
|
61385
61802
|
};
|
|
61386
61803
|
var ProcessOutputBuffer = class {
|
|
61804
|
+
options;
|
|
61387
61805
|
buffer = [];
|
|
61388
61806
|
decoder = new import_string_decoder.StringDecoder();
|
|
61389
61807
|
constructor(options) {
|
|
@@ -61414,6 +61832,7 @@ var ProcessOutputBuffer = class {
|
|
|
61414
61832
|
}
|
|
61415
61833
|
};
|
|
61416
61834
|
var ProcessOutputStream = class {
|
|
61835
|
+
stream;
|
|
61417
61836
|
method;
|
|
61418
61837
|
buffer;
|
|
61419
61838
|
constructor(stream4) {
|
|
@@ -61442,6 +61861,7 @@ var ProcessOutputStream = class {
|
|
|
61442
61861
|
}
|
|
61443
61862
|
};
|
|
61444
61863
|
var ProcessOutput = class {
|
|
61864
|
+
options;
|
|
61445
61865
|
stream;
|
|
61446
61866
|
active;
|
|
61447
61867
|
constructor(stdout, stderr, options) {
|
|
@@ -61479,20 +61899,20 @@ var ProcessOutput = class {
|
|
|
61479
61899
|
};
|
|
61480
61900
|
}).filter((message2) => message2.entry);
|
|
61481
61901
|
if (output.length > 0) {
|
|
61482
|
-
if (this.options.leaveEmptyLine) this.stdout.write(
|
|
61902
|
+
if (this.options.leaveEmptyLine) this.stdout.write(import_os3.EOL);
|
|
61483
61903
|
output.forEach((message2) => {
|
|
61484
|
-
(message2.stream ?? this.stdout).write(message2.entry +
|
|
61904
|
+
(message2.stream ?? this.stdout).write(message2.entry + import_os3.EOL);
|
|
61485
61905
|
});
|
|
61486
61906
|
}
|
|
61487
61907
|
this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
|
|
61488
61908
|
this.active = false;
|
|
61489
61909
|
}
|
|
61490
61910
|
toStdout(buffer, eol = true) {
|
|
61491
|
-
if (eol) buffer = buffer +
|
|
61911
|
+
if (eol) buffer = buffer + import_os3.EOL;
|
|
61492
61912
|
return this.stream.stdout.write(buffer);
|
|
61493
61913
|
}
|
|
61494
61914
|
toStderr(buffer, eol = true) {
|
|
61495
|
-
if (eol) buffer = buffer +
|
|
61915
|
+
if (eol) buffer = buffer + import_os3.EOL;
|
|
61496
61916
|
return this.stream.stderr.write(buffer);
|
|
61497
61917
|
}
|
|
61498
61918
|
};
|
|
@@ -61546,56 +61966,38 @@ var Spinner = class {
|
|
|
61546
61966
|
this.id = void 0;
|
|
61547
61967
|
}
|
|
61548
61968
|
};
|
|
61549
|
-
var ListrDefaultRendererLogLevels = /* @__PURE__ */ (function(ListrDefaultRendererLogLevels2) {
|
|
61550
|
-
ListrDefaultRendererLogLevels2["SKIPPED_WITH_COLLAPSE"] = "SKIPPED_WITH_COLLAPSE";
|
|
61551
|
-
ListrDefaultRendererLogLevels2["SKIPPED_WITHOUT_COLLAPSE"] = "SKIPPED_WITHOUT_COLLAPSE";
|
|
61552
|
-
ListrDefaultRendererLogLevels2["OUTPUT"] = "OUTPUT";
|
|
61553
|
-
ListrDefaultRendererLogLevels2["OUTPUT_WITH_BOTTOMBAR"] = "OUTPUT_WITH_BOTTOMBAR";
|
|
61554
|
-
ListrDefaultRendererLogLevels2["PENDING"] = "PENDING";
|
|
61555
|
-
ListrDefaultRendererLogLevels2["COMPLETED"] = "COMPLETED";
|
|
61556
|
-
ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SUBTASKS"] = "COMPLETED_WITH_FAILED_SUBTASKS";
|
|
61557
|
-
ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SISTER_TASKS"] = "COMPLETED_WITH_SISTER_TASKS_FAILED";
|
|
61558
|
-
ListrDefaultRendererLogLevels2["RETRY"] = "RETRY";
|
|
61559
|
-
ListrDefaultRendererLogLevels2["ROLLING_BACK"] = "ROLLING_BACK";
|
|
61560
|
-
ListrDefaultRendererLogLevels2["ROLLED_BACK"] = "ROLLED_BACK";
|
|
61561
|
-
ListrDefaultRendererLogLevels2["FAILED"] = "FAILED";
|
|
61562
|
-
ListrDefaultRendererLogLevels2["FAILED_WITH_FAILED_SUBTASKS"] = "FAILED_WITH_SUBTASKS";
|
|
61563
|
-
ListrDefaultRendererLogLevels2["WAITING"] = "WAITING";
|
|
61564
|
-
ListrDefaultRendererLogLevels2["PAUSED"] = "PAUSED";
|
|
61565
|
-
return ListrDefaultRendererLogLevels2;
|
|
61566
|
-
})({});
|
|
61567
61969
|
var LISTR_DEFAULT_RENDERER_STYLE = {
|
|
61568
61970
|
icon: {
|
|
61569
|
-
[
|
|
61570
|
-
[
|
|
61571
|
-
[
|
|
61572
|
-
[
|
|
61573
|
-
[
|
|
61574
|
-
[
|
|
61575
|
-
[
|
|
61576
|
-
[
|
|
61577
|
-
[
|
|
61578
|
-
[
|
|
61579
|
-
[
|
|
61580
|
-
[
|
|
61581
|
-
[
|
|
61582
|
-
[
|
|
61583
|
-
[
|
|
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
|
|
61584
61986
|
},
|
|
61585
61987
|
color: {
|
|
61586
|
-
[
|
|
61587
|
-
[
|
|
61588
|
-
[
|
|
61589
|
-
[
|
|
61590
|
-
[
|
|
61591
|
-
[
|
|
61592
|
-
[
|
|
61593
|
-
[
|
|
61594
|
-
[
|
|
61595
|
-
[
|
|
61596
|
-
[
|
|
61597
|
-
[
|
|
61598
|
-
[
|
|
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
|
|
61599
62001
|
}
|
|
61600
62002
|
};
|
|
61601
62003
|
function parseTimer(duration) {
|
|
@@ -61613,6 +62015,9 @@ var PRESET_TIMER = {
|
|
|
61613
62015
|
format: () => color.dim
|
|
61614
62016
|
};
|
|
61615
62017
|
var DefaultRenderer = class DefaultRenderer2 {
|
|
62018
|
+
tasks;
|
|
62019
|
+
options;
|
|
62020
|
+
events;
|
|
61616
62021
|
static nonTTY = false;
|
|
61617
62022
|
static rendererOptions = {
|
|
61618
62023
|
indentation: 2,
|
|
@@ -61685,7 +62090,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61685
62090
|
if (!this.options?.lazy) this.spinner.start(() => {
|
|
61686
62091
|
this.update();
|
|
61687
62092
|
});
|
|
61688
|
-
this.events.on(
|
|
62093
|
+
this.events.on("SHOUD_REFRESH_RENDER", () => {
|
|
61689
62094
|
this.update();
|
|
61690
62095
|
});
|
|
61691
62096
|
}
|
|
@@ -61719,31 +62124,31 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61719
62124
|
if (render.length > 0) render.push("");
|
|
61720
62125
|
render.push(...renderPrompt);
|
|
61721
62126
|
}
|
|
61722
|
-
return render.join(
|
|
62127
|
+
return render.join(import_os3.EOL);
|
|
61723
62128
|
}
|
|
61724
62129
|
style(task, output = false) {
|
|
61725
62130
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
61726
62131
|
if (task.isSkipped()) {
|
|
61727
|
-
if (output || rendererOptions.collapseSkips) return this.logger.icon(
|
|
61728
|
-
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");
|
|
61729
62134
|
}
|
|
61730
62135
|
if (output) {
|
|
61731
|
-
if (this.shouldOutputToBottomBar(task)) return this.logger.icon(
|
|
61732
|
-
return this.logger.icon(
|
|
62136
|
+
if (this.shouldOutputToBottomBar(task)) return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");
|
|
62137
|
+
return this.logger.icon("OUTPUT");
|
|
61733
62138
|
}
|
|
61734
62139
|
if (task.hasSubtasks()) {
|
|
61735
|
-
if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) return this.logger.icon(
|
|
61736
|
-
else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) return this.logger.icon(
|
|
61737
|
-
else if (task.hasFailed()) return this.logger.icon(
|
|
61738
|
-
}
|
|
61739
|
-
if (task.isStarted() || task.isPrompt()) return this.logger.icon(
|
|
61740
|
-
else if (task.isCompleted()) return this.logger.icon(
|
|
61741
|
-
else if (task.isRetrying()) return this.logger.icon(
|
|
61742
|
-
else if (task.isRollingBack()) return this.logger.icon(
|
|
61743
|
-
else if (task.hasRolledBack()) return this.logger.icon(
|
|
61744
|
-
else if (task.hasFailed()) return this.logger.icon(
|
|
61745
|
-
else if (task.isPaused()) return this.logger.icon(
|
|
61746
|
-
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");
|
|
61747
62152
|
}
|
|
61748
62153
|
format(message2, icon, level) {
|
|
61749
62154
|
if (message2.trim() === "") return [];
|
|
@@ -61752,7 +62157,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61752
62157
|
const columns = (process.stdout.columns ?? 80) - level * this.options.indentation - 2;
|
|
61753
62158
|
switch (this.options.formatOutput) {
|
|
61754
62159
|
case "truncate":
|
|
61755
|
-
parsed = message2.split(
|
|
62160
|
+
parsed = message2.split(import_os3.EOL).map((s, i) => {
|
|
61756
62161
|
return this.truncate(this.indent(s, i), columns);
|
|
61757
62162
|
});
|
|
61758
62163
|
break;
|
|
@@ -61760,7 +62165,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61760
62165
|
parsed = this.wrap(message2, columns, {
|
|
61761
62166
|
hard: true,
|
|
61762
62167
|
trim: false
|
|
61763
|
-
}).split(
|
|
62168
|
+
}).split(import_os3.EOL).map((s, i) => this.indent(s, i));
|
|
61764
62169
|
break;
|
|
61765
62170
|
default:
|
|
61766
62171
|
throw new ListrRendererError("Format option for the renderer is wrong.");
|
|
@@ -61788,15 +62193,15 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61788
62193
|
if (task.isPrompt()) {
|
|
61789
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.");
|
|
61790
62195
|
else if (!this.activePrompt) {
|
|
61791
|
-
task.on(
|
|
62196
|
+
task.on("PROMPT", (prompt2) => {
|
|
61792
62197
|
const cleansed = cleanseAnsi(prompt2);
|
|
61793
62198
|
if (cleansed) this.prompt = cleansed;
|
|
61794
62199
|
});
|
|
61795
|
-
task.on(
|
|
61796
|
-
if (state ===
|
|
62200
|
+
task.on("STATE", (state) => {
|
|
62201
|
+
if (state === "PROMPT_COMPLETED" || task.hasFinalized() || task.hasReset()) {
|
|
61797
62202
|
this.prompt = null;
|
|
61798
62203
|
this.activePrompt = null;
|
|
61799
|
-
task.off(
|
|
62204
|
+
task.off("PROMPT");
|
|
61800
62205
|
}
|
|
61801
62206
|
});
|
|
61802
62207
|
this.activePrompt = task.id;
|
|
@@ -61804,12 +62209,12 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61804
62209
|
}
|
|
61805
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));
|
|
61806
62211
|
else if (task.isSkipped() && rendererOptions.collapseSkips) output.push(...this.format(this.logger.suffix(task.message.skip && rendererOptions.showSkipMessage ? task.message.skip : task.title, {
|
|
61807
|
-
field:
|
|
62212
|
+
field: "SKIPPED",
|
|
61808
62213
|
condition: rendererOptions.suffixSkips,
|
|
61809
62214
|
format: () => color.dim
|
|
61810
62215
|
}), this.style(task), level));
|
|
61811
62216
|
else if (task.isRetrying()) output.push(...this.format(this.logger.suffix(task.title, {
|
|
61812
|
-
field: `${
|
|
62217
|
+
field: `${"RETRY"}:${task.message.retry.count}`,
|
|
61813
62218
|
format: () => color.yellow,
|
|
61814
62219
|
condition: rendererOptions.suffixRetries
|
|
61815
62220
|
}), this.style(task), level));
|
|
@@ -61822,10 +62227,10 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61822
62227
|
args: [task.message.paused - Date.now()]
|
|
61823
62228
|
}), this.style(task), level));
|
|
61824
62229
|
else output.push(...this.format(task.title, this.style(task), level));
|
|
61825
|
-
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));
|
|
61826
62231
|
if (!task.hasSubtasks() || !rendererOptions.showSubtasks) {
|
|
61827
|
-
if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level,
|
|
61828
|
-
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"));
|
|
61829
62234
|
}
|
|
61830
62235
|
if (task.isPending() || rendererTaskOptions.persistentOutput) output.push(...this.renderOutputBar(task, level));
|
|
61831
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()))) {
|
|
@@ -61849,7 +62254,7 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61849
62254
|
renderOutputBar(task, level) {
|
|
61850
62255
|
const output = this.buffer.output.get(task.id);
|
|
61851
62256
|
if (!output) return [];
|
|
61852
|
-
return output.all.flatMap((o) => this.dump(task, level,
|
|
62257
|
+
return output.all.flatMap((o) => this.dump(task, level, "OUTPUT", o.entry));
|
|
61853
62258
|
}
|
|
61854
62259
|
renderBottomBar() {
|
|
61855
62260
|
if (this.buffer.bottom.size === 0) return [];
|
|
@@ -61877,25 +62282,25 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61877
62282
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
61878
62283
|
if (this.shouldOutputToBottomBar(task) && !this.buffer.bottom.has(task.id)) {
|
|
61879
62284
|
this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
|
|
61880
|
-
task.on(
|
|
61881
|
-
const data = this.dump(task, -1,
|
|
61882
|
-
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));
|
|
61883
62288
|
});
|
|
61884
|
-
task.on(
|
|
62289
|
+
task.on("STATE", (state) => {
|
|
61885
62290
|
switch (state) {
|
|
61886
|
-
case
|
|
62291
|
+
case "RETRY":
|
|
61887
62292
|
this.buffer.bottom.delete(task.id);
|
|
61888
62293
|
break;
|
|
61889
62294
|
}
|
|
61890
62295
|
});
|
|
61891
62296
|
} else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
|
|
61892
62297
|
this.buffer.output.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.outputBar === "number" ? rendererTaskOptions.outputBar : 1 }));
|
|
61893
|
-
task.on(
|
|
62298
|
+
task.on("OUTPUT", (output) => {
|
|
61894
62299
|
this.buffer.output.get(task.id).write(output);
|
|
61895
62300
|
});
|
|
61896
|
-
task.on(
|
|
62301
|
+
task.on("STATE", (state) => {
|
|
61897
62302
|
switch (state) {
|
|
61898
|
-
case
|
|
62303
|
+
case "RETRY":
|
|
61899
62304
|
this.buffer.output.delete(task.id);
|
|
61900
62305
|
break;
|
|
61901
62306
|
}
|
|
@@ -61907,20 +62312,20 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61907
62312
|
this.cache.rendererTaskOptions.delete(task.id);
|
|
61908
62313
|
this.buffer.output.delete(task.id);
|
|
61909
62314
|
}
|
|
61910
|
-
dump(task, level, source =
|
|
62315
|
+
dump(task, level, source = "OUTPUT", data) {
|
|
61911
62316
|
if (!data) switch (source) {
|
|
61912
|
-
case
|
|
62317
|
+
case "OUTPUT":
|
|
61913
62318
|
data = task.output;
|
|
61914
62319
|
break;
|
|
61915
|
-
case
|
|
62320
|
+
case "SKIPPED":
|
|
61916
62321
|
data = task.message.skip;
|
|
61917
62322
|
break;
|
|
61918
|
-
case
|
|
62323
|
+
case "FAILED":
|
|
61919
62324
|
data = task.message.error;
|
|
61920
62325
|
break;
|
|
61921
62326
|
}
|
|
61922
|
-
if (task.hasTitle() && source ===
|
|
61923
|
-
if (source ===
|
|
62327
|
+
if (task.hasTitle() && source === "FAILED" && data === task.title || typeof data !== "string") return [];
|
|
62328
|
+
if (source === "OUTPUT") data = cleanseAnsi(data);
|
|
61924
62329
|
return this.format(data, this.style(task, true), level + 1);
|
|
61925
62330
|
}
|
|
61926
62331
|
indent(str, i) {
|
|
@@ -61928,6 +62333,8 @@ var DefaultRenderer = class DefaultRenderer2 {
|
|
|
61928
62333
|
}
|
|
61929
62334
|
};
|
|
61930
62335
|
var SilentRenderer = class {
|
|
62336
|
+
tasks;
|
|
62337
|
+
options;
|
|
61931
62338
|
static nonTTY = true;
|
|
61932
62339
|
static rendererOptions;
|
|
61933
62340
|
static rendererTaskOptions;
|
|
@@ -61941,10 +62348,12 @@ var SilentRenderer = class {
|
|
|
61941
62348
|
}
|
|
61942
62349
|
};
|
|
61943
62350
|
var SimpleRenderer = class SimpleRenderer2 {
|
|
62351
|
+
tasks;
|
|
62352
|
+
options;
|
|
61944
62353
|
static nonTTY = true;
|
|
61945
62354
|
static rendererOptions = { pausedTimer: {
|
|
61946
62355
|
...PRESET_TIMER,
|
|
61947
|
-
field: (time) => `${
|
|
62356
|
+
field: (time) => `${"PAUSED"}:${time}`,
|
|
61948
62357
|
format: () => color.yellowBright
|
|
61949
62358
|
} };
|
|
61950
62359
|
static rendererTaskOptions = {};
|
|
@@ -61984,57 +62393,57 @@ var SimpleRenderer = class SimpleRenderer2 {
|
|
|
61984
62393
|
renderer(tasks) {
|
|
61985
62394
|
tasks.forEach((task) => {
|
|
61986
62395
|
this.calculate(task);
|
|
61987
|
-
task.once(
|
|
62396
|
+
task.once("CLOSED", () => {
|
|
61988
62397
|
this.reset(task);
|
|
61989
62398
|
});
|
|
61990
62399
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
61991
62400
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
61992
|
-
task.on(
|
|
62401
|
+
task.on("SUBTASK", (subtasks) => {
|
|
61993
62402
|
this.renderer(subtasks);
|
|
61994
62403
|
});
|
|
61995
|
-
task.on(
|
|
62404
|
+
task.on("STATE", (state) => {
|
|
61996
62405
|
if (!task.hasTitle()) return;
|
|
61997
|
-
if (state ===
|
|
61998
|
-
else if (state ===
|
|
62406
|
+
if (state === "STARTED") this.logger.log("STARTED", task.title);
|
|
62407
|
+
else if (state === "COMPLETED") {
|
|
61999
62408
|
const timer = rendererTaskOptions?.timer;
|
|
62000
|
-
this.logger.log(
|
|
62409
|
+
this.logger.log("COMPLETED", task.title, timer && { suffix: {
|
|
62001
62410
|
...timer,
|
|
62002
62411
|
condition: !!task.message?.duration && timer.condition,
|
|
62003
62412
|
args: [task.message.duration]
|
|
62004
62413
|
} });
|
|
62005
|
-
} else if (state ===
|
|
62414
|
+
} else if (state === "PROMPT") {
|
|
62006
62415
|
this.logger.process.hijack();
|
|
62007
|
-
task.on(
|
|
62416
|
+
task.on("PROMPT", (prompt2) => {
|
|
62008
62417
|
this.logger.process.toStderr(prompt2, false);
|
|
62009
62418
|
});
|
|
62010
|
-
} else if (state ===
|
|
62011
|
-
task.off(
|
|
62419
|
+
} else if (state === "PROMPT_COMPLETED") {
|
|
62420
|
+
task.off("PROMPT");
|
|
62012
62421
|
this.logger.process.release();
|
|
62013
62422
|
}
|
|
62014
62423
|
});
|
|
62015
|
-
task.on(
|
|
62016
|
-
this.logger.log(
|
|
62424
|
+
task.on("OUTPUT", (output) => {
|
|
62425
|
+
this.logger.log("OUTPUT", output);
|
|
62017
62426
|
});
|
|
62018
|
-
task.on(
|
|
62019
|
-
if (message2.error) this.logger.log(
|
|
62020
|
-
field: `${
|
|
62427
|
+
task.on("MESSAGE", (message2) => {
|
|
62428
|
+
if (message2.error) this.logger.log("FAILED", task.title, { suffix: {
|
|
62429
|
+
field: `${"FAILED"}: ${message2.error}`,
|
|
62021
62430
|
format: () => color.red
|
|
62022
62431
|
} });
|
|
62023
|
-
else if (message2.skip) this.logger.log(
|
|
62024
|
-
field: `${
|
|
62432
|
+
else if (message2.skip) this.logger.log("SKIPPED", task.title, { suffix: {
|
|
62433
|
+
field: `${"SKIPPED"}: ${message2.skip}`,
|
|
62025
62434
|
format: () => color.yellow
|
|
62026
62435
|
} });
|
|
62027
|
-
else if (message2.rollback) this.logger.log(
|
|
62028
|
-
field: `${
|
|
62436
|
+
else if (message2.rollback) this.logger.log("ROLLBACK", task.title, { suffix: {
|
|
62437
|
+
field: `${"ROLLBACK"}: ${message2.rollback}`,
|
|
62029
62438
|
format: () => color.red
|
|
62030
62439
|
} });
|
|
62031
|
-
else if (message2.retry) this.logger.log(
|
|
62032
|
-
field: `${
|
|
62440
|
+
else if (message2.retry) this.logger.log("RETRY", task.title, { suffix: {
|
|
62441
|
+
field: `${"RETRY"}:${message2.retry.count}`,
|
|
62033
62442
|
format: () => color.red
|
|
62034
62443
|
} });
|
|
62035
62444
|
else if (message2.paused) {
|
|
62036
62445
|
const timer = rendererOptions?.pausedTimer;
|
|
62037
|
-
this.logger.log(
|
|
62446
|
+
this.logger.log("PAUSED", task.title, timer && { suffix: {
|
|
62038
62447
|
...timer,
|
|
62039
62448
|
condition: !!message2?.paused && timer.condition,
|
|
62040
62449
|
args: [message2.paused - Date.now()]
|
|
@@ -62062,6 +62471,7 @@ var SimpleRenderer = class SimpleRenderer2 {
|
|
|
62062
62471
|
}
|
|
62063
62472
|
};
|
|
62064
62473
|
var TestRendererSerializer = class {
|
|
62474
|
+
options;
|
|
62065
62475
|
constructor(options) {
|
|
62066
62476
|
this.options = options;
|
|
62067
62477
|
}
|
|
@@ -62085,6 +62495,8 @@ var TestRendererSerializer = class {
|
|
|
62085
62495
|
}
|
|
62086
62496
|
};
|
|
62087
62497
|
var TestRenderer = class TestRenderer2 {
|
|
62498
|
+
tasks;
|
|
62499
|
+
options;
|
|
62088
62500
|
static nonTTY = true;
|
|
62089
62501
|
static rendererOptions = {
|
|
62090
62502
|
subtasks: true,
|
|
@@ -62145,27 +62557,27 @@ var TestRenderer = class TestRenderer2 {
|
|
|
62145
62557
|
}
|
|
62146
62558
|
renderer(tasks) {
|
|
62147
62559
|
tasks.forEach((task) => {
|
|
62148
|
-
if (this.options.subtasks) task.on(
|
|
62560
|
+
if (this.options.subtasks) task.on("SUBTASK", (subtasks) => {
|
|
62149
62561
|
this.renderer(subtasks);
|
|
62150
62562
|
});
|
|
62151
|
-
if (this.options.state) task.on(
|
|
62152
|
-
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));
|
|
62153
62565
|
});
|
|
62154
|
-
if (this.options.output) task.on(
|
|
62155
|
-
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));
|
|
62156
62568
|
});
|
|
62157
|
-
if (this.options.prompt) task.on(
|
|
62158
|
-
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));
|
|
62159
62571
|
});
|
|
62160
|
-
if (this.options.title) task.on(
|
|
62161
|
-
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));
|
|
62162
62574
|
});
|
|
62163
|
-
task.on(
|
|
62575
|
+
task.on("MESSAGE", (message2) => {
|
|
62164
62576
|
const parsed = Object.fromEntries(Object.entries(message2).map(([key, value]) => {
|
|
62165
62577
|
if (this.options.messages.includes(key)) return [key, value];
|
|
62166
62578
|
}).filter(Boolean));
|
|
62167
62579
|
if (Object.keys(parsed).length > 0) {
|
|
62168
|
-
const output = this.serializer.serialize(
|
|
62580
|
+
const output = this.serializer.serialize("MESSAGE", parsed, task);
|
|
62169
62581
|
if (this.options.messagesToStderr.some((state) => Object.keys(parsed).includes(state))) this.logger.toStderr(output);
|
|
62170
62582
|
else this.logger.toStdout(output);
|
|
62171
62583
|
}
|
|
@@ -62174,6 +62586,8 @@ var TestRenderer = class TestRenderer2 {
|
|
|
62174
62586
|
}
|
|
62175
62587
|
};
|
|
62176
62588
|
var VerboseRenderer = class VerboseRenderer2 {
|
|
62589
|
+
tasks;
|
|
62590
|
+
options;
|
|
62177
62591
|
static nonTTY = true;
|
|
62178
62592
|
static rendererOptions = {
|
|
62179
62593
|
logTitleChange: false,
|
|
@@ -62219,44 +62633,44 @@ var VerboseRenderer = class VerboseRenderer2 {
|
|
|
62219
62633
|
renderer(tasks) {
|
|
62220
62634
|
tasks.forEach((task) => {
|
|
62221
62635
|
this.calculate(task);
|
|
62222
|
-
task.once(
|
|
62636
|
+
task.once("CLOSED", () => {
|
|
62223
62637
|
this.reset(task);
|
|
62224
62638
|
});
|
|
62225
62639
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
62226
62640
|
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
62227
|
-
task.on(
|
|
62641
|
+
task.on("SUBTASK", (subtasks) => {
|
|
62228
62642
|
this.renderer(subtasks);
|
|
62229
62643
|
});
|
|
62230
|
-
task.on(
|
|
62644
|
+
task.on("STATE", (state) => {
|
|
62231
62645
|
if (!task.hasTitle()) return;
|
|
62232
|
-
if (state ===
|
|
62233
|
-
else if (state ===
|
|
62646
|
+
if (state === "STARTED") this.logger.log("STARTED", task.title);
|
|
62647
|
+
else if (state === "COMPLETED") {
|
|
62234
62648
|
const timer = rendererTaskOptions.timer;
|
|
62235
|
-
this.logger.log(
|
|
62649
|
+
this.logger.log("COMPLETED", task.title, timer && { suffix: {
|
|
62236
62650
|
...timer,
|
|
62237
62651
|
condition: !!task.message?.duration && timer.condition,
|
|
62238
62652
|
args: [task.message.duration]
|
|
62239
62653
|
} });
|
|
62240
62654
|
}
|
|
62241
62655
|
});
|
|
62242
|
-
task.on(
|
|
62243
|
-
this.logger.log(
|
|
62656
|
+
task.on("OUTPUT", (data) => {
|
|
62657
|
+
this.logger.log("OUTPUT", data);
|
|
62244
62658
|
});
|
|
62245
|
-
task.on(
|
|
62659
|
+
task.on("PROMPT", (prompt2) => {
|
|
62246
62660
|
const cleansed = cleanseAnsi(prompt2);
|
|
62247
|
-
if (cleansed) this.logger.log(
|
|
62661
|
+
if (cleansed) this.logger.log("PROMPT", cleansed);
|
|
62248
62662
|
});
|
|
62249
|
-
if (this.options?.logTitleChange !== false) task.on(
|
|
62250
|
-
this.logger.log(
|
|
62663
|
+
if (this.options?.logTitleChange !== false) task.on("TITLE", (title) => {
|
|
62664
|
+
this.logger.log("TITLE", title);
|
|
62251
62665
|
});
|
|
62252
|
-
task.on(
|
|
62253
|
-
if (message2?.error) this.logger.log(
|
|
62254
|
-
else if (message2?.skip) this.logger.log(
|
|
62255
|
-
else if (message2?.rollback) this.logger.log(
|
|
62256
|
-
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() });
|
|
62257
62671
|
else if (message2?.paused) {
|
|
62258
62672
|
const timer = rendererOptions?.pausedTimer;
|
|
62259
|
-
this.logger.log(
|
|
62673
|
+
this.logger.log("PAUSED", task.title, timer && { suffix: {
|
|
62260
62674
|
...timer,
|
|
62261
62675
|
condition: !!message2?.paused && timer.condition,
|
|
62262
62676
|
args: [message2.paused - Date.now()]
|
|
@@ -62300,17 +62714,17 @@ function getRendererClass(renderer) {
|
|
|
62300
62714
|
function getRenderer(options) {
|
|
62301
62715
|
if (assertFunctionOrSelf(options?.silentRendererCondition)) return {
|
|
62302
62716
|
renderer: getRendererClass("silent"),
|
|
62303
|
-
selection:
|
|
62717
|
+
selection: "SILENT"
|
|
62304
62718
|
};
|
|
62305
62719
|
const r = {
|
|
62306
62720
|
renderer: getRendererClass(options.renderer),
|
|
62307
62721
|
options: options.rendererOptions,
|
|
62308
|
-
selection:
|
|
62722
|
+
selection: "PRIMARY"
|
|
62309
62723
|
};
|
|
62310
62724
|
if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options?.fallbackRendererCondition)) return {
|
|
62311
62725
|
renderer: getRendererClass(options.fallbackRenderer),
|
|
62312
62726
|
options: options.fallbackRendererOptions,
|
|
62313
|
-
selection:
|
|
62727
|
+
selection: "SECONDARY"
|
|
62314
62728
|
};
|
|
62315
62729
|
return r;
|
|
62316
62730
|
}
|
|
@@ -62364,6 +62778,9 @@ function delay(time) {
|
|
|
62364
62778
|
});
|
|
62365
62779
|
}
|
|
62366
62780
|
var ListrError = class extends Error {
|
|
62781
|
+
error;
|
|
62782
|
+
type;
|
|
62783
|
+
task;
|
|
62367
62784
|
path;
|
|
62368
62785
|
ctx;
|
|
62369
62786
|
constructor(error, type, task) {
|
|
@@ -62385,6 +62802,7 @@ var ListrRendererError = class extends Error {
|
|
|
62385
62802
|
var PromptError = class extends Error {
|
|
62386
62803
|
};
|
|
62387
62804
|
var TaskWrapper = class {
|
|
62805
|
+
task;
|
|
62388
62806
|
constructor(task) {
|
|
62389
62807
|
this.task = task;
|
|
62390
62808
|
}
|
|
@@ -62446,7 +62864,7 @@ var TaskWrapper = class {
|
|
|
62446
62864
|
* @see {@link https://listr2.kilic.dev/task/skip.html}
|
|
62447
62865
|
*/
|
|
62448
62866
|
skip(message2, ...metadata) {
|
|
62449
|
-
this.task.state$ =
|
|
62867
|
+
this.task.state$ = "SKIPPED";
|
|
62450
62868
|
if (message2) this.task.message$ = { skip: message2 ? splat(message2, ...metadata) : this.task?.title };
|
|
62451
62869
|
}
|
|
62452
62870
|
/**
|
|
@@ -62479,7 +62897,7 @@ var TaskWrapper = class {
|
|
|
62479
62897
|
stdout(type) {
|
|
62480
62898
|
return createWritable((chunk) => {
|
|
62481
62899
|
switch (type) {
|
|
62482
|
-
case
|
|
62900
|
+
case "PROMPT":
|
|
62483
62901
|
this.promptOutput = chunk;
|
|
62484
62902
|
break;
|
|
62485
62903
|
default:
|
|
@@ -62495,10 +62913,15 @@ var TaskWrapper = class {
|
|
|
62495
62913
|
var ListrTaskEventManager = class extends EventManager {
|
|
62496
62914
|
};
|
|
62497
62915
|
var Task = class extends ListrTaskEventManager {
|
|
62916
|
+
listr;
|
|
62917
|
+
task;
|
|
62918
|
+
options;
|
|
62919
|
+
rendererOptions;
|
|
62920
|
+
rendererTaskOptions;
|
|
62498
62921
|
/** Unique id per task, can be used for identifying a Task. */
|
|
62499
62922
|
id = (0, import_crypto2.randomUUID)();
|
|
62500
62923
|
/** The current state of the task. */
|
|
62501
|
-
state =
|
|
62924
|
+
state = "WAITING";
|
|
62502
62925
|
/** Subtasks of the current task. */
|
|
62503
62926
|
subtasks;
|
|
62504
62927
|
/** Title of the task. */
|
|
@@ -62545,26 +62968,26 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62545
62968
|
*/
|
|
62546
62969
|
set state$(state) {
|
|
62547
62970
|
this.state = state;
|
|
62548
|
-
this.emit(
|
|
62971
|
+
this.emit("STATE", state);
|
|
62549
62972
|
if (this.hasSubtasks() && this.hasFailed()) {
|
|
62550
|
-
for (const subtask of this.subtasks) if (subtask.state ===
|
|
62973
|
+
for (const subtask of this.subtasks) if (subtask.state === "STARTED") subtask.state$ = "FAILED";
|
|
62551
62974
|
}
|
|
62552
|
-
this.listr.events.emit(
|
|
62975
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62553
62976
|
}
|
|
62554
62977
|
/**
|
|
62555
62978
|
* Update the current output of the Task and emit the neccassary events.
|
|
62556
62979
|
*/
|
|
62557
62980
|
set output$(data) {
|
|
62558
62981
|
this.output = data;
|
|
62559
|
-
this.emit(
|
|
62560
|
-
this.listr.events.emit(
|
|
62982
|
+
this.emit("OUTPUT", data);
|
|
62983
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62561
62984
|
}
|
|
62562
62985
|
/**
|
|
62563
62986
|
* Update the current prompt output of the Task and emit the neccassary events.
|
|
62564
62987
|
*/
|
|
62565
62988
|
set promptOutput$(data) {
|
|
62566
|
-
this.emit(
|
|
62567
|
-
if (cleanseAnsi(data)) this.listr.events.emit(
|
|
62989
|
+
this.emit("PROMPT", data);
|
|
62990
|
+
if (cleanseAnsi(data)) this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62568
62991
|
}
|
|
62569
62992
|
/**
|
|
62570
62993
|
* Update or extend the current message of the Task and emit the neccassary events.
|
|
@@ -62574,16 +62997,16 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62574
62997
|
...this.message,
|
|
62575
62998
|
...data
|
|
62576
62999
|
};
|
|
62577
|
-
this.emit(
|
|
62578
|
-
this.listr.events.emit(
|
|
63000
|
+
this.emit("MESSAGE", data);
|
|
63001
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62579
63002
|
}
|
|
62580
63003
|
/**
|
|
62581
63004
|
* Update the current title of the Task and emit the neccassary events.
|
|
62582
63005
|
*/
|
|
62583
63006
|
set title$(title) {
|
|
62584
63007
|
this.title = title;
|
|
62585
|
-
this.emit(
|
|
62586
|
-
this.listr.events.emit(
|
|
63008
|
+
this.emit("TITLE", title);
|
|
63009
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62587
63010
|
}
|
|
62588
63011
|
/**
|
|
62589
63012
|
* Current task path in the hierarchy.
|
|
@@ -62595,10 +63018,10 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62595
63018
|
* Checks whether the current task with the given context should be set as enabled.
|
|
62596
63019
|
*/
|
|
62597
63020
|
async check(ctx) {
|
|
62598
|
-
if (this.state ===
|
|
63021
|
+
if (this.state === "WAITING") {
|
|
62599
63022
|
this.enabled = await assertFunctionOrSelf(this.task?.enabled ?? true, ctx);
|
|
62600
|
-
this.emit(
|
|
62601
|
-
this.listr.events.emit(
|
|
63023
|
+
this.emit("ENABLED", this.enabled);
|
|
63024
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62602
63025
|
}
|
|
62603
63026
|
return this.enabled;
|
|
62604
63027
|
}
|
|
@@ -62616,35 +63039,35 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62616
63039
|
}
|
|
62617
63040
|
/** Returns whether this task has started. */
|
|
62618
63041
|
isStarted() {
|
|
62619
|
-
return this.state ===
|
|
63042
|
+
return this.state === "STARTED";
|
|
62620
63043
|
}
|
|
62621
63044
|
/** Returns whether this task is skipped. */
|
|
62622
63045
|
isSkipped() {
|
|
62623
|
-
return this.state ===
|
|
63046
|
+
return this.state === "SKIPPED";
|
|
62624
63047
|
}
|
|
62625
63048
|
/** Returns whether this task has been completed. */
|
|
62626
63049
|
isCompleted() {
|
|
62627
|
-
return this.state ===
|
|
63050
|
+
return this.state === "COMPLETED";
|
|
62628
63051
|
}
|
|
62629
63052
|
/** Returns whether this task has been failed. */
|
|
62630
63053
|
hasFailed() {
|
|
62631
|
-
return this.state ===
|
|
63054
|
+
return this.state === "FAILED";
|
|
62632
63055
|
}
|
|
62633
63056
|
/** Returns whether this task has an active rollback task going on. */
|
|
62634
63057
|
isRollingBack() {
|
|
62635
|
-
return this.state ===
|
|
63058
|
+
return this.state === "ROLLING_BACK";
|
|
62636
63059
|
}
|
|
62637
63060
|
/** Returns whether the rollback action was successful. */
|
|
62638
63061
|
hasRolledBack() {
|
|
62639
|
-
return this.state ===
|
|
63062
|
+
return this.state === "ROLLED_BACK";
|
|
62640
63063
|
}
|
|
62641
63064
|
/** Returns whether this task has an actively retrying task going on. */
|
|
62642
63065
|
isRetrying() {
|
|
62643
|
-
return this.state ===
|
|
63066
|
+
return this.state === "RETRY";
|
|
62644
63067
|
}
|
|
62645
63068
|
/** Returns whether this task has some kind of reset like retry and rollback going on. */
|
|
62646
63069
|
hasReset() {
|
|
62647
|
-
return this.state ===
|
|
63070
|
+
return this.state === "RETRY" || this.state === "ROLLING_BACK";
|
|
62648
63071
|
}
|
|
62649
63072
|
/** Returns whether enabled function resolves to true. */
|
|
62650
63073
|
isEnabled() {
|
|
@@ -62656,11 +63079,11 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62656
63079
|
}
|
|
62657
63080
|
/** Returns whether this task has a prompt inside. */
|
|
62658
63081
|
isPrompt() {
|
|
62659
|
-
return this.state ===
|
|
63082
|
+
return this.state === "PROMPT";
|
|
62660
63083
|
}
|
|
62661
63084
|
/** Returns whether this task is currently paused. */
|
|
62662
63085
|
isPaused() {
|
|
62663
|
-
return this.state ===
|
|
63086
|
+
return this.state === "PAUSED";
|
|
62664
63087
|
}
|
|
62665
63088
|
/** Returns whether this task is closed. */
|
|
62666
63089
|
isClosed() {
|
|
@@ -62669,7 +63092,7 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62669
63092
|
/** Pause the given task for certain time. */
|
|
62670
63093
|
async pause(time) {
|
|
62671
63094
|
const state = this.state;
|
|
62672
|
-
this.state$ =
|
|
63095
|
+
this.state$ = "PAUSED";
|
|
62673
63096
|
this.message$ = { paused: Date.now() + time };
|
|
62674
63097
|
await delay(time);
|
|
62675
63098
|
this.state$ = state;
|
|
@@ -62686,7 +63109,7 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62686
63109
|
result.rendererClass = getRendererClass("silent");
|
|
62687
63110
|
this.subtasks = result.tasks;
|
|
62688
63111
|
result.errors = this.listr.errors;
|
|
62689
|
-
this.emit(
|
|
63112
|
+
this.emit("SUBTASK", this.subtasks);
|
|
62690
63113
|
result = result.run(context);
|
|
62691
63114
|
} else if (result instanceof Promise) result = result.then(handleResult);
|
|
62692
63115
|
else if (isReadable(result)) result = new Promise((resolve2, reject) => {
|
|
@@ -62708,13 +63131,13 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62708
63131
|
return result;
|
|
62709
63132
|
};
|
|
62710
63133
|
const startTime = Date.now();
|
|
62711
|
-
this.state$ =
|
|
63134
|
+
this.state$ = "STARTED";
|
|
62712
63135
|
const skipped = await assertFunctionOrSelf(this.task?.skip ?? false, context);
|
|
62713
63136
|
if (skipped) {
|
|
62714
63137
|
if (typeof skipped === "string") this.message$ = { skip: skipped };
|
|
62715
63138
|
else if (this.hasTitle()) this.message$ = { skip: this.title };
|
|
62716
63139
|
else this.message$ = { skip: "Skipped task without a title." };
|
|
62717
|
-
this.state$ =
|
|
63140
|
+
this.state$ = "SKIPPED";
|
|
62718
63141
|
return;
|
|
62719
63142
|
}
|
|
62720
63143
|
try {
|
|
@@ -62732,27 +63155,27 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62732
63155
|
this.message$ = { retry: this.retry };
|
|
62733
63156
|
this.title$ = this.initialTitle;
|
|
62734
63157
|
this.output = void 0;
|
|
62735
|
-
wrapper.report(err,
|
|
62736
|
-
this.state$ =
|
|
63158
|
+
wrapper.report(err, "WILL_RETRY");
|
|
63159
|
+
this.state$ = "RETRY";
|
|
62737
63160
|
if (retryDelay) await this.pause(retryDelay);
|
|
62738
63161
|
} else throw err;
|
|
62739
63162
|
}
|
|
62740
63163
|
if (this.isStarted() || this.isRetrying()) {
|
|
62741
63164
|
this.message$ = { duration: Date.now() - startTime };
|
|
62742
|
-
this.state$ =
|
|
63165
|
+
this.state$ = "COMPLETED";
|
|
62743
63166
|
}
|
|
62744
63167
|
} catch (error) {
|
|
62745
63168
|
if (this.prompt instanceof PromptError) error = this.prompt;
|
|
62746
63169
|
if (this.task?.rollback) {
|
|
62747
|
-
wrapper.report(error,
|
|
63170
|
+
wrapper.report(error, "WILL_ROLLBACK");
|
|
62748
63171
|
try {
|
|
62749
|
-
this.state$ =
|
|
63172
|
+
this.state$ = "ROLLING_BACK";
|
|
62750
63173
|
await this.task.rollback(context, wrapper);
|
|
62751
63174
|
this.message$ = { rollback: this.title };
|
|
62752
|
-
this.state$ =
|
|
63175
|
+
this.state$ = "ROLLED_BACK";
|
|
62753
63176
|
} catch (err) {
|
|
62754
|
-
this.state$ =
|
|
62755
|
-
wrapper.report(err,
|
|
63177
|
+
this.state$ = "FAILED";
|
|
63178
|
+
wrapper.report(err, "HAS_FAILED_TO_ROLLBACK");
|
|
62756
63179
|
this.close();
|
|
62757
63180
|
throw err;
|
|
62758
63181
|
}
|
|
@@ -62761,26 +63184,29 @@ var Task = class extends ListrTaskEventManager {
|
|
|
62761
63184
|
throw error;
|
|
62762
63185
|
}
|
|
62763
63186
|
} else {
|
|
62764
|
-
this.state$ =
|
|
63187
|
+
this.state$ = "FAILED";
|
|
62765
63188
|
if (this.listr.options.exitOnError !== false && await assertFunctionOrSelf(this.task?.exitOnError, context) !== false) {
|
|
62766
|
-
wrapper.report(error,
|
|
63189
|
+
wrapper.report(error, "HAS_FAILED");
|
|
62767
63190
|
this.close();
|
|
62768
63191
|
throw error;
|
|
62769
|
-
} else if (!this.hasSubtasks()) wrapper.report(error,
|
|
63192
|
+
} else if (!this.hasSubtasks()) wrapper.report(error, "HAS_FAILED_WITHOUT_ERROR");
|
|
62770
63193
|
}
|
|
62771
63194
|
} finally {
|
|
62772
63195
|
this.close();
|
|
62773
63196
|
}
|
|
62774
63197
|
}
|
|
62775
63198
|
close() {
|
|
62776
|
-
this.emit(
|
|
62777
|
-
this.listr.events.emit(
|
|
63199
|
+
this.emit("CLOSED");
|
|
63200
|
+
this.listr.events.emit("SHOUD_REFRESH_RENDER");
|
|
62778
63201
|
this.complete();
|
|
62779
63202
|
}
|
|
62780
63203
|
};
|
|
62781
63204
|
var ListrEventManager = class extends EventManager {
|
|
62782
63205
|
};
|
|
62783
63206
|
var Listr = class {
|
|
63207
|
+
task;
|
|
63208
|
+
options;
|
|
63209
|
+
parentTask;
|
|
62784
63210
|
tasks = [];
|
|
62785
63211
|
errors = [];
|
|
62786
63212
|
ctx;
|
|
@@ -62816,11 +63242,11 @@ var Listr = class {
|
|
|
62816
63242
|
}
|
|
62817
63243
|
if (this.parentTask?.listr.events instanceof ListrEventManager) this.events = this.parentTask.listr.events;
|
|
62818
63244
|
else this.events = new ListrEventManager();
|
|
62819
|
-
if (this.options?.forceTTY || process.env[
|
|
63245
|
+
if (this.options?.forceTTY || process.env["LISTR_FORCE_TTY"]) {
|
|
62820
63246
|
process.stdout.isTTY = true;
|
|
62821
63247
|
process.stderr.isTTY = true;
|
|
62822
63248
|
}
|
|
62823
|
-
if (this.options?.forceUnicode) process.env[
|
|
63249
|
+
if (this.options?.forceUnicode) process.env["LISTR_FORCE_UNICODE"] = "1";
|
|
62824
63250
|
const renderer = getRenderer({
|
|
62825
63251
|
renderer: this.options.renderer,
|
|
62826
63252
|
rendererOptions: this.options.rendererOptions,
|
|
@@ -62885,8 +63311,8 @@ var Listr = class {
|
|
|
62885
63311
|
tasks = Array.isArray(tasks) ? tasks : [tasks];
|
|
62886
63312
|
return tasks.map((task) => {
|
|
62887
63313
|
let rendererTaskOptions;
|
|
62888
|
-
if (this.rendererSelection ===
|
|
62889
|
-
else if (this.rendererSelection ===
|
|
63314
|
+
if (this.rendererSelection === "PRIMARY") rendererTaskOptions = task.rendererOptions;
|
|
63315
|
+
else if (this.rendererSelection === "SECONDARY") rendererTaskOptions = task.fallbackRendererOptions;
|
|
62890
63316
|
return new Task(this, task, this.options, this.rendererClassOptions, rendererTaskOptions);
|
|
62891
63317
|
});
|
|
62892
63318
|
}
|
|
@@ -62896,7 +63322,7 @@ var Listr = class {
|
|
|
62896
63322
|
}
|
|
62897
63323
|
signalHandler() {
|
|
62898
63324
|
this.tasks?.forEach(async (task) => {
|
|
62899
|
-
if (task.isPending()) task.state$ =
|
|
63325
|
+
if (task.isPending()) task.state$ = "FAILED";
|
|
62900
63326
|
});
|
|
62901
63327
|
if (this.isRoot()) {
|
|
62902
63328
|
this.renderer?.end(/* @__PURE__ */ new Error("Interrupted."));
|
|
@@ -62909,7 +63335,7 @@ var Listr = class {
|
|
|
62909
63335
|
};
|
|
62910
63336
|
|
|
62911
63337
|
// packages/kong-cli/src/commands/installCommand.ts
|
|
62912
|
-
var
|
|
63338
|
+
var import_path5 = __toESM(require("path"));
|
|
62913
63339
|
|
|
62914
63340
|
// packages/kong-cli/src/common/listrTaskLogger.ts
|
|
62915
63341
|
var ListrTaskLogger = class {
|
|
@@ -62965,165 +63391,9 @@ var InstallCommand = class {
|
|
|
62965
63391
|
scriptPath() {
|
|
62966
63392
|
const scriptName = "python-install";
|
|
62967
63393
|
if (process.platform === "win32") {
|
|
62968
|
-
return
|
|
63394
|
+
return import_path5.default.join(__dirname, "assets", `${scriptName}.bat`);
|
|
62969
63395
|
}
|
|
62970
|
-
return
|
|
62971
|
-
}
|
|
62972
|
-
};
|
|
62973
|
-
|
|
62974
|
-
// packages/kong-cli/src/services/api.ts
|
|
62975
|
-
var import_keyring2 = __toESM(require_keyring());
|
|
62976
|
-
|
|
62977
|
-
// node_modules/jwt-decode/build/esm/index.js
|
|
62978
|
-
var InvalidTokenError = class extends Error {
|
|
62979
|
-
};
|
|
62980
|
-
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
62981
|
-
function b64DecodeUnicode(str) {
|
|
62982
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
62983
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
62984
|
-
if (code.length < 2) {
|
|
62985
|
-
code = "0" + code;
|
|
62986
|
-
}
|
|
62987
|
-
return "%" + code;
|
|
62988
|
-
}));
|
|
62989
|
-
}
|
|
62990
|
-
function base64UrlDecode(str) {
|
|
62991
|
-
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
62992
|
-
switch (output.length % 4) {
|
|
62993
|
-
case 0:
|
|
62994
|
-
break;
|
|
62995
|
-
case 2:
|
|
62996
|
-
output += "==";
|
|
62997
|
-
break;
|
|
62998
|
-
case 3:
|
|
62999
|
-
output += "=";
|
|
63000
|
-
break;
|
|
63001
|
-
default:
|
|
63002
|
-
throw new Error("base64 string is not of the correct length");
|
|
63003
|
-
}
|
|
63004
|
-
try {
|
|
63005
|
-
return b64DecodeUnicode(output);
|
|
63006
|
-
} catch (err) {
|
|
63007
|
-
return atob(output);
|
|
63008
|
-
}
|
|
63009
|
-
}
|
|
63010
|
-
function jwtDecode(token, options) {
|
|
63011
|
-
if (typeof token !== "string") {
|
|
63012
|
-
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
63013
|
-
}
|
|
63014
|
-
options || (options = {});
|
|
63015
|
-
const pos = options.header === true ? 0 : 1;
|
|
63016
|
-
const part = token.split(".")[pos];
|
|
63017
|
-
if (typeof part !== "string") {
|
|
63018
|
-
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
63019
|
-
}
|
|
63020
|
-
let decoded;
|
|
63021
|
-
try {
|
|
63022
|
-
decoded = base64UrlDecode(part);
|
|
63023
|
-
} catch (e) {
|
|
63024
|
-
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
63025
|
-
}
|
|
63026
|
-
try {
|
|
63027
|
-
return JSON.parse(decoded);
|
|
63028
|
-
} catch (e) {
|
|
63029
|
-
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
63030
|
-
}
|
|
63031
|
-
}
|
|
63032
|
-
|
|
63033
|
-
// packages/kong-cli/src/services/api.ts
|
|
63034
|
-
function requestConfigProvider(profile) {
|
|
63035
|
-
const cached = {
|
|
63036
|
-
headers: {
|
|
63037
|
-
"Content-Type": "application/json",
|
|
63038
|
-
"X-App-Tenant": parseTenant(profile.kongBaseUrl)
|
|
63039
|
-
}
|
|
63040
|
-
};
|
|
63041
|
-
return async () => {
|
|
63042
|
-
if (cached.headers?.Authorization) {
|
|
63043
|
-
try {
|
|
63044
|
-
const auth = cached.headers.Authorization;
|
|
63045
|
-
const accessToken = auth.split("Bearer ")[1]?.trim();
|
|
63046
|
-
if (accessToken) {
|
|
63047
|
-
const decoded = jwtDecode(accessToken);
|
|
63048
|
-
if (decoded.exp !== void 0) {
|
|
63049
|
-
const nowSeconds = Date.now() / 1e3;
|
|
63050
|
-
if (decoded.exp > nowSeconds + 60) {
|
|
63051
|
-
return cached;
|
|
63052
|
-
}
|
|
63053
|
-
}
|
|
63054
|
-
}
|
|
63055
|
-
} catch (ex) {
|
|
63056
|
-
console.warn("failed to use cached token, fetching new one", ex);
|
|
63057
|
-
}
|
|
63058
|
-
}
|
|
63059
|
-
const url2 = joinUrlAndPath(
|
|
63060
|
-
profile.kongBaseUrl,
|
|
63061
|
-
"api/keycloak/realms/kong/protocol/openid-connect/token"
|
|
63062
|
-
);
|
|
63063
|
-
const entry = new import_keyring2.Entry(profile.kongBaseUrl, profile.userName);
|
|
63064
|
-
const password = entry.getPassword();
|
|
63065
|
-
if (!password) {
|
|
63066
|
-
throw new Error("No password found in keyring for user: " + profile.userName);
|
|
63067
|
-
}
|
|
63068
|
-
const params = new URLSearchParams({
|
|
63069
|
-
grant_type: "password",
|
|
63070
|
-
client_id: "kong-web",
|
|
63071
|
-
username: profile.userName,
|
|
63072
|
-
password
|
|
63073
|
-
});
|
|
63074
|
-
const response = await axios_default.post(url2, params, {
|
|
63075
|
-
headers: {
|
|
63076
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
63077
|
-
}
|
|
63078
|
-
});
|
|
63079
|
-
cached.headers = {
|
|
63080
|
-
...cached.headers,
|
|
63081
|
-
["Authorization"]: `Bearer ${response.data.access_token}`
|
|
63082
|
-
};
|
|
63083
|
-
return cached;
|
|
63084
|
-
};
|
|
63085
|
-
}
|
|
63086
|
-
|
|
63087
|
-
// packages/kong-cli/src/services/managementClient.ts
|
|
63088
|
-
var ManagementClient = class {
|
|
63089
|
-
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
63090
|
-
this.requestConfigProvider = requestConfigProvider2;
|
|
63091
|
-
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/management");
|
|
63092
|
-
}
|
|
63093
|
-
async updateExtension(extension) {
|
|
63094
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
|
|
63095
|
-
await axios_default.put(url2, extension, await this.requestConfigProvider());
|
|
63096
|
-
}
|
|
63097
|
-
async createExtensionSnapshot(extensionId, snapshot) {
|
|
63098
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
|
|
63099
|
-
await axios_default.post(url2, snapshot, await this.requestConfigProvider());
|
|
63100
|
-
}
|
|
63101
|
-
async getExtensionSnapshot(extensionId, extensionSnapshotVersion) {
|
|
63102
|
-
const url2 = joinUrlAndPath(
|
|
63103
|
-
this.baseUrl,
|
|
63104
|
-
"v1/extensions",
|
|
63105
|
-
extensionId,
|
|
63106
|
-
"snapshots",
|
|
63107
|
-
extensionSnapshotVersion
|
|
63108
|
-
);
|
|
63109
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63110
|
-
}
|
|
63111
|
-
async getExtensionSnapshotVersions(extensionId) {
|
|
63112
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
|
|
63113
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63114
|
-
}
|
|
63115
|
-
async getExtensionSnapshotAliases(extensionId) {
|
|
63116
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
|
|
63117
|
-
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63118
|
-
}
|
|
63119
|
-
async getAuditLog(objectType2, objectId, createdAfter) {
|
|
63120
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/audit");
|
|
63121
|
-
const config = await this.requestConfigProvider();
|
|
63122
|
-
const response = await axios_default.get(url2, {
|
|
63123
|
-
...config,
|
|
63124
|
-
params: { ...config.params, objectType: objectType2, objectId, createdAfter }
|
|
63125
|
-
});
|
|
63126
|
-
return response.data;
|
|
63396
|
+
return import_path5.default.join(__dirname, "assets", `${scriptName}.sh`);
|
|
63127
63397
|
}
|
|
63128
63398
|
};
|
|
63129
63399
|
|
|
@@ -63137,14 +63407,13 @@ var ListAliasesCommand = class {
|
|
|
63137
63407
|
requestConfigProvider(profile)
|
|
63138
63408
|
);
|
|
63139
63409
|
}
|
|
63140
|
-
async execute() {
|
|
63410
|
+
async execute(processId) {
|
|
63141
63411
|
await new Listr(
|
|
63142
63412
|
[
|
|
63143
63413
|
{
|
|
63144
|
-
title: "list extension aliases",
|
|
63414
|
+
title: processId ? `list process aliases (${processId})` : "list extension aliases",
|
|
63145
63415
|
task: async (ctx, task) => {
|
|
63146
|
-
const
|
|
63147
|
-
const aliases = await this.managementClient.getExtensionSnapshotAliases(kongJson.id);
|
|
63416
|
+
const aliases = processId ? await this.managementClient.getProcessAliases(processId) : await this.managementClient.getExtensionSnapshotAliases(getKongJson().id);
|
|
63148
63417
|
if (aliases.length === 0) {
|
|
63149
63418
|
task.output = "no aliases available";
|
|
63150
63419
|
} else {
|
|
@@ -63185,14 +63454,15 @@ var ListVersionsCommand = class {
|
|
|
63185
63454
|
requestConfigProvider(profile)
|
|
63186
63455
|
);
|
|
63187
63456
|
}
|
|
63188
|
-
async execute() {
|
|
63457
|
+
async execute(processId) {
|
|
63189
63458
|
await new Listr(
|
|
63190
63459
|
[
|
|
63191
63460
|
{
|
|
63192
|
-
title: "list extension snapshot versions",
|
|
63461
|
+
title: processId ? `list process snapshot versions (${processId})` : "list extension snapshot versions",
|
|
63193
63462
|
task: async (ctx, task) => {
|
|
63194
|
-
const
|
|
63195
|
-
|
|
63463
|
+
const versions = processId ? await this.managementClient.getDocumentSnapshotVersions(
|
|
63464
|
+
processId
|
|
63465
|
+
) : await this.managementClient.getExtensionSnapshotVersions(getKongJson().id);
|
|
63196
63466
|
if (versions.length === 0) {
|
|
63197
63467
|
task.output = "no versions available";
|
|
63198
63468
|
} else {
|
|
@@ -63223,7 +63493,7 @@ var ListVersionsCommand = class {
|
|
|
63223
63493
|
};
|
|
63224
63494
|
|
|
63225
63495
|
// packages/kong-cli/src/commands/publishVersionCommand.ts
|
|
63226
|
-
var
|
|
63496
|
+
var import_child_process3 = require("child_process");
|
|
63227
63497
|
|
|
63228
63498
|
// packages/kong-cli/src/common/extensionContract.ts
|
|
63229
63499
|
var import__ = __toESM(require__());
|
|
@@ -63239,18 +63509,6 @@ function getExtensionContract(filePath) {
|
|
|
63239
63509
|
return contract;
|
|
63240
63510
|
}
|
|
63241
63511
|
|
|
63242
|
-
// packages/kong-cli/src/services/registryClient.ts
|
|
63243
|
-
var RegistryClient = class {
|
|
63244
|
-
constructor(kongBaseUrl, requestConfigProvider2) {
|
|
63245
|
-
this.requestConfigProvider = requestConfigProvider2;
|
|
63246
|
-
this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/registry");
|
|
63247
|
-
}
|
|
63248
|
-
async getPublishDetails(appName) {
|
|
63249
|
-
const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
|
|
63250
|
-
return (await axios_default.post(url2, {}, await this.requestConfigProvider())).data;
|
|
63251
|
-
}
|
|
63252
|
-
};
|
|
63253
|
-
|
|
63254
63512
|
// packages/kong-cli/src/commands/publishVersionCommand.ts
|
|
63255
63513
|
var PublishVersionCommand = class {
|
|
63256
63514
|
constructor(profile, verbose = false, contractPath = null) {
|
|
@@ -63265,7 +63523,7 @@ var PublishVersionCommand = class {
|
|
|
63265
63523
|
const clientRequestConfigProvider = requestConfigProvider(profile);
|
|
63266
63524
|
this.registryClient = new RegistryClient(profile.kongBaseUrl, clientRequestConfigProvider);
|
|
63267
63525
|
this.managementClient = new ManagementClient(profile.kongBaseUrl, clientRequestConfigProvider);
|
|
63268
|
-
const dockerVersion = (0,
|
|
63526
|
+
const dockerVersion = (0, import_child_process3.spawnSync)("docker", ["--version"]);
|
|
63269
63527
|
this.hasDocker = !dockerVersion.error;
|
|
63270
63528
|
}
|
|
63271
63529
|
get wslPrefix() {
|
|
@@ -63415,6 +63673,8 @@ var PublishVersionCommand = class {
|
|
|
63415
63673
|
name: kongJson.name,
|
|
63416
63674
|
category: kongJson.category,
|
|
63417
63675
|
deprecated: false,
|
|
63676
|
+
origin: "cli",
|
|
63677
|
+
checkpoint: void 0,
|
|
63418
63678
|
createdBy: "",
|
|
63419
63679
|
created: utcNow(DEFAULT_TIMEZONE),
|
|
63420
63680
|
updated: utcNow(DEFAULT_TIMEZONE),
|
|
@@ -63740,25 +64000,26 @@ var SetAliasCommand = class {
|
|
|
63740
64000
|
};
|
|
63741
64001
|
|
|
63742
64002
|
// packages/kong-cli/src/common/cli.ts
|
|
63743
|
-
var
|
|
63744
|
-
var
|
|
64003
|
+
var import_fs5 = __toESM(require("fs"));
|
|
64004
|
+
var import_path6 = __toESM(require("path"));
|
|
63745
64005
|
function getPresetVersion() {
|
|
63746
|
-
const packageJsonPath =
|
|
63747
|
-
if (!
|
|
64006
|
+
const packageJsonPath = import_path6.default.join(__dirname, "package.json");
|
|
64007
|
+
if (!import_fs5.default.existsSync(packageJsonPath)) {
|
|
63748
64008
|
throw new AppError(`package.json file was not found at path: ${packageJsonPath}`);
|
|
63749
64009
|
}
|
|
63750
64010
|
return require(packageJsonPath).version;
|
|
63751
64011
|
}
|
|
63752
64012
|
|
|
63753
64013
|
// packages/kong-cli/src/index.ts
|
|
63754
|
-
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 }));
|
|
63755
64015
|
async function main() {
|
|
63756
64016
|
const generateCommand = new Command("generate").description("Generate new extension").argument("name", "Extension name").addOption(
|
|
63757
64017
|
new Option("--sdk <name>", "Target sdk platform for extension").choices(["python", "kotlin"]).default("python")
|
|
63758
64018
|
).addOption(
|
|
63759
64019
|
new Option("--template <name>", "Starter template to scaffold (python only)").choices([
|
|
63760
64020
|
"basic",
|
|
63761
|
-
"
|
|
64021
|
+
"with-secret",
|
|
64022
|
+
"with-s3"
|
|
63762
64023
|
])
|
|
63763
64024
|
).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (name, options) => {
|
|
63764
64025
|
try {
|
|
@@ -63768,13 +64029,23 @@ async function main() {
|
|
|
63768
64029
|
printError("generate command failed", ex);
|
|
63769
64030
|
}
|
|
63770
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
|
+
});
|
|
63771
64042
|
const configureCommand = new Command("configure").description("Configure access to kong environments").action(async () => {
|
|
63772
64043
|
await new ConfigureCommand().execute();
|
|
63773
64044
|
});
|
|
63774
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) => {
|
|
63775
64046
|
try {
|
|
63776
64047
|
const kongJsonPath = resolveProjectPath("kong.json");
|
|
63777
|
-
const projectRoot =
|
|
64048
|
+
const projectRoot = import_path7.default.dirname(kongJsonPath);
|
|
63778
64049
|
await new InstallCommand(options.verbose).execute(projectRoot);
|
|
63779
64050
|
} catch (ex) {
|
|
63780
64051
|
printError("install command failed", ex);
|
|
@@ -63796,10 +64067,17 @@ async function main() {
|
|
|
63796
64067
|
printError("publish-version command failed", ex);
|
|
63797
64068
|
}
|
|
63798
64069
|
});
|
|
63799
|
-
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) => {
|
|
63800
64076
|
try {
|
|
63801
64077
|
printProfile(options.profile);
|
|
63802
|
-
await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute(
|
|
64078
|
+
await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute(
|
|
64079
|
+
options.process
|
|
64080
|
+
);
|
|
63803
64081
|
} catch (ex) {
|
|
63804
64082
|
printError("list-versions command failed", ex);
|
|
63805
64083
|
}
|
|
@@ -63824,16 +64102,24 @@ async function main() {
|
|
|
63824
64102
|
printError("set-alias command failed", ex);
|
|
63825
64103
|
}
|
|
63826
64104
|
});
|
|
63827
|
-
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) => {
|
|
63828
64111
|
try {
|
|
63829
64112
|
printProfile(options.profile);
|
|
63830
|
-
await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute(
|
|
64113
|
+
await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute(
|
|
64114
|
+
options.process
|
|
64115
|
+
);
|
|
63831
64116
|
} catch (ex) {
|
|
63832
64117
|
printError("list-aliases command failed", ex);
|
|
63833
64118
|
}
|
|
63834
64119
|
});
|
|
63835
64120
|
const cli = new Command().version(getPresetVersion()).description("CLI to support creating and publishing Kong extensions");
|
|
63836
64121
|
cli.addCommand(generateCommand);
|
|
64122
|
+
cli.addCommand(connectCommand);
|
|
63837
64123
|
cli.addCommand(configureCommand);
|
|
63838
64124
|
cli.addCommand(installCommand);
|
|
63839
64125
|
cli.addCommand(publishVersionCommand);
|