Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@compas/server

Package Overview
Dependencies
Maintainers
1
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compas/server - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

4

package.json
{
"name": "@compas/server",
"version": "0.11.0",
"version": "0.11.1",
"description": "Koa server and common middleware",

@@ -24,3 +24,3 @@ "exports": {

"dependencies": {
"@compas/stdlib": "0.11.0",
"@compas/stdlib": "0.11.1",
"@types/formidable": "2.0.6",

@@ -27,0 +27,0 @@ "@types/koa": "2.15.0",

@@ -1,2 +0,2 @@

import { _compasSentryExport } from "@compas/stdlib";
import { _compasSentryExport, isNil, uuid } from "@compas/stdlib";

@@ -24,3 +24,3 @@ /**

return async (ctx, next) => {
return (ctx, next) => {
if (ctx.method === "OPTIONS" || ctx.method === "HEAD") {

@@ -30,19 +30,23 @@ return next();

let traceParentData = {
forceTransaction: true,
};
if (ctx.request.get("sentry-trace")) {
// @ts-expect-error
traceParentData = _compasSentryExport.extractTraceparentData(
ctx.request.get("sentry-trace"),
);
if (!_compasSentryExport) {
return next();
}
// @ts-expect-error
return await _compasSentryExport.startSpanManual(
const traceHeader = ctx.request.get("sentry-trace");
/** @type {any} */
const traceParentData =
_compasSentryExport.extractTraceparentData(traceHeader) ?? {};
// Use a manual span, so we can end it right after the body is send.
return _compasSentryExport.startSpanManual(
{
// Force a new trace for every request. This keeps the traces view usable.
traceId: uuid().replace(/-/g, ""),
...traceParentData,
spanId: uuid().replace(/-/g, "").slice(16),
forceTransaction: isNil(traceParentData.parentSpanId),
op: "http.server",
name: "http",
description: "http",
...traceParentData,
attributes: {

@@ -49,0 +53,0 @@ "http.request.method": ctx.method,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc