Object.defineProperty(exports, '__esModule', { value: true }); const commonMap = new WeakMap(); /** * Takes a shared (garbage collectable) object between resources, e.g. a headers object shared between Next.js server components and returns a common propagation context. * * @param commonObject The shared object. * @param propagationContext The propagation context that should be shared between all the resources if no propagation context was registered yet. * @returns the shared propagation context. */ function commonObjectToPropagationContext( commonObject, propagationContext, ) { if (typeof commonObject === 'object' && commonObject) { const memoPropagationContext = commonMap.get(commonObject); if (memoPropagationContext) { return memoPropagationContext; } else { commonMap.set(commonObject, propagationContext); return propagationContext; } } else { return propagationContext; } } exports.commonObjectToPropagationContext = commonObjectToPropagationContext; //# sourceMappingURL=commonObjectTracing.js.map