@devkong/cli 0.0.67-alpha.25 → 0.0.67-alpha.27

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 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 fs6 = require("fs");
1108
- var path9 = require("path");
1109
- var os3 = require("os");
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 (fs6.existsSync(filepath)) {
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 = path9.resolve(process.cwd(), ".env.vault");
1247
+ possibleVaultPath = path10.resolve(process.cwd(), ".env.vault");
1248
1248
  }
1249
- if (fs6.existsSync(possibleVaultPath)) {
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] === "~" ? path9.join(os3.homedir(), envPath.slice(1)) : envPath;
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 = path9.resolve(process.cwd(), ".env");
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 path10 of optionPaths) {
1300
+ for (const path11 of optionPaths) {
1301
1301
  try {
1302
- const parsed = DotenvModule.parse(fs6.readFileSync(path10, { encoding }));
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 ${path10} ${e.message}`);
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 = path9.relative(process.cwd(), filePath);
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 fs6 = (0, node_1.default)();
7491
+ const fs7 = (0, node_1.default)();
7492
7492
  const handler = (err, buffer) => {
7493
7493
  if (fd) {
7494
- fs6.closeSync(fd);
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 = fs6.openSync(filepath, "r");
7506
+ fd = fs7.openSync(filepath, "r");
7507
7507
  let sample = Buffer.allocUnsafe(sampleSize);
7508
- fs6.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
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
- fs6.readFile(filepath, handler);
7520
+ fs7.readFile(filepath, handler);
7521
7521
  });
7522
7522
  exports2.detectFile = detectFile;
7523
7523
  var detectFileSync = (filepath, opts = {}) => {
7524
- const fs6 = (0, node_1.default)();
7524
+ const fs7 = (0, node_1.default)();
7525
7525
  if (opts && opts.sampleSize) {
7526
- const fd = fs6.openSync(filepath, "r");
7526
+ const fd = fs7.openSync(filepath, "r");
7527
7527
  let sample = Buffer.allocUnsafe(opts.sampleSize);
7528
- const bytesRead = fs6.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
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
- fs6.closeSync(fd);
7532
+ fs7.closeSync(fd);
7533
7533
  return (0, exports2.detect)(sample);
7534
7534
  }
7535
- return (0, exports2.detect)(fs6.readFileSync(filepath));
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(path9) {
20286
- if (!path9 || typeof path9 !== "string") {
20285
+ function lookup(path10) {
20286
+ if (!path10 || typeof path10 !== "string") {
20287
20287
  return false;
20288
20288
  }
20289
- var extension2 = extname("x." + path9).toLowerCase().substr(1);
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 path9 = require("path");
21395
- var http3 = require("http");
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 fs6 = require("fs");
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
- fs6.stat(value.path, function(err, stat) {
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 = path9.normalize(options.filepath).replace(/\\/g, "/");
21525
+ filename = path10.normalize(options.filepath).replace(/\\/g, "/");
21526
21526
  } else if (options.filename || value && (value.name || value.path)) {
21527
- filename = path9.basename(options.filename || value && (value.name || value.path));
21527
+ filename = path10.basename(options.filename || value && (value.name || value.path));
21528
21528
  } else if (value && value.readable && hasOwn(value, "httpVersion")) {
21529
- filename = path9.basename(value.client._httpMessage.path || "");
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 = http3.request(options);
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 os3 = require("os");
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 = os3.release().split(".");
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 http3 = require("http");
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: http3, https: https2 });
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(path9) {
26651
- let input = path9;
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 [path9, query] = wsComponent.resourceName.split("?");
26904
- wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
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 http3 = (
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: http3.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: http3,
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 fs6 = require2("fs"), ono = require2("ono"), url2 = require2("../util/url");
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
- fs6.readFile(n, function(r2, u) {
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 http3 = require2("http"), https2 = require2("https"), ono = require2("ono"), url2 = require2("../util/url");
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 : http3).get({ hostname: t.hostname, port: t.port, path: t.path, auth: t.auth, protocol: t.protocol, headers: o.headers || {}, withCredentials: o.withCredentials });
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 http3 = require2("http"), url2 = require2("url"), https2 = module3.exports;
36246
- for (var key in http3) http3.hasOwnProperty(key) && (https2[key] = http3[key]);
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), http3.request.call(this, t, r);
36252
+ return t = validateParams(t), http4.request.call(this, t, r);
36253
36253
  }, https2.get = function(t, r) {
36254
- return t = validateParams(t), http3.get.call(this, t, r);
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"), http3 = exports3;
38178
- http3.request = function(e, t) {
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
- }, http3.get = function(e, t) {
38185
- var r = http3.request(e, t);
38184
+ }, http4.get = function(e, t) {
38185
+ var r = http4.request(e, t);
38186
38186
  return r.end(), r;
38187
- }, http3.ClientRequest = ClientRequest, http3.IncomingMessage = response.IncomingMessage, http3.Agent = function() {
38188
- }, http3.Agent.defaultMaxSockets = 4, http3.globalAgent = new http3.Agent(), http3.STATUS_CODES = statusCodes, http3.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"];
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, path9, value) {
41014
+ function collectionFromPath(schema, path10, value) {
41015
41015
  let v = value;
41016
- for (let i = path9.length - 1; i >= 0; --i) {
41017
- const k = path9[i];
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 = (path9) => path9 == null || typeof path9 === "object" && path9[Symbol.iterator]().next().done;
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(path9, value) {
41043
- if (isEmptyPath(path9))
41042
+ addIn(path10, value) {
41043
+ if (isEmptyPath(path10))
41044
41044
  this.add(value);
41045
41045
  else {
41046
- const [key, ...rest] = path9;
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 path9 = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
43277
- warn(`The endpoint 'yaml/${path9}' will be removed in a future release.`, "DeprecationWarning");
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, path9, refs) {
44008
- path9 = decodeURIComponent(path9);
44009
- if (refs && refs[path9])
44010
- return clone(refs[path9]);
44011
- const keyElements = path9.replace("#/", "/").split("/");
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 && path9.includes("#/") && refs[keyElements[0]]) {
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} (${path9})`);
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, path9) {
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 = path9;
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(path9, items, value, sample, resolve2, traverseCallback) {
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, path9, resolve2))) {
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, path9, resolve2, traverseCallback) {
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)}`, path9);
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 = path9.concat(["items", key]);
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 = path9.concat(["items", current]);
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, path9.concat(["items", idx]), resolve2);
44669
+ items[idx] = traverseCallback(value.contains, path10.concat(["items", idx]), resolve2);
44670
44670
  }
44671
44671
  if (value.uniqueItems) {
44672
- return unique(path9.concat(["items"]), items, value, sample, resolve2, traverseCallback);
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, path9, resolve2, traverseCallback) {
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, path9.concat(["properties"]), resolve2, value);
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
- }, path9.concat(["properties"]), resolve2, value);
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, path9.concat(["properties"]), resolve2, value);
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, path9.concat(["properties"]), resolve2, value).value);
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, path9, resolve2, rootSchema) {
45090
- schema = resolve2(schema, null, path9);
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, path9);
45092
+ schema = resolve2(schema, null, path10);
45093
45093
  }
45094
45094
  if (!schema) {
45095
- throw new Error(`Cannot traverse at '${path9.join(".")}', given '${JSON.stringify(rootSchema)}'`);
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: path9
45099
+ schemaPath: path10
45100
45100
  };
45101
- if (path9[path9.length - 1] !== "properties") {
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, path9.concat(["not"]), resolve2, rootSchema);
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), path9, resolve2);
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, path9) || type;
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, path9));
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)}`, path9.concat(["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, path9, resolve2, traverse), context };
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, path9, resolve2, traverse);
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, path9);
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], path9.concat([prop]), resolve2, valueCopy);
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, path9) {
45445
- return path9.reduce((v, k) => k in v ? v[k] : {}, obj);
45444
+ function getIn(obj, path10) {
45445
+ return path10.reduce((v, k) => k in v ? v[k] : {}, obj);
45446
45446
  }
45447
- function addComments(context, path9, commentNode, iterNode = commentNode) {
45448
- const { title, description, comment } = getIn(context, path9);
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, [...path9, "items", n.key.value], n.key, n.value);
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, [...path9, "items", i], n);
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(path9) {
51364
- if (path9 === void 0) return this._executableDir;
51365
- this._executableDir = path9;
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 import_path6 = __toESM(require("path"));
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, path9 = "", value) => {
54728
+ set: (obj, path10 = "", value) => {
54725
54729
  let pointer = obj;
54726
- path9.split(".").forEach((key, index, arr) => {
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, path9 = "", defaultValue) => {
54738
- const travel = (regexp) => String.prototype.split.call(path9, regexp).filter(Boolean).reduce(
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(path9, key, dots) {
55982
- if (!path9) return key;
55983
- return path9.concat(key).map(function each(token, i) {
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, path9) {
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(path9, key, dots), convertValue(value));
56076
+ formData.append(renderKey(path10, key, dots), convertValue(value));
56073
56077
  return false;
56074
56078
  }
56075
- if (value && !path9 && typeof value === "object") {
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(path9, key, dots), convertValue(value));
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, path9, depth = 0) {
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 " + path9.join("."));
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, path9, exposedHelpers);
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, path9 ? path9.concat(key) : [key], depth + 1);
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, path9, helpers) {
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 path9 = [];
56350
+ const path10 = [];
56347
56351
  const pattern = /\w+|\[(\w*)]/g;
56348
56352
  let match2;
56349
56353
  while ((match2 = pattern.exec(name)) !== null) {
56350
- throwIfDepthExceeded(path9.length);
56351
- path9.push(match2[0] === "[]" ? "" : match2[1] || match2[0]);
56354
+ throwIfDepthExceeded(path10.length);
56355
+ path10.push(match2[0] === "[]" ? "" : match2[1] || match2[0]);
56352
56356
  }
56353
- return path9;
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(path9, value, target, index) {
56372
+ function buildPath(path10, value, target, index) {
56369
56373
  throwIfDepthExceeded(index);
56370
- let name = path9[index++];
56374
+ let name = path10[index++];
56371
56375
  if (name === "__proto__") return true;
56372
56376
  const isNumericKey = Number.isFinite(+name);
56373
- const isLast = index >= path9.length;
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(path9, value, target[name], index);
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 path9;
57984
+ let path10;
57981
57985
  try {
57982
- path9 = buildURL(
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: path9,
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, path9, domain, secure, sameSite) {
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(path9)) {
58410
- cookie.push(`path=${path9}`);
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,552 @@ 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 DEPLOY_STEPS = [
61113
+ "install dependencies",
61114
+ "generate schema",
61115
+ "get publish details",
61116
+ "docker login",
61117
+ "docker build",
61118
+ "docker push",
61119
+ "save publish details"
61120
+ ];
61121
+ function notNullStep(job, name) {
61122
+ const step = job.steps.find((item) => item.name === name);
61123
+ if (!step) {
61124
+ throw new Error(`unknown deployment step ${name}`);
61125
+ }
61126
+ return step;
61127
+ }
61128
+ var ConnectCommand = class {
61129
+ constructor(profileName, profile) {
61130
+ this.profileName = profileName;
61131
+ this.profile = profile;
61132
+ this.isWin = process.platform === "win32";
61133
+ this.deployments = /* @__PURE__ */ new Map();
61134
+ const provider = requestConfigProvider(profile);
61135
+ this.registryClient = new RegistryClient(profile.kongBaseUrl, provider);
61136
+ this.managementClient = new ManagementClient(profile.kongBaseUrl, provider);
61137
+ }
61138
+ async execute() {
61139
+ const server = import_http4.default.createServer((request, response) => {
61140
+ this.handle(request, response).catch((ex) => {
61141
+ console.error("request failed", ex);
61142
+ if (!response.headersSent) {
61143
+ this.json(response, 500, { error: String(ex) });
61144
+ }
61145
+ });
61146
+ });
61147
+ server.listen(KONG_CONNECT_PORT, () => {
61148
+ console.info(
61149
+ `kong connect is listening on http://localhost:${KONG_CONNECT_PORT} (profile=${this.profileName}, baseUrl=${this.profile.kongBaseUrl})`
61150
+ );
61151
+ console.info("keep this terminal open while working in the kong ui; ctrl+c to stop");
61152
+ });
61153
+ }
61154
+ async handle(request, response) {
61155
+ response.setHeader("Access-Control-Allow-Origin", "*");
61156
+ response.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
61157
+ response.setHeader("Access-Control-Allow-Headers", "Content-Type");
61158
+ if (request.method === "OPTIONS") {
61159
+ response.writeHead(204);
61160
+ response.end();
61161
+ return;
61162
+ }
61163
+ const url2 = new URL(request.url ?? "/", `http://localhost:${KONG_CONNECT_PORT}`);
61164
+ if (request.method === "GET" && url2.pathname === "/v1/profile") {
61165
+ this.json(response, 200, this.profileInfo());
61166
+ return;
61167
+ }
61168
+ if (request.method === "POST" && url2.pathname === "/v1/tests") {
61169
+ const body = await this.readBody(request);
61170
+ this.json(response, 200, await this.runTests(body));
61171
+ return;
61172
+ }
61173
+ if (request.method === "POST" && url2.pathname === "/v1/deployments") {
61174
+ const body = await this.readBody(request);
61175
+ this.json(response, 200, this.startDeployment(body));
61176
+ return;
61177
+ }
61178
+ const statusMatch = url2.pathname.match(/^\/v1\/deployments\/([A-Za-z0-9-]+)$/);
61179
+ if (request.method === "GET" && statusMatch) {
61180
+ const job = this.deployments.get(statusMatch[1]);
61181
+ if (!job) {
61182
+ this.json(response, 404, { error: `unknown deployment ${statusMatch[1]}` });
61183
+ return;
61184
+ }
61185
+ this.json(response, 200, job);
61186
+ return;
61187
+ }
61188
+ this.json(response, 404, { error: `unknown route ${request.method} ${url2.pathname}` });
61189
+ }
61190
+ profileInfo() {
61191
+ return {
61192
+ profile: this.profileName,
61193
+ baseUrl: this.profile.kongBaseUrl,
61194
+ userName: this.profile.userName,
61195
+ docker: !(0, import_child_process2.spawnSync)("docker", ["--version"]).error,
61196
+ python: !(0, import_child_process2.spawnSync)(this.pythonBin(), ["--version"]).error
61197
+ };
61198
+ }
61199
+ /** Runs only src/main_test.py in a fresh venv and returns the raw output. */
61200
+ async runTests(request) {
61201
+ const workDir = this.materialize(request.files);
61202
+ try {
61203
+ const log = [];
61204
+ const prepared = await this.prepareVenv(workDir, log);
61205
+ if (prepared.exitCode !== 0) {
61206
+ return { passed: false, output: log.join("\n") };
61207
+ }
61208
+ const result = await this.run(
61209
+ this.venvPython(workDir),
61210
+ ["-m", "pytest", import_path4.default.join("src", "main_test.py"), "-v"],
61211
+ workDir
61212
+ );
61213
+ log.push(result.output);
61214
+ return { passed: result.exitCode === 0, output: log.join("\n") };
61215
+ } finally {
61216
+ import_fs3.default.rmSync(workDir, { recursive: true, force: true });
61217
+ }
61218
+ }
61219
+ /**
61220
+ * Deployments are asynchronous: the ui polls GET /v1/deployments/{id} and
61221
+ * renders the steps in the same progress dialog as the kong-build path.
61222
+ */
61223
+ startDeployment(request) {
61224
+ const deploymentId = generateShortId();
61225
+ const job = {
61226
+ status: "pending",
61227
+ steps: DEPLOY_STEPS.map((name) => ({ name, status: "idle" })),
61228
+ output: ""
61229
+ };
61230
+ this.deployments.set(deploymentId, job);
61231
+ this.deploy(request, job).catch((ex) => {
61232
+ job.status = "failed";
61233
+ job.error = ex.message;
61234
+ for (const step of job.steps) {
61235
+ if (step.status === "pending") {
61236
+ step.status = "failed";
61237
+ }
61238
+ }
61239
+ });
61240
+ return { deploymentId };
61241
+ }
61242
+ /**
61243
+ * The client-side twin of the kong-build pipeline: docker build + push from
61244
+ * this machine (requirements.txt applied), schema generated locally with
61245
+ * `main.py --schema`, then the snapshot registered in kong-management.
61246
+ */
61247
+ async deploy(request, job) {
61248
+ const step = (name) => notNullStep(job, name);
61249
+ const runStep = async (name, action) => {
61250
+ step(name).status = "pending";
61251
+ try {
61252
+ const result = await action();
61253
+ step(name).status = "succeeded";
61254
+ return result;
61255
+ } catch (ex) {
61256
+ step(name).status = "failed";
61257
+ throw ex;
61258
+ }
61259
+ };
61260
+ const workDir = this.materialize(request.files);
61261
+ try {
61262
+ const log = [];
61263
+ import_fs3.default.writeFileSync(import_path4.default.join(workDir, "Dockerfile"), DOCKERFILE);
61264
+ await runStep("install dependencies", async () => {
61265
+ const prepared = await this.prepareVenv(workDir, log);
61266
+ job.output = log.join("\n");
61267
+ if (prepared.exitCode !== 0) {
61268
+ throw new Error(`dependency install failed:
61269
+ ${log.join("\n")}`);
61270
+ }
61271
+ });
61272
+ const contract = await runStep("generate schema", async () => {
61273
+ const schema = await this.run(
61274
+ this.venvPython(workDir),
61275
+ [import_path4.default.join("src", "main.py"), "--schema"],
61276
+ workDir
61277
+ );
61278
+ if (schema.exitCode !== 0) {
61279
+ throw new Error(`schema generation failed:
61280
+ ${schema.output}`);
61281
+ }
61282
+ return JSON.parse(schema.output);
61283
+ });
61284
+ const publishDetails = await runStep("get publish details", () => {
61285
+ const tenant = parseTenant(this.profile.kongBaseUrl);
61286
+ return this.registryClient.getPublishDetails(
61287
+ `${tenant}-k-extension-${request.extensionId}`
61288
+ );
61289
+ });
61290
+ const registryUrl = publishDetails.repoName === "docker-registry:5000" ? "localhost:5000" : publishDetails.repoName;
61291
+ const imageName = `${registryUrl}/${publishDetails.imageName}:${publishDetails.imageVersion}`;
61292
+ for (const dockerStep of [
61293
+ {
61294
+ title: "docker login",
61295
+ command: "docker",
61296
+ args: ["login", "-u", publishDetails.userName, "--password-stdin", registryUrl],
61297
+ stdin: publishDetails.token
61298
+ },
61299
+ {
61300
+ title: "docker build",
61301
+ command: "docker",
61302
+ args: ["build", "--network=host", "-t", imageName, "-f", "Dockerfile", "."]
61303
+ },
61304
+ { title: "docker push", command: "docker", args: ["push", imageName] }
61305
+ ]) {
61306
+ await runStep(dockerStep.title, async () => {
61307
+ log.push(`> ${dockerStep.title}`);
61308
+ const result = await this.run(
61309
+ dockerStep.command,
61310
+ dockerStep.args,
61311
+ workDir,
61312
+ dockerStep.stdin
61313
+ );
61314
+ log.push(result.output);
61315
+ job.output = log.join("\n");
61316
+ if (result.exitCode !== 0) {
61317
+ throw new Error(`${dockerStep.title} failed:
61318
+ ${result.output}`);
61319
+ }
61320
+ });
61321
+ }
61322
+ const version = Number(publishDetails.imageVersion);
61323
+ await runStep(
61324
+ "save publish details",
61325
+ () => this.managementClient.createExtensionSnapshot(
61326
+ request.extensionId,
61327
+ this.snapshotFor(request, version, contract)
61328
+ )
61329
+ );
61330
+ log.push(`the version ${version} has been successfully published!`);
61331
+ job.output = log.join("\n");
61332
+ job.version = version;
61333
+ job.status = "succeeded";
61334
+ } finally {
61335
+ import_fs3.default.rmSync(workDir, { recursive: true, force: true });
61336
+ }
61337
+ }
61338
+ snapshotFor(request, version, contract) {
61339
+ return {
61340
+ extensionId: request.extensionId,
61341
+ extensionName: request.extensionName,
61342
+ sdk: "python",
61343
+ inputSchema: contract.input,
61344
+ outputSchema: contract.output,
61345
+ metadata: {
61346
+ id: request.extensionId,
61347
+ name: request.extensionName,
61348
+ sdk: "python",
61349
+ settings: {
61350
+ input: { filter: jqFilter(""), schema: contract.input },
61351
+ output: { filter: jqFilter(""), schema: contract.output }
61352
+ }
61353
+ },
61354
+ version,
61355
+ notes: request.notes ?? "",
61356
+ checkpoint: "",
61357
+ created: utcNow(DEFAULT_TIMEZONE),
61358
+ createdBy: ""
61359
+ };
61360
+ }
61361
+ /** Writes the bundle to a fresh temp folder, decoding binary entries. */
61362
+ materialize(files) {
61363
+ const workDir = import_fs3.default.mkdtempSync(import_path4.default.join(import_os2.default.tmpdir(), `kong-connect-${generateShortId()}-`));
61364
+ for (const file of files) {
61365
+ const target = import_path4.default.resolve(workDir, file.name);
61366
+ if (!target.startsWith(workDir)) {
61367
+ continue;
61368
+ }
61369
+ import_fs3.default.mkdirSync(import_path4.default.dirname(target), { recursive: true });
61370
+ import_fs3.default.writeFileSync(
61371
+ target,
61372
+ file.binary === true ? Buffer.from(file.content, "base64") : file.content
61373
+ );
61374
+ }
61375
+ import_fs3.default.writeFileSync(import_path4.default.join(workDir, "pyproject.toml"), PYPROJECT);
61376
+ return workDir;
61377
+ }
61378
+ async prepareVenv(workDir, log) {
61379
+ const venv = await this.run(this.pythonBin(), ["-m", "venv", "--clear", ".venv"], workDir);
61380
+ log.push(venv.output);
61381
+ if (venv.exitCode !== 0) {
61382
+ return venv;
61383
+ }
61384
+ const install = await this.run(
61385
+ this.venvPython(workDir),
61386
+ [
61387
+ "-m",
61388
+ "pip",
61389
+ "install",
61390
+ "--default-timeout=120",
61391
+ "-r",
61392
+ "requirements.txt",
61393
+ ...TEST_DEPENDENCIES
61394
+ ],
61395
+ workDir
61396
+ );
61397
+ log.push(install.output);
61398
+ return install;
61399
+ }
61400
+ pythonBin() {
61401
+ return (0, import_child_process2.spawnSync)("python", ["--version"]).error ? "python3" : "python";
61402
+ }
61403
+ venvPython(workDir) {
61404
+ return this.isWin ? import_path4.default.join(workDir, ".venv", "Scripts", "python.exe") : import_path4.default.join(workDir, ".venv", "bin", "python");
61405
+ }
61406
+ run(command, args, cwd, stdin) {
61407
+ return new Promise((resolve2) => {
61408
+ const child = (0, import_child_process2.spawn)(command, args, { cwd });
61409
+ const chunks = [];
61410
+ child.stdout.on("data", (data) => chunks.push(String(data)));
61411
+ child.stderr.on("data", (data) => chunks.push(String(data)));
61412
+ child.on("error", (error) => resolve2({ exitCode: -1, output: String(error) }));
61413
+ child.on("close", (exitCode) => resolve2({ exitCode: exitCode ?? -1, output: chunks.join("") }));
61414
+ if (stdin !== void 0) {
61415
+ child.stdin.write(stdin);
61416
+ }
61417
+ child.stdin.end();
61418
+ });
61419
+ }
61420
+ readBody(request) {
61421
+ return new Promise((resolve2, reject) => {
61422
+ const chunks = [];
61423
+ request.on("data", (chunk) => chunks.push(chunk));
61424
+ request.on("error", reject);
61425
+ request.on("end", () => {
61426
+ try {
61427
+ resolve2(JSON.parse(Buffer.concat(chunks).toString("utf-8") || "{}"));
61428
+ } catch (ex) {
61429
+ reject(ex instanceof Error ? ex : new Error(String(ex)));
61430
+ }
61431
+ });
61432
+ });
61433
+ }
61434
+ json(response, status, body) {
61435
+ response.writeHead(status, { "Content-Type": "application/json" });
61436
+ response.end(JSON.stringify(body));
61437
+ }
61438
+ };
61439
+
60896
61440
  // packages/kong-cli/src/commands/generateCommand.ts
60897
61441
  var import_create_nx_workspace = require("create-nx-workspace");
60898
61442
 
60899
61443
  // packages/kong-cli/src/common/kongJson.ts
60900
61444
  var import_ajv = __toESM(require_ajv());
60901
- var import_fs3 = __toESM(require("fs"));
61445
+ var import_fs4 = __toESM(require("fs"));
60902
61446
 
60903
61447
  // packages/kong-cli/src/common/kongJsonSchema.ts
60904
61448
  var KONG_JSON_SCHEMA = {
@@ -61059,7 +61603,7 @@ function validateKongJson(kongJson) {
61059
61603
  function getKongJson() {
61060
61604
  const kongJsonPath = resolveProjectPath("kong.json");
61061
61605
  try {
61062
- const fileContent = import_fs3.default.readFileSync(kongJsonPath, "utf-8");
61606
+ const fileContent = import_fs4.default.readFileSync(kongJsonPath, "utf-8");
61063
61607
  const kongJson = JSON.parse(fileContent);
61064
61608
  return validateKongJson(kongJson);
61065
61609
  } catch (ex) {
@@ -61124,52 +61668,15 @@ var eventemitter3_default = import_index.default;
61124
61668
  // node_modules/listr2/dist/index.mjs
61125
61669
  var import_node_util11 = require("node:util");
61126
61670
  var import_util4 = require("util");
61127
- var import_os2 = require("os");
61671
+ var import_os3 = require("os");
61128
61672
  var import_string_decoder = require("string_decoder");
61129
61673
  var import_stream5 = require("stream");
61130
61674
  var import_rfdc = __toESM(require_rfdc(), 1);
61131
61675
  var import_crypto2 = require("crypto");
61132
- var ANSI_ESCAPE2 = "\x1B[";
61133
61676
  var ANSI_ESCAPE_CODES = {
61134
- CURSOR_HIDE: ANSI_ESCAPE2 + "?25l",
61135
- CURSOR_SHOW: ANSI_ESCAPE2 + "?25h"
61677
+ CURSOR_HIDE: "\x1B[?25l",
61678
+ CURSOR_SHOW: "\x1B[?25h"
61136
61679
  };
61137
- var ListrEnvironmentVariables = /* @__PURE__ */ (function(ListrEnvironmentVariables2) {
61138
- ListrEnvironmentVariables2["FORCE_UNICODE"] = "LISTR_FORCE_UNICODE";
61139
- ListrEnvironmentVariables2["FORCE_TTY"] = "LISTR_FORCE_TTY";
61140
- ListrEnvironmentVariables2["DISABLE_COLOR"] = "NO_COLOR";
61141
- ListrEnvironmentVariables2["FORCE_COLOR"] = "FORCE_COLOR";
61142
- return ListrEnvironmentVariables2;
61143
- })({});
61144
- var ListrErrorTypes = /* @__PURE__ */ (function(ListrErrorTypes2) {
61145
- ListrErrorTypes2["WILL_RETRY"] = "WILL_RETRY";
61146
- ListrErrorTypes2["WILL_ROLLBACK"] = "WILL_ROLLBACK";
61147
- ListrErrorTypes2["HAS_FAILED_TO_ROLLBACK"] = "HAS_FAILED_TO_ROLLBACK";
61148
- ListrErrorTypes2["HAS_FAILED"] = "HAS_FAILED";
61149
- ListrErrorTypes2["HAS_FAILED_WITHOUT_ERROR"] = "HAS_FAILED_WITHOUT_ERROR";
61150
- return ListrErrorTypes2;
61151
- })({});
61152
- var ListrEventType = /* @__PURE__ */ (function(ListrEventType2) {
61153
- ListrEventType2["SHOULD_REFRESH_RENDER"] = "SHOUD_REFRESH_RENDER";
61154
- return ListrEventType2;
61155
- })({});
61156
- var ListrRendererSelection = /* @__PURE__ */ (function(ListrRendererSelection2) {
61157
- ListrRendererSelection2["PRIMARY"] = "PRIMARY";
61158
- ListrRendererSelection2["SECONDARY"] = "SECONDARY";
61159
- ListrRendererSelection2["SILENT"] = "SILENT";
61160
- return ListrRendererSelection2;
61161
- })({});
61162
- var ListrTaskEventType = /* @__PURE__ */ (function(ListrTaskEventType2) {
61163
- ListrTaskEventType2["TITLE"] = "TITLE";
61164
- ListrTaskEventType2["STATE"] = "STATE";
61165
- ListrTaskEventType2["ENABLED"] = "ENABLED";
61166
- ListrTaskEventType2["SUBTASK"] = "SUBTASK";
61167
- ListrTaskEventType2["PROMPT"] = "PROMPT";
61168
- ListrTaskEventType2["OUTPUT"] = "OUTPUT";
61169
- ListrTaskEventType2["MESSAGE"] = "MESSAGE";
61170
- ListrTaskEventType2["CLOSED"] = "CLOSED";
61171
- return ListrTaskEventType2;
61172
- })({});
61173
61680
  var ListrTaskState = /* @__PURE__ */ (function(ListrTaskState2) {
61174
61681
  ListrTaskState2["WAITING"] = "WAITING";
61175
61682
  ListrTaskState2["STARTED"] = "STARTED";
@@ -61210,7 +61717,7 @@ function isReadable(obj) {
61210
61717
  return !!obj && typeof obj === "object" && obj.readable === true && typeof obj.read === "function" && typeof obj.on === "function";
61211
61718
  }
61212
61719
  function isUnicodeSupported2() {
61213
- return !!process.env[ListrEnvironmentVariables.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";
61720
+ return !!process.env["LISTR_FORCE_UNICODE"] || process.platform !== "win32" || !!process.env.CI || !!process.env.WT_SESSION || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty";
61214
61721
  }
61215
61722
  var CLEAR_LINE_REGEX = "(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+";
61216
61723
  var BELL_REGEX = /\u0007/;
@@ -61246,47 +61753,35 @@ var figures2 = isUnicodeSupported2() ? FIGURES_MAIN : FIGURES_FALLBACK;
61246
61753
  function splat(message2, ...splat2) {
61247
61754
  return (0, import_util4.format)(String(message2), ...splat2);
61248
61755
  }
61249
- var ListrLogLevels = /* @__PURE__ */ (function(ListrLogLevels2) {
61250
- ListrLogLevels2["STARTED"] = "STARTED";
61251
- ListrLogLevels2["COMPLETED"] = "COMPLETED";
61252
- ListrLogLevels2["FAILED"] = "FAILED";
61253
- ListrLogLevels2["SKIPPED"] = "SKIPPED";
61254
- ListrLogLevels2["OUTPUT"] = "OUTPUT";
61255
- ListrLogLevels2["TITLE"] = "TITLE";
61256
- ListrLogLevels2["ROLLBACK"] = "ROLLBACK";
61257
- ListrLogLevels2["RETRY"] = "RETRY";
61258
- ListrLogLevels2["PROMPT"] = "PROMPT";
61259
- ListrLogLevels2["PAUSED"] = "PAUSED";
61260
- return ListrLogLevels2;
61261
- })({});
61262
61756
  var LISTR_LOGGER_STYLE = {
61263
61757
  icon: {
61264
- [ListrLogLevels.STARTED]: figures2.pointer,
61265
- [ListrLogLevels.FAILED]: figures2.cross,
61266
- [ListrLogLevels.SKIPPED]: figures2.arrowDown,
61267
- [ListrLogLevels.COMPLETED]: figures2.tick,
61268
- [ListrLogLevels.OUTPUT]: figures2.pointerSmall,
61269
- [ListrLogLevels.TITLE]: figures2.arrowRight,
61270
- [ListrLogLevels.RETRY]: figures2.warning,
61271
- [ListrLogLevels.ROLLBACK]: figures2.arrowLeft,
61272
- [ListrLogLevels.PAUSED]: figures2.squareSmallFilled
61758
+ ["STARTED"]: figures2.pointer,
61759
+ ["FAILED"]: figures2.cross,
61760
+ ["SKIPPED"]: figures2.arrowDown,
61761
+ ["COMPLETED"]: figures2.tick,
61762
+ ["OUTPUT"]: figures2.pointerSmall,
61763
+ ["TITLE"]: figures2.arrowRight,
61764
+ ["RETRY"]: figures2.warning,
61765
+ ["ROLLBACK"]: figures2.arrowLeft,
61766
+ ["PAUSED"]: figures2.squareSmallFilled
61273
61767
  },
61274
61768
  color: {
61275
- [ListrLogLevels.STARTED]: color.yellow,
61276
- [ListrLogLevels.FAILED]: color.red,
61277
- [ListrLogLevels.SKIPPED]: color.yellow,
61278
- [ListrLogLevels.COMPLETED]: color.green,
61279
- [ListrLogLevels.RETRY]: color.yellowBright,
61280
- [ListrLogLevels.ROLLBACK]: color.redBright,
61281
- [ListrLogLevels.PAUSED]: color.yellowBright
61769
+ ["STARTED"]: color.yellow,
61770
+ ["FAILED"]: color.red,
61771
+ ["SKIPPED"]: color.yellow,
61772
+ ["COMPLETED"]: color.green,
61773
+ ["RETRY"]: color.yellowBright,
61774
+ ["ROLLBACK"]: color.redBright,
61775
+ ["PAUSED"]: color.yellowBright
61282
61776
  }
61283
61777
  };
61284
61778
  var LISTR_LOGGER_STDERR_LEVELS = [
61285
- ListrLogLevels.RETRY,
61286
- ListrLogLevels.ROLLBACK,
61287
- ListrLogLevels.FAILED
61779
+ "RETRY",
61780
+ "ROLLBACK",
61781
+ "FAILED"
61288
61782
  ];
61289
61783
  var ListrLogger = class {
61784
+ options;
61290
61785
  process;
61291
61786
  constructor(options) {
61292
61787
  this.options = options;
@@ -61365,12 +61860,12 @@ var ListrLogger = class {
61365
61860
  }
61366
61861
  format(level, message2, options) {
61367
61862
  if (!Array.isArray(message2)) message2 = [message2];
61368
- message2 = this.splat(message2.shift(), ...message2).toString().split(import_os2.EOL).filter((m) => !m || m.trim() !== "").map((m) => {
61863
+ message2 = this.splat(message2.shift(), ...message2).toString().split(import_os3.EOL).filter((m) => !m || m.trim() !== "").map((m) => {
61369
61864
  return this.style(level, this.fields(m, {
61370
61865
  prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
61371
61866
  suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
61372
61867
  }));
61373
- }).join(import_os2.EOL);
61868
+ }).join(import_os3.EOL);
61374
61869
  return message2;
61375
61870
  }
61376
61871
  style(level, message2) {
@@ -61388,6 +61883,7 @@ var ListrLogger = class {
61388
61883
  }
61389
61884
  };
61390
61885
  var ProcessOutputBuffer = class {
61886
+ options;
61391
61887
  buffer = [];
61392
61888
  decoder = new import_string_decoder.StringDecoder();
61393
61889
  constructor(options) {
@@ -61418,6 +61914,7 @@ var ProcessOutputBuffer = class {
61418
61914
  }
61419
61915
  };
61420
61916
  var ProcessOutputStream = class {
61917
+ stream;
61421
61918
  method;
61422
61919
  buffer;
61423
61920
  constructor(stream4) {
@@ -61446,6 +61943,7 @@ var ProcessOutputStream = class {
61446
61943
  }
61447
61944
  };
61448
61945
  var ProcessOutput = class {
61946
+ options;
61449
61947
  stream;
61450
61948
  active;
61451
61949
  constructor(stdout, stderr, options) {
@@ -61483,20 +61981,20 @@ var ProcessOutput = class {
61483
61981
  };
61484
61982
  }).filter((message2) => message2.entry);
61485
61983
  if (output.length > 0) {
61486
- if (this.options.leaveEmptyLine) this.stdout.write(import_os2.EOL);
61984
+ if (this.options.leaveEmptyLine) this.stdout.write(import_os3.EOL);
61487
61985
  output.forEach((message2) => {
61488
- (message2.stream ?? this.stdout).write(message2.entry + import_os2.EOL);
61986
+ (message2.stream ?? this.stdout).write(message2.entry + import_os3.EOL);
61489
61987
  });
61490
61988
  }
61491
61989
  this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
61492
61990
  this.active = false;
61493
61991
  }
61494
61992
  toStdout(buffer, eol = true) {
61495
- if (eol) buffer = buffer + import_os2.EOL;
61993
+ if (eol) buffer = buffer + import_os3.EOL;
61496
61994
  return this.stream.stdout.write(buffer);
61497
61995
  }
61498
61996
  toStderr(buffer, eol = true) {
61499
- if (eol) buffer = buffer + import_os2.EOL;
61997
+ if (eol) buffer = buffer + import_os3.EOL;
61500
61998
  return this.stream.stderr.write(buffer);
61501
61999
  }
61502
62000
  };
@@ -61550,56 +62048,38 @@ var Spinner = class {
61550
62048
  this.id = void 0;
61551
62049
  }
61552
62050
  };
61553
- var ListrDefaultRendererLogLevels = /* @__PURE__ */ (function(ListrDefaultRendererLogLevels2) {
61554
- ListrDefaultRendererLogLevels2["SKIPPED_WITH_COLLAPSE"] = "SKIPPED_WITH_COLLAPSE";
61555
- ListrDefaultRendererLogLevels2["SKIPPED_WITHOUT_COLLAPSE"] = "SKIPPED_WITHOUT_COLLAPSE";
61556
- ListrDefaultRendererLogLevels2["OUTPUT"] = "OUTPUT";
61557
- ListrDefaultRendererLogLevels2["OUTPUT_WITH_BOTTOMBAR"] = "OUTPUT_WITH_BOTTOMBAR";
61558
- ListrDefaultRendererLogLevels2["PENDING"] = "PENDING";
61559
- ListrDefaultRendererLogLevels2["COMPLETED"] = "COMPLETED";
61560
- ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SUBTASKS"] = "COMPLETED_WITH_FAILED_SUBTASKS";
61561
- ListrDefaultRendererLogLevels2["COMPLETED_WITH_FAILED_SISTER_TASKS"] = "COMPLETED_WITH_SISTER_TASKS_FAILED";
61562
- ListrDefaultRendererLogLevels2["RETRY"] = "RETRY";
61563
- ListrDefaultRendererLogLevels2["ROLLING_BACK"] = "ROLLING_BACK";
61564
- ListrDefaultRendererLogLevels2["ROLLED_BACK"] = "ROLLED_BACK";
61565
- ListrDefaultRendererLogLevels2["FAILED"] = "FAILED";
61566
- ListrDefaultRendererLogLevels2["FAILED_WITH_FAILED_SUBTASKS"] = "FAILED_WITH_SUBTASKS";
61567
- ListrDefaultRendererLogLevels2["WAITING"] = "WAITING";
61568
- ListrDefaultRendererLogLevels2["PAUSED"] = "PAUSED";
61569
- return ListrDefaultRendererLogLevels2;
61570
- })({});
61571
62051
  var LISTR_DEFAULT_RENDERER_STYLE = {
61572
62052
  icon: {
61573
- [ListrDefaultRendererLogLevels.SKIPPED_WITH_COLLAPSE]: figures2.arrowDown,
61574
- [ListrDefaultRendererLogLevels.SKIPPED_WITHOUT_COLLAPSE]: figures2.warning,
61575
- [ListrDefaultRendererLogLevels.OUTPUT]: figures2.pointerSmall,
61576
- [ListrDefaultRendererLogLevels.OUTPUT_WITH_BOTTOMBAR]: figures2.pointerSmall,
61577
- [ListrDefaultRendererLogLevels.PENDING]: figures2.pointer,
61578
- [ListrDefaultRendererLogLevels.COMPLETED]: figures2.tick,
61579
- [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SUBTASKS]: figures2.warning,
61580
- [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SISTER_TASKS]: figures2.squareSmallFilled,
61581
- [ListrDefaultRendererLogLevels.RETRY]: figures2.warning,
61582
- [ListrDefaultRendererLogLevels.ROLLING_BACK]: figures2.warning,
61583
- [ListrDefaultRendererLogLevels.ROLLED_BACK]: figures2.arrowLeft,
61584
- [ListrDefaultRendererLogLevels.FAILED]: figures2.cross,
61585
- [ListrDefaultRendererLogLevels.FAILED_WITH_FAILED_SUBTASKS]: figures2.pointer,
61586
- [ListrDefaultRendererLogLevels.WAITING]: figures2.squareSmallFilled,
61587
- [ListrDefaultRendererLogLevels.PAUSED]: figures2.squareSmallFilled
62053
+ ["SKIPPED_WITH_COLLAPSE"]: figures2.arrowDown,
62054
+ ["SKIPPED_WITHOUT_COLLAPSE"]: figures2.warning,
62055
+ ["OUTPUT"]: figures2.pointerSmall,
62056
+ ["OUTPUT_WITH_BOTTOMBAR"]: figures2.pointerSmall,
62057
+ ["PENDING"]: figures2.pointer,
62058
+ ["COMPLETED"]: figures2.tick,
62059
+ ["COMPLETED_WITH_FAILED_SUBTASKS"]: figures2.warning,
62060
+ ["COMPLETED_WITH_SISTER_TASKS_FAILED"]: figures2.squareSmallFilled,
62061
+ ["RETRY"]: figures2.warning,
62062
+ ["ROLLING_BACK"]: figures2.warning,
62063
+ ["ROLLED_BACK"]: figures2.arrowLeft,
62064
+ ["FAILED"]: figures2.cross,
62065
+ ["FAILED_WITH_SUBTASKS"]: figures2.pointer,
62066
+ ["WAITING"]: figures2.squareSmallFilled,
62067
+ ["PAUSED"]: figures2.squareSmallFilled
61588
62068
  },
61589
62069
  color: {
61590
- [ListrDefaultRendererLogLevels.SKIPPED_WITH_COLLAPSE]: color.yellow,
61591
- [ListrDefaultRendererLogLevels.SKIPPED_WITHOUT_COLLAPSE]: color.yellow,
61592
- [ListrDefaultRendererLogLevels.PENDING]: color.yellow,
61593
- [ListrDefaultRendererLogLevels.COMPLETED]: color.green,
61594
- [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SUBTASKS]: color.yellow,
61595
- [ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SISTER_TASKS]: color.red,
61596
- [ListrDefaultRendererLogLevels.RETRY]: color.yellowBright,
61597
- [ListrDefaultRendererLogLevels.ROLLING_BACK]: color.redBright,
61598
- [ListrDefaultRendererLogLevels.ROLLED_BACK]: color.redBright,
61599
- [ListrDefaultRendererLogLevels.FAILED]: color.red,
61600
- [ListrDefaultRendererLogLevels.FAILED_WITH_FAILED_SUBTASKS]: color.red,
61601
- [ListrDefaultRendererLogLevels.WAITING]: color.dim,
61602
- [ListrDefaultRendererLogLevels.PAUSED]: color.yellowBright
62070
+ ["SKIPPED_WITH_COLLAPSE"]: color.yellow,
62071
+ ["SKIPPED_WITHOUT_COLLAPSE"]: color.yellow,
62072
+ ["PENDING"]: color.yellow,
62073
+ ["COMPLETED"]: color.green,
62074
+ ["COMPLETED_WITH_FAILED_SUBTASKS"]: color.yellow,
62075
+ ["COMPLETED_WITH_SISTER_TASKS_FAILED"]: color.red,
62076
+ ["RETRY"]: color.yellowBright,
62077
+ ["ROLLING_BACK"]: color.redBright,
62078
+ ["ROLLED_BACK"]: color.redBright,
62079
+ ["FAILED"]: color.red,
62080
+ ["FAILED_WITH_SUBTASKS"]: color.red,
62081
+ ["WAITING"]: color.dim,
62082
+ ["PAUSED"]: color.yellowBright
61603
62083
  }
61604
62084
  };
61605
62085
  function parseTimer(duration) {
@@ -61617,6 +62097,9 @@ var PRESET_TIMER = {
61617
62097
  format: () => color.dim
61618
62098
  };
61619
62099
  var DefaultRenderer = class DefaultRenderer2 {
62100
+ tasks;
62101
+ options;
62102
+ events;
61620
62103
  static nonTTY = false;
61621
62104
  static rendererOptions = {
61622
62105
  indentation: 2,
@@ -61689,7 +62172,7 @@ var DefaultRenderer = class DefaultRenderer2 {
61689
62172
  if (!this.options?.lazy) this.spinner.start(() => {
61690
62173
  this.update();
61691
62174
  });
61692
- this.events.on(ListrEventType.SHOULD_REFRESH_RENDER, () => {
62175
+ this.events.on("SHOUD_REFRESH_RENDER", () => {
61693
62176
  this.update();
61694
62177
  });
61695
62178
  }
@@ -61723,31 +62206,31 @@ var DefaultRenderer = class DefaultRenderer2 {
61723
62206
  if (render.length > 0) render.push("");
61724
62207
  render.push(...renderPrompt);
61725
62208
  }
61726
- return render.join(import_os2.EOL);
62209
+ return render.join(import_os3.EOL);
61727
62210
  }
61728
62211
  style(task, output = false) {
61729
62212
  const rendererOptions = this.cache.rendererOptions.get(task.id);
61730
62213
  if (task.isSkipped()) {
61731
- if (output || rendererOptions.collapseSkips) return this.logger.icon(ListrDefaultRendererLogLevels.SKIPPED_WITH_COLLAPSE);
61732
- else if (rendererOptions.collapseSkips === false) return this.logger.icon(ListrDefaultRendererLogLevels.SKIPPED_WITHOUT_COLLAPSE);
62214
+ if (output || rendererOptions.collapseSkips) return this.logger.icon("SKIPPED_WITH_COLLAPSE");
62215
+ else if (rendererOptions.collapseSkips === false) return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE");
61733
62216
  }
61734
62217
  if (output) {
61735
- if (this.shouldOutputToBottomBar(task)) return this.logger.icon(ListrDefaultRendererLogLevels.OUTPUT_WITH_BOTTOMBAR);
61736
- return this.logger.icon(ListrDefaultRendererLogLevels.OUTPUT);
62218
+ if (this.shouldOutputToBottomBar(task)) return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");
62219
+ return this.logger.icon("OUTPUT");
61737
62220
  }
61738
62221
  if (task.hasSubtasks()) {
61739
- if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) return this.logger.icon(ListrDefaultRendererLogLevels.PENDING);
61740
- else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) return this.logger.icon(ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SUBTASKS);
61741
- else if (task.hasFailed()) return this.logger.icon(ListrDefaultRendererLogLevels.FAILED_WITH_FAILED_SUBTASKS);
61742
- }
61743
- if (task.isStarted() || task.isPrompt()) return this.logger.icon(ListrDefaultRendererLogLevels.PENDING, !this.options?.lazy && this.spinner.fetch());
61744
- else if (task.isCompleted()) return this.logger.icon(ListrDefaultRendererLogLevels.COMPLETED);
61745
- else if (task.isRetrying()) return this.logger.icon(ListrDefaultRendererLogLevels.RETRY, !this.options?.lazy && this.spinner.fetch());
61746
- else if (task.isRollingBack()) return this.logger.icon(ListrDefaultRendererLogLevels.ROLLING_BACK, !this.options?.lazy && this.spinner.fetch());
61747
- else if (task.hasRolledBack()) return this.logger.icon(ListrDefaultRendererLogLevels.ROLLED_BACK);
61748
- else if (task.hasFailed()) return this.logger.icon(ListrDefaultRendererLogLevels.FAILED);
61749
- else if (task.isPaused()) return this.logger.icon(ListrDefaultRendererLogLevels.PAUSED);
61750
- return this.logger.icon(ListrDefaultRendererLogLevels.WAITING);
62222
+ if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) return this.logger.icon("PENDING");
62223
+ else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");
62224
+ else if (task.hasFailed()) return this.logger.icon("FAILED_WITH_SUBTASKS");
62225
+ }
62226
+ if (task.isStarted() || task.isPrompt()) return this.logger.icon("PENDING", !this.options?.lazy && this.spinner.fetch());
62227
+ else if (task.isCompleted()) return this.logger.icon("COMPLETED");
62228
+ else if (task.isRetrying()) return this.logger.icon("RETRY", !this.options?.lazy && this.spinner.fetch());
62229
+ else if (task.isRollingBack()) return this.logger.icon("ROLLING_BACK", !this.options?.lazy && this.spinner.fetch());
62230
+ else if (task.hasRolledBack()) return this.logger.icon("ROLLED_BACK");
62231
+ else if (task.hasFailed()) return this.logger.icon("FAILED");
62232
+ else if (task.isPaused()) return this.logger.icon("PAUSED");
62233
+ return this.logger.icon("WAITING");
61751
62234
  }
61752
62235
  format(message2, icon, level) {
61753
62236
  if (message2.trim() === "") return [];
@@ -61756,7 +62239,7 @@ var DefaultRenderer = class DefaultRenderer2 {
61756
62239
  const columns = (process.stdout.columns ?? 80) - level * this.options.indentation - 2;
61757
62240
  switch (this.options.formatOutput) {
61758
62241
  case "truncate":
61759
- parsed = message2.split(import_os2.EOL).map((s, i) => {
62242
+ parsed = message2.split(import_os3.EOL).map((s, i) => {
61760
62243
  return this.truncate(this.indent(s, i), columns);
61761
62244
  });
61762
62245
  break;
@@ -61764,7 +62247,7 @@ var DefaultRenderer = class DefaultRenderer2 {
61764
62247
  parsed = this.wrap(message2, columns, {
61765
62248
  hard: true,
61766
62249
  trim: false
61767
- }).split(import_os2.EOL).map((s, i) => this.indent(s, i));
62250
+ }).split(import_os3.EOL).map((s, i) => this.indent(s, i));
61768
62251
  break;
61769
62252
  default:
61770
62253
  throw new ListrRendererError("Format option for the renderer is wrong.");
@@ -61792,15 +62275,15 @@ var DefaultRenderer = class DefaultRenderer2 {
61792
62275
  if (task.isPrompt()) {
61793
62276
  if (this.activePrompt && this.activePrompt !== task.id) throw new ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");
61794
62277
  else if (!this.activePrompt) {
61795
- task.on(ListrTaskEventType.PROMPT, (prompt2) => {
62278
+ task.on("PROMPT", (prompt2) => {
61796
62279
  const cleansed = cleanseAnsi(prompt2);
61797
62280
  if (cleansed) this.prompt = cleansed;
61798
62281
  });
61799
- task.on(ListrTaskEventType.STATE, (state) => {
61800
- if (state === ListrTaskState.PROMPT_COMPLETED || task.hasFinalized() || task.hasReset()) {
62282
+ task.on("STATE", (state) => {
62283
+ if (state === "PROMPT_COMPLETED" || task.hasFinalized() || task.hasReset()) {
61801
62284
  this.prompt = null;
61802
62285
  this.activePrompt = null;
61803
- task.off(ListrTaskEventType.PROMPT);
62286
+ task.off("PROMPT");
61804
62287
  }
61805
62288
  });
61806
62289
  this.activePrompt = task.id;
@@ -61808,12 +62291,12 @@ var DefaultRenderer = class DefaultRenderer2 {
61808
62291
  }
61809
62292
  if (task.hasTitle()) if (!(tasks.some((task2) => task2.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped()))) if (task.hasFailed() && rendererOptions.collapseErrors) output.push(...this.format(!task.hasSubtasks() && task.message.error && rendererOptions.showErrorMessage ? task.message.error : task.title, this.style(task), level));
61810
62293
  else if (task.isSkipped() && rendererOptions.collapseSkips) output.push(...this.format(this.logger.suffix(task.message.skip && rendererOptions.showSkipMessage ? task.message.skip : task.title, {
61811
- field: ListrLogLevels.SKIPPED,
62294
+ field: "SKIPPED",
61812
62295
  condition: rendererOptions.suffixSkips,
61813
62296
  format: () => color.dim
61814
62297
  }), this.style(task), level));
61815
62298
  else if (task.isRetrying()) output.push(...this.format(this.logger.suffix(task.title, {
61816
- field: `${ListrLogLevels.RETRY}:${task.message.retry.count}`,
62299
+ field: `${"RETRY"}:${task.message.retry.count}`,
61817
62300
  format: () => color.yellow,
61818
62301
  condition: rendererOptions.suffixRetries
61819
62302
  }), this.style(task), level));
@@ -61826,10 +62309,10 @@ var DefaultRenderer = class DefaultRenderer2 {
61826
62309
  args: [task.message.paused - Date.now()]
61827
62310
  }), this.style(task), level));
61828
62311
  else output.push(...this.format(task.title, this.style(task), level));
61829
- else output.push(...this.format(task.title, this.logger.icon(ListrDefaultRendererLogLevels.COMPLETED_WITH_FAILED_SISTER_TASKS), level));
62312
+ else output.push(...this.format(task.title, this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"), level));
61830
62313
  if (!task.hasSubtasks() || !rendererOptions.showSubtasks) {
61831
- if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, ListrLogLevels.FAILED));
61832
- else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, ListrLogLevels.SKIPPED));
62314
+ if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, "FAILED"));
62315
+ else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks)) output.push(...this.dump(task, level, "SKIPPED"));
61833
62316
  }
61834
62317
  if (task.isPending() || rendererTaskOptions.persistentOutput) output.push(...this.renderOutputBar(task, level));
61835
62318
  if (rendererOptions.showSubtasks !== false && task.hasSubtasks() && (task.isPending() || task.hasFinalized() && !task.hasTitle() || task.isCompleted() && rendererOptions.collapseSubtasks === false && !task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === true) || task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === false) || task.subtasks.some((subtask) => subtask.hasFailed()) || task.subtasks.some((subtask) => subtask.hasRolledBack()))) {
@@ -61853,7 +62336,7 @@ var DefaultRenderer = class DefaultRenderer2 {
61853
62336
  renderOutputBar(task, level) {
61854
62337
  const output = this.buffer.output.get(task.id);
61855
62338
  if (!output) return [];
61856
- return output.all.flatMap((o) => this.dump(task, level, ListrLogLevels.OUTPUT, o.entry));
62339
+ return output.all.flatMap((o) => this.dump(task, level, "OUTPUT", o.entry));
61857
62340
  }
61858
62341
  renderBottomBar() {
61859
62342
  if (this.buffer.bottom.size === 0) return [];
@@ -61881,25 +62364,25 @@ var DefaultRenderer = class DefaultRenderer2 {
61881
62364
  const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
61882
62365
  if (this.shouldOutputToBottomBar(task) && !this.buffer.bottom.has(task.id)) {
61883
62366
  this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
61884
- task.on(ListrTaskEventType.OUTPUT, (output) => {
61885
- const data = this.dump(task, -1, ListrLogLevels.OUTPUT, output);
61886
- this.buffer.bottom.get(task.id).write(data.join(import_os2.EOL));
62367
+ task.on("OUTPUT", (output) => {
62368
+ const data = this.dump(task, -1, "OUTPUT", output);
62369
+ this.buffer.bottom.get(task.id).write(data.join(import_os3.EOL));
61887
62370
  });
61888
- task.on(ListrTaskEventType.STATE, (state) => {
62371
+ task.on("STATE", (state) => {
61889
62372
  switch (state) {
61890
- case (ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK):
62373
+ case "RETRY":
61891
62374
  this.buffer.bottom.delete(task.id);
61892
62375
  break;
61893
62376
  }
61894
62377
  });
61895
62378
  } else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
61896
62379
  this.buffer.output.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.outputBar === "number" ? rendererTaskOptions.outputBar : 1 }));
61897
- task.on(ListrTaskEventType.OUTPUT, (output) => {
62380
+ task.on("OUTPUT", (output) => {
61898
62381
  this.buffer.output.get(task.id).write(output);
61899
62382
  });
61900
- task.on(ListrTaskEventType.STATE, (state) => {
62383
+ task.on("STATE", (state) => {
61901
62384
  switch (state) {
61902
- case (ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK):
62385
+ case "RETRY":
61903
62386
  this.buffer.output.delete(task.id);
61904
62387
  break;
61905
62388
  }
@@ -61911,20 +62394,20 @@ var DefaultRenderer = class DefaultRenderer2 {
61911
62394
  this.cache.rendererTaskOptions.delete(task.id);
61912
62395
  this.buffer.output.delete(task.id);
61913
62396
  }
61914
- dump(task, level, source = ListrLogLevels.OUTPUT, data) {
62397
+ dump(task, level, source = "OUTPUT", data) {
61915
62398
  if (!data) switch (source) {
61916
- case ListrLogLevels.OUTPUT:
62399
+ case "OUTPUT":
61917
62400
  data = task.output;
61918
62401
  break;
61919
- case ListrLogLevels.SKIPPED:
62402
+ case "SKIPPED":
61920
62403
  data = task.message.skip;
61921
62404
  break;
61922
- case ListrLogLevels.FAILED:
62405
+ case "FAILED":
61923
62406
  data = task.message.error;
61924
62407
  break;
61925
62408
  }
61926
- if (task.hasTitle() && source === ListrLogLevels.FAILED && data === task.title || typeof data !== "string") return [];
61927
- if (source === ListrLogLevels.OUTPUT) data = cleanseAnsi(data);
62409
+ if (task.hasTitle() && source === "FAILED" && data === task.title || typeof data !== "string") return [];
62410
+ if (source === "OUTPUT") data = cleanseAnsi(data);
61928
62411
  return this.format(data, this.style(task, true), level + 1);
61929
62412
  }
61930
62413
  indent(str, i) {
@@ -61932,6 +62415,8 @@ var DefaultRenderer = class DefaultRenderer2 {
61932
62415
  }
61933
62416
  };
61934
62417
  var SilentRenderer = class {
62418
+ tasks;
62419
+ options;
61935
62420
  static nonTTY = true;
61936
62421
  static rendererOptions;
61937
62422
  static rendererTaskOptions;
@@ -61945,10 +62430,12 @@ var SilentRenderer = class {
61945
62430
  }
61946
62431
  };
61947
62432
  var SimpleRenderer = class SimpleRenderer2 {
62433
+ tasks;
62434
+ options;
61948
62435
  static nonTTY = true;
61949
62436
  static rendererOptions = { pausedTimer: {
61950
62437
  ...PRESET_TIMER,
61951
- field: (time) => `${ListrLogLevels.PAUSED}:${time}`,
62438
+ field: (time) => `${"PAUSED"}:${time}`,
61952
62439
  format: () => color.yellowBright
61953
62440
  } };
61954
62441
  static rendererTaskOptions = {};
@@ -61988,57 +62475,57 @@ var SimpleRenderer = class SimpleRenderer2 {
61988
62475
  renderer(tasks) {
61989
62476
  tasks.forEach((task) => {
61990
62477
  this.calculate(task);
61991
- task.once(ListrTaskEventType.CLOSED, () => {
62478
+ task.once("CLOSED", () => {
61992
62479
  this.reset(task);
61993
62480
  });
61994
62481
  const rendererOptions = this.cache.rendererOptions.get(task.id);
61995
62482
  const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
61996
- task.on(ListrTaskEventType.SUBTASK, (subtasks) => {
62483
+ task.on("SUBTASK", (subtasks) => {
61997
62484
  this.renderer(subtasks);
61998
62485
  });
61999
- task.on(ListrTaskEventType.STATE, (state) => {
62486
+ task.on("STATE", (state) => {
62000
62487
  if (!task.hasTitle()) return;
62001
- if (state === ListrTaskState.STARTED) this.logger.log(ListrLogLevels.STARTED, task.title);
62002
- else if (state === ListrTaskState.COMPLETED) {
62488
+ if (state === "STARTED") this.logger.log("STARTED", task.title);
62489
+ else if (state === "COMPLETED") {
62003
62490
  const timer = rendererTaskOptions?.timer;
62004
- this.logger.log(ListrLogLevels.COMPLETED, task.title, timer && { suffix: {
62491
+ this.logger.log("COMPLETED", task.title, timer && { suffix: {
62005
62492
  ...timer,
62006
62493
  condition: !!task.message?.duration && timer.condition,
62007
62494
  args: [task.message.duration]
62008
62495
  } });
62009
- } else if (state === ListrTaskState.PROMPT) {
62496
+ } else if (state === "PROMPT") {
62010
62497
  this.logger.process.hijack();
62011
- task.on(ListrTaskEventType.PROMPT, (prompt2) => {
62498
+ task.on("PROMPT", (prompt2) => {
62012
62499
  this.logger.process.toStderr(prompt2, false);
62013
62500
  });
62014
- } else if (state === ListrTaskState.PROMPT_COMPLETED) {
62015
- task.off(ListrTaskEventType.PROMPT);
62501
+ } else if (state === "PROMPT_COMPLETED") {
62502
+ task.off("PROMPT");
62016
62503
  this.logger.process.release();
62017
62504
  }
62018
62505
  });
62019
- task.on(ListrTaskEventType.OUTPUT, (output) => {
62020
- this.logger.log(ListrLogLevels.OUTPUT, output);
62506
+ task.on("OUTPUT", (output) => {
62507
+ this.logger.log("OUTPUT", output);
62021
62508
  });
62022
- task.on(ListrTaskEventType.MESSAGE, (message2) => {
62023
- if (message2.error) this.logger.log(ListrLogLevels.FAILED, task.title, { suffix: {
62024
- field: `${ListrLogLevels.FAILED}: ${message2.error}`,
62509
+ task.on("MESSAGE", (message2) => {
62510
+ if (message2.error) this.logger.log("FAILED", task.title, { suffix: {
62511
+ field: `${"FAILED"}: ${message2.error}`,
62025
62512
  format: () => color.red
62026
62513
  } });
62027
- else if (message2.skip) this.logger.log(ListrLogLevels.SKIPPED, task.title, { suffix: {
62028
- field: `${ListrLogLevels.SKIPPED}: ${message2.skip}`,
62514
+ else if (message2.skip) this.logger.log("SKIPPED", task.title, { suffix: {
62515
+ field: `${"SKIPPED"}: ${message2.skip}`,
62029
62516
  format: () => color.yellow
62030
62517
  } });
62031
- else if (message2.rollback) this.logger.log(ListrLogLevels.ROLLBACK, task.title, { suffix: {
62032
- field: `${ListrLogLevels.ROLLBACK}: ${message2.rollback}`,
62518
+ else if (message2.rollback) this.logger.log("ROLLBACK", task.title, { suffix: {
62519
+ field: `${"ROLLBACK"}: ${message2.rollback}`,
62033
62520
  format: () => color.red
62034
62521
  } });
62035
- else if (message2.retry) this.logger.log(ListrLogLevels.RETRY, task.title, { suffix: {
62036
- field: `${ListrLogLevels.RETRY}:${message2.retry.count}`,
62522
+ else if (message2.retry) this.logger.log("RETRY", task.title, { suffix: {
62523
+ field: `${"RETRY"}:${message2.retry.count}`,
62037
62524
  format: () => color.red
62038
62525
  } });
62039
62526
  else if (message2.paused) {
62040
62527
  const timer = rendererOptions?.pausedTimer;
62041
- this.logger.log(ListrLogLevels.PAUSED, task.title, timer && { suffix: {
62528
+ this.logger.log("PAUSED", task.title, timer && { suffix: {
62042
62529
  ...timer,
62043
62530
  condition: !!message2?.paused && timer.condition,
62044
62531
  args: [message2.paused - Date.now()]
@@ -62066,6 +62553,7 @@ var SimpleRenderer = class SimpleRenderer2 {
62066
62553
  }
62067
62554
  };
62068
62555
  var TestRendererSerializer = class {
62556
+ options;
62069
62557
  constructor(options) {
62070
62558
  this.options = options;
62071
62559
  }
@@ -62089,6 +62577,8 @@ var TestRendererSerializer = class {
62089
62577
  }
62090
62578
  };
62091
62579
  var TestRenderer = class TestRenderer2 {
62580
+ tasks;
62581
+ options;
62092
62582
  static nonTTY = true;
62093
62583
  static rendererOptions = {
62094
62584
  subtasks: true,
@@ -62149,27 +62639,27 @@ var TestRenderer = class TestRenderer2 {
62149
62639
  }
62150
62640
  renderer(tasks) {
62151
62641
  tasks.forEach((task) => {
62152
- if (this.options.subtasks) task.on(ListrTaskEventType.SUBTASK, (subtasks) => {
62642
+ if (this.options.subtasks) task.on("SUBTASK", (subtasks) => {
62153
62643
  this.renderer(subtasks);
62154
62644
  });
62155
- if (this.options.state) task.on(ListrTaskEventType.STATE, (state) => {
62156
- this.logger.toStdout(this.serializer.serialize(ListrTaskEventType.STATE, state, task));
62645
+ if (this.options.state) task.on("STATE", (state) => {
62646
+ this.logger.toStdout(this.serializer.serialize("STATE", state, task));
62157
62647
  });
62158
- if (this.options.output) task.on(ListrTaskEventType.OUTPUT, (data) => {
62159
- this.logger.toStdout(this.serializer.serialize(ListrTaskEventType.OUTPUT, data, task));
62648
+ if (this.options.output) task.on("OUTPUT", (data) => {
62649
+ this.logger.toStdout(this.serializer.serialize("OUTPUT", data, task));
62160
62650
  });
62161
- if (this.options.prompt) task.on(ListrTaskEventType.PROMPT, (prompt2) => {
62162
- this.logger.toStdout(this.serializer.serialize(ListrTaskEventType.PROMPT, prompt2, task));
62651
+ if (this.options.prompt) task.on("PROMPT", (prompt2) => {
62652
+ this.logger.toStdout(this.serializer.serialize("PROMPT", prompt2, task));
62163
62653
  });
62164
- if (this.options.title) task.on(ListrTaskEventType.TITLE, (title) => {
62165
- this.logger.toStdout(this.serializer.serialize(ListrTaskEventType.TITLE, title, task));
62654
+ if (this.options.title) task.on("TITLE", (title) => {
62655
+ this.logger.toStdout(this.serializer.serialize("TITLE", title, task));
62166
62656
  });
62167
- task.on(ListrTaskEventType.MESSAGE, (message2) => {
62657
+ task.on("MESSAGE", (message2) => {
62168
62658
  const parsed = Object.fromEntries(Object.entries(message2).map(([key, value]) => {
62169
62659
  if (this.options.messages.includes(key)) return [key, value];
62170
62660
  }).filter(Boolean));
62171
62661
  if (Object.keys(parsed).length > 0) {
62172
- const output = this.serializer.serialize(ListrTaskEventType.MESSAGE, parsed, task);
62662
+ const output = this.serializer.serialize("MESSAGE", parsed, task);
62173
62663
  if (this.options.messagesToStderr.some((state) => Object.keys(parsed).includes(state))) this.logger.toStderr(output);
62174
62664
  else this.logger.toStdout(output);
62175
62665
  }
@@ -62178,6 +62668,8 @@ var TestRenderer = class TestRenderer2 {
62178
62668
  }
62179
62669
  };
62180
62670
  var VerboseRenderer = class VerboseRenderer2 {
62671
+ tasks;
62672
+ options;
62181
62673
  static nonTTY = true;
62182
62674
  static rendererOptions = {
62183
62675
  logTitleChange: false,
@@ -62223,44 +62715,44 @@ var VerboseRenderer = class VerboseRenderer2 {
62223
62715
  renderer(tasks) {
62224
62716
  tasks.forEach((task) => {
62225
62717
  this.calculate(task);
62226
- task.once(ListrTaskEventType.CLOSED, () => {
62718
+ task.once("CLOSED", () => {
62227
62719
  this.reset(task);
62228
62720
  });
62229
62721
  const rendererOptions = this.cache.rendererOptions.get(task.id);
62230
62722
  const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
62231
- task.on(ListrTaskEventType.SUBTASK, (subtasks) => {
62723
+ task.on("SUBTASK", (subtasks) => {
62232
62724
  this.renderer(subtasks);
62233
62725
  });
62234
- task.on(ListrTaskEventType.STATE, (state) => {
62726
+ task.on("STATE", (state) => {
62235
62727
  if (!task.hasTitle()) return;
62236
- if (state === ListrTaskState.STARTED) this.logger.log(ListrLogLevels.STARTED, task.title);
62237
- else if (state === ListrTaskState.COMPLETED) {
62728
+ if (state === "STARTED") this.logger.log("STARTED", task.title);
62729
+ else if (state === "COMPLETED") {
62238
62730
  const timer = rendererTaskOptions.timer;
62239
- this.logger.log(ListrLogLevels.COMPLETED, task.title, timer && { suffix: {
62731
+ this.logger.log("COMPLETED", task.title, timer && { suffix: {
62240
62732
  ...timer,
62241
62733
  condition: !!task.message?.duration && timer.condition,
62242
62734
  args: [task.message.duration]
62243
62735
  } });
62244
62736
  }
62245
62737
  });
62246
- task.on(ListrTaskEventType.OUTPUT, (data) => {
62247
- this.logger.log(ListrLogLevels.OUTPUT, data);
62738
+ task.on("OUTPUT", (data) => {
62739
+ this.logger.log("OUTPUT", data);
62248
62740
  });
62249
- task.on(ListrTaskEventType.PROMPT, (prompt2) => {
62741
+ task.on("PROMPT", (prompt2) => {
62250
62742
  const cleansed = cleanseAnsi(prompt2);
62251
- if (cleansed) this.logger.log(ListrLogLevels.PROMPT, cleansed);
62743
+ if (cleansed) this.logger.log("PROMPT", cleansed);
62252
62744
  });
62253
- if (this.options?.logTitleChange !== false) task.on(ListrTaskEventType.TITLE, (title) => {
62254
- this.logger.log(ListrLogLevels.TITLE, title);
62745
+ if (this.options?.logTitleChange !== false) task.on("TITLE", (title) => {
62746
+ this.logger.log("TITLE", title);
62255
62747
  });
62256
- task.on(ListrTaskEventType.MESSAGE, (message2) => {
62257
- if (message2?.error) this.logger.log(ListrLogLevels.FAILED, message2.error);
62258
- else if (message2?.skip) this.logger.log(ListrLogLevels.SKIPPED, message2.skip);
62259
- else if (message2?.rollback) this.logger.log(ListrLogLevels.ROLLBACK, message2.rollback);
62260
- else if (message2?.retry) this.logger.log(ListrLogLevels.RETRY, task.title, { suffix: message2.retry.count.toString() });
62748
+ task.on("MESSAGE", (message2) => {
62749
+ if (message2?.error) this.logger.log("FAILED", message2.error);
62750
+ else if (message2?.skip) this.logger.log("SKIPPED", message2.skip);
62751
+ else if (message2?.rollback) this.logger.log("ROLLBACK", message2.rollback);
62752
+ else if (message2?.retry) this.logger.log("RETRY", task.title, { suffix: message2.retry.count.toString() });
62261
62753
  else if (message2?.paused) {
62262
62754
  const timer = rendererOptions?.pausedTimer;
62263
- this.logger.log(ListrLogLevels.PAUSED, task.title, timer && { suffix: {
62755
+ this.logger.log("PAUSED", task.title, timer && { suffix: {
62264
62756
  ...timer,
62265
62757
  condition: !!message2?.paused && timer.condition,
62266
62758
  args: [message2.paused - Date.now()]
@@ -62304,17 +62796,17 @@ function getRendererClass(renderer) {
62304
62796
  function getRenderer(options) {
62305
62797
  if (assertFunctionOrSelf(options?.silentRendererCondition)) return {
62306
62798
  renderer: getRendererClass("silent"),
62307
- selection: ListrRendererSelection.SILENT
62799
+ selection: "SILENT"
62308
62800
  };
62309
62801
  const r = {
62310
62802
  renderer: getRendererClass(options.renderer),
62311
62803
  options: options.rendererOptions,
62312
- selection: ListrRendererSelection.PRIMARY
62804
+ selection: "PRIMARY"
62313
62805
  };
62314
62806
  if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options?.fallbackRendererCondition)) return {
62315
62807
  renderer: getRendererClass(options.fallbackRenderer),
62316
62808
  options: options.fallbackRendererOptions,
62317
- selection: ListrRendererSelection.SECONDARY
62809
+ selection: "SECONDARY"
62318
62810
  };
62319
62811
  return r;
62320
62812
  }
@@ -62368,6 +62860,9 @@ function delay(time) {
62368
62860
  });
62369
62861
  }
62370
62862
  var ListrError = class extends Error {
62863
+ error;
62864
+ type;
62865
+ task;
62371
62866
  path;
62372
62867
  ctx;
62373
62868
  constructor(error, type, task) {
@@ -62389,6 +62884,7 @@ var ListrRendererError = class extends Error {
62389
62884
  var PromptError = class extends Error {
62390
62885
  };
62391
62886
  var TaskWrapper = class {
62887
+ task;
62392
62888
  constructor(task) {
62393
62889
  this.task = task;
62394
62890
  }
@@ -62450,7 +62946,7 @@ var TaskWrapper = class {
62450
62946
  * @see {@link https://listr2.kilic.dev/task/skip.html}
62451
62947
  */
62452
62948
  skip(message2, ...metadata) {
62453
- this.task.state$ = ListrTaskState.SKIPPED;
62949
+ this.task.state$ = "SKIPPED";
62454
62950
  if (message2) this.task.message$ = { skip: message2 ? splat(message2, ...metadata) : this.task?.title };
62455
62951
  }
62456
62952
  /**
@@ -62483,7 +62979,7 @@ var TaskWrapper = class {
62483
62979
  stdout(type) {
62484
62980
  return createWritable((chunk) => {
62485
62981
  switch (type) {
62486
- case ListrTaskEventType.PROMPT:
62982
+ case "PROMPT":
62487
62983
  this.promptOutput = chunk;
62488
62984
  break;
62489
62985
  default:
@@ -62499,10 +62995,15 @@ var TaskWrapper = class {
62499
62995
  var ListrTaskEventManager = class extends EventManager {
62500
62996
  };
62501
62997
  var Task = class extends ListrTaskEventManager {
62998
+ listr;
62999
+ task;
63000
+ options;
63001
+ rendererOptions;
63002
+ rendererTaskOptions;
62502
63003
  /** Unique id per task, can be used for identifying a Task. */
62503
63004
  id = (0, import_crypto2.randomUUID)();
62504
63005
  /** The current state of the task. */
62505
- state = ListrTaskState.WAITING;
63006
+ state = "WAITING";
62506
63007
  /** Subtasks of the current task. */
62507
63008
  subtasks;
62508
63009
  /** Title of the task. */
@@ -62549,26 +63050,26 @@ var Task = class extends ListrTaskEventManager {
62549
63050
  */
62550
63051
  set state$(state) {
62551
63052
  this.state = state;
62552
- this.emit(ListrTaskEventType.STATE, state);
63053
+ this.emit("STATE", state);
62553
63054
  if (this.hasSubtasks() && this.hasFailed()) {
62554
- for (const subtask of this.subtasks) if (subtask.state === ListrTaskState.STARTED) subtask.state$ = ListrTaskState.FAILED;
63055
+ for (const subtask of this.subtasks) if (subtask.state === "STARTED") subtask.state$ = "FAILED";
62555
63056
  }
62556
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63057
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62557
63058
  }
62558
63059
  /**
62559
63060
  * Update the current output of the Task and emit the neccassary events.
62560
63061
  */
62561
63062
  set output$(data) {
62562
63063
  this.output = data;
62563
- this.emit(ListrTaskEventType.OUTPUT, data);
62564
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63064
+ this.emit("OUTPUT", data);
63065
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62565
63066
  }
62566
63067
  /**
62567
63068
  * Update the current prompt output of the Task and emit the neccassary events.
62568
63069
  */
62569
63070
  set promptOutput$(data) {
62570
- this.emit(ListrTaskEventType.PROMPT, data);
62571
- if (cleanseAnsi(data)) this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63071
+ this.emit("PROMPT", data);
63072
+ if (cleanseAnsi(data)) this.listr.events.emit("SHOUD_REFRESH_RENDER");
62572
63073
  }
62573
63074
  /**
62574
63075
  * Update or extend the current message of the Task and emit the neccassary events.
@@ -62578,16 +63079,16 @@ var Task = class extends ListrTaskEventManager {
62578
63079
  ...this.message,
62579
63080
  ...data
62580
63081
  };
62581
- this.emit(ListrTaskEventType.MESSAGE, data);
62582
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63082
+ this.emit("MESSAGE", data);
63083
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62583
63084
  }
62584
63085
  /**
62585
63086
  * Update the current title of the Task and emit the neccassary events.
62586
63087
  */
62587
63088
  set title$(title) {
62588
63089
  this.title = title;
62589
- this.emit(ListrTaskEventType.TITLE, title);
62590
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63090
+ this.emit("TITLE", title);
63091
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62591
63092
  }
62592
63093
  /**
62593
63094
  * Current task path in the hierarchy.
@@ -62599,10 +63100,10 @@ var Task = class extends ListrTaskEventManager {
62599
63100
  * Checks whether the current task with the given context should be set as enabled.
62600
63101
  */
62601
63102
  async check(ctx) {
62602
- if (this.state === ListrTaskState.WAITING) {
63103
+ if (this.state === "WAITING") {
62603
63104
  this.enabled = await assertFunctionOrSelf(this.task?.enabled ?? true, ctx);
62604
- this.emit(ListrTaskEventType.ENABLED, this.enabled);
62605
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63105
+ this.emit("ENABLED", this.enabled);
63106
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62606
63107
  }
62607
63108
  return this.enabled;
62608
63109
  }
@@ -62620,35 +63121,35 @@ var Task = class extends ListrTaskEventManager {
62620
63121
  }
62621
63122
  /** Returns whether this task has started. */
62622
63123
  isStarted() {
62623
- return this.state === ListrTaskState.STARTED;
63124
+ return this.state === "STARTED";
62624
63125
  }
62625
63126
  /** Returns whether this task is skipped. */
62626
63127
  isSkipped() {
62627
- return this.state === ListrTaskState.SKIPPED;
63128
+ return this.state === "SKIPPED";
62628
63129
  }
62629
63130
  /** Returns whether this task has been completed. */
62630
63131
  isCompleted() {
62631
- return this.state === ListrTaskState.COMPLETED;
63132
+ return this.state === "COMPLETED";
62632
63133
  }
62633
63134
  /** Returns whether this task has been failed. */
62634
63135
  hasFailed() {
62635
- return this.state === ListrTaskState.FAILED;
63136
+ return this.state === "FAILED";
62636
63137
  }
62637
63138
  /** Returns whether this task has an active rollback task going on. */
62638
63139
  isRollingBack() {
62639
- return this.state === ListrTaskState.ROLLING_BACK;
63140
+ return this.state === "ROLLING_BACK";
62640
63141
  }
62641
63142
  /** Returns whether the rollback action was successful. */
62642
63143
  hasRolledBack() {
62643
- return this.state === ListrTaskState.ROLLED_BACK;
63144
+ return this.state === "ROLLED_BACK";
62644
63145
  }
62645
63146
  /** Returns whether this task has an actively retrying task going on. */
62646
63147
  isRetrying() {
62647
- return this.state === ListrTaskState.RETRY;
63148
+ return this.state === "RETRY";
62648
63149
  }
62649
63150
  /** Returns whether this task has some kind of reset like retry and rollback going on. */
62650
63151
  hasReset() {
62651
- return this.state === ListrTaskState.RETRY || this.state === ListrTaskState.ROLLING_BACK;
63152
+ return this.state === "RETRY" || this.state === "ROLLING_BACK";
62652
63153
  }
62653
63154
  /** Returns whether enabled function resolves to true. */
62654
63155
  isEnabled() {
@@ -62660,11 +63161,11 @@ var Task = class extends ListrTaskEventManager {
62660
63161
  }
62661
63162
  /** Returns whether this task has a prompt inside. */
62662
63163
  isPrompt() {
62663
- return this.state === ListrTaskState.PROMPT;
63164
+ return this.state === "PROMPT";
62664
63165
  }
62665
63166
  /** Returns whether this task is currently paused. */
62666
63167
  isPaused() {
62667
- return this.state === ListrTaskState.PAUSED;
63168
+ return this.state === "PAUSED";
62668
63169
  }
62669
63170
  /** Returns whether this task is closed. */
62670
63171
  isClosed() {
@@ -62673,7 +63174,7 @@ var Task = class extends ListrTaskEventManager {
62673
63174
  /** Pause the given task for certain time. */
62674
63175
  async pause(time) {
62675
63176
  const state = this.state;
62676
- this.state$ = ListrTaskState.PAUSED;
63177
+ this.state$ = "PAUSED";
62677
63178
  this.message$ = { paused: Date.now() + time };
62678
63179
  await delay(time);
62679
63180
  this.state$ = state;
@@ -62690,7 +63191,7 @@ var Task = class extends ListrTaskEventManager {
62690
63191
  result.rendererClass = getRendererClass("silent");
62691
63192
  this.subtasks = result.tasks;
62692
63193
  result.errors = this.listr.errors;
62693
- this.emit(ListrTaskEventType.SUBTASK, this.subtasks);
63194
+ this.emit("SUBTASK", this.subtasks);
62694
63195
  result = result.run(context);
62695
63196
  } else if (result instanceof Promise) result = result.then(handleResult);
62696
63197
  else if (isReadable(result)) result = new Promise((resolve2, reject) => {
@@ -62712,13 +63213,13 @@ var Task = class extends ListrTaskEventManager {
62712
63213
  return result;
62713
63214
  };
62714
63215
  const startTime = Date.now();
62715
- this.state$ = ListrTaskState.STARTED;
63216
+ this.state$ = "STARTED";
62716
63217
  const skipped = await assertFunctionOrSelf(this.task?.skip ?? false, context);
62717
63218
  if (skipped) {
62718
63219
  if (typeof skipped === "string") this.message$ = { skip: skipped };
62719
63220
  else if (this.hasTitle()) this.message$ = { skip: this.title };
62720
63221
  else this.message$ = { skip: "Skipped task without a title." };
62721
- this.state$ = ListrTaskState.SKIPPED;
63222
+ this.state$ = "SKIPPED";
62722
63223
  return;
62723
63224
  }
62724
63225
  try {
@@ -62736,27 +63237,27 @@ var Task = class extends ListrTaskEventManager {
62736
63237
  this.message$ = { retry: this.retry };
62737
63238
  this.title$ = this.initialTitle;
62738
63239
  this.output = void 0;
62739
- wrapper.report(err, ListrErrorTypes.WILL_RETRY);
62740
- this.state$ = ListrTaskState.RETRY;
63240
+ wrapper.report(err, "WILL_RETRY");
63241
+ this.state$ = "RETRY";
62741
63242
  if (retryDelay) await this.pause(retryDelay);
62742
63243
  } else throw err;
62743
63244
  }
62744
63245
  if (this.isStarted() || this.isRetrying()) {
62745
63246
  this.message$ = { duration: Date.now() - startTime };
62746
- this.state$ = ListrTaskState.COMPLETED;
63247
+ this.state$ = "COMPLETED";
62747
63248
  }
62748
63249
  } catch (error) {
62749
63250
  if (this.prompt instanceof PromptError) error = this.prompt;
62750
63251
  if (this.task?.rollback) {
62751
- wrapper.report(error, ListrErrorTypes.WILL_ROLLBACK);
63252
+ wrapper.report(error, "WILL_ROLLBACK");
62752
63253
  try {
62753
- this.state$ = ListrTaskState.ROLLING_BACK;
63254
+ this.state$ = "ROLLING_BACK";
62754
63255
  await this.task.rollback(context, wrapper);
62755
63256
  this.message$ = { rollback: this.title };
62756
- this.state$ = ListrTaskState.ROLLED_BACK;
63257
+ this.state$ = "ROLLED_BACK";
62757
63258
  } catch (err) {
62758
- this.state$ = ListrTaskState.FAILED;
62759
- wrapper.report(err, ListrErrorTypes.HAS_FAILED_TO_ROLLBACK);
63259
+ this.state$ = "FAILED";
63260
+ wrapper.report(err, "HAS_FAILED_TO_ROLLBACK");
62760
63261
  this.close();
62761
63262
  throw err;
62762
63263
  }
@@ -62765,26 +63266,29 @@ var Task = class extends ListrTaskEventManager {
62765
63266
  throw error;
62766
63267
  }
62767
63268
  } else {
62768
- this.state$ = ListrTaskState.FAILED;
63269
+ this.state$ = "FAILED";
62769
63270
  if (this.listr.options.exitOnError !== false && await assertFunctionOrSelf(this.task?.exitOnError, context) !== false) {
62770
- wrapper.report(error, ListrErrorTypes.HAS_FAILED);
63271
+ wrapper.report(error, "HAS_FAILED");
62771
63272
  this.close();
62772
63273
  throw error;
62773
- } else if (!this.hasSubtasks()) wrapper.report(error, ListrErrorTypes.HAS_FAILED_WITHOUT_ERROR);
63274
+ } else if (!this.hasSubtasks()) wrapper.report(error, "HAS_FAILED_WITHOUT_ERROR");
62774
63275
  }
62775
63276
  } finally {
62776
63277
  this.close();
62777
63278
  }
62778
63279
  }
62779
63280
  close() {
62780
- this.emit(ListrTaskEventType.CLOSED);
62781
- this.listr.events.emit(ListrEventType.SHOULD_REFRESH_RENDER);
63281
+ this.emit("CLOSED");
63282
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
62782
63283
  this.complete();
62783
63284
  }
62784
63285
  };
62785
63286
  var ListrEventManager = class extends EventManager {
62786
63287
  };
62787
63288
  var Listr = class {
63289
+ task;
63290
+ options;
63291
+ parentTask;
62788
63292
  tasks = [];
62789
63293
  errors = [];
62790
63294
  ctx;
@@ -62820,11 +63324,11 @@ var Listr = class {
62820
63324
  }
62821
63325
  if (this.parentTask?.listr.events instanceof ListrEventManager) this.events = this.parentTask.listr.events;
62822
63326
  else this.events = new ListrEventManager();
62823
- if (this.options?.forceTTY || process.env[ListrEnvironmentVariables.FORCE_TTY]) {
63327
+ if (this.options?.forceTTY || process.env["LISTR_FORCE_TTY"]) {
62824
63328
  process.stdout.isTTY = true;
62825
63329
  process.stderr.isTTY = true;
62826
63330
  }
62827
- if (this.options?.forceUnicode) process.env[ListrEnvironmentVariables.FORCE_UNICODE] = "1";
63331
+ if (this.options?.forceUnicode) process.env["LISTR_FORCE_UNICODE"] = "1";
62828
63332
  const renderer = getRenderer({
62829
63333
  renderer: this.options.renderer,
62830
63334
  rendererOptions: this.options.rendererOptions,
@@ -62889,8 +63393,8 @@ var Listr = class {
62889
63393
  tasks = Array.isArray(tasks) ? tasks : [tasks];
62890
63394
  return tasks.map((task) => {
62891
63395
  let rendererTaskOptions;
62892
- if (this.rendererSelection === ListrRendererSelection.PRIMARY) rendererTaskOptions = task.rendererOptions;
62893
- else if (this.rendererSelection === ListrRendererSelection.SECONDARY) rendererTaskOptions = task.fallbackRendererOptions;
63396
+ if (this.rendererSelection === "PRIMARY") rendererTaskOptions = task.rendererOptions;
63397
+ else if (this.rendererSelection === "SECONDARY") rendererTaskOptions = task.fallbackRendererOptions;
62894
63398
  return new Task(this, task, this.options, this.rendererClassOptions, rendererTaskOptions);
62895
63399
  });
62896
63400
  }
@@ -62900,7 +63404,7 @@ var Listr = class {
62900
63404
  }
62901
63405
  signalHandler() {
62902
63406
  this.tasks?.forEach(async (task) => {
62903
- if (task.isPending()) task.state$ = ListrTaskState.FAILED;
63407
+ if (task.isPending()) task.state$ = "FAILED";
62904
63408
  });
62905
63409
  if (this.isRoot()) {
62906
63410
  this.renderer?.end(/* @__PURE__ */ new Error("Interrupted."));
@@ -62913,7 +63417,7 @@ var Listr = class {
62913
63417
  };
62914
63418
 
62915
63419
  // packages/kong-cli/src/commands/installCommand.ts
62916
- var import_path4 = __toESM(require("path"));
63420
+ var import_path5 = __toESM(require("path"));
62917
63421
 
62918
63422
  // packages/kong-cli/src/common/listrTaskLogger.ts
62919
63423
  var ListrTaskLogger = class {
@@ -62969,165 +63473,9 @@ var InstallCommand = class {
62969
63473
  scriptPath() {
62970
63474
  const scriptName = "python-install";
62971
63475
  if (process.platform === "win32") {
62972
- return import_path4.default.join(__dirname, "assets", `${scriptName}.bat`);
63476
+ return import_path5.default.join(__dirname, "assets", `${scriptName}.bat`);
62973
63477
  }
62974
- return import_path4.default.join(__dirname, "assets", `${scriptName}.sh`);
62975
- }
62976
- };
62977
-
62978
- // packages/kong-cli/src/services/api.ts
62979
- var import_keyring2 = __toESM(require_keyring());
62980
-
62981
- // node_modules/jwt-decode/build/esm/index.js
62982
- var InvalidTokenError = class extends Error {
62983
- };
62984
- InvalidTokenError.prototype.name = "InvalidTokenError";
62985
- function b64DecodeUnicode(str) {
62986
- return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
62987
- let code = p.charCodeAt(0).toString(16).toUpperCase();
62988
- if (code.length < 2) {
62989
- code = "0" + code;
62990
- }
62991
- return "%" + code;
62992
- }));
62993
- }
62994
- function base64UrlDecode(str) {
62995
- let output = str.replace(/-/g, "+").replace(/_/g, "/");
62996
- switch (output.length % 4) {
62997
- case 0:
62998
- break;
62999
- case 2:
63000
- output += "==";
63001
- break;
63002
- case 3:
63003
- output += "=";
63004
- break;
63005
- default:
63006
- throw new Error("base64 string is not of the correct length");
63007
- }
63008
- try {
63009
- return b64DecodeUnicode(output);
63010
- } catch (err) {
63011
- return atob(output);
63012
- }
63013
- }
63014
- function jwtDecode(token, options) {
63015
- if (typeof token !== "string") {
63016
- throw new InvalidTokenError("Invalid token specified: must be a string");
63017
- }
63018
- options || (options = {});
63019
- const pos = options.header === true ? 0 : 1;
63020
- const part = token.split(".")[pos];
63021
- if (typeof part !== "string") {
63022
- throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
63023
- }
63024
- let decoded;
63025
- try {
63026
- decoded = base64UrlDecode(part);
63027
- } catch (e) {
63028
- throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
63029
- }
63030
- try {
63031
- return JSON.parse(decoded);
63032
- } catch (e) {
63033
- throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
63034
- }
63035
- }
63036
-
63037
- // packages/kong-cli/src/services/api.ts
63038
- function requestConfigProvider(profile) {
63039
- const cached = {
63040
- headers: {
63041
- "Content-Type": "application/json",
63042
- "X-App-Tenant": parseTenant(profile.kongBaseUrl)
63043
- }
63044
- };
63045
- return async () => {
63046
- if (cached.headers?.Authorization) {
63047
- try {
63048
- const auth = cached.headers.Authorization;
63049
- const accessToken = auth.split("Bearer ")[1]?.trim();
63050
- if (accessToken) {
63051
- const decoded = jwtDecode(accessToken);
63052
- if (decoded.exp !== void 0) {
63053
- const nowSeconds = Date.now() / 1e3;
63054
- if (decoded.exp > nowSeconds + 60) {
63055
- return cached;
63056
- }
63057
- }
63058
- }
63059
- } catch (ex) {
63060
- console.warn("failed to use cached token, fetching new one", ex);
63061
- }
63062
- }
63063
- const url2 = joinUrlAndPath(
63064
- profile.kongBaseUrl,
63065
- "api/keycloak/realms/kong/protocol/openid-connect/token"
63066
- );
63067
- const entry = new import_keyring2.Entry(profile.kongBaseUrl, profile.userName);
63068
- const password = entry.getPassword();
63069
- if (!password) {
63070
- throw new Error("No password found in keyring for user: " + profile.userName);
63071
- }
63072
- const params = new URLSearchParams({
63073
- grant_type: "password",
63074
- client_id: "kong-web",
63075
- username: profile.userName,
63076
- password
63077
- });
63078
- const response = await axios_default.post(url2, params, {
63079
- headers: {
63080
- "Content-Type": "application/x-www-form-urlencoded"
63081
- }
63082
- });
63083
- cached.headers = {
63084
- ...cached.headers,
63085
- ["Authorization"]: `Bearer ${response.data.access_token}`
63086
- };
63087
- return cached;
63088
- };
63089
- }
63090
-
63091
- // packages/kong-cli/src/services/managementClient.ts
63092
- var ManagementClient = class {
63093
- constructor(kongBaseUrl, requestConfigProvider2) {
63094
- this.requestConfigProvider = requestConfigProvider2;
63095
- this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/management");
63096
- }
63097
- async updateExtension(extension) {
63098
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
63099
- await axios_default.put(url2, extension, await this.requestConfigProvider());
63100
- }
63101
- async createExtensionSnapshot(extensionId, snapshot) {
63102
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
63103
- await axios_default.post(url2, snapshot, await this.requestConfigProvider());
63104
- }
63105
- async getExtensionSnapshot(extensionId, extensionSnapshotVersion) {
63106
- const url2 = joinUrlAndPath(
63107
- this.baseUrl,
63108
- "v1/extensions",
63109
- extensionId,
63110
- "snapshots",
63111
- extensionSnapshotVersion
63112
- );
63113
- return (await axios_default.get(url2, await this.requestConfigProvider())).data;
63114
- }
63115
- async getExtensionSnapshotVersions(extensionId) {
63116
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
63117
- return (await axios_default.get(url2, await this.requestConfigProvider())).data;
63118
- }
63119
- async getExtensionSnapshotAliases(extensionId) {
63120
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
63121
- return (await axios_default.get(url2, await this.requestConfigProvider())).data;
63122
- }
63123
- async getAuditLog(objectType2, objectId, createdAfter) {
63124
- const url2 = joinUrlAndPath(this.baseUrl, "v1/audit");
63125
- const config = await this.requestConfigProvider();
63126
- const response = await axios_default.get(url2, {
63127
- ...config,
63128
- params: { ...config.params, objectType: objectType2, objectId, createdAfter }
63129
- });
63130
- return response.data;
63478
+ return import_path5.default.join(__dirname, "assets", `${scriptName}.sh`);
63131
63479
  }
63132
63480
  };
63133
63481
 
@@ -63141,14 +63489,13 @@ var ListAliasesCommand = class {
63141
63489
  requestConfigProvider(profile)
63142
63490
  );
63143
63491
  }
63144
- async execute() {
63492
+ async execute(processId) {
63145
63493
  await new Listr(
63146
63494
  [
63147
63495
  {
63148
- title: "list extension aliases",
63496
+ title: processId ? `list process aliases (${processId})` : "list extension aliases",
63149
63497
  task: async (ctx, task) => {
63150
- const kongJson = getKongJson();
63151
- const aliases = await this.managementClient.getExtensionSnapshotAliases(kongJson.id);
63498
+ const aliases = processId ? await this.managementClient.getProcessAliases(processId) : await this.managementClient.getExtensionSnapshotAliases(getKongJson().id);
63152
63499
  if (aliases.length === 0) {
63153
63500
  task.output = "no aliases available";
63154
63501
  } else {
@@ -63189,14 +63536,15 @@ var ListVersionsCommand = class {
63189
63536
  requestConfigProvider(profile)
63190
63537
  );
63191
63538
  }
63192
- async execute() {
63539
+ async execute(processId) {
63193
63540
  await new Listr(
63194
63541
  [
63195
63542
  {
63196
- title: "list extension snapshot versions",
63543
+ title: processId ? `list process snapshot versions (${processId})` : "list extension snapshot versions",
63197
63544
  task: async (ctx, task) => {
63198
- const kongJson = getKongJson();
63199
- const versions = await this.managementClient.getExtensionSnapshotVersions(kongJson.id);
63545
+ const versions = processId ? await this.managementClient.getDocumentSnapshotVersions(
63546
+ processId
63547
+ ) : await this.managementClient.getExtensionSnapshotVersions(getKongJson().id);
63200
63548
  if (versions.length === 0) {
63201
63549
  task.output = "no versions available";
63202
63550
  } else {
@@ -63227,7 +63575,7 @@ var ListVersionsCommand = class {
63227
63575
  };
63228
63576
 
63229
63577
  // packages/kong-cli/src/commands/publishVersionCommand.ts
63230
- var import_child_process2 = require("child_process");
63578
+ var import_child_process3 = require("child_process");
63231
63579
 
63232
63580
  // packages/kong-cli/src/common/extensionContract.ts
63233
63581
  var import__ = __toESM(require__());
@@ -63243,18 +63591,6 @@ function getExtensionContract(filePath) {
63243
63591
  return contract;
63244
63592
  }
63245
63593
 
63246
- // packages/kong-cli/src/services/registryClient.ts
63247
- var RegistryClient = class {
63248
- constructor(kongBaseUrl, requestConfigProvider2) {
63249
- this.requestConfigProvider = requestConfigProvider2;
63250
- this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/registry");
63251
- }
63252
- async getPublishDetails(appName) {
63253
- const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
63254
- return (await axios_default.post(url2, {}, await this.requestConfigProvider())).data;
63255
- }
63256
- };
63257
-
63258
63594
  // packages/kong-cli/src/commands/publishVersionCommand.ts
63259
63595
  var PublishVersionCommand = class {
63260
63596
  constructor(profile, verbose = false, contractPath = null) {
@@ -63269,7 +63605,7 @@ var PublishVersionCommand = class {
63269
63605
  const clientRequestConfigProvider = requestConfigProvider(profile);
63270
63606
  this.registryClient = new RegistryClient(profile.kongBaseUrl, clientRequestConfigProvider);
63271
63607
  this.managementClient = new ManagementClient(profile.kongBaseUrl, clientRequestConfigProvider);
63272
- const dockerVersion = (0, import_child_process2.spawnSync)("docker", ["--version"]);
63608
+ const dockerVersion = (0, import_child_process3.spawnSync)("docker", ["--version"]);
63273
63609
  this.hasDocker = !dockerVersion.error;
63274
63610
  }
63275
63611
  get wslPrefix() {
@@ -63419,6 +63755,8 @@ var PublishVersionCommand = class {
63419
63755
  name: kongJson.name,
63420
63756
  category: kongJson.category,
63421
63757
  deprecated: false,
63758
+ origin: "cli",
63759
+ checkpoint: void 0,
63422
63760
  createdBy: "",
63423
63761
  created: utcNow(DEFAULT_TIMEZONE),
63424
63762
  updated: utcNow(DEFAULT_TIMEZONE),
@@ -63604,13 +63942,13 @@ function parseVersionWeightList(list) {
63604
63942
  }
63605
63943
  return uses;
63606
63944
  }
63607
- var DEPLOY_STEPS = [
63945
+ var DEPLOY_STEPS2 = [
63608
63946
  "create deployment",
63609
63947
  "save deployment details",
63610
63948
  "deployment completed"
63611
63949
  ];
63612
63950
  function createDeploySteps() {
63613
- return DEPLOY_STEPS.map((action) => {
63951
+ return DEPLOY_STEPS2.map((action) => {
63614
63952
  const handlers = {
63615
63953
  resolve: () => void 0,
63616
63954
  reject: () => void 0
@@ -63744,18 +64082,18 @@ var SetAliasCommand = class {
63744
64082
  };
63745
64083
 
63746
64084
  // packages/kong-cli/src/common/cli.ts
63747
- var import_fs4 = __toESM(require("fs"));
63748
- var import_path5 = __toESM(require("path"));
64085
+ var import_fs5 = __toESM(require("fs"));
64086
+ var import_path6 = __toESM(require("path"));
63749
64087
  function getPresetVersion() {
63750
- const packageJsonPath = import_path5.default.join(__dirname, "package.json");
63751
- if (!import_fs4.default.existsSync(packageJsonPath)) {
64088
+ const packageJsonPath = import_path6.default.join(__dirname, "package.json");
64089
+ if (!import_fs5.default.existsSync(packageJsonPath)) {
63752
64090
  throw new AppError(`package.json file was not found at path: ${packageJsonPath}`);
63753
64091
  }
63754
64092
  return require(packageJsonPath).version;
63755
64093
  }
63756
64094
 
63757
64095
  // packages/kong-cli/src/index.ts
63758
- import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_path6.default.join(__dirname, ".env"), quiet: true }));
64096
+ import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_path7.default.join(__dirname, ".env"), quiet: true }));
63759
64097
  async function main() {
63760
64098
  const generateCommand = new Command("generate").description("Generate new extension").argument("name", "Extension name").addOption(
63761
64099
  new Option("--sdk <name>", "Target sdk platform for extension").choices(["python", "kotlin"]).default("python")
@@ -63773,13 +64111,23 @@ async function main() {
63773
64111
  printError("generate command failed", ex);
63774
64112
  }
63775
64113
  });
64114
+ const connectCommand = new Command("connect").description(
64115
+ "Start the local helper server the Kong UI uses to run extension tests and build snapshot images on this machine"
64116
+ ).addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).action(async (options) => {
64117
+ try {
64118
+ printProfile(options.profile);
64119
+ await new ConnectCommand(options.profile, getProfile(options.profile)).execute();
64120
+ } catch (ex) {
64121
+ printError("connect command failed", ex);
64122
+ }
64123
+ });
63776
64124
  const configureCommand = new Command("configure").description("Configure access to kong environments").action(async () => {
63777
64125
  await new ConfigureCommand().execute();
63778
64126
  });
63779
64127
  const installCommand = new Command("install").description("Setup virtual environment and install dependencies").addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
63780
64128
  try {
63781
64129
  const kongJsonPath = resolveProjectPath("kong.json");
63782
- const projectRoot = import_path6.default.dirname(kongJsonPath);
64130
+ const projectRoot = import_path7.default.dirname(kongJsonPath);
63783
64131
  await new InstallCommand(options.verbose).execute(projectRoot);
63784
64132
  } catch (ex) {
63785
64133
  printError("install command failed", ex);
@@ -63801,10 +64149,17 @@ async function main() {
63801
64149
  printError("publish-version command failed", ex);
63802
64150
  }
63803
64151
  });
63804
- const listVersionsCommand = new Command("list-versions").description("List available versions").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
64152
+ const listVersionsCommand = new Command("list-versions").description("List available versions").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(
64153
+ new Option(
64154
+ "--process <documentId>",
64155
+ "List a workflow (process) document's snapshot versions instead of the current extension's (no kong.json needed)"
64156
+ )
64157
+ ).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
63805
64158
  try {
63806
64159
  printProfile(options.profile);
63807
- await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute();
64160
+ await new ListVersionsCommand(getProfile(options.profile), options.verbose).execute(
64161
+ options.process
64162
+ );
63808
64163
  } catch (ex) {
63809
64164
  printError("list-versions command failed", ex);
63810
64165
  }
@@ -63829,16 +64184,24 @@ async function main() {
63829
64184
  printError("set-alias command failed", ex);
63830
64185
  }
63831
64186
  });
63832
- const listAliasesCommand = new Command("list-aliases").description("List available extension aliases").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).action(async (options) => {
64187
+ const listAliasesCommand = new Command("list-aliases").description("List available extension aliases").addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(
64188
+ new Option(
64189
+ "--process <documentId>",
64190
+ "List a workflow (process) document's aliases instead of the current extension's (no kong.json needed)"
64191
+ )
64192
+ ).action(async (options) => {
63833
64193
  try {
63834
64194
  printProfile(options.profile);
63835
- await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute();
64195
+ await new ListAliasesCommand(getProfile(options.profile), options.verbose).execute(
64196
+ options.process
64197
+ );
63836
64198
  } catch (ex) {
63837
64199
  printError("list-aliases command failed", ex);
63838
64200
  }
63839
64201
  });
63840
64202
  const cli = new Command().version(getPresetVersion()).description("CLI to support creating and publishing Kong extensions");
63841
64203
  cli.addCommand(generateCommand);
64204
+ cli.addCommand(connectCommand);
63842
64205
  cli.addCommand(configureCommand);
63843
64206
  cli.addCommand(installCommand);
63844
64207
  cli.addCommand(publishVersionCommand);