{"version":3,"sources":["../src/api/server-context.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { setAPIRequestRuntimeResolver, type APIRequestRuntime } from \"./server-client-bridge\";\n\nconst API_RUNTIME_STORAGE = Symbol.for(\"@farm.js/core/api-request-storage\");\nconst runtimeGlobal = globalThis as typeof globalThis & {\n  [API_RUNTIME_STORAGE]?: AsyncLocalStorage<APIRequestRuntime>;\n};\nconst storage = (runtimeGlobal[API_RUNTIME_STORAGE] ??= new AsyncLocalStorage<APIRequestRuntime>());\nsetAPIRequestRuntimeResolver(() => storage.getStore());\n\n/** Bind the owning app's live route dispatcher, never a process-wide route table. */\nexport function _runWithAPIRequestRuntime<T>(runtime: APIRequestRuntime, run: () => T): T {\n  return storage.run(runtime, run);\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,yBAAyB;AAGlC,IAAM,sBAAsB,uBAAO,IAAI,mCAAmC;AAC1E,IAAM,gBAAgB;AAGtB,IAAM,UAAW,4EAAuC,IAAI,kBAAqC;AACjG,6BAA6B,MAAM,QAAQ,SAAS,CAAC;AAG9C,SAAS,0BAA6B,SAA4B,KAAiB;AACxF,SAAO,QAAQ,IAAI,SAAS,GAAG;AACjC;AAFgB;","names":[]}