@exceptionless/node
Advanced tools
Comparing version 3.0.5 to 3.1.0
@@ -14,3 +14,3 @@ import { ExceptionlessClient, LocalStorage, SimpleErrorPlugin } from "@exceptionless/core"; | ||
try { | ||
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless')); | ||
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + "/.exceptionless")); | ||
config.useLocalStorage = () => storage; | ||
@@ -20,3 +20,3 @@ config.services.storage = storage; | ||
catch (ex) { | ||
this.config.services.log.info(`Error configuring localStorage polyfill: ${ex instanceof Error ? ex.message : ex + ''}`); | ||
this.config.services.log.info(`Error configuring localStorage polyfill: ${ex instanceof Error ? ex.message : ex + ""}`); | ||
} | ||
@@ -23,0 +23,0 @@ config.addPlugin(new NodeEnvironmentInfoPlugin()); |
import { argv, memoryUsage, pid, title, version } from "process"; | ||
import { arch, cpus, endianness, freemem, hostname, loadavg, networkInterfaces, platform, release, tmpdir, totalmem, type, uptime, } from "os"; | ||
import { arch, cpus, endianness, freemem, hostname, loadavg, networkInterfaces, platform, release, tmpdir, totalmem, type, uptime } from "os"; | ||
import { KnownEventDataKeys } from "@exceptionless/core"; | ||
export class NodeEnvironmentInfoPlugin { | ||
constructor() { | ||
this.priority = 80; | ||
this.name = "NodeEnvironmentInfoPlugin"; | ||
} | ||
priority = 80; | ||
name = "NodeEnvironmentInfoPlugin"; | ||
_environmentInfo; | ||
run(context) { | ||
@@ -59,3 +58,3 @@ if (context.event.data && !context.event.data[KnownEventDataKeys.EnvironmentInfo]) { | ||
tmpdir: tmpdir() | ||
}, | ||
} | ||
}; | ||
@@ -62,0 +61,0 @@ const config = context.client.config; |
import { KnownEventDataKeys, IgnoredErrorProperties, isEmpty, stringify } from "@exceptionless/core"; | ||
import { parse as fromError } from "stack-trace"; | ||
export class NodeErrorPlugin { | ||
constructor() { | ||
this.priority = 30; | ||
this.name = "NodeErrorPlugin"; | ||
} | ||
priority = 30; | ||
name = "NodeErrorPlugin"; | ||
async run(context) { | ||
@@ -36,3 +34,3 @@ const exception = context.eventContext.getException(); | ||
name: frame.methodName || frame.functionName, | ||
parameters: [], | ||
parameters: [], // TODO: See if there is a way to get this. | ||
file_name: frame.fileName, | ||
@@ -43,4 +41,4 @@ line_number: frame.lineNumber || 0, | ||
data: { | ||
is_native: frame.native || (frame.fileName && frame.fileName[0] !== "/" && frame.fileName[0] !== "."), | ||
}, | ||
is_native: frame.native || (frame.fileName && frame.fileName[0] !== "/" && frame.fileName[0] !== ".") | ||
} | ||
}); | ||
@@ -57,3 +55,3 @@ } | ||
message: exception.message, | ||
stack_trace: getStackFrames(result || []), // TODO: Update type definition. | ||
stack_trace: getStackFrames(result || []) // TODO: Update type definition. | ||
}); | ||
@@ -60,0 +58,0 @@ } |
import { toError } from "@exceptionless/core"; | ||
export class NodeGlobalHandlerPlugin { | ||
constructor() { | ||
this.priority = 100; | ||
this.name = "NodeGlobalHandlerPlugin"; | ||
this._client = null; | ||
} | ||
priority = 100; | ||
name = "NodeGlobalHandlerPlugin"; | ||
_client = null; | ||
startup(context) { | ||
@@ -9,0 +7,0 @@ if (this._client) { |
@@ -8,8 +8,8 @@ import { IEventPlugin, PluginContext } from "@exceptionless/core"; | ||
/** | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
private getExitCodeReason; | ||
} | ||
//# sourceMappingURL=NodeLifeCyclePlugin.d.ts.map |
export class NodeLifeCyclePlugin { | ||
constructor() { | ||
this.priority = 105; | ||
this.name = "NodeLifeCyclePlugin"; | ||
this._client = null; | ||
} | ||
priority = 105; | ||
name = "NodeLifeCyclePlugin"; | ||
_client = null; | ||
startup(context) { | ||
@@ -33,6 +31,6 @@ if (this._client) { | ||
/** | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
getExitCodeReason(exitCode) { | ||
@@ -39,0 +37,0 @@ if (exitCode === 1) { |
@@ -1,7 +0,5 @@ | ||
import { getCookies, isEmpty, isMatch, KnownEventDataKeys, stringify, } from "@exceptionless/core"; | ||
import { getCookies, isEmpty, isMatch, KnownEventDataKeys, stringify } from "@exceptionless/core"; | ||
export class NodeRequestInfoPlugin { | ||
constructor() { | ||
this.priority = 70; | ||
this.name = "NodeRequestInfoPlugin"; | ||
} | ||
priority = 70; | ||
name = "NodeRequestInfoPlugin"; | ||
run(context) { | ||
@@ -40,3 +38,3 @@ if (context.event.data && !context.event.data[KnownEventDataKeys.RequestInfo]) { | ||
const host = request.headers.host; | ||
const port = host && parseInt(host.slice(host.indexOf(":") + 1), 10) || 0; | ||
const port = (host && parseInt(host.slice(host.indexOf(":") + 1), 10)) || 0; | ||
if (port > 0) { | ||
@@ -52,12 +50,3 @@ requestInfo.port = port; | ||
if (config.includeHeaders) { | ||
const ignoredHeaders = [ | ||
"Authorization", | ||
"Cookie", | ||
"Host", | ||
"Method", | ||
"Path", | ||
"Proxy-Authorization", | ||
"Referer", | ||
"User-Agent" | ||
]; | ||
const ignoredHeaders = ["Authorization", "Cookie", "Host", "Method", "Path", "Proxy-Authorization", "Referer", "User-Agent"]; | ||
const json = stringify(request.headers, [...ignoredHeaders, ...exclusions]); | ||
@@ -68,3 +57,3 @@ if (!isEmpty(json)) { | ||
for (const key in parsedHeaders) { | ||
headers[key] = parsedHeaders[key].split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/).map(value => value.trim()); | ||
headers[key] = parsedHeaders[key].split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/).map((value) => value.trim()); | ||
} | ||
@@ -71,0 +60,0 @@ requestInfo.headers = headers; |
export class NodeWrapFunctions { | ||
constructor() { | ||
this.priority = 110; | ||
this.name = "NodeWrapFunctions"; | ||
this._client = null; | ||
} | ||
priority = 110; | ||
name = "NodeWrapFunctions"; | ||
_client = null; | ||
startup(context) { | ||
@@ -8,0 +6,0 @@ if (this._client) { |
@@ -6,2 +6,3 @@ import { mkdirSync } from "fs"; | ||
export class NodeDirectoryStorage { | ||
directory; | ||
constructor(directory) { | ||
@@ -8,0 +9,0 @@ if (!directory) { |
{ | ||
"name": "@exceptionless/node", | ||
"version": "3.0.5", | ||
"version": "3.1.0", | ||
"description": "JavaScript client for Exceptionless", | ||
@@ -62,12 +62,12 @@ "author": { | ||
"@jest/globals": "^29.7.0", | ||
"@types/node": "^20.8.8", | ||
"@types/node-localstorage": "^1.3.2", | ||
"@types/stack-trace": "^0.0.32", | ||
"esbuild": "^0.19.5", | ||
"@types/node": "^20.11.30", | ||
"@types/node-localstorage": "^1.3.3", | ||
"@types/stack-trace": "^0.0.33", | ||
"esbuild": "^0.20.2", | ||
"jest": "^29.7.0", | ||
"jest-ts-webcompat-resolver": "^1.0.0", | ||
"ts-jest": "^29.1.1" | ||
"ts-jest": "^29.1.2" | ||
}, | ||
"dependencies": { | ||
"@exceptionless/core": "3.0.5", | ||
"@exceptionless/core": "3.1.0", | ||
"node-localstorage": "^3.0.5", | ||
@@ -74,0 +74,0 @@ "stack-trace": "^1.0.0-pre2" |
@@ -23,3 +23,3 @@ # Exceptionless NodeJS | ||
await Exceptionless.startup(c => { | ||
await Exceptionless.startup((c) => { | ||
c.apiKey = "API_KEY_HERE"; | ||
@@ -26,0 +26,0 @@ |
export * from "@exceptionless/core"; | ||
export { NodeErrorPlugin } from "./plugins/NodeErrorPlugin.js" | ||
export { NodeErrorPlugin } from "./plugins/NodeErrorPlugin.js"; | ||
export { NodeEnvironmentInfoPlugin } from "./plugins/NodeEnvironmentInfoPlugin.js"; | ||
@@ -5,0 +5,0 @@ export { NodeGlobalHandlerPlugin } from "./plugins/NodeGlobalHandlerPlugin.js"; |
@@ -1,7 +0,2 @@ | ||
import { | ||
Configuration, | ||
ExceptionlessClient, | ||
LocalStorage, | ||
SimpleErrorPlugin | ||
} from "@exceptionless/core"; | ||
import { Configuration, ExceptionlessClient, LocalStorage, SimpleErrorPlugin } from "@exceptionless/core"; | ||
@@ -23,7 +18,7 @@ import { LocalStorage as LocalStoragePolyfill } from "node-localstorage"; | ||
try { | ||
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless')); | ||
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + "/.exceptionless")); | ||
config.useLocalStorage = () => storage; | ||
config.services.storage = storage; | ||
} catch (ex) { | ||
this.config.services.log.info(`Error configuring localStorage polyfill: ${ex instanceof Error ? ex.message : ex + ''}`); | ||
this.config.services.log.info(`Error configuring localStorage polyfill: ${ex instanceof Error ? ex.message : ex + ""}`); | ||
} | ||
@@ -30,0 +25,0 @@ |
@@ -1,31 +0,6 @@ | ||
import { | ||
argv, | ||
memoryUsage, | ||
pid, | ||
title, | ||
version | ||
} from "process"; | ||
import { argv, memoryUsage, pid, title, version } from "process"; | ||
import { | ||
arch, | ||
cpus, | ||
endianness, | ||
freemem, | ||
hostname, | ||
loadavg, | ||
networkInterfaces, | ||
platform, | ||
release, | ||
tmpdir, | ||
totalmem, | ||
type, | ||
uptime, | ||
} from "os"; | ||
import { arch, cpus, endianness, freemem, hostname, loadavg, networkInterfaces, platform, release, tmpdir, totalmem, type, uptime } from "os"; | ||
import { | ||
EnvironmentInfo, | ||
EventPluginContext, | ||
IEventPlugin, | ||
KnownEventDataKeys | ||
} from "@exceptionless/core"; | ||
import { EnvironmentInfo, EventPluginContext, IEventPlugin, KnownEventDataKeys } from "@exceptionless/core"; | ||
@@ -95,3 +70,3 @@ export class NodeEnvironmentInfoPlugin implements IEventPlugin { | ||
tmpdir: tmpdir() | ||
}, | ||
} | ||
}; | ||
@@ -98,0 +73,0 @@ |
@@ -67,4 +67,4 @@ import { | ||
data: { | ||
is_native: frame.native || (frame.fileName && frame.fileName[0] !== "/" && frame.fileName[0] !== "."), | ||
}, | ||
is_native: frame.native || (frame.fileName && frame.fileName[0] !== "/" && frame.fileName[0] !== ".") | ||
} | ||
}); | ||
@@ -84,5 +84,5 @@ } | ||
message: exception.message, | ||
stack_trace: getStackFrames(<stackFrameShape[]><unknown>result || []), // TODO: Update type definition. | ||
stack_trace: getStackFrames(<stackFrameShape[]>(<unknown>result) || []) // TODO: Update type definition. | ||
}); | ||
} | ||
} |
@@ -1,7 +0,2 @@ | ||
import { | ||
ExceptionlessClient, | ||
IEventPlugin, | ||
PluginContext, | ||
toError | ||
} from "@exceptionless/core"; | ||
import { ExceptionlessClient, IEventPlugin, PluginContext, toError } from "@exceptionless/core"; | ||
@@ -27,3 +22,3 @@ export class NodeGlobalHandlerPlugin implements IEventPlugin { | ||
process.addListener("unhandledRejection", (reason: unknown) => { | ||
const error: Error = toError(reason, "Unhandled rejection") | ||
const error: Error = toError(reason, "Unhandled rejection"); | ||
void this._client?.submitUnhandledException(error, "unhandledRejection"); | ||
@@ -30,0 +25,0 @@ }); |
@@ -1,6 +0,2 @@ | ||
import { | ||
ExceptionlessClient, | ||
IEventPlugin, | ||
PluginContext | ||
} from "@exceptionless/core"; | ||
import { ExceptionlessClient, IEventPlugin, PluginContext } from "@exceptionless/core"; | ||
@@ -47,6 +43,6 @@ export class NodeLifeCyclePlugin implements IEventPlugin { | ||
/** | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
* exit codes: https://nodejs.org/api/process.html#process_event_exit | ||
* From now on, only synchronous code may run. As soon as this method | ||
* ends, the application inevitably will exit. | ||
*/ | ||
private getExitCodeReason(exitCode: number): string | null { | ||
@@ -53,0 +49,0 @@ if (exitCode === 1) { |
@@ -1,11 +0,2 @@ | ||
import { | ||
EventPluginContext, | ||
getCookies, | ||
IEventPlugin, | ||
isEmpty, | ||
isMatch, | ||
KnownEventDataKeys, | ||
RequestInfo, | ||
stringify, | ||
} from "@exceptionless/core"; | ||
import { EventPluginContext, getCookies, IEventPlugin, isEmpty, isMatch, KnownEventDataKeys, RequestInfo, stringify } from "@exceptionless/core"; | ||
@@ -43,10 +34,10 @@ export class NodeRequestInfoPlugin implements IEventPlugin { | ||
type requestShape = { | ||
method: string, | ||
secure: boolean, | ||
ip: string, | ||
hostname: string, | ||
path: string, | ||
headers: Record<string, string>, | ||
params: Record<string, unknown>, | ||
body?: object | ||
method: string; | ||
secure: boolean; | ||
ip: string; | ||
hostname: string; | ||
path: string; | ||
headers: Record<string, string>; | ||
params: Record<string, unknown>; | ||
body?: object; | ||
}; | ||
@@ -65,3 +56,3 @@ | ||
const host = request.headers.host; | ||
const port: number = host && parseInt(host.slice(host.indexOf(":") + 1), 10) || 0; | ||
const port: number = (host && parseInt(host.slice(host.indexOf(":") + 1), 10)) || 0; | ||
if (port > 0) { | ||
@@ -80,12 +71,3 @@ requestInfo.port = port; | ||
if (config.includeHeaders) { | ||
const ignoredHeaders = [ | ||
"Authorization", | ||
"Cookie", | ||
"Host", | ||
"Method", | ||
"Path", | ||
"Proxy-Authorization", | ||
"Referer", | ||
"User-Agent" | ||
]; | ||
const ignoredHeaders = ["Authorization", "Cookie", "Host", "Method", "Path", "Proxy-Authorization", "Referer", "User-Agent"]; | ||
@@ -97,3 +79,3 @@ const json = stringify(request.headers, [...ignoredHeaders, ...exclusions]); | ||
for (const key in parsedHeaders) { | ||
headers[key] = parsedHeaders[key].split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/).map(value => value.trim()); | ||
headers[key] = parsedHeaders[key].split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/).map((value) => value.trim()); | ||
} | ||
@@ -100,0 +82,0 @@ |
@@ -1,6 +0,2 @@ | ||
import { | ||
ExceptionlessClient, | ||
IEventPlugin, | ||
PluginContext | ||
} from "@exceptionless/core"; | ||
import { ExceptionlessClient, IEventPlugin, PluginContext } from "@exceptionless/core"; | ||
@@ -7,0 +3,0 @@ export class NodeWrapFunctions implements IEventPlugin { |
@@ -1,4 +0,2 @@ | ||
import { | ||
IStorage | ||
} from "@exceptionless/core"; | ||
import { IStorage } from "@exceptionless/core"; | ||
@@ -5,0 +3,0 @@ import { mkdirSync } from "fs"; |
@@ -13,7 +13,2 @@ import { IStorage } from "@exceptionless/core"; | ||
describeStorage( | ||
"NodeDirectoryStorage", | ||
(): IStorage => new NodeDirectoryStorage(directory), | ||
resetStorageDirectory, | ||
resetStorageDirectory | ||
); | ||
describeStorage("NodeDirectoryStorage", (): IStorage => new NodeDirectoryStorage(directory), resetStorageDirectory, resetStorageDirectory); |
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"lib": [ | ||
"ES2021" | ||
], | ||
"lib": ["ES2022"], | ||
"outDir": "dist", | ||
"rootDir": "src", | ||
"types": [ | ||
"node", | ||
"jest" | ||
] | ||
"types": ["node", "jest"] | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
"include": ["src"] | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
396631
4510
+ Added@exceptionless/core@3.1.0(transitive)
- Removed@exceptionless/core@3.0.5(transitive)
Updated@exceptionless/core@3.1.0