@quantum-hub/qhubctl 1.1.2 → 1.1.4
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.
- package/bin/dev.js +3 -1
- package/bin/run.js +1 -1
- package/dist/client/kqh/apis/ServicePlatformApplicationsApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformApplicationsApi.js +9 -46
- package/dist/client/kqh/apis/ServicePlatformDashboardApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformDashboardApi.js +5 -42
- package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformDataPoolsApi.js +11 -48
- package/dist/client/kqh/apis/ServicePlatformJobsApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformJobsApi.js +9 -46
- package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformMarketplaceApi.js +5 -42
- package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformMeteringAPIApi.js +5 -42
- package/dist/client/kqh/apis/ServicePlatformServicesApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformServicesApi.js +34 -71
- package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.d.ts +2 -2
- package/dist/client/kqh/apis/ServicePlatformSubscriptionsApi.js +7 -44
- package/dist/client/kqh/apis/TaxonomiesApi.d.ts +2 -2
- package/dist/client/kqh/apis/TaxonomiesApi.js +12 -49
- package/dist/client/kqh/apis/index.d.ts +9 -9
- package/dist/client/kqh/apis/index.js +9 -25
- package/dist/client/kqh/index.d.ts +3 -3
- package/dist/client/kqh/index.js +3 -19
- package/dist/client/kqh/models/AccessTokenDto.js +5 -12
- package/dist/client/kqh/models/AmountMajorDto.js +4 -10
- package/dist/client/kqh/models/ApiDto.d.ts +2 -2
- package/dist/client/kqh/models/ApiDto.js +13 -20
- package/dist/client/kqh/models/ApiOverviewDto.d.ts +1 -1
- package/dist/client/kqh/models/ApiOverviewDto.js +10 -17
- package/dist/client/kqh/models/ApplicationDto.js +5 -12
- package/dist/client/kqh/models/BuildJobDto.d.ts +1 -1
- package/dist/client/kqh/models/BuildJobDto.js +9 -16
- package/dist/client/kqh/models/CpuConfiguration.d.ts +1 -1
- package/dist/client/kqh/models/CpuConfiguration.js +7 -13
- package/dist/client/kqh/models/CreateApplicationRequest.js +4 -10
- package/dist/client/kqh/models/CreateDataPoolRequest.js +4 -10
- package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.d.ts +1 -1
- package/dist/client/kqh/models/CreateExternalServicePricingPlanRequest.js +8 -15
- package/dist/client/kqh/models/CreateJobRequest.d.ts +1 -1
- package/dist/client/kqh/models/CreateJobRequest.js +9 -15
- package/dist/client/kqh/models/CreateManagedServicePricingPlanRequest.js +6 -13
- package/dist/client/kqh/models/CreateProductRequest.js +4 -10
- package/dist/client/kqh/models/CreateSubscriptionRequest.js +4 -10
- package/dist/client/kqh/models/CreateWorkflowServiceRequest.js +4 -10
- package/dist/client/kqh/models/DataPoolDto.d.ts +3 -3
- package/dist/client/kqh/models/DataPoolDto.js +21 -28
- package/dist/client/kqh/models/DataPoolRef.js +4 -10
- package/dist/client/kqh/models/DataSourceDescriptorDto.d.ts +1 -1
- package/dist/client/kqh/models/DataSourceDescriptorDto.js +8 -15
- package/dist/client/kqh/models/FileDto.js +4 -10
- package/dist/client/kqh/models/FileSource.d.ts +1 -1
- package/dist/client/kqh/models/FileSource.js +4 -10
- package/dist/client/kqh/models/GpuConfiguration.d.ts +1 -1
- package/dist/client/kqh/models/GpuConfiguration.js +8 -15
- package/dist/client/kqh/models/JobDto.d.ts +2 -2
- package/dist/client/kqh/models/JobDto.js +13 -20
- package/dist/client/kqh/models/JobOverviewDto.d.ts +1 -1
- package/dist/client/kqh/models/JobOverviewDto.js +8 -15
- package/dist/client/kqh/models/MemoryConfiguration.d.ts +1 -1
- package/dist/client/kqh/models/MemoryConfiguration.js +7 -13
- package/dist/client/kqh/models/MeteringRequest.js +4 -10
- package/dist/client/kqh/models/MeteringResponse.js +4 -10
- package/dist/client/kqh/models/MonthAmountDto.d.ts +2 -2
- package/dist/client/kqh/models/MonthAmountDto.js +10 -16
- package/dist/client/kqh/models/OwnerDto.js +4 -10
- package/dist/client/kqh/models/PageDataPoolDto.d.ts +3 -3
- package/dist/client/kqh/models/PageDataPoolDto.js +13 -19
- package/dist/client/kqh/models/PageableObject.d.ts +1 -1
- package/dist/client/kqh/models/PageableObject.js +7 -13
- package/dist/client/kqh/models/PricingPlanDto.d.ts +1 -1
- package/dist/client/kqh/models/PricingPlanDto.js +8 -15
- package/dist/client/kqh/models/ProductAmountDto.d.ts +1 -1
- package/dist/client/kqh/models/ProductAmountDto.js +7 -13
- package/dist/client/kqh/models/ProductDto.js +5 -12
- package/dist/client/kqh/models/ProductGroupDto.d.ts +2 -2
- package/dist/client/kqh/models/ProductGroupDto.js +10 -16
- package/dist/client/kqh/models/ProductUsageDto.js +4 -10
- package/dist/client/kqh/models/RegistrySource.d.ts +1 -1
- package/dist/client/kqh/models/RegistrySource.js +7 -13
- package/dist/client/kqh/models/RepositorySource.d.ts +1 -1
- package/dist/client/kqh/models/RepositorySource.js +7 -13
- package/dist/client/kqh/models/ResourceConfiguration.js +10 -16
- package/dist/client/kqh/models/ReviewDto.js +5 -12
- package/dist/client/kqh/models/RuntimeConfiguration.js +5 -12
- package/dist/client/kqh/models/ServiceDefinitionCommand.js +5 -12
- package/dist/client/kqh/models/ServiceDefinitionDto.d.ts +5 -5
- package/dist/client/kqh/models/ServiceDefinitionDto.js +21 -28
- package/dist/client/kqh/models/ServiceDefinitionDtoSource.d.ts +3 -3
- package/dist/client/kqh/models/ServiceDefinitionDtoSource.js +18 -23
- package/dist/client/kqh/models/ServiceDefinitionOverviewDto.js +6 -13
- package/dist/client/kqh/models/ServiceDto.d.ts +1 -1
- package/dist/client/kqh/models/ServiceDto.js +8 -15
- package/dist/client/kqh/models/ServiceExecutionConsumerDto.js +5 -12
- package/dist/client/kqh/models/ServiceExecutionDto.js +4 -10
- package/dist/client/kqh/models/ServiceOverviewDto.js +8 -15
- package/dist/client/kqh/models/ServiceSource.js +10 -16
- package/dist/client/kqh/models/SortObject.js +4 -10
- package/dist/client/kqh/models/SubscriptionDto.d.ts +3 -3
- package/dist/client/kqh/models/SubscriptionDto.js +13 -19
- package/dist/client/kqh/models/TaxonomyElement.js +4 -10
- package/dist/client/kqh/models/UpdateDataPoolRequest.js +4 -10
- package/dist/client/kqh/models/UpdateResourceConfigurationRequest.d.ts +3 -3
- package/dist/client/kqh/models/UpdateResourceConfigurationRequest.js +18 -23
- package/dist/client/kqh/models/UpdateVersionRequest.d.ts +1 -1
- package/dist/client/kqh/models/UpdateVersionRequest.js +7 -13
- package/dist/client/kqh/models/UpdateWorkflowServiceRequest.js +4 -10
- package/dist/client/kqh/models/ValidationResult.js +5 -12
- package/dist/client/kqh/models/index.d.ts +57 -57
- package/dist/client/kqh/models/index.js +57 -73
- package/dist/client/kqh/runtime.js +17 -32
- package/dist/client/users/apis/AuthenticationApi.d.ts +2 -2
- package/dist/client/users/apis/AuthenticationApi.js +4 -41
- package/dist/client/users/apis/ExpertsApi.d.ts +2 -2
- package/dist/client/users/apis/ExpertsApi.js +5 -42
- package/dist/client/users/apis/SearchApi.d.ts +2 -2
- package/dist/client/users/apis/SearchApi.js +5 -42
- package/dist/client/users/apis/UserSettingsApi.d.ts +2 -2
- package/dist/client/users/apis/UserSettingsApi.js +11 -48
- package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.d.ts +2 -2
- package/dist/client/users/apis/UserSettingsPersonalAccessTokensApi.js +7 -44
- package/dist/client/users/apis/UsersApi.d.ts +2 -2
- package/dist/client/users/apis/UsersApi.js +4 -41
- package/dist/client/users/apis/index.d.ts +6 -6
- package/dist/client/users/apis/index.js +6 -22
- package/dist/client/users/index.d.ts +3 -3
- package/dist/client/users/index.js +3 -19
- package/dist/client/users/models/AccessTokenCreateRequest.js +5 -12
- package/dist/client/users/models/AccessTokenDto.js +5 -12
- package/dist/client/users/models/AccessTokensResponse.d.ts +1 -1
- package/dist/client/users/models/AccessTokensResponse.js +7 -13
- package/dist/client/users/models/DefaultAccessTokenResponse.js +4 -10
- package/dist/client/users/models/Language.js +4 -10
- package/dist/client/users/models/PageUserDto.d.ts +3 -3
- package/dist/client/users/models/PageUserDto.js +13 -19
- package/dist/client/users/models/Pageable.js +4 -10
- package/dist/client/users/models/PageableObject.d.ts +1 -1
- package/dist/client/users/models/PageableObject.js +7 -13
- package/dist/client/users/models/PersonalAccessTokenPrincipal.d.ts +1 -1
- package/dist/client/users/models/PersonalAccessTokenPrincipal.js +7 -13
- package/dist/client/users/models/Skill.js +4 -10
- package/dist/client/users/models/SortObject.js +4 -10
- package/dist/client/users/models/UpdateUserRequest.js +4 -10
- package/dist/client/users/models/UserDto.d.ts +2 -2
- package/dist/client/users/models/UserDto.js +10 -16
- package/dist/client/users/models/UserOverviewDto.js +4 -10
- package/dist/client/users/models/index.d.ts +14 -14
- package/dist/client/users/models/index.js +14 -30
- package/dist/client/users/runtime.js +17 -32
- package/dist/commands/compress/index.d.ts +1 -1
- package/dist/commands/compress/index.js +13 -19
- package/dist/commands/datapool/upload.d.ts +4 -4
- package/dist/commands/datapool/upload.js +24 -30
- package/dist/commands/get-context/index.d.ts +1 -1
- package/dist/commands/get-context/index.js +2 -5
- package/dist/commands/init/index.d.ts +3 -3
- package/dist/commands/init/index.js +30 -36
- package/dist/commands/list-contexts/index.d.ts +2 -2
- package/dist/commands/list-contexts/index.js +11 -17
- package/dist/commands/login/index.d.ts +3 -3
- package/dist/commands/login/index.js +16 -22
- package/dist/commands/logout/index.d.ts +1 -1
- package/dist/commands/logout/index.js +7 -10
- package/dist/commands/openapi/index.d.ts +7 -7
- package/dist/commands/openapi/index.js +81 -87
- package/dist/commands/run/index.d.ts +6 -6
- package/dist/commands/run/index.js +43 -48
- package/dist/commands/serve/index.d.ts +3 -3
- package/dist/commands/serve/index.js +31 -37
- package/dist/commands/services/index.d.ts +5 -5
- package/dist/commands/services/index.js +17 -23
- package/dist/commands/set-context/index.d.ts +4 -4
- package/dist/commands/set-context/index.js +15 -22
- package/dist/commands/up/index.d.ts +5 -5
- package/dist/commands/up/index.js +51 -57
- package/dist/index.js +1 -4
- package/dist/lib/command.js +5 -10
- package/dist/lib/debug.js +1 -5
- package/dist/lib/entrypoint-resolver.js +3 -7
- package/dist/lib/error.js +8 -12
- package/dist/lib/fetch.js +4 -10
- package/dist/lib/init-user-input.d.ts +1 -1
- package/dist/lib/init-user-input.js +16 -20
- package/dist/lib/random-name.js +1 -5
- package/dist/lib/random-string.js +1 -5
- package/dist/lib/repository.js +9 -17
- package/dist/lib/stream-to-blob.d.ts +1 -1
- package/dist/lib/stream-to-blob.js +1 -5
- package/dist/lib/up/get-description.js +9 -15
- package/dist/lib/up/ignore.js +9 -15
- package/dist/lib/up/zip.js +18 -24
- package/dist/model/account.js +1 -2
- package/dist/model/command.d.ts +2 -2
- package/dist/model/command.js +11 -19
- package/dist/model/managed-service-config.js +4 -7
- package/dist/model/user-config.js +3 -6
- package/dist/service/auth-service.d.ts +3 -3
- package/dist/service/auth-service.js +8 -14
- package/dist/service/command-service.d.ts +2 -2
- package/dist/service/command-service.js +1 -5
- package/dist/service/quantum-hub-service.d.ts +10 -10
- package/dist/service/quantum-hub-service.js +21 -24
- package/dist/service/service-config-service.d.ts +1 -1
- package/dist/service/service-config-service.js +14 -21
- package/dist/service/user-config-service.d.ts +1 -1
- package/dist/service/user-config-service.js +14 -21
- package/dist/service/user-service.d.ts +2 -2
- package/dist/service/user-service.js +8 -11
- package/oclif.manifest.json +46 -46
- package/package.json +4 -2
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const command_service_1 = require("./command-service");
|
|
9
|
-
class QuantumHubService extends command_service_1.CommandService {
|
|
1
|
+
import { HubPlatformClient } from "@quantum-hub/qhub-api/platform";
|
|
2
|
+
import { Configuration, ServicePlatformServicesApi, } from '../client/kqh/index.js';
|
|
3
|
+
import { handleError } from '../lib/error.js';
|
|
4
|
+
import { fetchOrThrow } from '../lib/fetch.js';
|
|
5
|
+
import { defaultBasePath } from '../model/user-config.js';
|
|
6
|
+
import { CommandService } from './command-service.js';
|
|
7
|
+
export default class QuantumHubService extends CommandService {
|
|
10
8
|
serviceApi;
|
|
11
9
|
apiClient;
|
|
12
10
|
constructor(cmd, config, userConfig) {
|
|
13
11
|
super(cmd, config, userConfig);
|
|
14
|
-
const basePath = (userConfig.endpoint?.basePath ||
|
|
12
|
+
const basePath = (userConfig.endpoint?.basePath || defaultBasePath) + '/qc-catalog';
|
|
15
13
|
const defaultHeaders = userConfig.endpoint?.defaultHeaders || {};
|
|
16
14
|
const apiKey = userConfig.auth?.value;
|
|
17
15
|
const organizationId = this.userConfig.context?.isOrganization ? this.userConfig.context.id : undefined;
|
|
18
|
-
this.serviceApi = new
|
|
16
|
+
this.serviceApi = new ServicePlatformServicesApi(new Configuration({
|
|
19
17
|
apiKey,
|
|
20
18
|
basePath,
|
|
21
19
|
headers: defaultHeaders,
|
|
22
20
|
}));
|
|
23
|
-
this.apiClient = new
|
|
21
|
+
this.apiClient = new HubPlatformClient({
|
|
24
22
|
apiKey,
|
|
25
23
|
baseUrl: basePath,
|
|
26
24
|
organizationId
|
|
@@ -46,20 +44,20 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
catch (error) {
|
|
49
|
-
const errorMessage = await
|
|
47
|
+
const errorMessage = await handleError(error);
|
|
50
48
|
throw new Error(errorMessage);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
async getAccounts() {
|
|
54
|
-
const basePath = (this.userConfig.endpoint?.basePath ||
|
|
52
|
+
const basePath = (this.userConfig.endpoint?.basePath || defaultBasePath) + '/qc-catalog';
|
|
55
53
|
try {
|
|
56
|
-
const response = await
|
|
54
|
+
const response = await fetchOrThrow(basePath + '/my/accounts', {
|
|
57
55
|
headers: { 'X-Auth-Token': this.userConfig.auth.value },
|
|
58
56
|
});
|
|
59
57
|
return (await response.json());
|
|
60
58
|
}
|
|
61
59
|
catch (error) {
|
|
62
|
-
const errorMessage = await
|
|
60
|
+
const errorMessage = await handleError(error);
|
|
63
61
|
throw new Error(errorMessage);
|
|
64
62
|
}
|
|
65
63
|
}
|
|
@@ -73,7 +71,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
73
71
|
});
|
|
74
72
|
}
|
|
75
73
|
catch (error) {
|
|
76
|
-
const errorMessage = await
|
|
74
|
+
const errorMessage = await handleError(error);
|
|
77
75
|
throw new Error(errorMessage);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
@@ -82,7 +80,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
82
80
|
return await this.apiClient.serviceJobs.getServiceJob({ "id": id });
|
|
83
81
|
}
|
|
84
82
|
catch (error) {
|
|
85
|
-
const errorMessage = await
|
|
83
|
+
const errorMessage = await handleError(error);
|
|
86
84
|
throw new Error(errorMessage);
|
|
87
85
|
}
|
|
88
86
|
}
|
|
@@ -92,7 +90,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
92
90
|
return await this.serviceApi.getService({ id, xOrganizationId: organizationId });
|
|
93
91
|
}
|
|
94
92
|
catch (error) {
|
|
95
|
-
const errorMessage = await
|
|
93
|
+
const errorMessage = await handleError(error);
|
|
96
94
|
throw new Error(errorMessage);
|
|
97
95
|
}
|
|
98
96
|
}
|
|
@@ -102,7 +100,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
102
100
|
return await this.serviceApi.getServices({ xOrganizationId: organizationId });
|
|
103
101
|
}
|
|
104
102
|
catch (error) {
|
|
105
|
-
const errorMessage = await
|
|
103
|
+
const errorMessage = await handleError(error);
|
|
106
104
|
throw new Error(errorMessage);
|
|
107
105
|
}
|
|
108
106
|
}
|
|
@@ -111,7 +109,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
111
109
|
return await this.apiClient.serviceJobs.createServiceJob(request);
|
|
112
110
|
}
|
|
113
111
|
catch (error) {
|
|
114
|
-
const errorMessage = await
|
|
112
|
+
const errorMessage = await handleError(error);
|
|
115
113
|
throw new Error(errorMessage);
|
|
116
114
|
}
|
|
117
115
|
}
|
|
@@ -128,7 +126,7 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
128
|
catch (error) {
|
|
131
|
-
const errorMessage = await
|
|
129
|
+
const errorMessage = await handleError(error);
|
|
132
130
|
throw new Error(errorMessage);
|
|
133
131
|
}
|
|
134
132
|
}
|
|
@@ -214,9 +212,8 @@ class QuantumHubService extends command_service_1.CommandService {
|
|
|
214
212
|
return service;
|
|
215
213
|
}
|
|
216
214
|
catch (error) {
|
|
217
|
-
const errorMessage = await
|
|
215
|
+
const errorMessage = await handleError(error);
|
|
218
216
|
throw new Error(errorMessage);
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
|
-
exports.default = QuantumHubService;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ManagedServiceConfig from '../model/managed-service-config';
|
|
1
|
+
import ManagedServiceConfig from '../model/managed-service-config.js';
|
|
2
2
|
export declare const readServiceConfig: (location: string) => ManagedServiceConfig;
|
|
3
3
|
export declare const writeServiceConfig: (location: string, serviceConfig: ManagedServiceConfig) => ManagedServiceConfig;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const readServiceConfig = (location) => {
|
|
11
|
-
const file = node_path_1.default.join(location, 'qhub.json');
|
|
12
|
-
if (!node_fs_1.default.existsSync(file)) {
|
|
1
|
+
import fsExtra from 'fs-extra';
|
|
2
|
+
const { createFileSync, readJsonSync, writeJsonSync } = fsExtra;
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
export const readServiceConfig = (location) => {
|
|
6
|
+
const file = path.join(location, 'qhub.json');
|
|
7
|
+
if (!fs.existsSync(file)) {
|
|
13
8
|
throw new Error('No qhub.json file found in current directory');
|
|
14
9
|
}
|
|
15
|
-
return
|
|
10
|
+
return readJsonSync(file, { encoding: 'utf8' });
|
|
16
11
|
};
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0, fs_extra_1.createFileSync)(file);
|
|
12
|
+
export const writeServiceConfig = (location, serviceConfig) => {
|
|
13
|
+
const file = path.join(location, 'qhub.json');
|
|
14
|
+
if (!fs.existsSync(file)) {
|
|
15
|
+
createFileSync(file);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
17
|
+
writeJsonSync(file, serviceConfig, { encoding: 'utf8', spaces: 2 });
|
|
18
|
+
return readServiceConfig(location);
|
|
25
19
|
};
|
|
26
|
-
exports.writeServiceConfig = writeServiceConfig;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const readUserConfig = (location) => {
|
|
11
|
-
const file = node_path_1.default.join(location, 'config.json');
|
|
12
|
-
if (!node_fs_1.default.existsSync(file)) {
|
|
1
|
+
import fsExtra from 'fs-extra';
|
|
2
|
+
const { createFileSync, readJsonSync, writeJsonSync } = fsExtra;
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
export const readUserConfig = (location) => {
|
|
6
|
+
const file = path.join(location, 'config.json');
|
|
7
|
+
if (!fs.existsSync(file)) {
|
|
13
8
|
return {};
|
|
14
9
|
}
|
|
15
|
-
return
|
|
10
|
+
return readJsonSync(file, { encoding: 'utf8' });
|
|
16
11
|
};
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0, fs_extra_1.createFileSync)(file);
|
|
12
|
+
export const writeUserConfig = (location, userConfig) => {
|
|
13
|
+
const file = path.join(location, 'config.json');
|
|
14
|
+
if (!fs.existsSync(file)) {
|
|
15
|
+
createFileSync(file);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
17
|
+
writeJsonSync(file, userConfig, { encoding: 'utf8', spaces: 2 });
|
|
18
|
+
return readUserConfig(location);
|
|
25
19
|
};
|
|
26
|
-
exports.writeUserConfig = writeUserConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UserDto, UserSettingsApi } from '../client/users';
|
|
2
|
-
import UserConfig from '../model/user-config';
|
|
1
|
+
import { UserDto, UserSettingsApi } from '../client/users/index.js';
|
|
2
|
+
import UserConfig from '../model/user-config.js';
|
|
3
3
|
export default class UserService {
|
|
4
4
|
basePath: string;
|
|
5
5
|
defaultHeaders: Record<string, string>;
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const user_config_1 = require("../model/user-config");
|
|
6
|
-
class UserService {
|
|
1
|
+
import { Configuration, UserSettingsApi } from '../client/users/index.js';
|
|
2
|
+
import { handleError } from '../lib/error.js';
|
|
3
|
+
import { defaultBasePath } from '../model/user-config.js';
|
|
4
|
+
export default class UserService {
|
|
7
5
|
basePath;
|
|
8
6
|
defaultHeaders;
|
|
9
7
|
userSettingsApi;
|
|
10
8
|
constructor(userConfig) {
|
|
11
|
-
this.basePath = (userConfig.endpoint?.basePath ||
|
|
9
|
+
this.basePath = (userConfig.endpoint?.basePath || defaultBasePath) + '/user-service';
|
|
12
10
|
this.defaultHeaders = userConfig.endpoint?.defaultHeaders || {};
|
|
13
11
|
const apiKey = userConfig.auth?.value;
|
|
14
|
-
this.userSettingsApi = new
|
|
12
|
+
this.userSettingsApi = new UserSettingsApi(new Configuration({
|
|
15
13
|
apiKey,
|
|
16
14
|
basePath: this.basePath,
|
|
17
15
|
headers: this.defaultHeaders,
|
|
18
16
|
}));
|
|
19
17
|
}
|
|
20
18
|
async getCurrentUser(apiKey) {
|
|
21
|
-
const userSettingsApi = new
|
|
19
|
+
const userSettingsApi = new UserSettingsApi(new Configuration({
|
|
22
20
|
apiKey,
|
|
23
21
|
basePath: this.basePath,
|
|
24
22
|
headers: this.defaultHeaders,
|
|
@@ -27,9 +25,8 @@ class UserService {
|
|
|
27
25
|
return await userSettingsApi.getUser();
|
|
28
26
|
}
|
|
29
27
|
catch (error) {
|
|
30
|
-
const errorMessage = await
|
|
28
|
+
const errorMessage = await handleError(error);
|
|
31
29
|
throw new Error(errorMessage);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
exports.default = UserService;
|
package/oclif.manifest.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"pluginName": "@quantum-hub/qhubctl",
|
|
16
16
|
"pluginType": "core",
|
|
17
17
|
"strict": true,
|
|
18
|
-
"isESM":
|
|
18
|
+
"isESM": true,
|
|
19
19
|
"relativePath": [
|
|
20
20
|
"dist",
|
|
21
21
|
"commands",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"pluginName": "@quantum-hub/qhubctl",
|
|
60
60
|
"pluginType": "core",
|
|
61
61
|
"strict": true,
|
|
62
|
-
"isESM":
|
|
62
|
+
"isESM": true,
|
|
63
63
|
"relativePath": [
|
|
64
64
|
"dist",
|
|
65
65
|
"commands",
|
|
@@ -67,6 +67,29 @@
|
|
|
67
67
|
"upload.js"
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
|
+
"get-context": {
|
|
71
|
+
"aliases": [],
|
|
72
|
+
"args": {},
|
|
73
|
+
"description": "Get the current context, i.e., the personal or organization account you are currently working with.",
|
|
74
|
+
"examples": [
|
|
75
|
+
"$ qhubctl get-context"
|
|
76
|
+
],
|
|
77
|
+
"flags": {},
|
|
78
|
+
"hasDynamicHelp": false,
|
|
79
|
+
"hiddenAliases": [],
|
|
80
|
+
"id": "get-context",
|
|
81
|
+
"pluginAlias": "@quantum-hub/qhubctl",
|
|
82
|
+
"pluginName": "@quantum-hub/qhubctl",
|
|
83
|
+
"pluginType": "core",
|
|
84
|
+
"strict": true,
|
|
85
|
+
"isESM": true,
|
|
86
|
+
"relativePath": [
|
|
87
|
+
"dist",
|
|
88
|
+
"commands",
|
|
89
|
+
"get-context",
|
|
90
|
+
"index.js"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
70
93
|
"init": {
|
|
71
94
|
"aliases": [],
|
|
72
95
|
"args": {},
|
|
@@ -98,7 +121,7 @@
|
|
|
98
121
|
"pluginName": "@quantum-hub/qhubctl",
|
|
99
122
|
"pluginType": "core",
|
|
100
123
|
"strict": true,
|
|
101
|
-
"isESM":
|
|
124
|
+
"isESM": true,
|
|
102
125
|
"relativePath": [
|
|
103
126
|
"dist",
|
|
104
127
|
"commands",
|
|
@@ -106,29 +129,6 @@
|
|
|
106
129
|
"index.js"
|
|
107
130
|
]
|
|
108
131
|
},
|
|
109
|
-
"get-context": {
|
|
110
|
-
"aliases": [],
|
|
111
|
-
"args": {},
|
|
112
|
-
"description": "Get the current context, i.e., the personal or organization account you are currently working with.",
|
|
113
|
-
"examples": [
|
|
114
|
-
"$ qhubctl get-context"
|
|
115
|
-
],
|
|
116
|
-
"flags": {},
|
|
117
|
-
"hasDynamicHelp": false,
|
|
118
|
-
"hiddenAliases": [],
|
|
119
|
-
"id": "get-context",
|
|
120
|
-
"pluginAlias": "@quantum-hub/qhubctl",
|
|
121
|
-
"pluginName": "@quantum-hub/qhubctl",
|
|
122
|
-
"pluginType": "core",
|
|
123
|
-
"strict": true,
|
|
124
|
-
"isESM": false,
|
|
125
|
-
"relativePath": [
|
|
126
|
-
"dist",
|
|
127
|
-
"commands",
|
|
128
|
-
"get-context",
|
|
129
|
-
"index.js"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
132
|
"login": {
|
|
133
133
|
"aliases": [],
|
|
134
134
|
"args": {},
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"pluginName": "@quantum-hub/qhubctl",
|
|
164
164
|
"pluginType": "core",
|
|
165
165
|
"strict": true,
|
|
166
|
-
"isESM":
|
|
166
|
+
"isESM": true,
|
|
167
167
|
"relativePath": [
|
|
168
168
|
"dist",
|
|
169
169
|
"commands",
|
|
@@ -171,49 +171,49 @@
|
|
|
171
171
|
"index.js"
|
|
172
172
|
]
|
|
173
173
|
},
|
|
174
|
-
"
|
|
174
|
+
"list-contexts": {
|
|
175
175
|
"aliases": [],
|
|
176
176
|
"args": {},
|
|
177
|
-
"description": "
|
|
177
|
+
"description": "Retrieves the available contexts, i.e., the personal or organizational accounts available to you to work with.",
|
|
178
178
|
"examples": [
|
|
179
|
-
"$ qhubctl
|
|
179
|
+
"$ qhubctl list-contexts"
|
|
180
180
|
],
|
|
181
181
|
"flags": {},
|
|
182
182
|
"hasDynamicHelp": false,
|
|
183
183
|
"hiddenAliases": [],
|
|
184
|
-
"id": "
|
|
184
|
+
"id": "list-contexts",
|
|
185
185
|
"pluginAlias": "@quantum-hub/qhubctl",
|
|
186
186
|
"pluginName": "@quantum-hub/qhubctl",
|
|
187
187
|
"pluginType": "core",
|
|
188
188
|
"strict": true,
|
|
189
|
-
"isESM":
|
|
189
|
+
"isESM": true,
|
|
190
190
|
"relativePath": [
|
|
191
191
|
"dist",
|
|
192
192
|
"commands",
|
|
193
|
-
"
|
|
193
|
+
"list-contexts",
|
|
194
194
|
"index.js"
|
|
195
195
|
]
|
|
196
196
|
},
|
|
197
|
-
"
|
|
197
|
+
"logout": {
|
|
198
198
|
"aliases": [],
|
|
199
199
|
"args": {},
|
|
200
|
-
"description": "
|
|
200
|
+
"description": "Logout",
|
|
201
201
|
"examples": [
|
|
202
|
-
"$ qhubctl
|
|
202
|
+
"$ qhubctl logout"
|
|
203
203
|
],
|
|
204
204
|
"flags": {},
|
|
205
205
|
"hasDynamicHelp": false,
|
|
206
206
|
"hiddenAliases": [],
|
|
207
|
-
"id": "
|
|
207
|
+
"id": "logout",
|
|
208
208
|
"pluginAlias": "@quantum-hub/qhubctl",
|
|
209
209
|
"pluginName": "@quantum-hub/qhubctl",
|
|
210
210
|
"pluginType": "core",
|
|
211
211
|
"strict": true,
|
|
212
|
-
"isESM":
|
|
212
|
+
"isESM": true,
|
|
213
213
|
"relativePath": [
|
|
214
214
|
"dist",
|
|
215
215
|
"commands",
|
|
216
|
-
"
|
|
216
|
+
"logout",
|
|
217
217
|
"index.js"
|
|
218
218
|
]
|
|
219
219
|
},
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"pluginName": "@quantum-hub/qhubctl",
|
|
289
289
|
"pluginType": "core",
|
|
290
290
|
"strict": true,
|
|
291
|
-
"isESM":
|
|
291
|
+
"isESM": true,
|
|
292
292
|
"relativePath": [
|
|
293
293
|
"dist",
|
|
294
294
|
"commands",
|
|
@@ -347,7 +347,7 @@
|
|
|
347
347
|
"pluginName": "@quantum-hub/qhubctl",
|
|
348
348
|
"pluginType": "core",
|
|
349
349
|
"strict": true,
|
|
350
|
-
"isESM":
|
|
350
|
+
"isESM": true,
|
|
351
351
|
"relativePath": [
|
|
352
352
|
"dist",
|
|
353
353
|
"commands",
|
|
@@ -392,7 +392,7 @@
|
|
|
392
392
|
"strict": true,
|
|
393
393
|
"CONTAINER_NAME": "planqk-cli-serve",
|
|
394
394
|
"IMAGE": "registry.gitlab.com/planqk-foss/planqk-cli-serve:latest",
|
|
395
|
-
"isESM":
|
|
395
|
+
"isESM": true,
|
|
396
396
|
"relativePath": [
|
|
397
397
|
"dist",
|
|
398
398
|
"commands",
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
"pluginName": "@quantum-hub/qhubctl",
|
|
441
441
|
"pluginType": "core",
|
|
442
442
|
"strict": true,
|
|
443
|
-
"isESM":
|
|
443
|
+
"isESM": true,
|
|
444
444
|
"relativePath": [
|
|
445
445
|
"dist",
|
|
446
446
|
"commands",
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
"pluginName": "@quantum-hub/qhubctl",
|
|
469
469
|
"pluginType": "core",
|
|
470
470
|
"strict": true,
|
|
471
|
-
"isESM":
|
|
471
|
+
"isESM": true,
|
|
472
472
|
"relativePath": [
|
|
473
473
|
"dist",
|
|
474
474
|
"commands",
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
"pluginName": "@quantum-hub/qhubctl",
|
|
518
518
|
"pluginType": "core",
|
|
519
519
|
"strict": true,
|
|
520
|
-
"isESM":
|
|
520
|
+
"isESM": true,
|
|
521
521
|
"relativePath": [
|
|
522
522
|
"dist",
|
|
523
523
|
"commands",
|
|
@@ -526,5 +526,5 @@
|
|
|
526
526
|
]
|
|
527
527
|
}
|
|
528
528
|
},
|
|
529
|
-
"version": "1.1.
|
|
529
|
+
"version": "1.1.4"
|
|
530
530
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantum-hub/qhubctl",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Quantum Hub CLI",
|
|
5
5
|
"author": "Kipu Quantum GmbH",
|
|
6
6
|
"contributors": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"Harzenetter, Lukas <lukas.harzenetter@kipu-quantum.com>"
|
|
11
11
|
],
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
|
+
"type": "module",
|
|
13
14
|
"keywords": [
|
|
14
15
|
"hub",
|
|
15
16
|
"kipu",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"@oclif/plugin-not-found": "^3.2.74",
|
|
33
34
|
"@oclif/plugin-version": "^2.2.36",
|
|
34
35
|
"@oclif/plugin-warn-if-update-available": "^3.1.55",
|
|
35
|
-
"@quantum-hub/qhub-api": "^1",
|
|
36
|
+
"@quantum-hub/qhub-api": "^1.0.24",
|
|
36
37
|
"adm-zip": "^0.5.16",
|
|
37
38
|
"async-wait-until": "^2.0.31",
|
|
38
39
|
"fs-extra": "^11.3.3",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"oclif": "^4.22.81",
|
|
62
63
|
"shx": "^0.4.0",
|
|
63
64
|
"ts-node": "^10.9.2",
|
|
65
|
+
"tsx": "^4.21.0",
|
|
64
66
|
"typescript": "^5.9.3",
|
|
65
67
|
"typescript-eslint": "^8.56.1"
|
|
66
68
|
},
|