@report-toolkit/common
Version:
See docs at [https://ibm.github.io/report-toolkit](https://ibm.github.io/report-toolkit)
132 lines (131 loc) • 4.56 kB
TypeScript
/**
* A representation of a Diagnostic Report
* @module @report-toolkit/common.report
*
*/
/**
*/
/**
* Creates a read-only {@link Report} from a {@link ReportLike} value.
* Use this instead of `new Report()`!
* @param {ReportLike} rawReport
* @param {string} filepath
*/
export function createReport(rawReport: ReportLike, filepath: string): Readonly<Report>;
/**
* Returns `true` if the value is an object having a property `report-toolkit-report` `Symbol` with value `true`.
* @param {any} value
*/
export function isReport(value: any): boolean;
/**
* Returns `true` if `value` has all expected root properties of a Diagnostic Report (as returned by [process.report.getReport()](https://nodejs.org/api/process.html#process_process_report_getreport_err)), or is a {@link Report}.
* @param {any} value
*/
export function isReportLike(value: any): boolean;
/**
* Either a {@link Report} or an object with all of the required props. See {@link Report.isReportLike}
*/
export type ReportLike = import("../diagnostic-report.js").DiagnosticReport | Report;
/**
* Represents a [Diagnostic Report](https://nodejs.org/api/process.html#process_process_report_getreport_err).
*/
export class Report {
/**
* Creates a read-only {@link Report} from a {@link ReportLike} value.
* Use this instead of `new Report()`!
* @param {ReportLike} rawReport
* @param {string} filepath
*/
static create(rawReport: ReportLike, filepath: string): Readonly<Report>;
/**
* Returns `true` if the value is an object having a property `report-toolkit-report` `Symbol` with value `true`.
* @param {any} value
*/
static isReport(value: any): boolean;
/**
* Returns `true` if `value` has all expected root properties of a Diagnostic Report (as returned by [process.report.getReport()](https://nodejs.org/api/process.html#process_process_report_getreport_err)), or is a {@link Report}.
* @param {any} value
*/
static isReportLike(value: any): boolean;
/**
* Creates shallow copies of root props in `report`; assigns internally-used `Symbol`s.
* @param {import('../diagnostic-report').DiagnosticReport} report - Raw object
* @param {string?} filepath - Original filepath of report, if available. Defaults to {@link NO_FILEPATH}
*/
constructor(report: import('../diagnostic-report').DiagnosticReport, filepath?: string | null);
header: {
event: string;
trigger: string;
filename: string;
dumpEventTime: string;
dumpEventTimeStamp: string;
processId: number;
threadId: number;
cwd: string;
commandLine: string[];
nodejsVersion: string;
wordSize: number;
arch: string;
platform: string;
componentVersions: {
[key: string]: string;
};
release: {
name: string;
headersUrl: string;
sourceUrl: string;
};
osName: string;
osRelease: string;
osVersion: string;
osMachine: string;
cpus: import("../diagnostic-report.js").ReportHeaderCpu[];
host: string;
};
javascriptStack: {
message: string;
stack: string[];
};
nativeStack: import("../diagnostic-report.js").NativeStackFrame[];
javascriptHeap: {
totalMemory: number;
totalCommittedMemory: number;
usedMemory: number;
availableMemory: number;
memoryLimit: number;
heapSpaces: {
[key: string]: import("../diagnostic-report.js").ReportHeapSpace;
};
};
resourceUsage: {
userCpuSeconds: number;
kernelCpuSeconds: number;
cpuConsumptionPercent: number;
maxRss: number;
pageFaults: {
IORequired: number;
IONotRequired: number;
};
fsActivity: {
reads: number;
writes: number;
};
};
libuv: import("../diagnostic-report.js").ReportUVItem[];
workers: import("../diagnostic-report.js").DiagnosticReport[];
environmentVariables: {
[x: string]: string;
};
userLimits: {
[x: string]: import("../diagnostic-report.js").ReportUserLimit;
};
sharedObjects: string[];
/**
* Original filepath of report, if available. Defaults to {@link NO_FILEPATH}.
*/
get filepath(): string;
[kReportFilepath]: string;
[kReport]: boolean;
}
import { kReportFilepath } from "./symbols.js";
import { kReport } from "./symbols.js";