@quantum-hub/qhubctl 1.17.0 → 1.18.0

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.
@@ -103,8 +103,8 @@ async function selectExistingDatapool(client) {
103
103
  const selection = await input({
104
104
  message: `Select a data pool (1-${dataPools.length}) or enter the ID directly:`,
105
105
  });
106
- const index = parseInt(selection, 10);
107
- if (!isNaN(index) && index >= 1 && index <= dataPools.length) {
106
+ const index = Number.parseInt(selection, 10);
107
+ if (!Number.isNaN(index) && index >= 1 && index <= dataPools.length) {
108
108
  return dataPools[index - 1].id;
109
109
  }
110
110
  return selection;
@@ -1,8 +1,7 @@
1
1
  import { Command } from 'commander';
2
2
  import { spinner } from '../lib/output.js';
3
- import { configDir } from '../model/command.js';
3
+ import { configDir, getUserConfig } from '../model/command.js';
4
4
  import { writeUserConfig } from '../service/user-config-service.js';
5
- import { getUserConfig } from '../model/command.js';
6
5
  const EXAMPLES = `
7
6
  Examples:
8
7
  $ qhubctl logout`;
@@ -21,7 +21,14 @@ export const setContextCommand = new Command('set-context')
21
21
  .action(async (contextId) => {
22
22
  const userConfig = await requireAuth();
23
23
  const quantumHubService = new QuantumHubService(userConfig);
24
- if (!contextId) {
24
+ if (contextId) {
25
+ const accounts = await quantumHubService.getAccounts();
26
+ const selectedContext = accounts.find(account => account.id === contextId);
27
+ if (!selectedContext) {
28
+ error(`Context with id "${contextId}" not found.`);
29
+ }
30
+ }
31
+ else {
25
32
  const spin = spinner('Loading available contexts');
26
33
  const accounts = await quantumHubService.getAccounts();
27
34
  spin.succeed('Contexts loaded');
@@ -32,13 +39,6 @@ export const setContextCommand = new Command('set-context')
32
39
  });
33
40
  contextId = response.id;
34
41
  }
35
- else {
36
- const accounts = await quantumHubService.getAccounts();
37
- const selectedContext = accounts.find(account => account.id === contextId);
38
- if (!selectedContext) {
39
- error(`Context with id "${contextId}" not found.`);
40
- }
41
- }
42
42
  const accounts = await quantumHubService.getAccounts();
43
43
  const selectedContext = accounts.find(account => account.id === contextId);
44
44
  if (!selectedContext) {
@@ -34,8 +34,7 @@ async function buildServiceJob(qhubService, service, silentMode) {
34
34
  if (!silentMode) {
35
35
  if (buildJob.step !== currentStep) {
36
36
  if (buildJob.step === HubPlatform.BuildJobDto.Step.BuildImage) {
37
- if (!spin)
38
- spin = spinner('Building Image (1/2)');
37
+ spin ??= spinner('Building Image (1/2)');
39
38
  }
40
39
  else if (buildJob.step === HubPlatform.BuildJobDto.Step.PushImage) {
41
40
  if (spin) {
package/dist/lib/fetch.js CHANGED
@@ -27,11 +27,11 @@ export const getErrorMessage = async (response) => {
27
27
  const httpStatus = response.status && response.statusText ? `${response.status} - ${response.statusText}` : response.status;
28
28
  // message is either in body.errorMessage, body.error or body.detail
29
29
  let errorMessage;
30
- if (body && body.errorMessage)
30
+ if (body?.errorMessage)
31
31
  errorMessage = body.errorMessage;
32
- if (!errorMessage && body && body.error)
32
+ if (!errorMessage && body?.error)
33
33
  errorMessage = body.error;
34
- if (!errorMessage && body && body.detail)
34
+ if (!errorMessage && body?.detail)
35
35
  errorMessage = body.detail;
36
36
  return errorMessage ? `${errorMessage} (${httpStatus})` : `${httpStatus}`;
37
37
  };
@@ -1,5 +1,5 @@
1
1
  import { type Ora } from 'ora';
2
- export type { Ora };
2
+ export type { Ora } from 'ora';
3
3
  /**
4
4
  * Output helpers — replaces oclif's `ux.*` surface.
5
5
  *
@@ -1,6 +1,5 @@
1
- import { configDir } from '../lib/config-dir.js';
2
1
  import UserConfig from './user-config.js';
3
- export { configDir };
2
+ export { configDir } from '../lib/config-dir.js';
4
3
  export declare function getUserConfig(): UserConfig;
5
4
  export declare function getContextDisplayString(userConfig: UserConfig): string;
6
5
  export declare function showCustomBasePathWarning(): void;
@@ -2,7 +2,7 @@ import { configDir } from '../lib/config-dir.js';
2
2
  import { stdout, warn } from '../lib/output.js';
3
3
  import AuthService from '../service/auth-service.js';
4
4
  import { readUserConfig, writeUserConfig } from '../service/user-config-service.js';
5
- export { configDir };
5
+ export { configDir } from '../lib/config-dir.js';
6
6
  export function getUserConfig() {
7
7
  return readUserConfig(configDir);
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantum-hub/qhubctl",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Kipu Quantum Hub CLI",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [