@zerothreatai/cli 6.0.5 → 6.0.6

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.
@@ -92,12 +92,14 @@ async function firstIgnition(licenseKey, emailId) {
92
92
  await ensureNetwork();
93
93
  await pullImages();
94
94
  await runCompose(["up", "-d"]);
95
- //sleep for 30 seconds to allow sql server to start
96
- console.log("Waiting for SQL Server to start...");
95
+ //Wait for 10 minutes to allow sql server to start
96
+ const sqlContainerWaitSpinner = (0, ora_1.default)('Waiting for SQL Server to start...').start();
97
97
  const SqlSuccess = await checkSqlSuccess();
98
98
  if (!SqlSuccess) {
99
- throw new Error("Unable to complete database setup. Please try again later.");
99
+ sqlContainerWaitSpinner.fail("Unable to complete database setup.");
100
+ throw new Error("Please try again later.");
100
101
  }
102
+ sqlContainerWaitSpinner.succeed("connected to database.");
101
103
  }
102
104
  catch (error) {
103
105
  if (spinner.isSpinning)
@@ -180,12 +182,14 @@ async function updateSystemService() {
180
182
  await ensureNetwork();
181
183
  await pullImages();
182
184
  await runCompose(["up", "-d"]);
183
- //sleep for 30 seconds to allow sql server to start
184
- console.log("Waiting for SQL Server to start...");
185
+ //Wait for 10 minutes to allow sql server to start
186
+ const sqlContainerWaitSpinner = (0, ora_1.default)('Waiting for SQL Server to start...').start();
185
187
  const SqlSuccess = await checkSqlSuccess();
186
188
  if (!SqlSuccess) {
189
+ sqlContainerWaitSpinner.fail("Unable to complete database setup.");
187
190
  throw new Error("Unable to complete database setup. Please try again later.");
188
191
  }
192
+ sqlContainerWaitSpinner.succeed("connected to database.");
189
193
  }
190
194
  catch (error) {
191
195
  if (spinner.isSpinning)
@@ -40,7 +40,7 @@ async function cleanupContainersFromCompose(composeFilePath) {
40
40
  async function runCompose() {
41
41
  await cleanupContainersFromCompose(app_constants_1.dockerComposeAcr);
42
42
  return new Promise((resolve, reject) => {
43
- const child = (0, child_process_2.spawn)("docker", ["compose", "-f", app_constants_1.dockerComposeAcr, "up", "-d"], {
43
+ const child = (0, child_process_2.spawn)("docker", ["compose", "-f", app_constants_1.dockerComposeAcr, "-p", PROJECT, "up", "-d"], {
44
44
  stdio: ["ignore", "ignore", "pipe"],
45
45
  });
46
46
  child.on("close", code => (code === 0 ? resolve() : reject(new Error("compose failed"))));
@@ -98,14 +98,13 @@ async function restartService() {
98
98
  return;
99
99
  }
100
100
  // Up the docker images
101
+ const TIMEOUT_MS = 2 * 60 * 1000;
102
+ const containerTimeout = setTimeout(() => {
103
+ throw new Error('TIMEOUT: Taking more time to restart, Please try again later');
104
+ }, TIMEOUT_MS);
101
105
  try {
102
- const TIMEOUT_MS = 2 * 60 * 1000;
103
- const containerTimeout = setTimeout(() => {
104
- throw new Error('TIMEOUT: Taking more time to restart, Please try again later');
105
- }, TIMEOUT_MS);
106
106
  dockerUpSpinner.start();
107
107
  await runCompose();
108
- clearTimeout(containerTimeout);
109
108
  dockerUpSpinner.succeed('Containers are up and running. 🐳🚀');
110
109
  console.log(chalk_1.default.gray('➤ You can now continue using ZeroThreat on this url : '));
111
110
  console.log(chalk_1.default.bold.blue('http://localhost:3203'));
@@ -116,6 +115,7 @@ async function restartService() {
116
115
  console.log(chalk_1.default.red(error));
117
116
  }
118
117
  finally {
118
+ clearTimeout(containerTimeout);
119
119
  if (app_constants_1.dockerComposeAcr) {
120
120
  const tempDir = path_1.default.dirname(app_constants_1.dockerComposeAcr);
121
121
  fs_1.default.rmSync(tempDir, { recursive: true, force: true });
@@ -24,10 +24,11 @@ const completeProcess = async () => {
24
24
  return;
25
25
  };
26
26
  async function updateSystem() {
27
- console.log(chalk_1.default.greenBright("\nUpdating Zero Threat...\n"));
27
+ console.log(chalk_1.default.greenBright("\nUpdating ZeroThreat...\n"));
28
28
  try {
29
29
  await (0, license_service_1.updateSystemService)();
30
30
  await completeProcess();
31
+ console.log(chalk_1.default.greenBright("\nZeroThreat updated successfully.\n"));
31
32
  }
32
33
  catch (err) {
33
34
  if (err instanceof acr_error_1.default) {
@@ -22,7 +22,8 @@ function displayLicenseTable(response) {
22
22
  0: 'Free Credit Universal',
23
23
  1: 'Free Credit Hostname',
24
24
  2: 'Paid Credit',
25
- 3: 'Subscription'
25
+ 3: 'Subscription',
26
+ 5: 'Promotional Credit',
26
27
  };
27
28
  return map[type] || '❓ Unknown';
28
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerothreatai/cli",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "node build.js",