Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return;
}
if (!(schemaHash in this.reports)) {
this.reportHeaders[schemaHash] = new ReportHeader({
...serviceHeaderDefaults,
schemaHash,
schemaTag:
this.options.schemaTag || process.env.ENGINE_SCHEMA_TAG || '',
});
// initializes this.reports[reportHash]
this.resetReport(schemaHash);
}
const report = this.reports[schemaHash];
const protobufError = Trace.verify(trace);
if (protobufError) {
throw new Error(`Error encoding trace: ${protobufError}`);
}
const encodedTrace = Trace.encode(trace).finish();
const signature = await this.getTraceSignature({
queryHash,
documentAST,
queryString,
operationName,
});
const statsReportKey = `# ${operationName || '-'}\n${signature}`;
if (!report.tracesPerQuery.hasOwnProperty(statsReportKey)) {
report.tracesPerQuery[statsReportKey] = new Traces();
(report.tracesPerQuery[statsReportKey] as any).encodedTraces = [];