UNPKG

@logtail/next

Version:

Better Stack Telemetry Next.js client

49 lines 2.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const generic_1 = __importDefault(require("./generic")); class VercelConfig extends generic_1.default { constructor() { super(...arguments); this.shouldSendEdgeReport = true; this.region = process.env.VERCEL_REGION || undefined; this.environment = process.env.VERCEL_ENV || process.env.NODE_ENV || ''; } wrapWebVitalsObject(metrics) { return metrics.map(m => ({ webVital: m, dt: new Date().getTime(), vercel: { environment: this.environment, source: 'web-vital', deploymentId: process.env.VERCEL_DEPLOYMENT_ID, deploymentUrl: process.env.NEXT_PUBLIC_VERCEL_URL, project: process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL, git: { commit: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA, repo: process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG, ref: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF, }, }, })); } injectPlatformMetadata(logEvent, source) { logEvent.vercel = { environment: this.environment, region: this.region, source: source, deploymentId: process.env.VERCEL_DEPLOYMENT_ID, deploymentUrl: process.env.NEXT_PUBLIC_VERCEL_URL, project: process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL, git: { commit: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA, repo: process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG, ref: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF, }, }; } } exports.default = VercelConfig; //# sourceMappingURL=vercel.js.map