@quantum-hub/qhubctl 1.0.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.
Files changed (270) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/dev.js +15 -0
  5. package/bin/run.cmd +3 -0
  6. package/bin/run.js +12 -0
  7. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.d.ts +89 -0
  8. package/dist/client/kqh/apis/ServicePlatformApplicationsApi.js +259 -0
  9. package/dist/client/kqh/apis/ServicePlatformDashboardApi.d.ts +44 -0
  10. package/dist/client/kqh/apis/ServicePlatformDashboardApi.js +143 -0
  11. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.d.ts +133 -0
  12. package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.js +410 -0
  13. package/dist/client/kqh/apis/ServicePlatformJobsApi.d.ts +101 -0
  14. package/dist/client/kqh/apis/ServicePlatformJobsApi.js +298 -0
  15. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.d.ts +48 -0
  16. package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.js +152 -0
  17. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.d.ts +29 -0
  18. package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.js +90 -0
  19. package/dist/client/kqh/apis/ServicePlatformServicesApi.d.ts +501 -0
  20. package/dist/client/kqh/apis/ServicePlatformServicesApi.js +1509 -0
  21. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.d.ts +66 -0
  22. package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.js +194 -0
  23. package/dist/client/kqh/apis/TaxonomiesApi.d.ts +90 -0
  24. package/dist/client/kqh/apis/TaxonomiesApi.js +309 -0
  25. package/dist/client/kqh/apis/index.d.ts +9 -0
  26. package/dist/client/kqh/apis/index.js +27 -0
  27. package/dist/client/kqh/index.d.ts +3 -0
  28. package/dist/client/kqh/index.js +21 -0
  29. package/dist/client/kqh/models/AccessTokenDto.d.ts +81 -0
  30. package/dist/client/kqh/models/AccessTokenDto.js +66 -0
  31. package/dist/client/kqh/models/AmountMajorDto.d.ts +37 -0
  32. package/dist/client/kqh/models/AmountMajorDto.js +46 -0
  33. package/dist/client/kqh/models/ApiDto.d.ts +144 -0
  34. package/dist/client/kqh/models/ApiDto.js +99 -0
  35. package/dist/client/kqh/models/ApiOverviewDto.d.ts +119 -0
  36. package/dist/client/kqh/models/ApiOverviewDto.js +90 -0
  37. package/dist/client/kqh/models/ApplicationDto.d.ts +64 -0
  38. package/dist/client/kqh/models/ApplicationDto.js +60 -0
  39. package/dist/client/kqh/models/BuildJobDto.d.ts +75 -0
  40. package/dist/client/kqh/models/BuildJobDto.js +71 -0
  41. package/dist/client/kqh/models/CpuConfiguration.d.ts +38 -0
  42. package/dist/client/kqh/models/CpuConfiguration.js +49 -0
  43. package/dist/client/kqh/models/CreateApplicationRequest.d.ts +31 -0
  44. package/dist/client/kqh/models/CreateApplicationRequest.js +44 -0
  45. package/dist/client/kqh/models/CreateDataPoolRequest.d.ts +31 -0
  46. package/dist/client/kqh/models/CreateDataPoolRequest.js +46 -0
  47. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.d.ts +46 -0
  48. package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.js +57 -0
  49. package/dist/client/kqh/models/CreateJobRequest.d.ts +62 -0
  50. package/dist/client/kqh/models/CreateJobRequest.js +57 -0
  51. package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.d.ts +73 -0
  52. package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.js +79 -0
  53. package/dist/client/kqh/models/CreateProductRequest.d.ts +43 -0
  54. package/dist/client/kqh/models/CreateProductRequest.js +52 -0
  55. package/dist/client/kqh/models/CreateSubscriptionRequest.d.ts +37 -0
  56. package/dist/client/kqh/models/CreateSubscriptionRequest.js +50 -0
  57. package/dist/client/kqh/models/CreateWorkflowServiceRequest.d.ts +37 -0
  58. package/dist/client/kqh/models/CreateWorkflowServiceRequest.js +48 -0
  59. package/dist/client/kqh/models/DataPoolDto.d.ts +166 -0
  60. package/dist/client/kqh/models/DataPoolDto.js +105 -0
  61. package/dist/client/kqh/models/DataPoolRef.d.ts +43 -0
  62. package/dist/client/kqh/models/DataPoolRef.js +48 -0
  63. package/dist/client/kqh/models/DataSourceDescriptorDto.d.ts +89 -0
  64. package/dist/client/kqh/models/DataSourceDescriptorDto.js +69 -0
  65. package/dist/client/kqh/models/FileDto.d.ts +73 -0
  66. package/dist/client/kqh/models/FileDto.js +51 -0
  67. package/dist/client/kqh/models/FileSource.d.ts +26 -0
  68. package/dist/client/kqh/models/FileSource.js +34 -0
  69. package/dist/client/kqh/models/GpuConfiguration.d.ts +49 -0
  70. package/dist/client/kqh/models/GpuConfiguration.js +60 -0
  71. package/dist/client/kqh/models/JobDto.d.ts +117 -0
  72. package/dist/client/kqh/models/JobDto.js +82 -0
  73. package/dist/client/kqh/models/JobOverviewDto.d.ts +74 -0
  74. package/dist/client/kqh/models/JobOverviewDto.js +67 -0
  75. package/dist/client/kqh/models/MemoryConfiguration.d.ts +38 -0
  76. package/dist/client/kqh/models/MemoryConfiguration.js +49 -0
  77. package/dist/client/kqh/models/MeteringRequest.d.ts +43 -0
  78. package/dist/client/kqh/models/MeteringRequest.js +48 -0
  79. package/dist/client/kqh/models/MeteringResponse.d.ts +49 -0
  80. package/dist/client/kqh/models/MeteringResponse.js +50 -0
  81. package/dist/client/kqh/models/MonthAmountDto.d.ts +51 -0
  82. package/dist/client/kqh/models/MonthAmountDto.js +52 -0
  83. package/dist/client/kqh/models/OwnerDto.d.ts +67 -0
  84. package/dist/client/kqh/models/OwnerDto.js +56 -0
  85. package/dist/client/kqh/models/PageDataPoolDto.d.ts +94 -0
  86. package/dist/client/kqh/models/PageDataPoolDto.js +67 -0
  87. package/dist/client/kqh/models/PageableObject.d.ts +62 -0
  88. package/dist/client/kqh/models/PageableObject.js +55 -0
  89. package/dist/client/kqh/models/PricingPlanDto.d.ts +52 -0
  90. package/dist/client/kqh/models/PricingPlanDto.js +57 -0
  91. package/dist/client/kqh/models/ProductAmountDto.d.ts +38 -0
  92. package/dist/client/kqh/models/ProductAmountDto.js +47 -0
  93. package/dist/client/kqh/models/ProductDto.d.ts +83 -0
  94. package/dist/client/kqh/models/ProductDto.js +76 -0
  95. package/dist/client/kqh/models/ProductGroupDto.d.ts +45 -0
  96. package/dist/client/kqh/models/ProductGroupDto.js +50 -0
  97. package/dist/client/kqh/models/ProductUsageDto.d.ts +61 -0
  98. package/dist/client/kqh/models/ProductUsageDto.js +54 -0
  99. package/dist/client/kqh/models/RegistrySource.d.ts +52 -0
  100. package/dist/client/kqh/models/RegistrySource.js +55 -0
  101. package/dist/client/kqh/models/RepositorySource.d.ts +32 -0
  102. package/dist/client/kqh/models/RepositorySource.js +47 -0
  103. package/dist/client/kqh/models/ResourceConfiguration.d.ts +31 -0
  104. package/dist/client/kqh/models/ResourceConfiguration.js +58 -0
  105. package/dist/client/kqh/models/ReviewDto.d.ts +51 -0
  106. package/dist/client/kqh/models/ReviewDto.js +56 -0
  107. package/dist/client/kqh/models/RuntimeConfiguration.d.ts +53 -0
  108. package/dist/client/kqh/models/RuntimeConfiguration.js +56 -0
  109. package/dist/client/kqh/models/ServiceDefinitionCommand.d.ts +39 -0
  110. package/dist/client/kqh/models/ServiceDefinitionCommand.js +52 -0
  111. package/dist/client/kqh/models/ServiceDefinitionDto.d.ts +180 -0
  112. package/dist/client/kqh/models/ServiceDefinitionDto.js +108 -0
  113. package/dist/client/kqh/models/ServiceDefinitionDtoSource.d.ts +23 -0
  114. package/dist/client/kqh/models/ServiceDefinitionDtoSource.js +54 -0
  115. package/dist/client/kqh/models/ServiceDefinitionOverviewDto.d.ts +79 -0
  116. package/dist/client/kqh/models/ServiceDefinitionOverviewDto.js +71 -0
  117. package/dist/client/kqh/models/ServiceDto.d.ts +59 -0
  118. package/dist/client/kqh/models/ServiceDto.js +59 -0
  119. package/dist/client/kqh/models/ServiceExecutionConsumerDto.d.ts +67 -0
  120. package/dist/client/kqh/models/ServiceExecutionConsumerDto.js +64 -0
  121. package/dist/client/kqh/models/ServiceExecutionDto.d.ts +49 -0
  122. package/dist/client/kqh/models/ServiceExecutionDto.js +50 -0
  123. package/dist/client/kqh/models/ServiceOverviewDto.d.ts +115 -0
  124. package/dist/client/kqh/models/ServiceOverviewDto.js +92 -0
  125. package/dist/client/kqh/models/ServiceSource.d.ts +31 -0
  126. package/dist/client/kqh/models/ServiceSource.js +58 -0
  127. package/dist/client/kqh/models/SortObject.d.ts +43 -0
  128. package/dist/client/kqh/models/SortObject.js +48 -0
  129. package/dist/client/kqh/models/SubscriptionDto.d.ts +58 -0
  130. package/dist/client/kqh/models/SubscriptionDto.js +55 -0
  131. package/dist/client/kqh/models/TaxonomyElement.d.ts +43 -0
  132. package/dist/client/kqh/models/TaxonomyElement.js +48 -0
  133. package/dist/client/kqh/models/UpdateDataPoolRequest.d.ts +109 -0
  134. package/dist/client/kqh/models/UpdateDataPoolRequest.js +72 -0
  135. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.d.ts +23 -0
  136. package/dist/client/kqh/models/UpdateResourceConfigurationRequest.js +54 -0
  137. package/dist/client/kqh/models/UpdateVersionRequest.d.ts +44 -0
  138. package/dist/client/kqh/models/UpdateVersionRequest.js +49 -0
  139. package/dist/client/kqh/models/UpdateWorkflowServiceRequest.d.ts +31 -0
  140. package/dist/client/kqh/models/UpdateWorkflowServiceRequest.js +44 -0
  141. package/dist/client/kqh/models/ValidationResult.d.ts +52 -0
  142. package/dist/client/kqh/models/ValidationResult.js +57 -0
  143. package/dist/client/kqh/models/index.d.ts +57 -0
  144. package/dist/client/kqh/models/index.js +75 -0
  145. package/dist/client/kqh/runtime.d.ts +181 -0
  146. package/dist/client/kqh/runtime.js +340 -0
  147. package/dist/client/users/apis/AuthenticationApi.d.ts +31 -0
  148. package/dist/client/users/apis/AuthenticationApi.js +83 -0
  149. package/dist/client/users/apis/ExpertsApi.d.ts +44 -0
  150. package/dist/client/users/apis/ExpertsApi.js +112 -0
  151. package/dist/client/users/apis/SearchApi.d.ts +46 -0
  152. package/dist/client/users/apis/SearchApi.js +134 -0
  153. package/dist/client/users/apis/UserSettingsApi.d.ts +139 -0
  154. package/dist/client/users/apis/UserSettingsApi.js +417 -0
  155. package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.d.ts +64 -0
  156. package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.js +184 -0
  157. package/dist/client/users/apis/UsersApi.d.ts +70 -0
  158. package/dist/client/users/apis/UsersApi.js +170 -0
  159. package/dist/client/users/apis/index.d.ts +6 -0
  160. package/dist/client/users/apis/index.js +24 -0
  161. package/dist/client/users/index.d.ts +3 -0
  162. package/dist/client/users/index.js +21 -0
  163. package/dist/client/users/models/AccessTokenCreateRequest.d.ts +51 -0
  164. package/dist/client/users/models/AccessTokenCreateRequest.js +60 -0
  165. package/dist/client/users/models/AccessTokenDto.d.ts +75 -0
  166. package/dist/client/users/models/AccessTokenDto.js +68 -0
  167. package/dist/client/users/models/AccessTokensResponse.d.ts +38 -0
  168. package/dist/client/users/models/AccessTokensResponse.js +47 -0
  169. package/dist/client/users/models/DefaultAccessTokenResponse.d.ts +31 -0
  170. package/dist/client/users/models/DefaultAccessTokenResponse.js +44 -0
  171. package/dist/client/users/models/Language.d.ts +31 -0
  172. package/dist/client/users/models/Language.js +44 -0
  173. package/dist/client/users/models/PageUserDto.d.ts +94 -0
  174. package/dist/client/users/models/PageUserDto.js +67 -0
  175. package/dist/client/users/models/Pageable.d.ts +43 -0
  176. package/dist/client/users/models/Pageable.js +48 -0
  177. package/dist/client/users/models/PageableObject.d.ts +62 -0
  178. package/dist/client/users/models/PageableObject.js +55 -0
  179. package/dist/client/users/models/PersonalAccessTokenPrincipal.d.ts +38 -0
  180. package/dist/client/users/models/PersonalAccessTokenPrincipal.js +47 -0
  181. package/dist/client/users/models/Skill.d.ts +31 -0
  182. package/dist/client/users/models/Skill.js +44 -0
  183. package/dist/client/users/models/SortObject.d.ts +43 -0
  184. package/dist/client/users/models/SortObject.js +48 -0
  185. package/dist/client/users/models/UpdateUserRequest.d.ts +61 -0
  186. package/dist/client/users/models/UpdateUserRequest.js +54 -0
  187. package/dist/client/users/models/UserDto.d.ts +111 -0
  188. package/dist/client/users/models/UserDto.js +72 -0
  189. package/dist/client/users/models/UserOverviewDto.d.ts +67 -0
  190. package/dist/client/users/models/UserOverviewDto.js +56 -0
  191. package/dist/client/users/models/index.d.ts +14 -0
  192. package/dist/client/users/models/index.js +32 -0
  193. package/dist/client/users/runtime.d.ts +181 -0
  194. package/dist/client/users/runtime.js +340 -0
  195. package/dist/commands/compress/index.d.ts +6 -0
  196. package/dist/commands/compress/index.js +31 -0
  197. package/dist/commands/datapool/upload.d.ts +23 -0
  198. package/dist/commands/datapool/upload.js +266 -0
  199. package/dist/commands/get-context/index.d.ts +6 -0
  200. package/dist/commands/get-context/index.js +13 -0
  201. package/dist/commands/init/index.d.ts +10 -0
  202. package/dist/commands/init/index.js +81 -0
  203. package/dist/commands/list-contexts/index.d.ts +9 -0
  204. package/dist/commands/list-contexts/index.js +36 -0
  205. package/dist/commands/login/index.d.ts +10 -0
  206. package/dist/commands/login/index.js +68 -0
  207. package/dist/commands/logout/index.d.ts +6 -0
  208. package/dist/commands/logout/index.js +21 -0
  209. package/dist/commands/openapi/index.d.ts +26 -0
  210. package/dist/commands/openapi/index.js +313 -0
  211. package/dist/commands/run/index.d.ts +18 -0
  212. package/dist/commands/run/index.js +155 -0
  213. package/dist/commands/serve/index.d.ts +13 -0
  214. package/dist/commands/serve/index.js +93 -0
  215. package/dist/commands/services/index.d.ts +14 -0
  216. package/dist/commands/services/index.js +71 -0
  217. package/dist/commands/set-context/index.d.ts +17 -0
  218. package/dist/commands/set-context/index.js +69 -0
  219. package/dist/commands/up/index.d.ts +19 -0
  220. package/dist/commands/up/index.js +196 -0
  221. package/dist/index.d.ts +1 -0
  222. package/dist/index.js +4 -0
  223. package/dist/lib/command.d.ts +6 -0
  224. package/dist/lib/command.js +21 -0
  225. package/dist/lib/debug.d.ts +1 -0
  226. package/dist/lib/debug.js +5 -0
  227. package/dist/lib/entrypoint-resolver.d.ts +52 -0
  228. package/dist/lib/entrypoint-resolver.js +125 -0
  229. package/dist/lib/error.d.ts +1 -0
  230. package/dist/lib/error.js +20 -0
  231. package/dist/lib/fetch.d.ts +7 -0
  232. package/dist/lib/fetch.js +43 -0
  233. package/dist/lib/init-user-input.d.ts +18 -0
  234. package/dist/lib/init-user-input.js +87 -0
  235. package/dist/lib/random-name.d.ts +1 -0
  236. package/dist/lib/random-name.js +161 -0
  237. package/dist/lib/random-string.d.ts +1 -0
  238. package/dist/lib/random-string.js +12 -0
  239. package/dist/lib/repository.d.ts +3 -0
  240. package/dist/lib/repository.js +51 -0
  241. package/dist/lib/stream-to-blob.d.ts +2 -0
  242. package/dist/lib/stream-to-blob.js +27 -0
  243. package/dist/lib/up/get-description.d.ts +1 -0
  244. package/dist/lib/up/get-description.js +29 -0
  245. package/dist/lib/up/ignore.d.ts +1 -0
  246. package/dist/lib/up/ignore.js +21 -0
  247. package/dist/lib/up/zip.d.ts +1 -0
  248. package/dist/lib/up/zip.js +40 -0
  249. package/dist/model/account.d.ts +5 -0
  250. package/dist/model/account.js +2 -0
  251. package/dist/model/command.d.ts +12 -0
  252. package/dist/model/command.js +55 -0
  253. package/dist/model/managed-service-config.d.ts +28 -0
  254. package/dist/model/managed-service-config.js +16 -0
  255. package/dist/model/user-config.d.ts +22 -0
  256. package/dist/model/user-config.js +8 -0
  257. package/dist/service/auth-service.d.ts +9 -0
  258. package/dist/service/auth-service.js +38 -0
  259. package/dist/service/command-service.d.ts +9 -0
  260. package/dist/service/command-service.js +14 -0
  261. package/dist/service/quantum-hub-service.d.ts +24 -0
  262. package/dist/service/quantum-hub-service.js +222 -0
  263. package/dist/service/service-config-service.d.ts +3 -0
  264. package/dist/service/service-config-service.js +26 -0
  265. package/dist/service/user-config-service.d.ts +3 -0
  266. package/dist/service/user-config-service.js +26 -0
  267. package/dist/service/user-service.d.ts +9 -0
  268. package/dist/service/user-service.js +35 -0
  269. package/oclif.manifest.json +530 -0
  270. package/package.json +107 -0
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getErrorMessage = exports.fetchOrThrow = exports.PlatformError = void 0;
4
+ class PlatformError extends Error {
5
+ response;
6
+ constructor(response) {
7
+ super(response.statusText);
8
+ this.response = response;
9
+ }
10
+ async getErrorMessage() {
11
+ return (0, exports.getErrorMessage)(this.response);
12
+ }
13
+ }
14
+ exports.PlatformError = PlatformError;
15
+ const fetchOrThrow = async (input, init) => {
16
+ const response = await fetch(input, init);
17
+ if (!response.ok) {
18
+ throw new PlatformError(response);
19
+ }
20
+ return response;
21
+ };
22
+ exports.fetchOrThrow = fetchOrThrow;
23
+ const getErrorMessage = async (response) => {
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ let body;
26
+ try {
27
+ body = await response.json();
28
+ }
29
+ catch {
30
+ // ignore
31
+ }
32
+ const httpStatus = response.status && response.statusText ? `${response.status} - ${response.statusText}` : response.status;
33
+ // message is either in body.errorMessage, body.error or body.detail
34
+ let errorMessage;
35
+ if (body && body.errorMessage)
36
+ errorMessage = body.errorMessage;
37
+ if (!errorMessage && body && body.error)
38
+ errorMessage = body.error;
39
+ if (!errorMessage && body && body.detail)
40
+ errorMessage = body.detail;
41
+ return errorMessage ? `${errorMessage} (${httpStatus})` : `${httpStatus}`;
42
+ };
43
+ exports.getErrorMessage = getErrorMessage;
@@ -0,0 +1,18 @@
1
+ import { GpuType, Runtime } from '../model/managed-service-config';
2
+ export interface StarterInput {
3
+ url: string;
4
+ runtime: Runtime;
5
+ }
6
+ export interface UserInput {
7
+ cpu: number;
8
+ descriptionFile?: string;
9
+ gpu?: GpuType;
10
+ memory: number;
11
+ name: string;
12
+ starter?: StarterInput;
13
+ }
14
+ export declare const DEFAULT_STARTER: {
15
+ url: string;
16
+ runtime: Runtime;
17
+ };
18
+ export declare const promptUserInput: (defaultName: string) => Promise<UserInput>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promptUserInput = exports.DEFAULT_STARTER = void 0;
4
+ const prompts_1 = require("@inquirer/prompts");
5
+ const managed_service_config_1 = require("../model/managed-service-config");
6
+ exports.DEFAULT_STARTER = {
7
+ url: 'https://gitlab.com/planqk-foss/planqk-starter-python/-/archive/main/planqk-starter-python-main.zip',
8
+ runtime: managed_service_config_1.Runtime.PYTHON_TEMPLATE
9
+ };
10
+ const promptUserInput = async (defaultName) => {
11
+ const name = await (0, prompts_1.input)({
12
+ message: `Service name (${defaultName}):`,
13
+ default: defaultName,
14
+ });
15
+ const starter = await (0, prompts_1.select)({
16
+ message: 'Choose a starter template',
17
+ choices: [
18
+ {
19
+ name: 'Python Starter (recommended to get started quickly)',
20
+ value: exports.DEFAULT_STARTER,
21
+ },
22
+ {
23
+ name: 'Docker Starter (setup for experienced users)',
24
+ value: {
25
+ url: 'https://gitlab.com/planqk-foss/planqk-starter-docker/-/archive/main/planqk-starter-docker-main.zip',
26
+ runtime: managed_service_config_1.Runtime.DOCKER
27
+ },
28
+ },
29
+ {
30
+ name: 'NVIDIA CUDA-Q Starter (for GPU accelerated applications; setup for experienced users)',
31
+ value: {
32
+ url: 'https://gitlab.com/planqk-foss/planqk-starter-gpu/-/archive/main/planqk-starter-gpu-main.zip',
33
+ runtime: managed_service_config_1.Runtime.DOCKER
34
+ },
35
+ },
36
+ { name: 'None (creates "qhub.json" in current directory)', value: undefined },
37
+ ],
38
+ default: exports.DEFAULT_STARTER,
39
+ });
40
+ const cpu = await (0, prompts_1.number)({
41
+ message: 'Enter vCPU configuration (may be between 1 and 220 vCPUs, depending on your account):',
42
+ default: 1,
43
+ validate: (input) => {
44
+ if (input === null || input === undefined || !Number.isInteger(input)) {
45
+ return 'Please enter a valid integer';
46
+ }
47
+ if (input < 1 || input > 220) {
48
+ return 'vCPU must be between 1 and 220';
49
+ }
50
+ return true;
51
+ },
52
+ });
53
+ const memory = await (0, prompts_1.number)({
54
+ message: 'Enter memory configuration in GB (may be between 1 and 848 GBs, depending on your account):',
55
+ default: 1,
56
+ validate: (input) => {
57
+ if (input === null || input === undefined || !Number.isInteger(input)) {
58
+ return 'Please enter a valid integer';
59
+ }
60
+ if (input < 1 || input > 848) {
61
+ return 'Memory must be between 1 and 848 GB';
62
+ }
63
+ return true;
64
+ },
65
+ });
66
+ let gpu = undefined;
67
+ if (!starter || starter.url.includes('planqk-starter-gpu')) {
68
+ gpu = await (0, prompts_1.select)({
69
+ message: 'Choose your GPU configuration',
70
+ choices: [
71
+ { name: 'No GPU support', value: undefined },
72
+ { name: 'NVIDIA® T4', value: managed_service_config_1.GpuType.NVIDIA_TESLA_T4 },
73
+ { name: 'NVIDIA® V100', value: managed_service_config_1.GpuType.NVIDIA_TESLA_V100 },
74
+ ],
75
+ default: undefined,
76
+ });
77
+ }
78
+ return {
79
+ name,
80
+ starter,
81
+ cpu: cpu,
82
+ memory: memory,
83
+ gpu,
84
+ descriptionFile: 'README.md',
85
+ };
86
+ };
87
+ exports.promptUserInput = promptUserInput;
@@ -0,0 +1 @@
1
+ export declare const randomName: () => string;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomName = void 0;
4
+ const randomName = () => {
5
+ const suffix = Math.random().toString(36).slice(2, 7);
6
+ const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
7
+ const randomAnimal = animals[Math.floor(Math.random() * animals.length)];
8
+ return `${randomAdjective}-${randomAnimal}-${suffix}`;
9
+ };
10
+ exports.randomName = randomName;
11
+ const adjectives = [
12
+ 'admiring',
13
+ 'adoring',
14
+ 'agile',
15
+ 'ambitious',
16
+ 'blissful',
17
+ 'bold',
18
+ 'brave',
19
+ 'brilliant',
20
+ 'calm',
21
+ 'charming',
22
+ 'cozy',
23
+ 'creative',
24
+ 'curious',
25
+ 'dazzling',
26
+ 'delightful',
27
+ 'diligent',
28
+ 'dynamic',
29
+ 'eager',
30
+ 'efficient',
31
+ 'elegant',
32
+ 'fantastic',
33
+ 'fierce',
34
+ 'fluffy',
35
+ 'focused',
36
+ 'generous',
37
+ 'gentle',
38
+ 'gloomy',
39
+ 'graceful',
40
+ 'harmonious',
41
+ 'honest',
42
+ 'innovative',
43
+ 'intelligent',
44
+ 'jolly',
45
+ 'joyful',
46
+ 'jubilant',
47
+ 'kind',
48
+ 'lively',
49
+ 'luminous',
50
+ 'magnificent',
51
+ 'misty',
52
+ 'noble',
53
+ 'optimistic',
54
+ 'peaceful',
55
+ 'precious',
56
+ 'quiet',
57
+ 'radiant',
58
+ 'resilient',
59
+ 'serene',
60
+ 'silly',
61
+ 'trustworthy',
62
+ 'unique',
63
+ 'vibrant',
64
+ 'wise',
65
+ 'xenial',
66
+ 'youthful',
67
+ 'zealous',
68
+ ];
69
+ const animals = [
70
+ 'aardvark',
71
+ 'alpaca',
72
+ 'anaconda',
73
+ 'antelope',
74
+ 'armadillo',
75
+ 'baboon',
76
+ 'badger',
77
+ 'bat',
78
+ 'bear',
79
+ 'beaver',
80
+ 'bison',
81
+ 'boar',
82
+ 'buffalo',
83
+ 'camel',
84
+ 'cat',
85
+ 'cheetah',
86
+ 'chimpanzee',
87
+ 'chinchilla',
88
+ 'cobra',
89
+ 'cougar',
90
+ 'coyote',
91
+ 'crocodile',
92
+ 'deer',
93
+ 'dingo',
94
+ 'dog',
95
+ 'dolphin',
96
+ 'donkey',
97
+ 'eagle',
98
+ 'elephant',
99
+ 'elk',
100
+ 'falcon',
101
+ 'ferret',
102
+ 'flamingo',
103
+ 'fox',
104
+ 'gazelle',
105
+ 'giraffe',
106
+ 'goat',
107
+ 'gorilla',
108
+ 'grizzly bear',
109
+ 'hamster',
110
+ 'hedgehog',
111
+ 'hippopotamus',
112
+ 'horse',
113
+ 'hummingbird',
114
+ 'hyena',
115
+ 'iguana',
116
+ 'jackal',
117
+ 'jaguar',
118
+ 'kangaroo',
119
+ 'koala',
120
+ 'lemur',
121
+ 'leopard',
122
+ 'lion',
123
+ 'llama',
124
+ 'lynx',
125
+ 'mantis',
126
+ 'marmot',
127
+ 'mongoose',
128
+ 'moose',
129
+ 'narwhal',
130
+ 'octopus',
131
+ 'orangutan',
132
+ 'ostrich',
133
+ 'otter',
134
+ 'panda',
135
+ 'panther',
136
+ 'peacock',
137
+ 'penguin',
138
+ 'platypus',
139
+ 'puma',
140
+ 'quail',
141
+ 'rabbit',
142
+ 'raccoon',
143
+ 'raven',
144
+ 'rhinoceros',
145
+ 'salamander',
146
+ 'seal',
147
+ 'shark',
148
+ 'skunk',
149
+ 'sloth',
150
+ 'squirrel',
151
+ 'tapir',
152
+ 'tiger',
153
+ 'turtle',
154
+ 'viper',
155
+ 'walrus',
156
+ 'whale',
157
+ 'wombat',
158
+ 'wolverine',
159
+ 'yak',
160
+ 'zebra',
161
+ ];
@@ -0,0 +1 @@
1
+ export declare const randomString: (length: number) => string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomString = void 0;
4
+ const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
5
+ const randomString = (length) => {
6
+ let value = '';
7
+ for (let i = 0; i < length; i++) {
8
+ value += characters.charAt(Math.floor(Math.random() * characters.length));
9
+ }
10
+ return value;
11
+ };
12
+ exports.randomString = randomString;
@@ -0,0 +1,3 @@
1
+ import AdmZip from 'adm-zip';
2
+ export declare const downloadRepository: (url: string) => Promise<AdmZip>;
3
+ export declare const extractStarter: (zip: AdmZip, starterName: string, targetDirectory: string) => void;
@@ -0,0 +1,51 @@
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
+ exports.extractStarter = exports.downloadRepository = void 0;
7
+ const adm_zip_1 = __importDefault(require("adm-zip"));
8
+ const debug_1 = require("./debug");
9
+ const fetch_1 = require("./fetch");
10
+ const downloadRepository = async (url) => {
11
+ const config = {
12
+ cache: 'no-cache',
13
+ method: 'GET',
14
+ mode: 'same-origin',
15
+ referrerPolicy: 'no-referrer',
16
+ responseType: 'arraybuffer',
17
+ };
18
+ let zip;
19
+ try {
20
+ const response = await (0, fetch_1.fetchOrThrow)(url, config);
21
+ const buffer = await response.arrayBuffer();
22
+ zip = new adm_zip_1.default(Buffer.from(buffer), {});
23
+ }
24
+ catch (error) {
25
+ if (error instanceof fetch_1.PlatformError) {
26
+ const errorMessage = await error.getErrorMessage();
27
+ throw new Error(errorMessage);
28
+ }
29
+ if ((0, debug_1.debugEnabled)()) {
30
+ console.error(JSON.stringify(error));
31
+ }
32
+ throw new Error('Internal error occurred, please contact your Quantum Hub administrator');
33
+ }
34
+ return zip;
35
+ };
36
+ exports.downloadRepository = downloadRepository;
37
+ const extractStarter = (zip, starterName, targetDirectory) => {
38
+ const templateFolder = `${starterName}/`;
39
+ for (const entry of zip.getEntries()) {
40
+ if (!entry.isDirectory && entry.entryName.startsWith(templateFolder)) {
41
+ let destinationPath = targetDirectory;
42
+ // check if file is in sub-folder
43
+ if (entry.entryName.replace(templateFolder, '').includes('/')) {
44
+ const pathWithinFolder = entry.entryName.replace(templateFolder, '');
45
+ destinationPath = destinationPath + '/' + pathWithinFolder.slice(0, Math.max(0, pathWithinFolder.lastIndexOf('/')));
46
+ }
47
+ zip.extractEntryTo(entry.entryName, destinationPath, false, true);
48
+ }
49
+ }
50
+ };
51
+ exports.extractStarter = extractStarter;
@@ -0,0 +1,2 @@
1
+ import { ReadStream } from 'fs-extra';
2
+ export declare const streamToBlob: (stream: ReadStream, mimeType?: string) => Promise<Blob>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.streamToBlob = void 0;
4
+ const streamToBlob = (stream, mimeType) => {
5
+ return new Promise((resolve, reject) => {
6
+ const chunks = [];
7
+ stream.on('data', (chunk) => {
8
+ // ReadStream can emit either string or Buffer, ensure we have Buffer
9
+ if (typeof chunk === 'string') {
10
+ chunks.push(Buffer.from(chunk));
11
+ }
12
+ else {
13
+ chunks.push(chunk);
14
+ }
15
+ });
16
+ stream.on('end', () => {
17
+ // Concatenate all chunks into a single Buffer, then convert to Blob
18
+ const buffer = Buffer.concat(chunks);
19
+ const blob = new Blob([buffer], { type: mimeType || 'application/octet-stream' });
20
+ resolve(blob);
21
+ });
22
+ stream.on('error', (error) => {
23
+ reject(error);
24
+ });
25
+ });
26
+ };
27
+ exports.streamToBlob = streamToBlob;
@@ -0,0 +1 @@
1
+ export declare function getDescriptionText(workingDirectory?: string): Promise<string>;
@@ -0,0 +1,29 @@
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
+ exports.getDescriptionText = getDescriptionText;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ function getDescriptionPath(workingDirectory = process.cwd()) {
10
+ const configPath = node_path_1.default.join(workingDirectory, 'qhub.json');
11
+ if (node_fs_1.default.existsSync(configPath)) {
12
+ const config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf8'));
13
+ if (config.descriptionFile) {
14
+ return node_path_1.default.join(workingDirectory, config.descriptionFile);
15
+ }
16
+ return '';
17
+ }
18
+ throw new Error('qhub.json file not found');
19
+ }
20
+ async function getDescriptionText(workingDirectory = process.cwd()) {
21
+ const descriptionPath = getDescriptionPath(workingDirectory);
22
+ if (descriptionPath) {
23
+ if (node_fs_1.default.existsSync(descriptionPath)) {
24
+ return node_fs_1.default.readFileSync(descriptionPath, 'utf8');
25
+ }
26
+ throw new Error('Provided "descriptionFile" was not found');
27
+ }
28
+ return '';
29
+ }
@@ -0,0 +1 @@
1
+ export declare function createIgnoreFileChecker(filePath?: string): Promise<(fullPath: string) => boolean>;
@@ -0,0 +1,21 @@
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
+ exports.createIgnoreFileChecker = createIgnoreFileChecker;
7
+ const ignore_1 = __importDefault(require("ignore"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const node_util_1 = require("node:util");
11
+ const readFile = (0, node_util_1.promisify)(node_fs_1.default.readFile);
12
+ async function createIgnoreFileChecker(filePath = process.cwd()) {
13
+ const ignoreFilePath = node_path_1.default.join(filePath, '.dockerignore');
14
+ if (!node_fs_1.default.existsSync(ignoreFilePath)) {
15
+ return () => false;
16
+ }
17
+ const ignoreFileContents = await readFile(ignoreFilePath, 'utf8');
18
+ const ig = (0, ignore_1.default)().add(ignoreFileContents.split('\n'));
19
+ ig.add('service.zip');
20
+ return (fullPath) => ig.ignores(fullPath);
21
+ }
@@ -0,0 +1 @@
1
+ export declare function zipProjectFolder(workingDirectory?: string, targetDirectory?: string, targetFilename?: string): Promise<Blob>;
@@ -0,0 +1,40 @@
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
+ exports.zipProjectFolder = zipProjectFolder;
7
+ const adm_zip_1 = __importDefault(require("adm-zip"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const stream_to_blob_1 = require("../stream-to-blob");
12
+ const ignore_1 = require("./ignore");
13
+ async function zipProjectFolder(workingDirectory = process.cwd(), targetDirectory = (0, node_os_1.tmpdir)(), targetFilename = 'user_code.zip') {
14
+ const targetFilePath = node_path_1.default.join(targetDirectory, '/', targetFilename);
15
+ if (fs_extra_1.default.existsSync(targetFilePath)) {
16
+ fs_extra_1.default.unlinkSync(targetFilePath);
17
+ }
18
+ const zip = new adm_zip_1.default();
19
+ const ignoreFile = await (0, ignore_1.createIgnoreFileChecker)(workingDirectory);
20
+ function addToZip(folderPath) {
21
+ const files = fs_extra_1.default.readdirSync(folderPath);
22
+ for (const file of files) {
23
+ const fullPath = node_path_1.default.join(folderPath, file);
24
+ if (ignoreFile(fullPath)) {
25
+ continue;
26
+ }
27
+ const stat = fs_extra_1.default.statSync(fullPath);
28
+ if (stat.isDirectory()) {
29
+ addToZip(fullPath);
30
+ }
31
+ else {
32
+ zip.addLocalFile(fullPath, node_path_1.default.relative(workingDirectory, folderPath));
33
+ }
34
+ }
35
+ }
36
+ addToZip(workingDirectory);
37
+ zip.writeZip(targetFilePath);
38
+ const userCode = fs_extra_1.default.createReadStream(node_path_1.default.join(targetFilePath));
39
+ return (0, stream_to_blob_1.streamToBlob)(userCode);
40
+ }
@@ -0,0 +1,5 @@
1
+ export default interface Account {
2
+ displayName: string;
3
+ id: string;
4
+ isOrganization: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ import { Config } from '@oclif/core/lib/config';
3
+ import UserConfig from './user-config';
4
+ export declare abstract class AbstractCommand extends Command {
5
+ userConfig: UserConfig;
6
+ constructor(argv: string[], config: Config);
7
+ protected showCustomBasePathWarning(): void;
8
+ }
9
+ export declare abstract class AuthenticatedCommand extends AbstractCommand {
10
+ getContextOutputString(userConfig: UserConfig): Promise<string>;
11
+ init(printContext?: boolean): Promise<void>;
12
+ }
@@ -0,0 +1,55 @@
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
+ exports.AuthenticatedCommand = exports.AbstractCommand = void 0;
7
+ const core_1 = require("@oclif/core");
8
+ const auth_service_1 = __importDefault(require("../service/auth-service"));
9
+ const user_config_service_1 = require("../service/user-config-service");
10
+ class AbstractCommand extends core_1.Command {
11
+ userConfig;
12
+ constructor(argv, config) {
13
+ super(argv, config);
14
+ this.userConfig = (0, user_config_service_1.readUserConfig)(this.config.configDir);
15
+ }
16
+ showCustomBasePathWarning() {
17
+ core_1.ux.warn(`Using custom base path. This is intended for internal development use only.`);
18
+ core_1.ux.stdout('');
19
+ }
20
+ }
21
+ exports.AbstractCommand = AbstractCommand;
22
+ class AuthenticatedCommand extends AbstractCommand {
23
+ async getContextOutputString(userConfig) {
24
+ if (userConfig?.context) {
25
+ const type = userConfig.context.isOrganization ? 'Organization' : 'Personal';
26
+ return `${userConfig.context.displayName} (${type})`;
27
+ }
28
+ return 'No context set. Use "qhubctl set-context" to set a context.';
29
+ }
30
+ async init(printContext = true) {
31
+ await super.init();
32
+ if (!this.userConfig.auth) {
33
+ throw new Error('No credentials provided. Use the "login" command to log-in.');
34
+ }
35
+ if (this.userConfig.endpoint?.basePath) {
36
+ this.showCustomBasePathWarning();
37
+ }
38
+ const auth = new auth_service_1.default(this.userConfig);
39
+ try {
40
+ await auth.authenticate(this.userConfig.auth.value);
41
+ }
42
+ catch {
43
+ (0, user_config_service_1.writeUserConfig)(this.config.configDir, {
44
+ ...this.userConfig,
45
+ auth: undefined,
46
+ context: undefined,
47
+ });
48
+ throw new Error('Invalid credentials provided. Use the "login" command to log-in.');
49
+ }
50
+ if (printContext) {
51
+ core_1.ux.stdout('Current context: ' + await this.getContextOutputString(this.userConfig));
52
+ }
53
+ }
54
+ }
55
+ exports.AuthenticatedCommand = AuthenticatedCommand;
@@ -0,0 +1,28 @@
1
+ export default interface ManagedServiceConfig {
2
+ descriptionFile?: string;
3
+ name: string;
4
+ summary?: string;
5
+ resources?: ResourceConfiguration;
6
+ runtime?: Runtime;
7
+ serviceId?: string;
8
+ }
9
+ export declare enum Runtime {
10
+ DOCKER = "DOCKER",
11
+ PYTHON = "PYTHON",
12
+ PYTHON_TEMPLATE = "PYTHON_TEMPLATE"
13
+ }
14
+ export interface ResourceConfiguration {
15
+ cpu: number;
16
+ gpu?: GpuConfiguration;
17
+ memory: number;
18
+ }
19
+ export interface GpuConfiguration {
20
+ count: number;
21
+ type: GpuType;
22
+ }
23
+ export declare enum GpuType {
24
+ NVIDIA_TESLA_A100 = "NVIDIA_TESLA_A100",
25
+ NVIDIA_TESLA_P100 = "NVIDIA_TESLA_P100",
26
+ NVIDIA_TESLA_T4 = "NVIDIA_TESLA_T4",
27
+ NVIDIA_TESLA_V100 = "NVIDIA_TESLA_V100"
28
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GpuType = exports.Runtime = void 0;
4
+ var Runtime;
5
+ (function (Runtime) {
6
+ Runtime["DOCKER"] = "DOCKER";
7
+ Runtime["PYTHON"] = "PYTHON";
8
+ Runtime["PYTHON_TEMPLATE"] = "PYTHON_TEMPLATE";
9
+ })(Runtime || (exports.Runtime = Runtime = {}));
10
+ var GpuType;
11
+ (function (GpuType) {
12
+ GpuType["NVIDIA_TESLA_A100"] = "NVIDIA_TESLA_A100";
13
+ GpuType["NVIDIA_TESLA_P100"] = "NVIDIA_TESLA_P100";
14
+ GpuType["NVIDIA_TESLA_T4"] = "NVIDIA_TESLA_T4";
15
+ GpuType["NVIDIA_TESLA_V100"] = "NVIDIA_TESLA_V100";
16
+ })(GpuType || (exports.GpuType = GpuType = {}));
@@ -0,0 +1,22 @@
1
+ export declare enum AuthType {
2
+ API_KEY = "API_KEY"
3
+ }
4
+ export interface Authentication {
5
+ type: AuthType;
6
+ value: string;
7
+ }
8
+ export interface Endpoint {
9
+ basePath: string;
10
+ defaultHeaders: Record<string, string>;
11
+ }
12
+ export interface Context {
13
+ displayName: string;
14
+ id: string;
15
+ isOrganization: boolean;
16
+ }
17
+ export declare const defaultBasePath = "https://api.hub.kipu-quantum.com";
18
+ export default interface UserConfig {
19
+ auth?: Authentication;
20
+ context?: Context;
21
+ endpoint?: Endpoint;
22
+ }