@atlashub/smartstack-cli 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -117947,6 +117947,7 @@ var openPattern = /\\{/g;
117947
117947
  var closePattern = /\\}/g;
117948
117948
  var commaPattern = /\\,/g;
117949
117949
  var periodPattern = /\\./g;
117950
+ var EXPANSION_MAX = 1e5;
117950
117951
  function numeric(str) {
117951
117952
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
117952
117953
  }
@@ -117977,14 +117978,15 @@ function parseCommaParts(str) {
117977
117978
  parts.push.apply(parts, p);
117978
117979
  return parts;
117979
117980
  }
117980
- function expand(str) {
117981
+ function expand(str, options = {}) {
117981
117982
  if (!str) {
117982
117983
  return [];
117983
117984
  }
117985
+ const { max = EXPANSION_MAX } = options;
117984
117986
  if (str.slice(0, 2) === "{}") {
117985
117987
  str = "\\{\\}" + str.slice(2);
117986
117988
  }
117987
- return expand_(escapeBraces(str), true).map(unescapeBraces);
117989
+ return expand_(escapeBraces(str), max, true).map(unescapeBraces);
117988
117990
  }
117989
117991
  function embrace(str) {
117990
117992
  return "{" + str + "}";
@@ -117998,15 +118000,15 @@ function lte(i, y) {
117998
118000
  function gte(i, y) {
117999
118001
  return i >= y;
118000
118002
  }
118001
- function expand_(str, isTop) {
118003
+ function expand_(str, max, isTop) {
118002
118004
  const expansions = [];
118003
118005
  const m = balanced("{", "}", str);
118004
118006
  if (!m)
118005
118007
  return [str];
118006
118008
  const pre = m.pre;
118007
- const post = m.post.length ? expand_(m.post, false) : [""];
118009
+ const post = m.post.length ? expand_(m.post, max, false) : [""];
118008
118010
  if (/\$$/.test(m.pre)) {
118009
- for (let k = 0; k < post.length; k++) {
118011
+ for (let k = 0; k < post.length && k < max; k++) {
118010
118012
  const expansion = pre + "{" + m.body + "}" + post[k];
118011
118013
  expansions.push(expansion);
118012
118014
  }
@@ -118018,7 +118020,7 @@ function expand_(str, isTop) {
118018
118020
  if (!isSequence && !isOptions) {
118019
118021
  if (m.post.match(/,(?!,).*\}/)) {
118020
118022
  str = m.pre + "{" + m.body + escClose + m.post;
118021
- return expand_(str);
118023
+ return expand_(str, max, true);
118022
118024
  }
118023
118025
  return [str];
118024
118026
  }
@@ -118028,7 +118030,7 @@ function expand_(str, isTop) {
118028
118030
  } else {
118029
118031
  n = parseCommaParts(m.body);
118030
118032
  if (n.length === 1 && n[0] !== void 0) {
118031
- n = expand_(n[0], false).map(embrace);
118033
+ n = expand_(n[0], max, false).map(embrace);
118032
118034
  if (n.length === 1) {
118033
118035
  return post.map((p) => m.pre + n[0] + p);
118034
118036
  }
@@ -118074,11 +118076,11 @@ function expand_(str, isTop) {
118074
118076
  } else {
118075
118077
  N = [];
118076
118078
  for (let j = 0; j < n.length; j++) {
118077
- N.push.apply(N, expand_(n[j], false));
118079
+ N.push.apply(N, expand_(n[j], max, false));
118078
118080
  }
118079
118081
  }
118080
118082
  for (let j = 0; j < N.length; j++) {
118081
- for (let k = 0; k < post.length; k++) {
118083
+ for (let k = 0; k < post.length && expansions.length < max; k++) {
118082
118084
  const expansion = pre + N[j] + post[k];
118083
118085
  if (!isTop || isSequence || expansion) {
118084
118086
  expansions.push(expansion);
@@ -125907,7 +125909,7 @@ function executeSqlCmd(server, database, query, sqlAuth) {
125907
125909
  const sqlServer = server === "(local)" ? "." : server;
125908
125910
  const authFlag = sqlAuth ? `-U "${sqlAuth.user}" -P "${sqlAuth.password}"` : "-E";
125909
125911
  const cmd = `sqlcmd -S "${sqlServer}" -d "${database}" ${authFlag} -I -C -Q "${query.replace(/"/g, '\\"')}" -h -1 -W`;
125910
- return (0, import_child_process8.execSync)(cmd, { encoding: "utf-8" }).trim();
125912
+ return (0, import_child_process8.execSync)(cmd, { encoding: "utf-8", timeout: 15e3 }).trim();
125911
125913
  }
125912
125914
  function isLoginFailure(error) {
125913
125915
  const msg = error instanceof Error ? error.message : String(error);
@@ -126120,8 +126122,9 @@ adminCommand.command("reset").description("Reset the localAdmin account password
126120
126122
  if (nativeDriver) {
126121
126123
  try {
126122
126124
  spinner.text = "Connecting with Windows Authentication...";
126125
+ const nativeServer = connInfo.server === "(local)" ? "localhost" : connInfo.server;
126123
126126
  const nativeConfig = {
126124
- server: connInfo.server,
126127
+ server: nativeServer,
126125
126128
  database: connInfo.database,
126126
126129
  options: {
126127
126130
  trustedConnection: true,
@@ -126130,7 +126133,12 @@ adminCommand.command("reset").description("Reset the localAdmin account password
126130
126133
  connectionTimeout: 15e3,
126131
126134
  requestTimeout: 15e3
126132
126135
  };
126133
- await nativeDriver.connect(nativeConfig);
126136
+ await Promise.race([
126137
+ nativeDriver.connect(nativeConfig),
126138
+ new Promise(
126139
+ (_3, reject) => setTimeout(() => reject(new Error("Connection timeout (15s)")), 15e3)
126140
+ )
126141
+ ]);
126134
126142
  nativeConnected = true;
126135
126143
  await resetViaMssql(nativeDriver);
126136
126144
  } catch (nativeError) {