{"version":3,"sources":["error-reporting.ts"],"sourcesContent":["import { Compiler } from \"../compiler/compiler.ts\";\nimport { sendDatexViaHTTPChannel } from \"../network/datex-http-channel.ts\";\nimport { Runtime } from \"../runtime/runtime.ts\";\nimport { LOCAL_ENDPOINT } from \"../types/addressing.ts\";\nimport { getCallerInfo } from \"../utils/caller_metadata.ts\";\nimport { logger } from \"./global_values.ts\";\n\nexport async function sendReport(identifier: string, reportData:Record<string,any>) {\n\tif (!enabled) return;\n\n\tconst report = {\n\t\tidentifier,\n\t\ttimestamp: new Date(),\n\t\tmetadata: {\n\t\t\tendpoint: Runtime.endpoint.toString(),\n\t\t\tdatexcoreVersion: Runtime.VERSION,\n\t\t\tuixVersion: globalThis.UIX?.version,\n\t\t\tdenoVersion: globalThis.Deno?.version.deno,\n\t\t\ttsVersion: globalThis.Deno?.version.typescript,\n\t\t\tv8Version: globalThis.Deno?.version.v8,\n\t\t\tuserAgent: JSON.parse(JSON.stringify(globalThis.navigator.userAgentData ?? globalThis.navigator.userAgent))\n\t\t},\n\t\treportData,\n\t\tstack: getCallerInfo()\n\t}\n\n\tconst dx = `#endpoint.Reporting.sendReport(?)`\n\tconst dxb = <ArrayBuffer> await Compiler.compile(dx, [report], {sign: false, encrypt: false, to: LOCAL_ENDPOINT});\n\tsendDatexViaHTTPChannel(dxb, \"https://status.unyt.org\")\n}\n\nlet enabled = false;\n\nexport function enableErrorReporting(enable = true) {\n\tlogger.debug(\"error reporting to unyt.org \" + (enable ? \"enabled\" : \"disabled\"));\n\tenabled = enable;\n}"],"names":["Compiler","sendDatexViaHTTPChannel","Runtime","LOCAL_ENDPOINT","getCallerInfo","logger","sendReport","identifier","reportData","enabled","report","timestamp","Date","metadata","endpoint","toString","datexcoreVersion","VERSION","uixVersion","globalThis","UIX","version","denoVersion","Deno","deno","tsVersion","typescript","v8Version","v8","userAgent","JSON","parse","stringify","navigator","userAgentData","stack","compile","sign","encrypt","to","enableErrorReporting","enable","debug"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,uBAAuB,QAAQ,mCAAmC;AAC3E,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,OAAO,eAAeC,WAAWC,UAAkB,EAAEC,UAA6B;IACjF,IAAI,CAACC,SAAS;IAEd,IAAMC,SAAS;QACdH;QACAI,WAAW,IAAIC;QACfC,UAAU;YACTC,UAAUZ,QAAQY,QAAQ,CAACC,QAAQ;YACnCC,kBAAkBd,QAAQe,OAAO;YACjCC,YAAYC,WAAWC,GAAG,EAAEC;YAC5BC,aAAaH,WAAWI,IAAI,EAAEF,QAAQG;YACtCC,WAAWN,WAAWI,IAAI,EAAEF,QAAQK;YACpCC,WAAWR,WAAWI,IAAI,EAAEF,QAAQO;YACpCC,WAAWC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACb,WAAWc,SAAS,CAACC,aAAa,IAAIf,WAAWc,SAAS,CAACJ,SAAS;QAC1G;QACArB;QACA2B,OAAO/B;IACR;IAIAH,wBAD0B,MAAMD,SAASoC,OAAO,CADrC,qCAC0C;QAAC1B;KAAO,EAAE;QAAC2B,MAAM,CAAA;QAAOC,SAAS,CAAA;QAAOC,IAAIpC;IAAc,IAClF;AAC9B;AAEA,IAAIM,UAAU,CAAA;AAEd,OAAO,SAAS+B,qBAAqBC,SAAS,CAAA,CAAI;IACjDpC,OAAOqC,KAAK,CAAC,iCAAkCD,CAAAA,SAAS,YAAY,UAAS,IAC7EhC,UAAUgC;AACX","sourceRoot":"/lib/datex-core-js-legacy-0.3.15/utils/","file":"error-reporting.ts"}