@mcma/client
Advanced tools
Comparing version 0.14.8 to 0.15.0
@@ -9,2 +9,3 @@ import { Authenticator } from "./authenticator"; | ||
get(authType: string): Authenticator; | ||
getDefault(): Authenticator; | ||
} |
@@ -31,3 +31,9 @@ "use strict"; | ||
} | ||
getDefault() { | ||
if (Object.keys(this.registeredAuthTypes).length === 1) { | ||
return this.registeredAuthTypes[Object.keys(this.registeredAuthTypes)[0]]; | ||
} | ||
return null; | ||
} | ||
} | ||
exports.AuthProvider = AuthProvider; |
@@ -7,6 +7,6 @@ "use strict"; | ||
return { | ||
servicesUrl: configVariables.get("ServicesUrl"), | ||
servicesAuthType: configVariables.getOptional("ServicesAuthType"), | ||
serviceRegistryUrl: configVariables.get("MCMA_SERVICE_REGISTRY_URL"), | ||
serviceRegistryAuthType: configVariables.getOptional("MCMA_SERVICE_REGISTRY_AUTH_TYPE"), | ||
}; | ||
} | ||
exports.getResourceManagerConfig = getResourceManagerConfig; |
import { HttpClientConfig } from "../http"; | ||
export interface ResourceManagerConfig { | ||
servicesUrl: string; | ||
servicesAuthType?: string; | ||
serviceRegistryUrl: string; | ||
serviceRegistryAuthType?: string; | ||
httpClientConfig?: HttpClientConfig; | ||
} |
@@ -12,3 +12,3 @@ import { McmaResource, McmaResourceType, NotificationEndpointProperties } from "@mcma/core"; | ||
private authProvider; | ||
private httpClient; | ||
private readonly httpClient; | ||
private serviceClients; | ||
@@ -15,0 +15,0 @@ constructor(config: ResourceManagerConfig, authProvider: AuthProvider); |
@@ -16,7 +16,10 @@ "use strict"; | ||
this.authProvider = authProvider; | ||
this.httpClient = new http_1.HttpClient(); | ||
this.serviceClients = []; | ||
if (!config.servicesUrl) { | ||
throw new core_1.McmaException("Missing property 'servicesUrl' in ResourceManager config"); | ||
if (!config.serviceRegistryUrl) { | ||
throw new core_1.McmaException("Missing property 'serviceRegistryUrl' in ResourceManager config"); | ||
} | ||
if (config.serviceRegistryUrl.endsWith("/")) { | ||
config.serviceRegistryUrl = config.serviceRegistryUrl.substring(0, config.serviceRegistryUrl.length - 1); | ||
} | ||
this.httpClient = new http_1.HttpClient(authProvider.getDefault(), config.httpClientConfig); | ||
} | ||
@@ -28,7 +31,11 @@ async init() { | ||
name: "Service Registry", | ||
authType: this.config.serviceRegistryAuthType, | ||
resources: [ | ||
new core_1.ResourceEndpoint({ | ||
resourceType: "Service", | ||
httpEndpoint: this.config.servicesUrl, | ||
authType: this.config.servicesAuthType, | ||
httpEndpoint: this.config.serviceRegistryUrl + "/services", | ||
}), | ||
new core_1.ResourceEndpoint({ | ||
resourceType: "JobProfile", | ||
httpEndpoint: this.config.serviceRegistryUrl + "/job-profiles", | ||
}) | ||
@@ -35,0 +42,0 @@ ] |
{ | ||
"name": "@mcma/client", | ||
"version": "0.14.8", | ||
"version": "0.15.0", | ||
"description": "Node module with classes and functions used to access services in an MCMA environment", | ||
"engines": { | ||
"node": "^14.17.0" | ||
"node": "^16.0.0" | ||
}, | ||
@@ -35,9 +35,9 @@ "type": "commonjs", | ||
"peerDependencies": { | ||
"@mcma/core": "0.14.8" | ||
"@mcma/core": "0.15.0" | ||
}, | ||
"devDependencies": { | ||
"@mcma/core": "0.14.8", | ||
"@types/node": "^14.17.22", | ||
"@mcma/core": "0.15.0", | ||
"@types/node": "^16.11.60", | ||
"jasmine": "^3.3.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41853
902