@mcma/client
Advanced tools
Comparing version 0.9.7 to 0.10.0
@@ -1,1 +0,1 @@ | ||
export * from "./lib/index"; | ||
export * from "./lib"; |
@@ -6,2 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lib/index")); | ||
__export(require("./lib")); |
@@ -1,3 +0,3 @@ | ||
export * from "./auth/index"; | ||
export * from "./http/index"; | ||
export * from "./resources/index"; | ||
export * from "./auth"; | ||
export * from "./http"; | ||
export * from "./resources"; |
@@ -6,4 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./auth/index")); | ||
__export(require("./http/index")); | ||
__export(require("./resources/index")); | ||
__export(require("./auth")); | ||
__export(require("./http")); | ||
__export(require("./resources")); |
@@ -14,3 +14,3 @@ import { McmaResource, McmaResourceType, NotificationEndpointProperties } from "@mcma/core"; | ||
create<T extends McmaResource>(resource: T): Promise<T>; | ||
get<T extends McmaResource>(resource: T | string): Promise<T | null>; | ||
get<T extends McmaResource>(resource: string): Promise<T | null>; | ||
update<T extends McmaResource>(resource: T): Promise<T>; | ||
@@ -21,4 +21,4 @@ delete<T extends McmaResource>(resource: T | string): Promise<T>; | ||
id?: string; | ||
notificationEndpoint?: NotificationEndpointProperties | string; | ||
notificationEndpoint?: NotificationEndpointProperties; | ||
}>(resource: T): Promise<void>; | ||
} |
@@ -67,3 +67,3 @@ "use strict"; | ||
try { | ||
if (!usedHttpEndpoints[resourceEndpoint.httpEndpoint]) { | ||
if (!usedHttpEndpoints.includes(resourceEndpoint.httpEndpoint)) { | ||
let response = await resourceEndpoint.get({ params: filter }); | ||
@@ -104,14 +104,9 @@ result.push(...(response.data)); | ||
let resolvedResource; | ||
if (typeof resource === "string") { | ||
let http = await this.getResourceEndpointClient(resource) || this.httpClient; | ||
try { | ||
let response = await http.get(resource); | ||
resolvedResource = response.data; | ||
} | ||
catch (error) { | ||
throw new core_1.McmaException("ResourceManager: Failed to get resource from URL '" + resource + "'", error); | ||
} | ||
let http = await this.getResourceEndpointClient(resource) || this.httpClient; | ||
try { | ||
let response = await http.get(resource); | ||
resolvedResource = response.data; | ||
} | ||
else { | ||
resolvedResource = resource; | ||
catch (error) { | ||
throw new core_1.McmaException("ResourceManager: Failed to get resource from URL '" + resource + "'", error); | ||
} | ||
@@ -174,12 +169,6 @@ if (!resolvedResource) { | ||
async sendNotification(resource) { | ||
var _a; | ||
if (resource.notificationEndpoint) { | ||
try { | ||
let notificationEndpoint; | ||
if (typeof resource.notificationEndpoint === "string") { | ||
notificationEndpoint = await this.get(resource.notificationEndpoint); | ||
} | ||
else { | ||
notificationEndpoint = resource.notificationEndpoint; | ||
} | ||
let http = await this.getResourceEndpointClient(notificationEndpoint.httpEndpoint) || this.httpClient; | ||
let http = (_a = await this.getResourceEndpointClient(resource.notificationEndpoint.httpEndpoint), (_a !== null && _a !== void 0 ? _a : this.httpClient)); | ||
let notification = new core_1.Notification({ | ||
@@ -189,3 +178,3 @@ source: resource.id, | ||
}); | ||
await http.post(notification, notificationEndpoint.httpEndpoint); | ||
await http.post(notification, resource.notificationEndpoint.httpEndpoint); | ||
} | ||
@@ -192,0 +181,0 @@ catch (error) { |
{ | ||
"name": "@mcma/client", | ||
"version": "0.9.7", | ||
"version": "0.10.0", | ||
"description": "Node module with classes and functions used to access services in an MCMA environment", | ||
@@ -35,6 +35,6 @@ "engines": { | ||
"peerDependencies": { | ||
"@mcma/core": "0.9.7" | ||
"@mcma/core": "0.10.0" | ||
}, | ||
"devDependencies": { | ||
"@mcma/core": "0.9.7", | ||
"@mcma/core": "0.10.0", | ||
"@types/node": "^13.7.4", | ||
@@ -41,0 +41,0 @@ "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
33660
751