@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,15 +1,10 @@
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 node_fs_1 = __importDefault(require("node:fs"));
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const command_1 = require("../../model/command");
11
- const platform_1 = require("@quantum-hub/qhub-api/dist/api/platform");
12
- class DatapoolUpload extends command_1.AuthenticatedCommand {
1
+ import { input, select } from '@inquirer/prompts';
2
+ import { Flags, ux } from '@oclif/core';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { AuthenticatedCommand } from '../../model/command.js';
6
+ import { HubPlatformClient, HubPlatformError } from "@quantum-hub/qhub-api/platform";
7
+ export default class DatapoolUpload extends AuthenticatedCommand {
13
8
  static description = 'Upload files to a data pool';
14
9
  static examples = [
15
10
  '$ qhubctl datapool upload --file ./data/dataset.csv',
@@ -17,13 +12,13 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
17
12
  '$ qhubctl datapool upload -f ./data/dataset.csv -f ./data/metadata.json --datapool-id 550e8400-e29b-41d4-a716-446655440000',
18
13
  ];
19
14
  static flags = {
20
- file: core_1.Flags.string({
15
+ file: Flags.string({
21
16
  char: 'f',
22
17
  description: 'Path to a file to upload (can be specified multiple times)',
23
18
  required: true,
24
19
  multiple: true,
25
20
  }),
26
- 'datapool-id': core_1.Flags.string({
21
+ 'datapool-id': Flags.string({
27
22
  char: 'd',
28
23
  description: 'ID of the data pool to upload the files to (optional - will prompt to create a new one if not provided)',
29
24
  required: false,
@@ -39,7 +34,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
39
34
  ? `${this.userConfig.endpoint.basePath}/qc-catalog`
40
35
  : undefined; // Will use the default environment if no custom endpoint is set
41
36
  const apiKey = this.userConfig.auth?.value;
42
- this.hubPlatformClient = new platform_1.HubPlatformClient({
37
+ this.hubPlatformClient = new HubPlatformClient({
43
38
  baseUrl: baseUrl,
44
39
  apiKey: apiKey,
45
40
  organizationId: this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined,
@@ -53,20 +48,20 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
53
48
  // Handle datapool ID - check if exists or prompt to create
54
49
  datapoolId = await this.ensureDatapoolExists(datapoolId, filePaths);
55
50
  for (const filePath of filePaths) {
56
- const fileName = node_path_1.default.basename(filePath);
57
- core_1.ux.action.start(`Uploading ${fileName} to data pool ${datapoolId}`);
51
+ const fileName = path.basename(filePath);
52
+ ux.action.start(`Uploading ${fileName} to data pool ${datapoolId}`);
58
53
  await this.uploadToDatapool(datapoolId, filePath);
59
54
  }
60
55
  }
61
56
  ensureFilesExist(filePaths) {
62
57
  // Validate files exist
63
58
  for (const filePath of filePaths) {
64
- if (!node_fs_1.default.existsSync(filePath)) {
59
+ if (!fs.existsSync(filePath)) {
65
60
  this.error(`File not found: ${filePath}`);
66
61
  }
67
62
  // Check if file is readable
68
63
  try {
69
- node_fs_1.default.accessSync(filePath, node_fs_1.default.constants.R_OK);
64
+ fs.accessSync(filePath, fs.constants.R_OK);
70
65
  }
71
66
  catch {
72
67
  this.error(`Cannot read file: ${filePath}`);
@@ -85,7 +80,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
85
80
  return datapoolId;
86
81
  }
87
82
  catch (error) {
88
- if (error instanceof platform_1.HubPlatformError && error.statusCode === 404) {
83
+ if (error instanceof HubPlatformError && error.statusCode === 404) {
89
84
  this.log(`Data pool ${datapoolId} not found. Would you like to create a new data pool instead?`);
90
85
  return await this.createOrSelectDataPool(filePaths);
91
86
  }
@@ -116,7 +111,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
116
111
  return 'create';
117
112
  }
118
113
  // Offer choice between creating new or selecting existing using select prompt
119
- return await (0, prompts_1.select)({
114
+ return await select({
120
115
  message: 'What would you like to do?',
121
116
  choices: [
122
117
  { name: 'Create a new data pool', value: 'create' },
@@ -145,7 +140,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
145
140
  dataPools.forEach((pool, index) => {
146
141
  this.log(`${index + 1}. ${pool.name} (${pool.id})`);
147
142
  });
148
- const selection = await (0, prompts_1.input)({
143
+ const selection = await input({
149
144
  message: `Select a data pool (1-${dataPools.length}) or enter the ID directly:`,
150
145
  });
151
146
  // Check if it's a number (index selection)
@@ -162,7 +157,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
162
157
  }
163
158
  async createDatapool(suggestedName) {
164
159
  try {
165
- const name = await (0, prompts_1.input)({
160
+ const name = await input({
166
161
  message: 'Enter a name for the new data pool:',
167
162
  default: `Data Pool for ${suggestedName}`,
168
163
  });
@@ -173,7 +168,7 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
173
168
  return datapool.id;
174
169
  }
175
170
  catch (error) {
176
- if (error instanceof platform_1.HubPlatformError) {
171
+ if (error instanceof HubPlatformError) {
177
172
  const errorMessage = error.body || error.message || 'Unknown API error occurred';
178
173
  this.error(`Failed to create data pool (HTTP ${error.statusCode}): ${JSON.stringify(errorMessage)}`);
179
174
  }
@@ -184,11 +179,11 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
184
179
  }
185
180
  }
186
181
  async uploadToDatapool(datapoolId, filePath) {
187
- const fileName = node_path_1.default.basename(filePath);
182
+ const fileName = path.basename(filePath);
188
183
  try {
189
- const fileStream = node_fs_1.default.createReadStream(filePath);
184
+ const fileStream = fs.createReadStream(filePath);
190
185
  const result = await this.hubPlatformClient.dataPools.addDataPoolFile({ "id": datapoolId, file: fileStream });
191
- core_1.ux.action.stop('✓');
186
+ ux.action.stop('✓');
192
187
  this.log(`Successfully uploaded ${fileName} to data pool ${datapoolId}`);
193
188
  this.log(`File ID: ${result.id}`);
194
189
  }
@@ -197,8 +192,8 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
197
192
  }
198
193
  }
199
194
  handleError(error, datapoolId) {
200
- core_1.ux.action.stop('✗');
201
- if (error instanceof platform_1.HubPlatformError) {
195
+ ux.action.stop('✗');
196
+ if (error instanceof HubPlatformError) {
202
197
  const statusCode = error.statusCode ?? 500; // Default to 500 if statusCode is not set
203
198
  let errorMessage = 'Unknown API error occurred';
204
199
  if (error.body) {
@@ -263,4 +258,3 @@ class DatapoolUpload extends command_1.AuthenticatedCommand {
263
258
  }
264
259
  }
265
260
  }
266
- exports.default = DatapoolUpload;
@@ -1,4 +1,4 @@
1
- import { AuthenticatedCommand } from '../../model/command';
1
+ import { AuthenticatedCommand } from '../../model/command.js';
2
2
  export default class GetContext extends AuthenticatedCommand {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("../../model/command");
4
- class GetContext extends command_1.AuthenticatedCommand {
1
+ import { AuthenticatedCommand } from '../../model/command.js';
2
+ export default class GetContext extends AuthenticatedCommand {
5
3
  static description = 'Get the current context, i.e., the personal or organization account you are currently working with.';
6
4
  static examples = [
7
5
  '$ qhubctl get-context',
@@ -10,4 +8,3 @@ class GetContext extends command_1.AuthenticatedCommand {
10
8
  // printing the current context is done by parent 'init' method
11
9
  }
12
10
  }
13
- exports.default = GetContext;
@@ -1,10 +1,10 @@
1
- import { AbstractCommand } from '../../model/command';
1
+ import { AbstractCommand } from '../../model/command.js';
2
2
  export default class Init extends AbstractCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
- name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'non-interactive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
8
  };
9
9
  run(): Promise<void>;
10
10
  }
@@ -1,25 +1,20 @@
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 fs_extra_1 = __importDefault(require("fs-extra"));
8
- const node_path_1 = __importDefault(require("node:path"));
9
- const init_user_input_1 = require("../../lib/init-user-input");
10
- const random_name_1 = require("../../lib/random-name");
11
- const repository_1 = require("../../lib/repository");
12
- const command_1 = require("../../model/command");
13
- const managed_service_config_1 = require("../../model/managed-service-config");
14
- const service_config_service_1 = require("../../service/service-config-service");
15
- class Init extends command_1.AbstractCommand {
1
+ import { Flags, ux } from '@oclif/core';
2
+ import fs from 'fs-extra';
3
+ import path from 'node:path';
4
+ import { DEFAULT_STARTER, promptUserInput } from '../../lib/init-user-input.js';
5
+ import { randomName } from '../../lib/random-name.js';
6
+ import { downloadRepository, extractStarter } from '../../lib/repository.js';
7
+ import { AbstractCommand } from '../../model/command.js';
8
+ import { Runtime } from '../../model/managed-service-config.js';
9
+ import { writeServiceConfig } from '../../service/service-config-service.js';
10
+ export default class Init extends AbstractCommand {
16
11
  static description = 'Bootstrap project to create a service.';
17
12
  static examples = [
18
13
  '$ qhubctl init',
19
14
  ];
20
15
  static flags = {
21
- name: core_1.Flags.string({ description: 'The name of the service', required: false }),
22
- 'non-interactive': core_1.Flags.boolean({
16
+ name: Flags.string({ description: 'The name of the service', required: false }),
17
+ 'non-interactive': Flags.boolean({
23
18
  description: 'Run it in non-interactive mode',
24
19
  required: false,
25
20
  }),
@@ -27,21 +22,21 @@ class Init extends command_1.AbstractCommand {
27
22
  async run() {
28
23
  const { flags } = await this.parse(Init);
29
24
  const nonInteractive = flags['non-interactive'];
30
- let name = flags.name ?? (0, random_name_1.randomName)();
25
+ let name = flags.name ?? randomName();
31
26
  const input = nonInteractive ? {
32
27
  cpu: 1,
33
28
  descriptionFile: 'README.md',
34
29
  gpu: undefined,
35
30
  memory: 1,
36
31
  name: name,
37
- starter: init_user_input_1.DEFAULT_STARTER,
38
- } : await (0, init_user_input_1.promptUserInput)(name);
32
+ starter: DEFAULT_STARTER,
33
+ } : await promptUserInput(name);
39
34
  name = input.name || name;
40
35
  // use current directory if no template is selected
41
- const targetDirectory = input.starter ? node_path_1.default.join(process.cwd(), name) : node_path_1.default.join(process.cwd());
36
+ const targetDirectory = input.starter ? path.join(process.cwd(), name) : path.join(process.cwd());
42
37
  // exit if the target directory already exists (only if a starter is selected)
43
- if (input.starter && fs_extra_1.default.existsSync(targetDirectory)) {
44
- core_1.ux.error(`Destination ${targetDirectory} already exists. Please choose another name.`);
38
+ if (input.starter && fs.existsSync(targetDirectory)) {
39
+ ux.error(`Destination ${targetDirectory} already exists. Please choose another name.`);
45
40
  }
46
41
  const serviceConfig = {
47
42
  name,
@@ -50,7 +45,7 @@ class Init extends command_1.AbstractCommand {
50
45
  cpu: input.cpu,
51
46
  memory: input.memory,
52
47
  },
53
- runtime: input.starter ? input.starter.runtime : managed_service_config_1.Runtime.PYTHON_TEMPLATE,
48
+ runtime: input.starter ? input.starter.runtime : Runtime.PYTHON_TEMPLATE,
54
49
  };
55
50
  if (input.gpu) {
56
51
  serviceConfig.resources.gpu = {
@@ -60,22 +55,21 @@ class Init extends command_1.AbstractCommand {
60
55
  }
61
56
  // make sure the target directory exists if a starter is selected
62
57
  if (input.starter) {
63
- fs_extra_1.default.mkdirSync(targetDirectory);
58
+ fs.mkdirSync(targetDirectory);
64
59
  }
65
- (0, service_config_service_1.writeServiceConfig)(targetDirectory, serviceConfig);
60
+ writeServiceConfig(targetDirectory, serviceConfig);
66
61
  if (input.starter) {
67
- const zip = await (0, repository_1.downloadRepository)(input.starter.url);
68
- const starterName = node_path_1.default.basename(input.starter.url, '.zip');
69
- (0, repository_1.extractStarter)(zip, starterName, targetDirectory);
62
+ const zip = await downloadRepository(input.starter.url);
63
+ const starterName = path.basename(input.starter.url, '.zip');
64
+ extractStarter(zip, starterName, targetDirectory);
70
65
  }
71
- core_1.ux.stdout('\u{1F389} Initialized project. Happy hacking!');
66
+ ux.stdout('\u{1F389} Initialized project. Happy hacking!');
72
67
  if (input.starter) {
73
- core_1.ux.stdout('\n Next steps:');
74
- core_1.ux.stdout(` \u{2022} cd ${name}`);
75
- core_1.ux.stdout(' \u{2022} qhubctl up (deploys your code as a service to Kipu Quantum Hub)');
76
- core_1.ux.stdout(' \u{2022} qhubclt run (executes your service using the data from the input directory)');
68
+ ux.stdout('\n Next steps:');
69
+ ux.stdout(` \u{2022} cd ${name}`);
70
+ ux.stdout(' \u{2022} qhubctl up (deploys your code as a service to Kipu Quantum Hub)');
71
+ ux.stdout(' \u{2022} qhubclt run (executes your service using the data from the input directory)');
77
72
  }
78
- core_1.ux.stdout('');
73
+ ux.stdout('');
79
74
  }
80
75
  }
81
- exports.default = Init;
@@ -1,5 +1,5 @@
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 ListContexts extends AuthenticatedCommand {
4
4
  static description: string;
5
5
  static examples: string[];
@@ -1,13 +1,8 @@
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 tty_table_1 = __importDefault(require("tty-table"));
8
- const command_1 = require("../../model/command");
9
- const quantum_hub_service_1 = __importDefault(require("../../service/quantum-hub-service"));
10
- class ListContexts extends command_1.AuthenticatedCommand {
1
+ import { ux } from '@oclif/core';
2
+ import Table from 'tty-table';
3
+ import { AuthenticatedCommand } from '../../model/command.js';
4
+ import QuantumHubService from '../../service/quantum-hub-service.js';
5
+ export default class ListContexts extends AuthenticatedCommand {
11
6
  static description = 'Retrieves the available contexts, i.e., the personal or organizational accounts available to you to work with.';
12
7
  static examples = [
13
8
  '$ qhubctl list-contexts',
@@ -15,12 +10,12 @@ class ListContexts extends command_1.AuthenticatedCommand {
15
10
  quantumHubService;
16
11
  async init() {
17
12
  await super.init();
18
- this.quantumHubService = new quantum_hub_service_1.default(this, this.config, this.userConfig);
13
+ this.quantumHubService = new QuantumHubService(this, this.config, this.userConfig);
19
14
  }
20
15
  async run() {
21
- core_1.ux.action.start('Loading available contexts');
16
+ ux.action.start('Loading available contexts');
22
17
  const accounts = await this.quantumHubService.getAccounts();
23
- core_1.ux.action.stop('Done');
18
+ ux.action.stop('Done');
24
19
  const tableData = accounts
25
20
  .map(account => ({ displayName: account.displayName, id: account.id, isOrganization: account.isOrganization }));
26
21
  const header = [
@@ -28,9 +23,8 @@ class ListContexts extends command_1.AuthenticatedCommand {
28
23
  { value: "id", alias: "ID", align: "left" },
29
24
  { value: "isOrganization", alias: "Account", width: 14, formatter: (value) => value ? "Organization" : "Personal" },
30
25
  ];
31
- const t = (0, tty_table_1.default)(header, tableData);
32
- core_1.ux.stdout(t.render());
33
- core_1.ux.stdout();
26
+ const t = Table(header, tableData);
27
+ ux.stdout(t.render());
28
+ ux.stdout();
34
29
  }
35
30
  }
36
- exports.default = ListContexts;
@@ -1,10 +1,10 @@
1
- import { AbstractCommand } from '../../model/command';
1
+ import { AbstractCommand } from '../../model/command.js';
2
2
  export default class Login extends AbstractCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
- token: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- 'base-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'base-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  run(): Promise<void>;
10
10
  }
@@ -1,30 +1,25 @@
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 command_1 = require("../../model/command");
9
- const user_config_1 = require("../../model/user-config");
10
- const auth_service_1 = __importDefault(require("../../service/auth-service"));
11
- const user_config_service_1 = require("../../service/user-config-service");
12
- class Login extends command_1.AbstractCommand {
1
+ import { password } from '@inquirer/prompts';
2
+ import { Flags, ux } from '@oclif/core';
3
+ import { AbstractCommand } from '../../model/command.js';
4
+ import { AuthType, defaultBasePath } from '../../model/user-config.js';
5
+ import AuthService from '../../service/auth-service.js';
6
+ import { writeUserConfig } from '../../service/user-config-service.js';
7
+ export default class Login extends AbstractCommand {
13
8
  static description = 'Login with your credentials';
14
9
  static examples = [
15
10
  '$ qhubctl login -t <personal access token>',
16
- `$ qhubctl login -t <personal access token> --base-path ${user_config_1.defaultBasePath}`,
11
+ `$ qhubctl login -t <personal access token> --base-path ${defaultBasePath}`,
17
12
  ];
18
13
  static flags = {
19
- token: core_1.Flags.string({ char: 't', description: 'Your personal access token', required: false }),
20
- 'base-path': core_1.Flags.string({ description: 'Custom base path for authentication (development)', required: false }),
14
+ token: Flags.string({ char: 't', description: 'Your personal access token', required: false }),
15
+ 'base-path': Flags.string({ description: 'Custom base path for authentication (development)', required: false }),
21
16
  };
22
17
  async run() {
23
18
  const { flags } = await this.parse(Login);
24
19
  let { token } = flags;
25
20
  const { 'base-path': basePath } = flags;
26
21
  if (!token) {
27
- token = await (0, prompts_1.password)({ message: 'Enter or paste your personal access token?', mask: true });
22
+ token = await password({ message: 'Enter or paste your personal access token?', mask: true });
28
23
  }
29
24
  if (!token) {
30
25
  throw new Error('Invalid credentials. Please try again.');
@@ -33,7 +28,7 @@ class Login extends command_1.AbstractCommand {
33
28
  if (basePath) {
34
29
  this.showCustomBasePathWarning();
35
30
  }
36
- core_1.ux.action.start('Login');
31
+ ux.action.start('Login');
37
32
  // Create temporary config with custom basePath for authentication
38
33
  const tempUserConfig = basePath ? {
39
34
  ...this.userConfig,
@@ -42,11 +37,11 @@ class Login extends command_1.AbstractCommand {
42
37
  defaultHeaders: this.userConfig.endpoint?.defaultHeaders || {}
43
38
  }
44
39
  } : this.userConfig;
45
- const user = await new auth_service_1.default(tempUserConfig).authenticate(token);
40
+ const user = await new AuthService(tempUserConfig).authenticate(token);
46
41
  const userConfig = {
47
42
  ...this.userConfig,
48
43
  auth: {
49
- type: user_config_1.AuthType.API_KEY,
44
+ type: AuthType.API_KEY,
50
45
  value: token,
51
46
  },
52
47
  context: {
@@ -61,8 +56,7 @@ class Login extends command_1.AbstractCommand {
61
56
  }
62
57
  })
63
58
  };
64
- (0, user_config_service_1.writeUserConfig)(this.config.configDir, userConfig);
65
- core_1.ux.action.stop('successful');
59
+ writeUserConfig(this.config.configDir, userConfig);
60
+ ux.action.stop('successful');
66
61
  }
67
62
  }
68
- exports.default = Login;
@@ -1,4 +1,4 @@
1
- import { AbstractCommand } from '../../model/command';
1
+ import { AbstractCommand } from '../../model/command.js';
2
2
  export default class Logout extends AbstractCommand {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const command_1 = require("../../model/command");
5
- const user_config_service_1 = require("../../service/user-config-service");
6
- class Logout extends command_1.AbstractCommand {
1
+ import { ux } from '@oclif/core';
2
+ import { AbstractCommand } from '../../model/command.js';
3
+ import { writeUserConfig } from '../../service/user-config-service.js';
4
+ export default class Logout extends AbstractCommand {
7
5
  static description = 'Logout';
8
6
  static examples = [
9
7
  '$ qhubctl logout',
10
8
  ];
11
9
  async run() {
12
- core_1.ux.action.start('Logout');
13
- (0, user_config_service_1.writeUserConfig)(this.config.configDir, {
10
+ ux.action.start('Logout');
11
+ writeUserConfig(this.config.configDir, {
14
12
  ...this.userConfig,
15
13
  auth: undefined,
16
14
  context: undefined,
17
15
  });
18
- core_1.ux.action.stop('successful');
16
+ ux.action.stop('successful');
19
17
  }
20
18
  }
21
- exports.default = Logout;
@@ -1,14 +1,14 @@
1
- import { AbstractCommand } from '../../model/command';
1
+ import { AbstractCommand } from '../../model/command.js';
2
2
  export default class Openapi extends AbstractCommand {
3
3
  static readonly description: string;
4
4
  static readonly examples: string[];
5
5
  static readonly flags: {
6
- force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
- file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- format: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
- entrypoint: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
- package: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- method: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ entrypoint: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ package: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ method: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
12
  };
13
13
  run(): Promise<void>;
14
14
  private getErrorMessage;