{"version":3,"file":"vercelWaitUntil.js","sources":["../../../src/utils/vercelWaitUntil.ts"],"sourcesContent":["import { GLOBAL_OBJ } from './worldwide';\n\ndeclare const EdgeRuntime: string | undefined;\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  // We only flush manually in Vercel Edge runtime\n  // In Node runtime, we use process.on('SIGTERM') instead\n  if (typeof EdgeRuntime !== 'string') {\n    return;\n  }\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 = vercelRequestContextGlobal?.get?.();\n\n  if (ctx?.waitUntil) {\n    ctx.waitUntil(task);\n  }\n}\n"],"names":["GLOBAL_OBJ"],"mappings":";;;;AAYA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAA0B;AAC9D;AACA;AACA,EAAE,IAAI,OAAO,WAAA,KAAgB,QAAQ,EAAE;AACvC,IAAI;AACJ,EAAE;AACF,EAAE,MAAM,0BAA0B;AAClC;AACA,IAAIA,oBAAU,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;;AAErD,EAAE,MAAM,MAAM,0BAA0B,EAAE,GAAG,IAAI;;AAEjD,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE;AACtB,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;AACvB,EAAE;AACF;;;;"}