Comparing version 6.10.0 to 6.11.0
import { WebhookTriggers } from './models/webhook'; | ||
import LoggingInterface from './models/LoggingInterface'; | ||
export declare let apiServer: string | null; | ||
@@ -8,2 +9,4 @@ export declare function setApiServer(newApiServer: string | null): void; | ||
export declare function setTimeout(newTimeout: number): void; | ||
export declare let logger: LoggingInterface | undefined; | ||
export declare function setLogger(newLogger?: LoggingInterface): void; | ||
export declare type NylasConfig = { | ||
@@ -18,2 +21,4 @@ /** Nylas application client ID */ | ||
timeout?: number; | ||
/** Logger to redirect log messages to your application. */ | ||
logger?: LoggingInterface; | ||
}; | ||
@@ -20,0 +25,0 @@ export declare enum ResponseType { |
@@ -20,2 +20,7 @@ "use strict"; | ||
exports.setTimeout = setTimeout; | ||
exports.logger = undefined; | ||
function setLogger(newLogger) { | ||
exports.logger = newLogger; | ||
} | ||
exports.setLogger = setLogger; | ||
var ResponseType; | ||
@@ -22,0 +27,0 @@ (function (ResponseType) { |
@@ -89,8 +89,6 @@ "use strict"; | ||
AttributeNumber.prototype.fromJSON = function (val) { | ||
if (!isNaN(Number(val))) { | ||
return Number(val); | ||
} | ||
else { | ||
if (val === null || isNaN(Number(val))) { | ||
return null; | ||
} | ||
return Number(val); | ||
}; | ||
@@ -113,4 +111,4 @@ return AttributeNumber; | ||
for (var num in json) { | ||
if (!isNaN(Number(num))) { | ||
nums.push(Number(num)); | ||
if (!isNaN(Number(json[num]))) { | ||
nums.push(Number(json[num])); | ||
} | ||
@@ -117,0 +115,0 @@ } |
@@ -69,3 +69,7 @@ "use strict"; | ||
} | ||
return _super.prototype.saveRequestBody.call(this); | ||
var json = _super.prototype.saveRequestBody.call(this); | ||
if (this.replyToMessageId !== undefined && this.replyToMessageId === '') { | ||
delete json.reply_to_message_id; | ||
} | ||
return json; | ||
}; | ||
@@ -72,0 +76,0 @@ Draft.prototype.deleteRequestBody = function (params) { |
@@ -151,2 +151,5 @@ "use strict"; | ||
} | ||
if (this.visibility !== undefined && this.visibility === '') { | ||
delete json.visibility; | ||
} | ||
return json; | ||
@@ -153,0 +156,0 @@ }; |
@@ -51,2 +51,3 @@ "use strict"; | ||
var rate_limit_error_1 = __importDefault(require("./models/rate-limit-error")); | ||
var config_1 = require("./config"); | ||
var PACKAGE_JSON = require('../package.json'); | ||
@@ -193,3 +194,3 @@ var SDK_VERSION = PACKAGE_JSON.version; | ||
controller.abort(); | ||
}, 150); | ||
}, config.timeout); | ||
} | ||
@@ -206,3 +207,3 @@ return new Promise(function (resolve, reject) { | ||
if (warning) { | ||
console.warn(warning); | ||
config_1.logger === null || config_1.logger === void 0 ? void 0 : config_1.logger.warn(warning); | ||
} | ||
@@ -272,6 +273,6 @@ if (response.status > 299) { | ||
if (err && err.name && err.name === 'AbortError') { | ||
console.warn('Request timed out'); | ||
config_1.logger === null || config_1.logger === void 0 ? void 0 : config_1.logger.warn('Request timed out'); | ||
return reject(err); | ||
} | ||
console.error("Error encountered during request:\n" + err.stack); | ||
config_1.logger === null || config_1.logger === void 0 ? void 0 : config_1.logger.error("Error encountered during request:\n" + err.stack); | ||
return reject(err); | ||
@@ -278,0 +279,0 @@ }) |
@@ -11,2 +11,3 @@ import NylasConnection from './nylas-connection'; | ||
import ApplicationDetails, { ApplicationDetailsProperties } from './models/application-details'; | ||
import LoggingInterface from './models/LoggingInterface'; | ||
declare class Nylas { | ||
@@ -20,2 +21,4 @@ static clientId: string; | ||
static set timeout(timeout: number); | ||
static get logger(): LoggingInterface | undefined; | ||
static set logger(timeout: LoggingInterface | undefined); | ||
static accounts: ManagementModelCollection<ManagementAccount> | RestfulModelCollection<Account>; | ||
@@ -22,0 +25,0 @@ static connect: Connect; |
@@ -60,2 +60,13 @@ "use strict"; | ||
}); | ||
Object.defineProperty(Nylas, "logger", { | ||
get: function () { | ||
return config.logger; | ||
}, | ||
// Logger to redirect log messages to your application | ||
set: function (timeout) { | ||
config.setLogger(timeout); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Nylas.config = function (config) { | ||
@@ -78,2 +89,5 @@ if (config.apiServer && config.apiServer.indexOf('://') === -1) { | ||
this.timeout = config.timeout || 0; | ||
if (config.logger) { | ||
this.logger = config.logger; | ||
} | ||
var conn = new nylas_connection_1.default(this.clientSecret, { | ||
@@ -80,0 +94,0 @@ clientId: this.clientId, |
{ | ||
"name": "nylas", | ||
"version": "6.10.0", | ||
"version": "6.11.0", | ||
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.", | ||
@@ -50,3 +50,3 @@ "main": "lib/nylas.js", | ||
"JSONStream": "^1.3.5", | ||
"node-fetch": "^2.6.1", | ||
"node-fetch": "^2.6.12", | ||
"uuid": "^8.3.2", | ||
@@ -53,0 +53,0 @@ "websocket": "^1.0.34" |
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
398958
131
10127
Updatednode-fetch@^2.6.12