@quantum-hub/qhubctl 1.1.1 → 1.1.3

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.
Files changed (211) hide show
  1. package/README.md +1 -1
  2. package/bin/dev.js +3 -1
  3. package/bin/run.js +1 -1
  4. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.d.ts +2 -2
  5. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.js +9 -46
  6. package/dist/client/kqh/apis/ServicePlatformDashboardApi.d.ts +2 -2
  7. package/dist/client/kqh/apis/ServicePlatformDashboardApi.js +5 -42
  8. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.d.ts +2 -2
  9. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.js +11 -48
  10. package/dist/client/kqh/apis/ServicePlatformJobsApi.d.ts +2 -2
  11. package/dist/client/kqh/apis/ServicePlatformJobsApi.js +9 -46
  12. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.d.ts +2 -2
  13. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.js +5 -42
  14. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.d.ts +2 -2
  15. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.js +5 -42
  16. package/dist/client/kqh/apis/ServicePlatformServicesApi.d.ts +2 -2
  17. package/dist/client/kqh/apis/ServicePlatformServicesApi.js +34 -71
  18. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.d.ts +2 -2
  19. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.js +7 -44
  20. package/dist/client/kqh/apis/TaxonomiesApi.d.ts +2 -2
  21. package/dist/client/kqh/apis/TaxonomiesApi.js +12 -49
  22. package/dist/client/kqh/apis/index.d.ts +9 -9
  23. package/dist/client/kqh/apis/index.js +9 -25
  24. package/dist/client/kqh/index.d.ts +3 -3
  25. package/dist/client/kqh/index.js +3 -19
  26. package/dist/client/kqh/models/AccessTokenDto.js +5 -12
  27. package/dist/client/kqh/models/AmountMajorDto.js +4 -10
  28. package/dist/client/kqh/models/ApiDto.d.ts +2 -2
  29. package/dist/client/kqh/models/ApiDto.js +13 -20
  30. package/dist/client/kqh/models/ApiOverviewDto.d.ts +1 -1
  31. package/dist/client/kqh/models/ApiOverviewDto.js +10 -17
  32. package/dist/client/kqh/models/ApplicationDto.js +5 -12
  33. package/dist/client/kqh/models/BuildJobDto.d.ts +1 -1
  34. package/dist/client/kqh/models/BuildJobDto.js +9 -16
  35. package/dist/client/kqh/models/CpuConfiguration.d.ts +1 -1
  36. package/dist/client/kqh/models/CpuConfiguration.js +7 -13
  37. package/dist/client/kqh/models/CreateApplicationRequest.js +4 -10
  38. package/dist/client/kqh/models/CreateDataPoolRequest.js +4 -10
  39. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.d.ts +1 -1
  40. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.js +8 -15
  41. package/dist/client/kqh/models/CreateJobRequest.d.ts +1 -1
  42. package/dist/client/kqh/models/CreateJobRequest.js +9 -15
  43. package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.js +6 -13
  44. package/dist/client/kqh/models/CreateProductRequest.js +4 -10
  45. package/dist/client/kqh/models/CreateSubscriptionRequest.js +4 -10
  46. package/dist/client/kqh/models/CreateWorkflowServiceRequest.js +4 -10
  47. package/dist/client/kqh/models/DataPoolDto.d.ts +3 -3
  48. package/dist/client/kqh/models/DataPoolDto.js +21 -28
  49. package/dist/client/kqh/models/DataPoolRef.js +4 -10
  50. package/dist/client/kqh/models/DataSourceDescriptorDto.d.ts +1 -1
  51. package/dist/client/kqh/models/DataSourceDescriptorDto.js +8 -15
  52. package/dist/client/kqh/models/FileDto.js +4 -10
  53. package/dist/client/kqh/models/FileSource.d.ts +1 -1
  54. package/dist/client/kqh/models/FileSource.js +4 -10
  55. package/dist/client/kqh/models/GpuConfiguration.d.ts +1 -1
  56. package/dist/client/kqh/models/GpuConfiguration.js +8 -15
  57. package/dist/client/kqh/models/JobDto.d.ts +2 -2
  58. package/dist/client/kqh/models/JobDto.js +13 -20
  59. package/dist/client/kqh/models/JobOverviewDto.d.ts +1 -1
  60. package/dist/client/kqh/models/JobOverviewDto.js +8 -15
  61. package/dist/client/kqh/models/MemoryConfiguration.d.ts +1 -1
  62. package/dist/client/kqh/models/MemoryConfiguration.js +7 -13
  63. package/dist/client/kqh/models/MeteringRequest.js +4 -10
  64. package/dist/client/kqh/models/MeteringResponse.js +4 -10
  65. package/dist/client/kqh/models/MonthAmountDto.d.ts +2 -2
  66. package/dist/client/kqh/models/MonthAmountDto.js +10 -16
  67. package/dist/client/kqh/models/OwnerDto.js +4 -10
  68. package/dist/client/kqh/models/PageDataPoolDto.d.ts +3 -3
  69. package/dist/client/kqh/models/PageDataPoolDto.js +13 -19
  70. package/dist/client/kqh/models/PageableObject.d.ts +1 -1
  71. package/dist/client/kqh/models/PageableObject.js +7 -13
  72. package/dist/client/kqh/models/PricingPlanDto.d.ts +1 -1
  73. package/dist/client/kqh/models/PricingPlanDto.js +8 -15
  74. package/dist/client/kqh/models/ProductAmountDto.d.ts +1 -1
  75. package/dist/client/kqh/models/ProductAmountDto.js +7 -13
  76. package/dist/client/kqh/models/ProductDto.js +5 -12
  77. package/dist/client/kqh/models/ProductGroupDto.d.ts +2 -2
  78. package/dist/client/kqh/models/ProductGroupDto.js +10 -16
  79. package/dist/client/kqh/models/ProductUsageDto.js +4 -10
  80. package/dist/client/kqh/models/RegistrySource.d.ts +1 -1
  81. package/dist/client/kqh/models/RegistrySource.js +7 -13
  82. package/dist/client/kqh/models/RepositorySource.d.ts +1 -1
  83. package/dist/client/kqh/models/RepositorySource.js +7 -13
  84. package/dist/client/kqh/models/ResourceConfiguration.js +10 -16
  85. package/dist/client/kqh/models/ReviewDto.js +5 -12
  86. package/dist/client/kqh/models/RuntimeConfiguration.js +5 -12
  87. package/dist/client/kqh/models/ServiceDefinitionCommand.js +5 -12
  88. package/dist/client/kqh/models/ServiceDefinitionDto.d.ts +5 -5
  89. package/dist/client/kqh/models/ServiceDefinitionDto.js +21 -28
  90. package/dist/client/kqh/models/ServiceDefinitionDtoSource.d.ts +3 -3
  91. package/dist/client/kqh/models/ServiceDefinitionDtoSource.js +18 -23
  92. package/dist/client/kqh/models/ServiceDefinitionOverviewDto.js +6 -13
  93. package/dist/client/kqh/models/ServiceDto.d.ts +1 -1
  94. package/dist/client/kqh/models/ServiceDto.js +8 -15
  95. package/dist/client/kqh/models/ServiceExecutionConsumerDto.js +5 -12
  96. package/dist/client/kqh/models/ServiceExecutionDto.js +4 -10
  97. package/dist/client/kqh/models/ServiceOverviewDto.js +8 -15
  98. package/dist/client/kqh/models/ServiceSource.js +10 -16
  99. package/dist/client/kqh/models/SortObject.js +4 -10
  100. package/dist/client/kqh/models/SubscriptionDto.d.ts +3 -3
  101. package/dist/client/kqh/models/SubscriptionDto.js +13 -19
  102. package/dist/client/kqh/models/TaxonomyElement.js +4 -10
  103. package/dist/client/kqh/models/UpdateDataPoolRequest.js +4 -10
  104. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.d.ts +3 -3
  105. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.js +18 -23
  106. package/dist/client/kqh/models/UpdateVersionRequest.d.ts +1 -1
  107. package/dist/client/kqh/models/UpdateVersionRequest.js +7 -13
  108. package/dist/client/kqh/models/UpdateWorkflowServiceRequest.js +4 -10
  109. package/dist/client/kqh/models/ValidationResult.js +5 -12
  110. package/dist/client/kqh/models/index.d.ts +57 -57
  111. package/dist/client/kqh/models/index.js +57 -73
  112. package/dist/client/kqh/runtime.js +17 -32
  113. package/dist/client/users/apis/AuthenticationApi.d.ts +2 -2
  114. package/dist/client/users/apis/AuthenticationApi.js +4 -41
  115. package/dist/client/users/apis/ExpertsApi.d.ts +2 -2
  116. package/dist/client/users/apis/ExpertsApi.js +5 -42
  117. package/dist/client/users/apis/SearchApi.d.ts +2 -2
  118. package/dist/client/users/apis/SearchApi.js +5 -42
  119. package/dist/client/users/apis/UserSettingsApi.d.ts +2 -2
  120. package/dist/client/users/apis/UserSettingsApi.js +11 -48
  121. package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.d.ts +2 -2
  122. package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.js +7 -44
  123. package/dist/client/users/apis/UsersApi.d.ts +2 -2
  124. package/dist/client/users/apis/UsersApi.js +4 -41
  125. package/dist/client/users/apis/index.d.ts +6 -6
  126. package/dist/client/users/apis/index.js +6 -22
  127. package/dist/client/users/index.d.ts +3 -3
  128. package/dist/client/users/index.js +3 -19
  129. package/dist/client/users/models/AccessTokenCreateRequest.js +5 -12
  130. package/dist/client/users/models/AccessTokenDto.js +5 -12
  131. package/dist/client/users/models/AccessTokensResponse.d.ts +1 -1
  132. package/dist/client/users/models/AccessTokensResponse.js +7 -13
  133. package/dist/client/users/models/DefaultAccessTokenResponse.js +4 -10
  134. package/dist/client/users/models/Language.js +4 -10
  135. package/dist/client/users/models/PageUserDto.d.ts +3 -3
  136. package/dist/client/users/models/PageUserDto.js +13 -19
  137. package/dist/client/users/models/Pageable.js +4 -10
  138. package/dist/client/users/models/PageableObject.d.ts +1 -1
  139. package/dist/client/users/models/PageableObject.js +7 -13
  140. package/dist/client/users/models/PersonalAccessTokenPrincipal.d.ts +1 -1
  141. package/dist/client/users/models/PersonalAccessTokenPrincipal.js +7 -13
  142. package/dist/client/users/models/Skill.js +4 -10
  143. package/dist/client/users/models/SortObject.js +4 -10
  144. package/dist/client/users/models/UpdateUserRequest.js +4 -10
  145. package/dist/client/users/models/UserDto.d.ts +2 -2
  146. package/dist/client/users/models/UserDto.js +10 -16
  147. package/dist/client/users/models/UserOverviewDto.js +4 -10
  148. package/dist/client/users/models/index.d.ts +14 -14
  149. package/dist/client/users/models/index.js +14 -30
  150. package/dist/client/users/runtime.js +17 -32
  151. package/dist/commands/compress/index.d.ts +1 -1
  152. package/dist/commands/compress/index.js +13 -19
  153. package/dist/commands/datapool/upload.d.ts +4 -4
  154. package/dist/commands/datapool/upload.js +24 -30
  155. package/dist/commands/get-context/index.d.ts +1 -1
  156. package/dist/commands/get-context/index.js +2 -5
  157. package/dist/commands/init/index.d.ts +3 -3
  158. package/dist/commands/init/index.js +30 -36
  159. package/dist/commands/list-contexts/index.d.ts +2 -2
  160. package/dist/commands/list-contexts/index.js +11 -17
  161. package/dist/commands/login/index.d.ts +3 -3
  162. package/dist/commands/login/index.js +16 -22
  163. package/dist/commands/logout/index.d.ts +1 -1
  164. package/dist/commands/logout/index.js +7 -10
  165. package/dist/commands/openapi/index.d.ts +7 -7
  166. package/dist/commands/openapi/index.js +81 -87
  167. package/dist/commands/run/index.d.ts +6 -6
  168. package/dist/commands/run/index.js +43 -48
  169. package/dist/commands/serve/index.d.ts +3 -3
  170. package/dist/commands/serve/index.js +31 -37
  171. package/dist/commands/services/index.d.ts +5 -5
  172. package/dist/commands/services/index.js +17 -23
  173. package/dist/commands/set-context/index.d.ts +4 -4
  174. package/dist/commands/set-context/index.js +13 -19
  175. package/dist/commands/up/index.d.ts +5 -5
  176. package/dist/commands/up/index.js +51 -57
  177. package/dist/index.js +1 -4
  178. package/dist/lib/command.js +5 -10
  179. package/dist/lib/debug.js +1 -5
  180. package/dist/lib/entrypoint-resolver.js +3 -7
  181. package/dist/lib/error.js +8 -12
  182. package/dist/lib/fetch.js +4 -10
  183. package/dist/lib/init-user-input.d.ts +1 -1
  184. package/dist/lib/init-user-input.js +16 -20
  185. package/dist/lib/random-name.js +1 -5
  186. package/dist/lib/random-string.js +1 -5
  187. package/dist/lib/repository.js +9 -17
  188. package/dist/lib/stream-to-blob.d.ts +1 -1
  189. package/dist/lib/stream-to-blob.js +1 -5
  190. package/dist/lib/up/get-description.js +9 -15
  191. package/dist/lib/up/ignore.js +9 -15
  192. package/dist/lib/up/zip.js +18 -24
  193. package/dist/model/account.js +1 -2
  194. package/dist/model/command.d.ts +2 -2
  195. package/dist/model/command.js +11 -19
  196. package/dist/model/managed-service-config.js +4 -7
  197. package/dist/model/user-config.js +3 -6
  198. package/dist/service/auth-service.d.ts +3 -3
  199. package/dist/service/auth-service.js +8 -14
  200. package/dist/service/command-service.d.ts +2 -2
  201. package/dist/service/command-service.js +1 -5
  202. package/dist/service/quantum-hub-service.d.ts +10 -10
  203. package/dist/service/quantum-hub-service.js +21 -24
  204. package/dist/service/service-config-service.d.ts +1 -1
  205. package/dist/service/service-config-service.js +14 -21
  206. package/dist/service/user-config-service.d.ts +1 -1
  207. package/dist/service/user-config-service.js +14 -21
  208. package/dist/service/user-service.d.ts +2 -2
  209. package/dist/service/user-service.js +8 -11
  210. package/oclif.manifest.json +170 -170
  211. package/package.json +4 -2
@@ -1,24 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const prompts_1 = require("@inquirer/prompts");
7
- const core_1 = require("@oclif/core");
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const command_1 = require("../../lib/command");
11
- const entrypoint_resolver_1 = require("../../lib/entrypoint-resolver");
12
- const fetch_1 = require("../../lib/fetch");
13
- const random_string_1 = require("../../lib/random-string");
14
- const command_2 = require("../../model/command");
15
- const managed_service_config_1 = require("../../model/managed-service-config");
16
- const service_config_service_1 = require("../../service/service-config-service");
1
+ import { confirm } from "@inquirer/prompts";
2
+ import { Flags, ux } from '@oclif/core';
3
+ import fs from "fs-extra";
4
+ import path from "node:path";
5
+ import { executeAsyncCommand } from "../../lib/command.js";
6
+ import { EntrypointResolver } from "../../lib/entrypoint-resolver.js";
7
+ import { fetchOrThrow } from "../../lib/fetch.js";
8
+ import { randomString } from "../../lib/random-string.js";
9
+ import { AbstractCommand } from '../../model/command.js';
10
+ import { Runtime } from "../../model/managed-service-config.js";
11
+ import { readServiceConfig } from "../../service/service-config-service.js";
17
12
  const SUPPORTED_FORMATS = ['yaml'];
18
13
  const DEFAULT_TEMPLATE_URL = 'https://docs.hub.kipu-quantum.com/files/openapi-service.yaml';
19
14
  const DEFAULT_OUTPUT_FILE = 'openapi.yaml';
20
15
  const DEPRECATED_FILE_NAME = 'openapi-spec.yml';
21
- class Openapi extends command_2.AbstractCommand {
16
+ export default class Openapi extends AbstractCommand {
22
17
  static description = 'Generates the OpenAPI description for your project based on the parameter and return types of your run() method. ' +
23
18
  'The output of this command will be used when creating or updating your service. ' +
24
19
  'Supports PYTHON_TEMPLATE (with src/program.py), PYTHON and DOCKER runtimes (with explicit entrypoint). ' +
@@ -31,29 +26,29 @@ class Openapi extends command_2.AbstractCommand {
31
26
  '$ qhubctl openapi --package=src.program',
32
27
  ];
33
28
  static flags = {
34
- force: core_1.Flags.boolean({
29
+ force: Flags.boolean({
35
30
  char: 'f',
36
31
  description: 'Overwrite the output file if it already exists',
37
32
  required: false,
38
33
  }),
39
- file: core_1.Flags.string({
34
+ file: Flags.string({
40
35
  description: 'The file to write the OpenAPI description to',
41
36
  required: false,
42
37
  }),
43
- format: core_1.Flags.string({
38
+ format: Flags.string({
44
39
  description: `The format to generate the OpenAPI description [possible values: ${SUPPORTED_FORMATS.join(', ')}]`,
45
40
  required: false,
46
41
  options: [...SUPPORTED_FORMATS]
47
42
  }),
48
- entrypoint: core_1.Flags.string({
43
+ entrypoint: Flags.string({
49
44
  description: 'The entrypoint to your program in the format "package.module:function" (default: "src.program:run"). Overrides package and method flags.',
50
45
  required: false,
51
46
  }),
52
- package: core_1.Flags.string({
47
+ package: Flags.string({
53
48
  description: 'The package/module path to your program (e.g., "src.program" or "my_package.main"). Only used if entrypoint is not provided.',
54
49
  required: false,
55
50
  }),
56
- method: core_1.Flags.string({
51
+ method: Flags.string({
57
52
  description: 'The method/function name in your program (default: "run"). Only used if entrypoint is not provided.',
58
53
  required: false,
59
54
  }),
@@ -68,7 +63,7 @@ class Openapi extends command_2.AbstractCommand {
68
63
  // Validate and resolve entrypoint (throws error if invalid)
69
64
  let entrypoint;
70
65
  try {
71
- entrypoint = entrypoint_resolver_1.EntrypointResolver.resolveEntrypoint(flags);
66
+ entrypoint = EntrypointResolver.resolveEntrypoint(flags);
72
67
  }
73
68
  catch (error) {
74
69
  const errorMessage = this.getErrorMessage(error);
@@ -77,12 +72,12 @@ class Openapi extends command_2.AbstractCommand {
77
72
  const outputPath = await this.determineOutputPath(flags);
78
73
  const shouldGenerateFile = this.isProjectSupported(flags);
79
74
  if (!shouldGenerateFile) {
80
- core_1.ux.warn(`Cannot generate OpenAPI description from your code. Supported configurations:
75
+ ux.warn(`Cannot generate OpenAPI description from your code. Supported configurations:
81
76
  • PYTHON_TEMPLATE runtime with "./src/program.py" file
82
77
  • DOCKER, PYTHON, or PYTHON_TEMPLATE runtimes with explicit entrypoint (--entrypoint, or (--package, --method))`);
83
78
  return;
84
79
  }
85
- core_1.ux.action.start('Generating OpenAPI description');
80
+ ux.action.start('Generating OpenAPI description');
86
81
  let fileContent;
87
82
  if (shouldGenerateFile) {
88
83
  fileContent = await this.generateFromCode(entrypoint);
@@ -91,11 +86,11 @@ class Openapi extends command_2.AbstractCommand {
91
86
  fileContent = await this.fetchDefaultTemplate();
92
87
  }
93
88
  try {
94
- fs_extra_1.default.writeFileSync(outputPath, fileContent, 'utf8');
95
- core_1.ux.action.stop('Done');
89
+ fs.writeFileSync(outputPath, fileContent, 'utf8');
90
+ ux.action.stop('Done');
96
91
  }
97
92
  catch (error) {
98
- core_1.ux.action.stop('Failed');
93
+ ux.action.stop('Failed');
99
94
  const errorMessage = this.getErrorMessage(error);
100
95
  throw new Error(`Failed to write file ${outputPath}: ${errorMessage}`);
101
96
  }
@@ -120,21 +115,21 @@ class Openapi extends command_2.AbstractCommand {
120
115
  typeof error.message === 'string');
121
116
  }
122
117
  checkDeprecatedFiles() {
123
- const deprecatedFile = node_path_1.default.join(process.cwd(), DEPRECATED_FILE_NAME);
124
- if (fs_extra_1.default.existsSync(deprecatedFile)) {
125
- core_1.ux.warn(`Found deprecated file "${DEPRECATED_FILE_NAME}". Consider renaming it to "${DEFAULT_OUTPUT_FILE}".`);
118
+ const deprecatedFile = path.join(process.cwd(), DEPRECATED_FILE_NAME);
119
+ if (fs.existsSync(deprecatedFile)) {
120
+ ux.warn(`Found deprecated file "${DEPRECATED_FILE_NAME}". Consider renaming it to "${DEFAULT_OUTPUT_FILE}".`);
126
121
  }
127
122
  }
128
123
  async determineOutputPath(flags) {
129
- const defaultPath = node_path_1.default.join(process.cwd(), DEFAULT_OUTPUT_FILE);
130
- const outputPath = flags.file ? node_path_1.default.resolve(flags.file) : defaultPath;
131
- const outputExists = fs_extra_1.default.existsSync(outputPath);
124
+ const defaultPath = path.join(process.cwd(), DEFAULT_OUTPUT_FILE);
125
+ const outputPath = flags.file ? path.resolve(flags.file) : defaultPath;
126
+ const outputExists = fs.existsSync(outputPath);
132
127
  // Create output directory if it doesn't exist
133
128
  if (flags.file) {
134
- const outputDir = node_path_1.default.dirname(outputPath);
135
- if (!fs_extra_1.default.existsSync(outputDir)) {
129
+ const outputDir = path.dirname(outputPath);
130
+ if (!fs.existsSync(outputDir)) {
136
131
  try {
137
- fs_extra_1.default.mkdirpSync(outputDir);
132
+ fs.mkdirpSync(outputDir);
138
133
  }
139
134
  catch (error) {
140
135
  const errorMessage = this.getErrorMessage(error);
@@ -143,13 +138,13 @@ class Openapi extends command_2.AbstractCommand {
143
138
  }
144
139
  }
145
140
  if (outputExists && !flags.force) {
146
- const shouldOverwrite = await (0, prompts_1.confirm)({
147
- message: `File "${node_path_1.default.basename(outputPath)}" already exists. Overwrite?`,
141
+ const shouldOverwrite = await confirm({
142
+ message: `File "${path.basename(outputPath)}" already exists. Overwrite?`,
148
143
  default: false
149
144
  });
150
145
  if (!shouldOverwrite) {
151
- const newPath = node_path_1.default.join(node_path_1.default.dirname(outputPath), `${node_path_1.default.basename(outputPath, '.yaml')}-${(0, random_string_1.randomString)(5)}.yaml`);
152
- core_1.ux.stdout(`Creating new file: ${node_path_1.default.basename(newPath)}`);
146
+ const newPath = path.join(path.dirname(outputPath), `${path.basename(outputPath, '.yaml')}-${randomString(5)}.yaml`);
147
+ ux.stdout(`Creating new file: ${path.basename(newPath)}`);
153
148
  return newPath;
154
149
  }
155
150
  }
@@ -161,13 +156,13 @@ class Openapi extends command_2.AbstractCommand {
161
156
  let title = "Service API";
162
157
  let description;
163
158
  try {
164
- serviceConfig = (0, service_config_service_1.readServiceConfig)(process.cwd());
159
+ serviceConfig = readServiceConfig(process.cwd());
165
160
  title = serviceConfig.name || "Service API";
166
161
  description = serviceConfig.summary || '';
167
162
  }
168
163
  catch {
169
164
  // If we can't read the config, use defaults but continue
170
- core_1.ux.warn(`Could not load qhub.json configuration. Using default title: ${title}`);
165
+ ux.warn(`Could not load qhub.json configuration. Using default title: ${title}`);
171
166
  }
172
167
  // Escape parameters to prevent command injection
173
168
  const safeEntrypoint = entrypoint.replace(/"/g, '\\"');
@@ -176,7 +171,7 @@ class Openapi extends command_2.AbstractCommand {
176
171
  // Build Python command with title and description parameters
177
172
  const command = `python -c "from qhub.commons.openapi.generator import generate_openapi; generate_openapi(entrypoint='${safeEntrypoint}', title='${safeTitle}', description=${safeDescription === 'None' ? 'None' : `'${safeDescription}'`})"`;
178
173
  try {
179
- const result = await (0, command_1.executeAsyncCommand)(command);
174
+ const result = await executeAsyncCommand(command);
180
175
  const { stdout } = this.validateCommandResult(result);
181
176
  return stdout;
182
177
  }
@@ -225,7 +220,7 @@ class Openapi extends command_2.AbstractCommand {
225
220
  }
226
221
  async fetchDefaultTemplate() {
227
222
  try {
228
- const response = await (0, fetch_1.fetchOrThrow)(DEFAULT_TEMPLATE_URL, { method: 'GET' });
223
+ const response = await fetchOrThrow(DEFAULT_TEMPLATE_URL, { method: 'GET' });
229
224
  return await response.text();
230
225
  }
231
226
  catch (error) {
@@ -234,31 +229,31 @@ class Openapi extends command_2.AbstractCommand {
234
229
  }
235
230
  }
236
231
  displaySuccess(outputPath) {
237
- const relativePath = node_path_1.default.relative(process.cwd(), outputPath);
232
+ const relativePath = path.relative(process.cwd(), outputPath);
238
233
  const displayPath = relativePath.startsWith('..') ? outputPath : relativePath;
239
- core_1.ux.stdout('');
240
- core_1.ux.stdout(`OpenAPI description created: ${displayPath}`);
234
+ ux.stdout('');
235
+ ux.stdout(`OpenAPI description created: ${displayPath}`);
241
236
  // Provide next steps
242
- if (fs_extra_1.default.statSync(outputPath).size > 0) {
243
- core_1.ux.stdout('');
244
- core_1.ux.stdout('Next steps:');
245
- core_1.ux.stdout(' • Review the generated OpenAPI description');
246
- core_1.ux.stdout(' • Use it to create or update your service');
237
+ if (fs.statSync(outputPath).size > 0) {
238
+ ux.stdout('');
239
+ ux.stdout('Next steps:');
240
+ ux.stdout(' • Review the generated OpenAPI description');
241
+ ux.stdout(' • Use it to create or update your service');
247
242
  }
248
243
  }
249
244
  isProjectSupported(flags) {
250
245
  let serviceConfig;
251
246
  try {
252
- serviceConfig = (0, service_config_service_1.readServiceConfig)(process.cwd());
247
+ serviceConfig = readServiceConfig(process.cwd());
253
248
  }
254
249
  catch (error) {
255
250
  const errorMessage = this.getErrorMessage(error);
256
- core_1.ux.warn(`Failed to read project configuration: ${errorMessage}`);
257
- core_1.ux.warn('Ensure you have a valid qhub.json file in your project root.');
251
+ ux.warn(`Failed to read project configuration: ${errorMessage}`);
252
+ ux.warn('Ensure you have a valid qhub.json file in your project root.');
258
253
  return false;
259
254
  }
260
255
  const hasExplicitEntrypoint = !!(flags.entrypoint || flags.package || flags.method);
261
- const supportedRuntimes = [managed_service_config_1.Runtime.PYTHON_TEMPLATE, managed_service_config_1.Runtime.PYTHON, managed_service_config_1.Runtime.DOCKER];
256
+ const supportedRuntimes = [Runtime.PYTHON_TEMPLATE, Runtime.PYTHON, Runtime.DOCKER];
262
257
  if (hasExplicitEntrypoint) {
263
258
  const isSupported = supportedRuntimes.includes(serviceConfig.runtime);
264
259
  if (!isSupported) {
@@ -267,9 +262,9 @@ class Openapi extends command_2.AbstractCommand {
267
262
  return isSupported;
268
263
  }
269
264
  // Default behavior: only PYTHON_TEMPLATE with program.py file
270
- const programFile = node_path_1.default.join(process.cwd(), 'src', 'program.py');
271
- const hasProgramFile = fs_extra_1.default.existsSync(programFile);
272
- const isPythonTemplate = serviceConfig.runtime === managed_service_config_1.Runtime.PYTHON_TEMPLATE;
265
+ const programFile = path.join(process.cwd(), 'src', 'program.py');
266
+ const hasProgramFile = fs.existsSync(programFile);
267
+ const isPythonTemplate = serviceConfig.runtime === Runtime.PYTHON_TEMPLATE;
273
268
  const isSupported = isPythonTemplate && hasProgramFile;
274
269
  if (!isSupported) {
275
270
  this.showConfigurationHelp(serviceConfig.runtime, isPythonTemplate, hasProgramFile);
@@ -277,37 +272,36 @@ class Openapi extends command_2.AbstractCommand {
277
272
  return isSupported;
278
273
  }
279
274
  showRuntimeNotSupportedWarning(currentRuntime) {
280
- core_1.ux.warn(`Runtime "${currentRuntime}" is not supported for OpenAPI generation.`);
281
- core_1.ux.warn('');
282
- core_1.ux.warn('Supported configurations:');
283
- core_1.ux.warn(' • PYTHON_TEMPLATE: Automatic (requires src/program.py)');
284
- core_1.ux.warn(' • PYTHON/DOCKER: With explicit entrypoint flags');
285
- core_1.ux.warn('');
286
- core_1.ux.warn('Examples:');
287
- core_1.ux.warn(' qhubctl openapi --entrypoint=myapp.main:handler');
288
- core_1.ux.warn(' qhubctl openapi --package=myapp.core --method=process');
275
+ ux.warn(`Runtime "${currentRuntime}" is not supported for OpenAPI generation.`);
276
+ ux.warn('');
277
+ ux.warn('Supported configurations:');
278
+ ux.warn(' • PYTHON_TEMPLATE: Automatic (requires src/program.py)');
279
+ ux.warn(' • PYTHON/DOCKER: With explicit entrypoint flags');
280
+ ux.warn('');
281
+ ux.warn('Examples:');
282
+ ux.warn(' qhubctl openapi --entrypoint=myapp.main:handler');
283
+ ux.warn(' qhubctl openapi --package=myapp.core --method=process');
289
284
  }
290
285
  showConfigurationHelp(runtime, isPythonTemplate, hasProgramFile) {
291
- core_1.ux.warn('Cannot generate OpenAPI description from your code.');
292
- core_1.ux.warn('');
286
+ ux.warn('Cannot generate OpenAPI description from your code.');
287
+ ux.warn('');
293
288
  if (isPythonTemplate && !hasProgramFile) {
294
- core_1.ux.warn('Missing required file: src/program.py');
295
- core_1.ux.warn('');
296
- core_1.ux.warn('Solutions:');
297
- core_1.ux.warn(' • Create src/program.py with your main function, or');
298
- core_1.ux.warn(' • Use explicit entrypoint: --entrypoint=yourmodule.main:function');
289
+ ux.warn('Missing required file: src/program.py');
290
+ ux.warn('');
291
+ ux.warn('Solutions:');
292
+ ux.warn(' • Create src/program.py with your main function, or');
293
+ ux.warn(' • Use explicit entrypoint: --entrypoint=yourmodule.main:function');
299
294
  }
300
295
  else if (!isPythonTemplate) {
301
- core_1.ux.warn(`Runtime "${runtime}" requires explicit entrypoint specification.`);
302
- core_1.ux.warn('');
303
- core_1.ux.warn('Use one of these flags:');
304
- core_1.ux.warn(' --entrypoint=package.module:function');
305
- core_1.ux.warn(' --package=package.module --method=function');
306
- core_1.ux.warn('');
307
- core_1.ux.warn('Examples:');
308
- core_1.ux.warn(' qhubctl openapi --entrypoint=myapp.main:handler');
309
- core_1.ux.warn(' qhubctl openapi --package=myapp.core --method=process');
296
+ ux.warn(`Runtime "${runtime}" requires explicit entrypoint specification.`);
297
+ ux.warn('');
298
+ ux.warn('Use one of these flags:');
299
+ ux.warn(' --entrypoint=package.module:function');
300
+ ux.warn(' --package=package.module --method=function');
301
+ ux.warn('');
302
+ ux.warn('Examples:');
303
+ ux.warn(' qhubctl openapi --entrypoint=myapp.main:handler');
304
+ ux.warn(' qhubctl openapi --package=myapp.core --method=process');
310
305
  }
311
306
  }
312
307
  }
313
- exports.default = Openapi;
@@ -1,15 +1,15 @@
1
- import { AuthenticatedCommand } from '../../model/command';
2
- import QuantumHubService from '../../service/quantum-hub-service';
1
+ import { AuthenticatedCommand } from '../../model/command.js';
2
+ import QuantumHubService from '../../service/quantum-hub-service.js';
3
3
  export default class Run extends AuthenticatedCommand {
4
4
  static readonly args: {
5
- serviceId: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ serviceId: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
6
  };
7
7
  static readonly description = "Creates a job execution";
8
8
  static readonly examples: string[];
9
9
  static readonly flags: {
10
- input: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- 'input-files': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
- detached: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'input-files': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ detached: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
13
  };
14
14
  hubService: QuantumHubService;
15
15
  getInputFromFiles(filePaths: string): Promise<Record<string, never> | undefined>;
@@ -1,22 +1,18 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@oclif/core");
7
- const async_wait_until_1 = require("async-wait-until");
8
- const fs_extra_1 = require("fs-extra");
9
- const inquirer_1 = __importDefault(require("inquirer"));
10
- const node_fs_1 = __importDefault(require("node:fs"));
11
- const node_path_1 = __importDefault(require("node:path"));
12
- const command_1 = require("../../model/command");
13
- const user_config_1 = require("../../model/user-config");
14
- const quantum_hub_service_1 = __importDefault(require("../../service/quantum-hub-service"));
15
- const service_config_service_1 = require("../../service/service-config-service");
16
- const api_1 = require("@quantum-hub/qhub-api/dist/api/platform/api");
17
- class Run extends command_1.AuthenticatedCommand {
1
+ import { Args, Flags, ux } from '@oclif/core';
2
+ import { waitUntil } from 'async-wait-until';
3
+ import fsExtra from 'fs-extra';
4
+ const { readJsonSync } = fsExtra;
5
+ import inquirer from 'inquirer';
6
+ import fs from 'node:fs';
7
+ import path from 'node:path';
8
+ import { AuthenticatedCommand } from '../../model/command.js';
9
+ import { defaultBasePath } from '../../model/user-config.js';
10
+ import QuantumHubService from '../../service/quantum-hub-service.js';
11
+ import { readServiceConfig } from '../../service/service-config-service.js';
12
+ import { HubPlatform } from "@quantum-hub/qhub-api/platform";
13
+ export default class Run extends AuthenticatedCommand {
18
14
  static args = {
19
- serviceId: core_1.Args.string(),
15
+ serviceId: Args.string(),
20
16
  };
21
17
  static description = 'Creates a job execution';
22
18
  static examples = [
@@ -27,13 +23,13 @@ class Run extends command_1.AuthenticatedCommand {
27
23
  '$ qhubctl run --input-files=./config.json,./overrides.json',
28
24
  ];
29
25
  static flags = {
30
- input: core_1.Flags.string({ char: 'i', description: 'Input as JSON string.', required: false }),
31
- 'input-files': core_1.Flags.string({
26
+ input: Flags.string({ char: 'i', description: 'Input as JSON string.', required: false }),
27
+ 'input-files': Flags.string({
32
28
  aliases: ['input-files'],
33
29
  description: 'Comma-separated paths to files containing input to be merged (default: ./input/data.json,./input/params.json).',
34
30
  required: false,
35
31
  }),
36
- detached: core_1.Flags.boolean({
32
+ detached: Flags.boolean({
37
33
  description: 'Executes the job in detached mode, i.e., without waiting for it to finish.',
38
34
  required: false,
39
35
  }),
@@ -46,22 +42,22 @@ class Run extends command_1.AuthenticatedCommand {
46
42
  for (const filePath of paths) {
47
43
  let file = filePath;
48
44
  // if the file path is not absolute, try to find it in the current working directory
49
- if (!node_fs_1.default.existsSync(filePath)) {
50
- file = node_path_1.default.join(process.cwd(), filePath);
45
+ if (!fs.existsSync(filePath)) {
46
+ file = path.join(process.cwd(), filePath);
51
47
  }
52
- if (node_fs_1.default.existsSync(file)) {
48
+ if (fs.existsSync(file)) {
53
49
  try {
54
- const content = (0, fs_extra_1.readJsonSync)(file, { encoding: 'utf8' });
50
+ const content = readJsonSync(file, { encoding: 'utf8' });
55
51
  Object.assign(mergedInput, content);
56
52
  hasValidFile = true;
57
53
  }
58
54
  catch {
59
- core_1.ux.warn(`Failed to parse JSON from ${filePath}. Skipping this file.`);
55
+ ux.warn(`Failed to parse JSON from ${filePath}. Skipping this file.`);
60
56
  }
61
57
  }
62
58
  }
63
59
  if (!hasValidFile) {
64
- const response = await inquirer_1.default.prompt({
60
+ const response = await inquirer.prompt({
65
61
  message: `No valid input files found. Run without input?`,
66
62
  name: 'confirm',
67
63
  type: 'confirm',
@@ -74,7 +70,7 @@ class Run extends command_1.AuthenticatedCommand {
74
70
  }
75
71
  async init() {
76
72
  await super.init();
77
- this.hubService = new quantum_hub_service_1.default(this, this.config, this.userConfig);
73
+ this.hubService = new QuantumHubService(this, this.config, this.userConfig);
78
74
  }
79
75
  async run() {
80
76
  const { args } = await this.parse(Run);
@@ -83,7 +79,7 @@ class Run extends command_1.AuthenticatedCommand {
83
79
  // if no service id is provided, try to read it from the qhub.json
84
80
  if (!serviceId) {
85
81
  try {
86
- const serviceConfig = (0, service_config_service_1.readServiceConfig)(process.cwd());
82
+ const serviceConfig = readServiceConfig(process.cwd());
87
83
  serviceId = serviceConfig.serviceId;
88
84
  }
89
85
  catch {
@@ -91,7 +87,7 @@ class Run extends command_1.AuthenticatedCommand {
91
87
  }
92
88
  }
93
89
  if (!serviceId) {
94
- core_1.ux.error('Missing service ID. Please provide a service ID as argument or set it in the qhub.json of your project.');
90
+ ux.error('Missing service ID. Please provide a service ID as argument or set it in the qhub.json of your project.');
95
91
  }
96
92
  const service = await this.hubService.getService(serviceId);
97
93
  let input;
@@ -100,7 +96,7 @@ class Run extends command_1.AuthenticatedCommand {
100
96
  input = JSON.parse(flags.input);
101
97
  }
102
98
  catch {
103
- core_1.ux.error('Invalid JSON provided.');
99
+ ux.error('Invalid JSON provided.');
104
100
  }
105
101
  }
106
102
  else {
@@ -110,14 +106,14 @@ class Run extends command_1.AuthenticatedCommand {
110
106
  const payload = { serviceId: service.id, tags: ['cli'], input };
111
107
  job = await this.hubService.runJob(payload);
112
108
  if (flags.detached) {
113
- core_1.ux.stdout(`Job (${job.id}) created.`);
109
+ ux.stdout(`Job (${job.id}) created.`);
114
110
  this.exit();
115
111
  }
116
- core_1.ux.action.start(`Running Job (${job.id})`);
112
+ ux.action.start(`Running Job (${job.id})`);
117
113
  try {
118
- await (0, async_wait_until_1.waitUntil)(async () => {
114
+ await waitUntil(async () => {
119
115
  job = await this.hubService.getJobById(job.id);
120
- return job.status === api_1.ServiceJobDto.Status.Succeeded || job.status === api_1.ServiceJobDto.Status.Failed || job.status === api_1.ServiceJobDto.Status.Cancelled;
116
+ return job.status === HubPlatform.ServiceJobDto.Status.Succeeded || job.status === HubPlatform.ServiceJobDto.Status.Failed || job.status === HubPlatform.ServiceJobDto.Status.Cancelled;
121
117
  }, {
122
118
  intervalBetweenAttempts: 5000, // every 5 seconds
123
119
  timeout: 10 * 60 * 1000, // 10 minute timeout
@@ -126,30 +122,29 @@ class Run extends command_1.AuthenticatedCommand {
126
122
  catch {
127
123
  // ignore wait until next attempt
128
124
  }
129
- const basePath = this.userConfig.endpoint?.basePath || user_config_1.defaultBasePath;
125
+ const basePath = this.userConfig.endpoint?.basePath || defaultBasePath;
130
126
  const jobDetailsLink = `${basePath}/service-jobs/${job.id}`;
131
127
  switch (job.status) {
132
- case api_1.ServiceJobDto.Status.Cancelled: {
133
- core_1.ux.action.stop('Job canceled.');
134
- core_1.ux.stdout(`See details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
128
+ case HubPlatform.ServiceJobDto.Status.Cancelled: {
129
+ ux.action.stop('Job canceled.');
130
+ ux.stdout(`See details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
135
131
  break;
136
132
  }
137
- case api_1.ServiceJobDto.Status.Failed: {
138
- core_1.ux.action.stop('Job failed.');
139
- core_1.ux.stdout(`See details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
133
+ case HubPlatform.ServiceJobDto.Status.Failed: {
134
+ ux.action.stop('Job failed.');
135
+ ux.stdout(`See details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
140
136
  break;
141
137
  }
142
- case api_1.ServiceJobDto.Status.Succeeded: {
143
- core_1.ux.action.stop('Job succeeded.');
144
- core_1.ux.stdout(`See result at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
138
+ case HubPlatform.ServiceJobDto.Status.Succeeded: {
139
+ ux.action.stop('Job succeeded.');
140
+ ux.stdout(`See result at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
145
141
  break;
146
142
  }
147
143
  default: {
148
- core_1.ux.action.stop('Timeout polling status.');
149
- core_1.ux.stdout(`See status details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
144
+ ux.action.stop('Timeout polling status.');
145
+ ux.stdout(`See status details at \u001B]8;;${jobDetailsLink}\u0007${jobDetailsLink}\u001B]8;;\u0007\``);
150
146
  }
151
147
  }
152
148
  this.exit();
153
149
  }
154
150
  }
155
- exports.default = Run;
@@ -1,12 +1,12 @@
1
- import { AbstractCommand } from '../../model/command';
1
+ import { AbstractCommand } from '../../model/command.js';
2
2
  export default class Serve extends AbstractCommand {
3
3
  static CONTAINER_NAME: string;
4
4
  static IMAGE: string;
5
5
  static description: string;
6
6
  static examples: string[];
7
7
  static flags: {
8
- port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
- log_level: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ port: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ log_level: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  private isProjectSupported;