@quantum-hub/qhubctl 1.18.0 → 1.19.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.
@@ -151,13 +151,13 @@ async function generateFromCode(entrypoint) {
151
151
  catch {
152
152
  warn(`Could not load qhub.json configuration. Using default title: ${title}`);
153
153
  }
154
- const safeEntrypoint = entrypoint.replace(/"/g, '\\"');
155
- const safeTitle = title.replace(/"/g, '\\"');
156
- const safeDescription = description ? description.replace(/"/g, '\\"') : 'None';
157
- const pySnippet = `from qhub.commons.openapi.generator import generate_openapi; generate_openapi(entrypoint='${safeEntrypoint}', title='${safeTitle}', description=${safeDescription === 'None' ? 'None' : `'${safeDescription}'`})`;
158
- const command = `uv run --no-sync --project ${process.cwd()} python -c "${pySnippet}"`;
154
+ const pySnippet = 'import sys; from qhub.commons.openapi.generator import generate_openapi; ' +
155
+ 'generate_openapi(entrypoint=sys.argv[1], title=sys.argv[2], description=sys.argv[3] or None)';
159
156
  try {
160
- const result = await executeAsyncCommand(command);
157
+ const result = await executeAsyncCommand('uv', [
158
+ 'run', '--no-sync', '--project', process.cwd(),
159
+ 'python', '-c', pySnippet, entrypoint, title, description ?? '',
160
+ ]);
161
161
  const { stdout: out } = validateCommandResult(result);
162
162
  return out;
163
163
  }
@@ -4,5 +4,5 @@ export interface RunCommandOptions {
4
4
  tag: string[];
5
5
  storeInput: boolean;
6
6
  }
7
- export declare function buildCreateJobRequest(serviceId: string, input: Record<string, never> | undefined, opts: RunCommandOptions): HubPlatform.CreateServiceJobRequest;
7
+ export declare function buildCreateJobRequest(serviceId: string, input: HubPlatform.JsonNode | undefined, opts: RunCommandOptions): HubPlatform.CreateServiceJobRequest;
8
8
  export declare const runCommand: Command;
@@ -1,6 +1,4 @@
1
- import { StdioOptions } from "node:child_process";
2
- export declare const executeAsyncCommand: (command: string) => Promise<{
3
- stderr: string;
1
+ export declare const executeAsyncCommand: (file: string, args: string[]) => Promise<{
4
2
  stdout: string;
3
+ stderr: string;
5
4
  }>;
6
- export declare const executeCommand: (command: string, stdioOption?: StdioOptions) => void;
@@ -1,16 +1,4 @@
1
- import { exec, execSync } from "node:child_process";
2
- export const executeAsyncCommand = async (command) => {
3
- return new Promise((resolve, reject) => {
4
- exec(command, (error, stdout, stderr) => {
5
- if (error) {
6
- reject(error);
7
- }
8
- else {
9
- resolve({ stderr, stdout });
10
- }
11
- });
12
- });
13
- };
14
- export const executeCommand = (command, stdioOption) => {
15
- execSync(`${command}`, { stdio: stdioOption ?? 'inherit' });
16
- };
1
+ import { execFile } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ const execFileAsync = promisify(execFile);
4
+ export const executeAsyncCommand = (file, args) => execFileAsync(file, args);
@@ -12,9 +12,7 @@ export default class QuantumHubService extends CommandService {
12
12
  this.apiClient = new HubPlatformClient({
13
13
  apiKey,
14
14
  baseUrl: basePath,
15
- headers: {
16
- 'X-OrganizationId': organizationId,
17
- },
15
+ organizationId,
18
16
  });
19
17
  }
20
18
  async getAccounts() {
@@ -149,17 +147,15 @@ export default class QuantumHubService extends CommandService {
149
147
  await this.apiClient.services.updateServiceSummary(serviceId, { summary: serviceConfig.summary });
150
148
  }
151
149
  await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
152
- body: { type: 'cpu', amount: milliCpus, unit: 'm' },
150
+ type: 'cpu', amount: milliCpus, unit: 'm',
153
151
  });
154
152
  await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
155
- body: { type: 'memory', amount: memoryInMegabytes, unit: 'M' },
153
+ type: 'memory', amount: memoryInMegabytes, unit: 'M',
156
154
  });
157
155
  await this.apiClient.managedServices.updateManagedServiceResourceConfiguration(serviceId, {
158
- body: {
159
- type: 'gpu',
160
- amount: gpuCount,
161
- accelerator: gpuAccelerator
162
- },
156
+ type: 'gpu',
157
+ amount: gpuCount,
158
+ accelerator: gpuAccelerator,
163
159
  });
164
160
  if (openapi) {
165
161
  await this.apiClient.services.updateServiceOpenApi(serviceId, { file: openapi });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantum-hub/qhubctl",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Kipu Quantum Hub CLI",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@inquirer/prompts": "^8",
29
- "@quantum-hub/qhub-api": "^1",
29
+ "@quantum-hub/qhub-api": "^2",
30
30
  "adm-zip": "^0.5.17",
31
31
  "async-wait-until": "^2",
32
32
  "commander": "^14",