UNPKG

@sentry/core

Version:
1 lines 1.3 kB
{"version":3,"file":"vercelWaitUntil.js","sources":["../../../src/utils/vercelWaitUntil.ts"],"sourcesContent":["import { GLOBAL_OBJ } from './worldwide';\n\ninterface VercelRequestContextGlobal {\n get?():\n | {\n waitUntil?: (task: Promise<unknown>) => void;\n }\n | undefined;\n}\n\n/**\n * Function that delays closing of a Vercel lambda until the provided promise is resolved.\n *\n * Vendored from https://www.npmjs.com/package/@vercel/functions\n */\nexport function vercelWaitUntil(task: Promise<unknown>): void {\n const vercelRequestContextGlobal: VercelRequestContextGlobal | undefined =\n // @ts-expect-error This is not typed\n GLOBAL_OBJ[Symbol.for('@vercel/request-context')];\n\n const ctx =\n vercelRequestContextGlobal?.get && vercelRequestContextGlobal.get() ? vercelRequestContextGlobal.get() : {};\n\n if (ctx?.waitUntil) {\n ctx.waitUntil(task);\n }\n}\n"],"names":["GLOBAL_OBJ"],"mappings":";;;;AAUA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAA0B;AAC9D,EAAE,MAAM,0BAA0B;AAClC;AACA,IAAIA,oBAAU,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;;AAErD,EAAE,MAAM,GAAA;AACR,IAAI,0BAA0B,EAAE,GAAA,IAAO,0BAA0B,CAAC,GAAG,EAAC,GAAI,0BAA0B,CAAC,GAAG,EAAC,GAAI,EAAE;;AAE/G,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE;AACtB,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;AACvB;AACA;;;;"}