@mcma/core
Advanced tools
Comparing version 0.7.9 to 0.8.0
@@ -281,3 +281,3 @@ export type TypeOfValue = "boolean"|"number"|"bigint"|"string"|"symbol"|"function"|"object"|"undefined"; | ||
export interface LoggerProvider { | ||
get(tracker: McmaTracker): ILogger | ||
get(tracker?: McmaTracker): ILogger | ||
} | ||
@@ -288,3 +288,3 @@ | ||
get(tracker: McmaTracker): ILogger; | ||
get(tracker?: McmaTracker): ILogger; | ||
} | ||
@@ -308,4 +308,6 @@ | ||
function getTypeName(type: { name: string } | { ["@type"]: string } | string): string; | ||
function toBase64(text: string): string; | ||
function fromBase64(base64Text: string): string; | ||
} | ||
export as namespace McmaCore; |
@@ -47,3 +47,3 @@ //"use strict"; | ||
EnvironmentVariableProvider, | ||
Utils, | ||
Utils | ||
}; |
@@ -36,5 +36,8 @@ const util = require("util"); | ||
return JSON.stringify(logEvent, null, 2); | ||
} catch (error) { | ||
console.error(error); | ||
logEvent.message = logEvent.message + ""; | ||
} catch { | ||
try { | ||
logEvent.message = util.inspect(logEvent.message); | ||
} catch { | ||
logEvent.message = logEvent.message + ""; | ||
} | ||
} | ||
@@ -41,0 +44,0 @@ |
@@ -172,3 +172,5 @@ //"use strict"; | ||
this.tracker = new McmaTracker(this.tracker); | ||
if (typeof this.tracker === "object") { | ||
this.tracker = new McmaTracker(this.tracker); | ||
} | ||
@@ -187,3 +189,2 @@ if (typeof this.notificationEndpoint === "object") { | ||
this.checkProperty("jobInput", "resource", true); | ||
this.checkProperty("tracker", "object", false); | ||
@@ -190,0 +191,0 @@ if (typeof this.jobProfile === "object") { |
@@ -14,4 +14,36 @@ const { Exception } = require("./mcma-core"); | ||
function toBase64(text) { | ||
// check for browser function for base64 | ||
if (typeof btoa !== "undefined") { | ||
return btoa(text); | ||
} | ||
// check for Node.js Buffer class for converting | ||
if (typeof Buffer !== "undefined" && typeof Buffer.from !== "undefined") { | ||
return Buffer.from(text).toString("base64"); | ||
} | ||
// not sure what platform we're on - throw an error to indicate this is not supported | ||
throw new Exception("Unable to convert from plain text to base64 string. Neither the function 'btoa' nor the class 'Buffer' are defined on this platform."); | ||
} | ||
function fromBase64(base64Text) { | ||
// check for browser function for base64 | ||
if (typeof atob !== "undefined") { | ||
return atob(base64Text); | ||
} | ||
// check for Node.js Buffer class for converting | ||
if (typeof Buffer !== "undefined" && typeof Buffer.from !== "undefined") { | ||
return Buffer.from(base64Text, "base64").toString(); | ||
} | ||
// not sure what platform we're on - throw an error to indicate this is not supported | ||
throw new Exception("Unable to convert to plain text from base64 string. Neither the function 'atob' nor the class 'Buffer' are defined on this platform."); | ||
} | ||
module.exports = { | ||
getTypeName | ||
getTypeName, | ||
toBase64, | ||
fromBase64 | ||
}; |
{ | ||
"name": "@mcma/core", | ||
"version": "0.7.9", | ||
"version": "0.8.0", | ||
"description": "Node module with type definitions and helper utils for the EBU MCMA framework", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
27992
786