@sentry/node 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/cron/common.js +56 -0
- package/cjs/cron/common.js.map +1 -0
- package/cjs/cron/cron.js +112 -0
- package/cjs/cron/cron.js.map +1 -0
- package/cjs/cron/index.js +15 -0
- package/cjs/cron/index.js.map +1 -0
- package/cjs/cron/node-cron.js +72 -0
- package/cjs/cron/node-cron.js.map +1 -0
- package/cjs/cron/node-schedule.js +69 -0
- package/cjs/cron/node-schedule.js.map +1 -0
- package/cjs/debug-build.js +11 -0
- package/cjs/debug-build.js.map +1 -0
- package/cjs/index.js +85 -4018
- package/cjs/index.js.map +1 -1
- package/cjs/integrations/anr/index.js +211 -0
- package/cjs/integrations/anr/index.js.map +1 -0
- package/cjs/integrations/console.js +40 -0
- package/cjs/integrations/console.js.map +1 -0
- package/cjs/integrations/context.js +435 -0
- package/cjs/integrations/context.js.map +1 -0
- package/cjs/integrations/contextlines.js +137 -0
- package/cjs/integrations/contextlines.js.map +1 -0
- package/cjs/integrations/http.js +161 -0
- package/cjs/integrations/http.js.map +1 -0
- package/cjs/integrations/local-variables/common.js +87 -0
- package/cjs/integrations/local-variables/common.js.map +1 -0
- package/cjs/integrations/local-variables/index.js +12 -0
- package/cjs/integrations/local-variables/index.js.map +1 -0
- package/cjs/integrations/local-variables/local-variables-async.js +149 -0
- package/cjs/integrations/local-variables/local-variables-async.js.map +1 -0
- package/cjs/integrations/local-variables/local-variables-sync.js +376 -0
- package/cjs/integrations/local-variables/local-variables-sync.js.map +1 -0
- package/cjs/integrations/modules.js +99 -0
- package/cjs/integrations/modules.js.map +1 -0
- package/cjs/integrations/node-fetch.js +81 -0
- package/cjs/integrations/node-fetch.js.map +1 -0
- package/cjs/integrations/onuncaughtexception.js +135 -0
- package/cjs/integrations/onuncaughtexception.js.map +1 -0
- package/cjs/integrations/onunhandledrejection.js +90 -0
- package/cjs/integrations/onunhandledrejection.js.map +1 -0
- package/cjs/integrations/spotlight.js +109 -0
- package/cjs/integrations/spotlight.js.map +1 -0
- package/cjs/integrations/tracing/connect.js +41 -0
- package/cjs/integrations/tracing/connect.js.map +1 -0
- package/cjs/integrations/tracing/express.js +127 -0
- package/cjs/integrations/tracing/express.js.map +1 -0
- package/cjs/integrations/tracing/fastify.js +84 -0
- package/cjs/integrations/tracing/fastify.js.map +1 -0
- package/cjs/integrations/tracing/graphql.js +32 -0
- package/cjs/integrations/tracing/graphql.js.map +1 -0
- package/cjs/integrations/tracing/hapi/index.js +106 -0
- package/cjs/integrations/tracing/hapi/index.js.map +1 -0
- package/cjs/integrations/tracing/index.js +43 -0
- package/cjs/integrations/tracing/index.js.map +1 -0
- package/cjs/integrations/tracing/koa.js +60 -0
- package/cjs/integrations/tracing/koa.js.map +1 -0
- package/cjs/integrations/tracing/mongo.js +31 -0
- package/cjs/integrations/tracing/mongo.js.map +1 -0
- package/cjs/integrations/tracing/mongoose.js +31 -0
- package/cjs/integrations/tracing/mongoose.js.map +1 -0
- package/cjs/integrations/tracing/mysql.js +24 -0
- package/cjs/integrations/tracing/mysql.js.map +1 -0
- package/cjs/integrations/tracing/mysql2.js +31 -0
- package/cjs/integrations/tracing/mysql2.js.map +1 -0
- package/cjs/integrations/tracing/nest.js +69 -0
- package/cjs/integrations/tracing/nest.js.map +1 -0
- package/cjs/integrations/tracing/postgres.js +32 -0
- package/cjs/integrations/tracing/postgres.js.map +1 -0
- package/cjs/integrations/tracing/prisma.js +48 -0
- package/cjs/integrations/tracing/prisma.js.map +1 -0
- package/cjs/integrations/tracing/redis.js +29 -0
- package/cjs/integrations/tracing/redis.js.map +1 -0
- package/cjs/nodeVersion.js +10 -0
- package/cjs/nodeVersion.js.map +1 -0
- package/cjs/otel/contextManager.js +16 -0
- package/cjs/otel/contextManager.js.map +1 -0
- package/cjs/proxy/base.js +127 -0
- package/cjs/proxy/base.js.map +1 -0
- package/cjs/proxy/index.js +178 -0
- package/cjs/proxy/index.js.map +1 -0
- package/cjs/proxy/parse-proxy-response.js +104 -0
- package/cjs/proxy/parse-proxy-response.js.map +1 -0
- package/cjs/sdk/api.js +45 -0
- package/cjs/sdk/api.js.map +1 -0
- package/cjs/sdk/client.js +63 -0
- package/cjs/sdk/client.js.map +1 -0
- package/cjs/sdk/init.js +318 -0
- package/cjs/sdk/init.js.map +1 -0
- package/cjs/sdk/initOtel.js +58 -0
- package/cjs/sdk/initOtel.js.map +1 -0
- package/cjs/sdk/scope.js +18 -0
- package/cjs/sdk/scope.js.map +1 -0
- package/cjs/transports/http.js +163 -0
- package/cjs/transports/http.js.map +1 -0
- package/cjs/utils/addOriginToSpan.js +11 -0
- package/cjs/utils/addOriginToSpan.js.map +1 -0
- package/cjs/utils/errorhandling.js +44 -0
- package/cjs/utils/errorhandling.js.map +1 -0
- package/cjs/utils/getRequestUrl.js +18 -0
- package/cjs/utils/getRequestUrl.js.map +1 -0
- package/cjs/utils/module.js +62 -0
- package/cjs/utils/module.js.map +1 -0
- package/esm/cron/common.js +54 -0
- package/esm/cron/common.js.map +1 -0
- package/esm/cron/cron.js +110 -0
- package/esm/cron/cron.js.map +1 -0
- package/esm/cron/index.js +13 -0
- package/esm/cron/index.js.map +1 -0
- package/esm/cron/node-cron.js +67 -0
- package/esm/cron/node-cron.js.map +1 -0
- package/esm/cron/node-schedule.js +64 -0
- package/esm/cron/node-schedule.js.map +1 -0
- package/esm/debug-build.js +9 -0
- package/esm/debug-build.js.map +1 -0
- package/esm/index.js +35 -3973
- package/esm/index.js.map +1 -1
- package/esm/integrations/anr/index.js +204 -0
- package/esm/integrations/anr/index.js.map +1 -0
- package/esm/integrations/anr/worker-script.js +2 -2
- package/esm/integrations/console.js +38 -0
- package/esm/integrations/console.js.map +1 -0
- package/esm/integrations/context.js +427 -0
- package/esm/integrations/context.js.map +1 -0
- package/esm/integrations/contextlines.js +131 -0
- package/esm/integrations/contextlines.js.map +1 -0
- package/esm/integrations/http.js +156 -0
- package/esm/integrations/http.js.map +1 -0
- package/esm/integrations/local-variables/common.js +81 -0
- package/esm/integrations/local-variables/common.js.map +1 -0
- package/esm/integrations/local-variables/index.js +10 -0
- package/esm/integrations/local-variables/index.js.map +1 -0
- package/esm/integrations/local-variables/local-variables-async.js +143 -0
- package/esm/integrations/local-variables/local-variables-async.js.map +1 -0
- package/esm/integrations/local-variables/local-variables-sync.js +370 -0
- package/esm/integrations/local-variables/local-variables-sync.js.map +1 -0
- package/esm/integrations/local-variables/worker-script.js +1 -1
- package/esm/integrations/modules.js +97 -0
- package/esm/integrations/modules.js.map +1 -0
- package/esm/integrations/node-fetch.js +79 -0
- package/esm/integrations/node-fetch.js.map +1 -0
- package/esm/integrations/onuncaughtexception.js +132 -0
- package/esm/integrations/onuncaughtexception.js.map +1 -0
- package/esm/integrations/onunhandledrejection.js +87 -0
- package/esm/integrations/onunhandledrejection.js.map +1 -0
- package/esm/integrations/spotlight.js +106 -0
- package/esm/integrations/spotlight.js.map +1 -0
- package/esm/integrations/tracing/connect.js +38 -0
- package/esm/integrations/tracing/connect.js.map +1 -0
- package/esm/integrations/tracing/express.js +120 -0
- package/esm/integrations/tracing/express.js.map +1 -0
- package/esm/integrations/tracing/fastify.js +78 -0
- package/esm/integrations/tracing/fastify.js.map +1 -0
- package/esm/integrations/tracing/graphql.js +30 -0
- package/esm/integrations/tracing/graphql.js.map +1 -0
- package/esm/integrations/tracing/hapi/index.js +99 -0
- package/esm/integrations/tracing/hapi/index.js.map +1 -0
- package/esm/integrations/tracing/index.js +41 -0
- package/esm/integrations/tracing/index.js.map +1 -0
- package/esm/integrations/tracing/koa.js +57 -0
- package/esm/integrations/tracing/koa.js.map +1 -0
- package/esm/integrations/tracing/mongo.js +29 -0
- package/esm/integrations/tracing/mongo.js.map +1 -0
- package/esm/integrations/tracing/mongoose.js +29 -0
- package/esm/integrations/tracing/mongoose.js.map +1 -0
- package/esm/integrations/tracing/mysql.js +22 -0
- package/esm/integrations/tracing/mysql.js.map +1 -0
- package/esm/integrations/tracing/mysql2.js +29 -0
- package/esm/integrations/tracing/mysql2.js.map +1 -0
- package/esm/integrations/tracing/nest.js +63 -0
- package/esm/integrations/tracing/nest.js.map +1 -0
- package/esm/integrations/tracing/postgres.js +30 -0
- package/esm/integrations/tracing/postgres.js.map +1 -0
- package/esm/integrations/tracing/prisma.js +43 -0
- package/esm/integrations/tracing/prisma.js.map +1 -0
- package/esm/integrations/tracing/redis.js +27 -0
- package/esm/integrations/tracing/redis.js.map +1 -0
- package/esm/nodeVersion.js +7 -0
- package/esm/nodeVersion.js.map +1 -0
- package/esm/otel/contextManager.js +14 -0
- package/esm/otel/contextManager.js.map +1 -0
- package/esm/proxy/base.js +122 -0
- package/esm/proxy/base.js.map +1 -0
- package/esm/proxy/index.js +172 -0
- package/esm/proxy/index.js.map +1 -0
- package/esm/proxy/parse-proxy-response.js +102 -0
- package/esm/proxy/parse-proxy-response.js.map +1 -0
- package/esm/sdk/api.js +42 -0
- package/esm/sdk/api.js.map +1 -0
- package/esm/sdk/client.js +58 -0
- package/esm/sdk/client.js.map +1 -0
- package/esm/sdk/init.js +312 -0
- package/esm/sdk/init.js.map +1 -0
- package/esm/sdk/initOtel.js +55 -0
- package/esm/sdk/initOtel.js.map +1 -0
- package/esm/sdk/scope.js +16 -0
- package/esm/sdk/scope.js.map +1 -0
- package/esm/transports/http.js +158 -0
- package/esm/transports/http.js.map +1 -0
- package/esm/utils/addOriginToSpan.js +9 -0
- package/esm/utils/addOriginToSpan.js.map +1 -0
- package/esm/utils/errorhandling.js +42 -0
- package/esm/utils/errorhandling.js.map +1 -0
- package/esm/utils/getRequestUrl.js +16 -0
- package/esm/utils/getRequestUrl.js.map +1 -0
- package/esm/utils/module.js +60 -0
- package/esm/utils/module.js.map +1 -0
- package/package.json +16 -16
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/types/integrations/tracing/koa.d.ts.map +1 -1
- package/types/sdk/init.d.ts +4 -0
- package/types/sdk/init.d.ts.map +1 -1
- package/types-ts3.8/index.d.ts +2 -2
- package/types-ts3.8/sdk/init.d.ts +4 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @sentry/node 8.
|
|
2
|
-
import{Session as t}from"inspector";import{parentPort as e,workerData as n}from"worker_threads";import{posix as r,sep as o}from"path";import*as s from"node:http";import*as i from"node:https";import{Readable as c}from"stream";import{createGzip as u}from"zlib";import*as a from"net";import*as f from"tls";import*as h from"http";const p=Object.prototype.toString;function l(t,e){return p.call(t)===`[object ${e}]`}function d(t){return l(t,"Object")}function m(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function g(t,e){try{return t instanceof e}catch(t){return!1}}const y=globalThis;function b(t,e,n){const r=n||y,o=r.__SENTRY__=r.__SENTRY__||{};return o[t]||(o[t]=e())}const v=y,_=80;function w(t,e){const n=t,r=[];let o,s,i,c,u;if(!n||!n.tagName)return"";if(v.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const a=e&&e.length?e.filter((t=>n.getAttribute(t))).map((t=>[t,n.getAttribute(t)])):null;if(a&&a.length)a.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(n.id&&r.push(`#${n.id}`),o=n.className,o&&l(o,"String"))for(s=o.split(/\s+/),u=0;u<s.length;u++)r.push(`.${s[u]}`);const f=["aria-label","type","name","title","alt"];for(u=0;u<f.length;u++)i=f[u],c=n.getAttribute(i),c&&r.push(`[${i}="${c}"]`);return r.join("")}const S="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$=["debug","info","warn","error","log","assert","trace"],E={};function x(t){if(!("console"in y))return t();const e=y.console,n={},r=Object.keys(E);r.forEach((t=>{const r=E[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}const N=function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return S?$.forEach((n=>{e[n]=(...e)=>{t&&x((()=>{y.console[n](`Sentry Logger [${n}]:`,...e)}))}})):$.forEach((t=>{e[t]=()=>{}})),e}();function k(t,e=!1){const{host:n,path:r,pass:o,port:s,projectId:i,protocol:c,publicKey:u}=t;return`${c}://${u}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r?`${r}/`:r}${i}`}class C extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}}function D(t){if(function(t){switch(p.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return g(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...O(t)};if(e=t,"undefined"!=typeof Event&&g(e,Event)){const e={type:t.type,target:T(t.target),currentTarget:T(t.currentTarget),...O(t)};return"undefined"!=typeof CustomEvent&&g(t,CustomEvent)&&(e.detail=t.detail),e}return t;var e}function T(t){try{return e=t,"undefined"!=typeof Element&&g(e,Element)?function(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,o=[];let s=0,i=0;const c=" > ",u=c.length;let a;const f=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||_;for(;n&&s++<r&&(a=w(n,f),!("html"===a||s>1&&i+o.length*u+a.length>=h));)o.push(a),i+=a.length,n=n.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var e}function O(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function j(t){return R(t,new Map)}function R(t,e){if(function(t){if(!d(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||"Object"===e}catch(t){return!0}}(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const n of Object.keys(t))void 0!==t[n]&&(r[n]=R(t[n],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach((t=>{r.push(R(t,e))})),r}return t}const A=50,I="?",P=/captureMessage|captureException/;const U="<anonymous>";function M(){const t=y,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function L(t,e=100,n=1/0){try{return B("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function B(t,e,n=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(let t=0;t<e.length;t++)if(e[t]===n)return!0;return e.push(n),!1},function(n){if(t)e.delete(n);else for(let t=0;t<e.length;t++)if(e[t]===n){e.splice(t,1);break}}]}()){const[s,i]=o;if(null==e||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;const c=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.t)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if("object"==typeof(n=e)&&null!==n&&(n.__isVue||n.o))return"[VueViewModel]";if(function(t){return d(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(e))return"[SyntheticEvent]";if("number"==typeof e&&e!=e)return"[NaN]";if("function"==typeof e)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||U}catch(t){return U}}(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;const u="number"==typeof e.__sentry_override_normalization_depth__?e.__sentry_override_normalization_depth__:n;if(0===u)return c.replace("object ","");if(s(e))return"[Circular ~]";const a=e;if(a&&"function"==typeof a.toJSON)try{return B("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(e)?[]:{};let h=0;const p=D(e);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const e=p[t];f[t]=B(t,e,u-1,r,o),h++}return i(e),f}function G(t,e){const n=e.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${n}/*`,"ig"),"app:///")}const J=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function z(t){const e=function(t){const e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=J.exec(e);return n?n.slice(1):[]}(t),n=e[0];let r=e[1];return n||r?(r&&(r=r.slice(0,r.length-1)),n+r):"."}var H;function W(t){return new Y((e=>{e(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(H||(H={}));class Y{constructor(t){Y.prototype.__init.call(this),Y.prototype.__init2.call(this),Y.prototype.__init3.call(this),Y.prototype.__init4.call(this),this.i=H.PENDING,this.u=[];try{t(this.h,this.p)}catch(t){this.p(t)}}then(t,e){return new Y(((n,r)=>{this.u.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.l()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Y(((e,n)=>{let r,o;return this.then((e=>{o=!1,r=e,t&&t()}),(e=>{o=!0,r=e,t&&t()})).then((()=>{o?n(r):e(r)}))}))}__init(){this.h=t=>{this.m(H.RESOLVED,t)}}__init2(){this.p=t=>{this.m(H.REJECTED,t)}}__init3(){this.m=(t,e)=>{this.i===H.PENDING&&(m(e)?e.then(this.h,this.p):(this.i=t,this.v=e,this.l()))}}__init4(){this.l=()=>{if(this.i===H.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===H.RESOLVED&&t[1](this.v),this.i===H.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function q(t){const e=[];function n(t){return e.splice(e.indexOf(t),1)[0]}return{$:e,add:function(r){if(!(void 0===t||e.length<t))return o=new C("Not adding Promise because buffer limit was reached."),new Y(((t,e)=>{e(o)}));var o;const s=r();return-1===e.indexOf(s)&&e.push(s),s.then((()=>n(s))).then(null,(()=>n(s).then(null,(()=>{})))),s},drain:function(t){return new Y(((n,r)=>{let o=e.length;if(!o)return n(!0);const s=setTimeout((()=>{t&&t>0&&n(!1)}),t);e.forEach((t=>{W(t).then((()=>{--o||(clearTimeout(s),n(!0))}),r)}))}))}}}function F(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const K=1e3;function V(){return Date.now()/K}const Z=function(){const{performance:t}=y;if(!t||!t.now)return V;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/K}();function Q(t,e=[]){return[t,e]}function X(t,e){const n=t[1];for(const t of n){if(e(t,t[0].type))return!0}return!1}function tt(t){return y.__SENTRY__&&y.__SENTRY__.encodePolyfill?y.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function et(t){const[e,n]=t;let r=JSON.stringify(e);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[tt(r),t]:r.push("string"==typeof t?tt(t):t)}for(const t of n){const[e,n]=t;if(o(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let t;try{t=JSON.stringify(n)}catch(e){t=JSON.stringify(L(n))}o(t)}}return"string"==typeof r?r:function(t){const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}(()=>{const{performance:t}=y;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=o<e,i=t.timing&&t.timing.navigationStart,c="number"==typeof i?Math.abs(i+n-r):e;(s||c<e)&&(o<=c&&t.timeOrigin)})();const nt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function rt(t){return nt[t]}function ot(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}const st=6e4;function it(t,{statusCode:e,headers:n},r=Date.now()){const o={...t},s=n&&n["x-sentry-rate-limits"],i=n&&n["retry-after"];if(s)for(const t of s.trim().split(",")){const[e,n,,,s]=t.split(":",5),i=parseInt(e,10),c=1e3*(isNaN(i)?60:i);if(n)for(const t of n.split(";"))"metric_bucket"===t&&s&&!s.split(";").includes("custom")||(o[t]=r+c);else o.all=r+c}else i?o.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?st:r-e}(i,r):429===e&&(o.all=r+6e4);return o}const ct="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function ut(){return at(y),y}function at(t){return t.__SENTRY__||(t.__SENTRY__={extensions:{}}),t.__SENTRY__}function ft(t){const e=Z(),n={sid:M(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return j({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(n)};return t&&ht(n,t),n}function ht(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Z(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:M()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}const pt="_sentrySpan";function lt(t,e){e?function(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(n){S&&N.log(`Failed to add non-enumerable property "${e}" to object`,t)}}(t,pt,e):delete t[pt]}function dt(t){return t[pt]}class mt{constructor(){this._=!1,this.S=[],this.N=[],this.k=[],this.C=[],this.D={},this.T={},this.O={},this.j={},this.R={},this.A=gt()}clone(){const t=new mt;return t.k=[...this.k],t.T={...this.T},t.O={...this.O},t.j={...this.j},t.D=this.D,t.I=this.I,t.P=this.P,t.U=this.U,t.M=this.M,t.N=[...this.N],t.L=this.L,t.C=[...this.C],t.R={...this.R},t.A={...this.A},t.B=this.B,lt(t,dt(this)),t}setClient(t){this.B=t}getClient(){return this.B}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.N.push(t),this}setUser(t){return this.D=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&ht(this.P,{user:t}),this.G(),this}getUser(){return this.D}getRequestSession(){return this.L}setRequestSession(t){return this.L=t,this}setTags(t){return this.T={...this.T,...t},this.G(),this}setTag(t,e){return this.T={...this.T,[t]:e},this.G(),this}setExtras(t){return this.O={...this.O,...t},this.G(),this}setExtra(t,e){return this.O={...this.O,[t]:e},this.G(),this}setFingerprint(t){return this.M=t,this.G(),this}setLevel(t){return this.I=t,this.G(),this}setTransactionName(t){return this.U=t,this.G(),this}setContext(t,e){return null===e?delete this.j[t]:this.j[t]=e,this.G(),this}setSession(t){return t?this.P=t:delete this.P,this.G(),this}getSession(){return this.P}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof mt?[e.getScopeData(),e.getRequestSession()]:d(e)?[t,t.requestSession]:[],{tags:o,extra:s,user:i,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=n||{};return this.T={...this.T,...o},this.O={...this.O,...s},this.j={...this.j,...c},i&&Object.keys(i).length&&(this.D=i),u&&(this.I=u),a.length&&(this.M=a),f&&(this.A=f),r&&(this.L=r),this}clear(){return this.k=[],this.T={},this.O={},this.D={},this.j={},this.I=void 0,this.U=void 0,this.M=void 0,this.L=void 0,this.P=void 0,lt(this,void 0),this.C=[],this.A=gt(),this.G(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:V(),...t},o=this.k;return o.push(r),this.k=o.length>n?o.slice(-n):o,this.G(),this}getLastBreadcrumb(){return this.k[this.k.length-1]}clearBreadcrumbs(){return this.k=[],this.G(),this}addAttachment(t){return this.C.push(t),this}clearAttachments(){return this.C=[],this}getScopeData(){return{breadcrumbs:this.k,attachments:this.C,contexts:this.j,tags:this.T,extra:this.O,user:this.D,level:this.I,fingerprint:this.M||[],eventProcessors:this.N,propagationContext:this.A,sdkProcessingMetadata:this.R,transactionName:this.U,span:dt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.A=t,this}getPropagationContext(){return this.A}captureException(t,e){const n=e&&e.event_id?e.event_id:M();if(!this.B)return N.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:M();if(!this.B)return N.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,e,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:M();return this.B?(this.B.captureEvent(t,{...e,event_id:n},this),n):(N.warn("No client configured on scope - will not capture event!"),n)}G(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}function gt(){return{traceId:M(),spanId:M().substring(16)}}function yt(){return $t(ut()).getCurrentScope().getClient()}class bt{constructor(t,e){let n,r;n=t||new mt,r=e||new mt,this.J=[{scope:n}],this.H=r}withScope(t){const e=this.W();let n;try{n=t(e)}catch(t){throw this.Y(),t}return m(n)?n.then((t=>(this.Y(),t)),(t=>{throw this.Y(),t})):(this.Y(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.H}getStack(){return this.J}getStackTop(){return this.J[this.J.length-1]}W(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}Y(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}}function vt(){const t=at(ut());return t.hub||(t.hub=new bt(b("defaultCurrentScope",(()=>new mt)),b("defaultIsolationScope",(()=>new mt)))),t.hub}function _t(t){return vt().withScope(t)}function wt(t,e){const n=vt();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function St(t){return vt().withScope((()=>t(vt().getIsolationScope())))}function $t(t){const e=at(t);return e.acs?e.acs:{withIsolationScope:St,withScope:_t,withSetScope:wt,withSetIsolationScope:(t,e)=>St(e),getCurrentScope:()=>vt().getScope(),getIsolationScope:()=>vt().getIsolationScope()}}const Et="sentry.source",xt="sentry.sample_rate",Nt="sentry.op",kt="sentry.origin",Ct=0,Dt=1,Tt="production",Ot="_frozenDsc";function jt(t){const e=yt();if(!e)return{};const n=function(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o=j({environment:n.environment||Tt,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",o),o}(Ut(t).trace_id||"",e),r=Bt(t);if(!r)return n;const o=r[Ot];if(o)return o;const s=Ut(r),i=s.data||{},c=i[xt];null!=c&&(n.sample_rate=`${c}`);const u=i[Et];return u&&"url"!==u&&(n.transaction=s.description),n.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return e===Rt}(r)),e.emit("createDsc",n),n}const Rt=1;function At(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=Ut(t);return j({parent_span_id:r,span_id:e,trace_id:n})}function It(t){return"number"==typeof t?Pt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Pt(t.getTime()):Z()}function Pt(t){return t>9999999999?t/1e3:t}function Ut(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:o,name:s,endTime:i,parentSpanId:c,status:u}=t;return j({span_id:e,trace_id:n,data:r,description:s,parent_span_id:c,start_timestamp:It(o),timestamp:It(i)||void 0,status:Mt(u),op:r[Nt],origin:r[kt],q:void 0})}return{span_id:e,trace_id:n}}catch(t){return{}}}function Mt(t){if(t&&t.code!==Ct)return t.code===Dt?"ok":t.message||"unknown_error"}const Lt="_sentryRootSpan";function Bt(t){return t[Lt]||t}function Gt(t,e,n,r){const o=ot(n),s=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]])}(t,n&&n.sdk);const i=function(t,e,n,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:k(r)},...o&&{trace:j({...o})}}}(t,o,r,e);delete t.sdkProcessingMetadata;return Q(i,[[{type:s},t]])}const Jt="__SENTRY_SUPPRESS_TRACING__";function zt(t){const e=$t(ut());return e.suppressTracing?e.suppressTracing(t):function(...t){const e=$t(ut());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}((e=>(e.setSDKProcessingMetadata({[Jt]:!0}),t())))}function Ht(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;!function(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:c}=e,u=j(n);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=j(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=j(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=j(s);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,e),r&&function(t,e){t.contexts={trace:At(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:jt(e),...t.sdkProcessingMetadata};const n=Bt(e),r=Ut(n).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,e){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e));t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,o),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,s)}const Wt="7";function Yt(t,e){return n={sentry_key:t.publicKey,sentry_version:Wt,...e&&{sentry_client:`${e.name}/${e.version}`}},Object.keys(n).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(n[t])}`)).join("&");var n}const qt=64;function Ft(t,e,n=q(t.bufferSize||qt)){let r={};return{send:function(o){const s=[];if(X(o,((e,n)=>{const o=rt(n);if(function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,o)){const r=Kt(e,n);t.recordDroppedEvent("ratelimit_backoff",o,r)}else s.push(e)})),0===s.length)return W({});const i=Q(o[0],s),c=e=>{X(i,((n,r)=>{const o=Kt(n,r);t.recordDroppedEvent(e,rt(r),o)}))};return n.add((()=>e({body:et(i)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&ct&&N.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=it(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof C)return ct&&N.error("Skipped sending event because buffer is full."),c("queue_overflow"),W({});throw t}))},flush:t=>n.drain(t)}}function Kt(t,e){if("event"===e||"transaction"===e)return Array.isArray(t)?t[1]:void 0}const Vt=Symbol("AgentBaseInternalState");class Zt extends h.Agent{[Vt];options;keepAlive;constructor(t){super(t),this[Vt]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,e,n){const r={...e,secureEndpoint:this.isSecureEndpoint(e)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof h.Agent)return o.addRequest(t,r);this[Vt].currentSocket=o,super.createSocket(t,e,n)}),n)}createConnection(){const t=this[Vt].currentSocket;if(this[Vt].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[Vt].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[Vt]&&(this[Vt].defaultPort=t)}get protocol(){return this[Vt].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[Vt]&&(this[Vt].protocol=t)}}function Qt(...t){N.log("[https-proxy-agent:parse-proxy-response]",...t)}function Xt(t){return new Promise(((e,n)=>{let r=0;const o=[];function s(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return Qt("have not received end of HTTP headers yet..."),void s();const f=u.slice(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));const p=h.split(" "),l=+p[1],d=p.slice(2).join(" "),m={};for(const e of f){if(!e)continue;const r=e.indexOf(":");if(-1===r)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${e}"`));const o=e.slice(0,r).toLowerCase(),s=e.slice(r+1).trimStart(),i=m[o];"string"==typeof i?m[o]=[i,s]:Array.isArray(i)?i.push(s):m[o]=s}Qt("got proxy server response: %o %o",h,m),i(),e({connect:{statusCode:l,statusText:d,headers:m},buffered:u})}(c):t.once("readable",s)}function i(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",s)}function c(){i(),Qt("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),Qt("onerror %o",t),n(t)}t.on("error",u),t.on("end",c),s()}))}function te(...t){N.log("[https-proxy-agent]",...t)}class ee extends Zt{static protocols=["http","https"];proxy;proxyHeaders;connectOpts;constructor(t,e){super(e),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=e?.headers??{},te("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),r=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...e?re(e,"headers"):null,host:n,port:r}}async connect(t,e){const{proxy:n}=this;if(!e.host)throw new TypeError('No "host" provided');let r;if("https:"===n.protocol){te("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else te("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},s=a.isIPv6(e.host)?`[${e.host}]`:e.host;let i=`CONNECT ${s}:${e.port} HTTP/1.1\r\n`;if(n.username||n.password){const t=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${s}:${e.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))i+=`${t}: ${o[t]}\r\n`;const c=Xt(r);r.write(`${i}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",ne),e.secureEndpoint){te("Upgrading socket connection to TLS");const t=e.servername||e.host;return f.connect({...re(e,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{te("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function ne(t){t.resume()}function re(t,...e){const n={};let r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}const oe=32768;function se(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const ie=n;let ce,ue=!1;function ae(t){ie.debug&&console.log(`[ANR Worker] ${t}`)}var fe,he,pe;const le=function(t){let e;try{e=new URL(t.url)}catch(e){return x((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),Ft(t,(()=>Promise.resolve({})))}const n="https:"===e.protocol,r=function(t,e){const{no_proxy:n}=process.env;return n&&n.split(",").some((e=>t.host.endsWith(e)||t.hostname.endsWith(e)))?void 0:e}(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?i:s,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new ee(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return zt((()=>{const e=function(t,e,n){const{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(f){return new Promise(((h,p)=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>oe&&(d["content-encoding"]="gzip",l=l.pipe(u()));const m=e.request({method:"POST",agent:n,headers:d,hostname:r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const e=t.headers["retry-after"]??null,n=t.headers["x-sentry-rate-limits"]??null;h({statusCode:t.statusCode,headers:{"retry-after":e,"x-sentry-rate-limits":Array.isArray(n)?n[0]:n}})}));m.on("error",p),l.pipe(m)}))}}(t,t.httpModule??o,f);return Ft(t,e)}))}({url:(fe=ie.dsn,he=ie.tunnel,pe=ie.sdkMetadata.sdk,he||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(fe)}?${Yt(fe,pe)}`),recordDroppedEvent:()=>{}});async function de(){if(ce){ae("Sending abnormal session"),ht(ce,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,e,n,r){const o=ot(n);return Q({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:k(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(ce,ie.dsn,ie.sdkMetadata,ie.tunnel);ae(JSON.stringify(t)),await le.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function me(t){if(!t)return;const e=function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),P.test(e[e.length-1].function||"")&&(e.pop(),P.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,A).map((t=>({...t,filename:t.filename||e[e.length-1].filename,function:t.function||I})))}(t);if(ie.appRootPath)for(const t of e)t.filename&&(t.filename=G(t.filename,ie.appRootPath));return e}async function ge(t,e){if(ue)return;ue=!0,await de(),ae("Sending event");const n={event_id:M(),contexts:ie.contexts,release:ie.release,environment:ie.environment,dist:ie.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${ie.anrThreshold} ms`,stacktrace:{frames:me(t)},mechanism:{type:"ANR"}}]},tags:ie.staticTags};e&&function(t,e){if(Ht(t,e),!t.contexts?.trace){const{traceId:n,spanId:r,parentSpanId:o}=e.propagationContext;t.contexts={trace:{trace_id:n,span_id:r,parent_span_id:o},...t.contexts}}}(n,e);const r=Gt(n,ie.dsn,ie.sdkMetadata,ie.tunnel);ae(JSON.stringify(r)),await le.send(r),await le.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let ye;if(ae("Started"),ie.captureStackTrace){ae("Connecting to debugger");const e=new t;e.connectToMainThread(),ae("Connected to debugger");const n=new Map;e.on("Debugger.scriptParsed",(t=>{n.set(t.params.scriptId,t.params.url)})),e.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{ae("Debugger paused");const s=[...t.params.callFrames],i=ie.appRootPath?function(t=(process.argv[1]?z(process.argv[1]):process.cwd()),e="\\"===o){const n=e?se(t):t;return t=>{if(!t)return;const o=e?se(t):t;let{dir:s,base:i,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(i=i.slice(0,-1*c.length)),s||(s=".");const u=s.lastIndexOf("/node_modules");if(u>-1)return`${s.slice(u+14).replace(/\//g,".")}:${i}`;if(s.startsWith(n)){let t=s.slice(n.length+1).replace(/\//g,".");return t&&(t+=":"),t+=i,t}return i}}(ie.appRootPath):()=>{},c=s.map((t=>function(t,e,n){const r=e?e.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return j({filename:r,module:n(r),function:t.functionName||I,colno:o,lineno:s,in_app:r?F(r):void 0})}(t,n.get(t.location.scriptId),i))),u=setTimeout((()=>{ge(c).then(null,(()=>{ae("Sending ANR event failed.")}))}),5e3);e.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,n)=>{t&&ae(`Error executing script: '${t.message}'`),clearTimeout(u);const r=n&&n.result?n.result.value:void 0;e.post("Debugger.resume"),e.post("Debugger.disable"),ge(c,r).then(null,(()=>{ae("Sending ANR event failed.")}))}))}catch(t){throw e.post("Debugger.resume"),e.post("Debugger.disable"),t}})),ye=()=>{try{e.post("Debugger.enable",(()=>{e.post("Debugger.pause")}))}catch(t){}}}const{poll:be}=function(t,e,n,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>e+n&&(s=!0,i&&r()),t<e+n&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[e,n]=process.hrtime(t);return Math.floor(1e3*e+n/1e6)},reset:()=>{t=process.hrtime()}}}),ie.pollInterval,ie.anrThreshold,(function(){ae("Watchdog timeout"),ye?(ae("Pausing debugger to capture stack trace"),ye()):(ae("Capturing event without a stack trace"),ge().then(null,(()=>{ae("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(ce=ft(t.session)),be()}));
|
|
1
|
+
/*! @sentry/node 8.1.0 (d31d7a0) | https://github.com/getsentry/sentry-javascript */
|
|
2
|
+
import{Session as t}from"inspector";import{parentPort as e,workerData as n}from"worker_threads";import{posix as r,sep as o}from"path";import*as s from"node:http";import*as i from"node:https";import{Readable as c}from"stream";import{createGzip as u}from"zlib";import*as a from"net";import*as f from"tls";import*as h from"http";const p=Object.prototype.toString;function l(t,e){return p.call(t)===`[object ${e}]`}function d(t){return l(t,"Object")}function m(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function g(t,e){try{return t instanceof e}catch(t){return!1}}const y=globalThis;function b(t,e,n){const r=n||y,o=r.__SENTRY__=r.__SENTRY__||{};return o[t]||(o[t]=e())}const v=y,_=80;function w(t,e){const n=t,r=[];let o,s,i,c,u;if(!n||!n.tagName)return"";if(v.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const a=e&&e.length?e.filter((t=>n.getAttribute(t))).map((t=>[t,n.getAttribute(t)])):null;if(a&&a.length)a.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(n.id&&r.push(`#${n.id}`),o=n.className,o&&l(o,"String"))for(s=o.split(/\s+/),u=0;u<s.length;u++)r.push(`.${s[u]}`);const f=["aria-label","type","name","title","alt"];for(u=0;u<f.length;u++)i=f[u],c=n.getAttribute(i),c&&r.push(`[${i}="${c}"]`);return r.join("")}const S="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$=["debug","info","warn","error","log","assert","trace"],E={};function x(t){if(!("console"in y))return t();const e=y.console,n={},r=Object.keys(E);r.forEach((t=>{const r=E[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}const N=function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return S?$.forEach((n=>{e[n]=(...e)=>{t&&x((()=>{y.console[n](`Sentry Logger [${n}]:`,...e)}))}})):$.forEach((t=>{e[t]=()=>{}})),e}();function k(t,e=!1){const{host:n,path:r,pass:o,port:s,projectId:i,protocol:c,publicKey:u}=t;return`${c}://${u}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r?`${r}/`:r}${i}`}class C extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}}function D(t){if(function(t){switch(p.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return g(t,Error)}}(t))return{message:t.message,name:t.name,stack:t.stack,...O(t)};if(e=t,"undefined"!=typeof Event&&g(e,Event)){const e={type:t.type,target:T(t.target),currentTarget:T(t.currentTarget),...O(t)};return"undefined"!=typeof CustomEvent&&g(t,CustomEvent)&&(e.detail=t.detail),e}return t;var e}function T(t){try{return e=t,"undefined"!=typeof Element&&g(e,Element)?function(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,o=[];let s=0,i=0;const c=" > ",u=c.length;let a;const f=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||_;for(;n&&s++<r&&(a=w(n,f),!("html"===a||s>1&&i+o.length*u+a.length>=h));)o.push(a),i+=a.length,n=n.parentNode;return o.reverse().join(c)}catch(t){return"<unknown>"}}(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}var e}function O(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function j(t){return R(t,new Map)}function R(t,e){if(function(t){if(!d(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||"Object"===e}catch(t){return!0}}(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const n of Object.keys(t))void 0!==t[n]&&(r[n]=R(t[n],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach((t=>{r.push(R(t,e))})),r}return t}const A=50,I="?",P=/captureMessage|captureException/;const U="<anonymous>";function M(){const t=y,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function L(t,e=100,n=1/0){try{return B("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function B(t,e,n=1/0,r=1/0,o=function(){const t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(let t=0;t<e.length;t++)if(e[t]===n)return!0;return e.push(n),!1},function(n){if(t)e.delete(n);else for(let t=0;t<e.length;t++)if(e[t]===n){e.splice(t,1);break}}]}()){const[s,i]=o;if(null==e||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;const c=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.t)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if("object"==typeof(n=e)&&null!==n&&(n.__isVue||n.o))return"[VueViewModel]";if(function(t){return d(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(e))return"[SyntheticEvent]";if("number"==typeof e&&e!=e)return"[NaN]";if("function"==typeof e)return`[Function: ${function(t){try{return t&&"function"==typeof t&&t.name||U}catch(t){return U}}(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;const u="number"==typeof e.__sentry_override_normalization_depth__?e.__sentry_override_normalization_depth__:n;if(0===u)return c.replace("object ","");if(s(e))return"[Circular ~]";const a=e;if(a&&"function"==typeof a.toJSON)try{return B("",a.toJSON(),u-1,r,o)}catch(t){}const f=Array.isArray(e)?[]:{};let h=0;const p=D(e);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){f[t]="[MaxProperties ~]";break}const e=p[t];f[t]=B(t,e,u-1,r,o),h++}return i(e),f}function G(t,e){const n=e.replace(/\\/g,"/").replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");let r=t;try{r=decodeURI(t)}catch(t){}return r.replace(/\\/g,"/").replace(/webpack:\/?/g,"").replace(new RegExp(`(file://)?/*${n}/*`,"ig"),"app:///")}const J=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function z(t){const e=function(t){const e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=J.exec(e);return n?n.slice(1):[]}(t),n=e[0];let r=e[1];return n||r?(r&&(r=r.slice(0,r.length-1)),n+r):"."}var H;function W(t){return new Y((e=>{e(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(H||(H={}));class Y{constructor(t){Y.prototype.__init.call(this),Y.prototype.__init2.call(this),Y.prototype.__init3.call(this),Y.prototype.__init4.call(this),this.i=H.PENDING,this.u=[];try{t(this.h,this.p)}catch(t){this.p(t)}}then(t,e){return new Y(((n,r)=>{this.u.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.l()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Y(((e,n)=>{let r,o;return this.then((e=>{o=!1,r=e,t&&t()}),(e=>{o=!0,r=e,t&&t()})).then((()=>{o?n(r):e(r)}))}))}__init(){this.h=t=>{this.m(H.RESOLVED,t)}}__init2(){this.p=t=>{this.m(H.REJECTED,t)}}__init3(){this.m=(t,e)=>{this.i===H.PENDING&&(m(e)?e.then(this.h,this.p):(this.i=t,this.v=e,this.l()))}}__init4(){this.l=()=>{if(this.i===H.PENDING)return;const t=this.u.slice();this.u=[],t.forEach((t=>{t[0]||(this.i===H.RESOLVED&&t[1](this.v),this.i===H.REJECTED&&t[2](this.v),t[0]=!0)}))}}}function q(t){const e=[];function n(t){return e.splice(e.indexOf(t),1)[0]}return{$:e,add:function(r){if(!(void 0===t||e.length<t))return o=new C("Not adding Promise because buffer limit was reached."),new Y(((t,e)=>{e(o)}));var o;const s=r();return-1===e.indexOf(s)&&e.push(s),s.then((()=>n(s))).then(null,(()=>n(s).then(null,(()=>{})))),s},drain:function(t){return new Y(((n,r)=>{let o=e.length;if(!o)return n(!0);const s=setTimeout((()=>{t&&t>0&&n(!1)}),t);e.forEach((t=>{W(t).then((()=>{--o||(clearTimeout(s),n(!0))}),r)}))}))}}}function F(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==t&&!t.includes("node_modules/")}const K=1e3;function V(){return Date.now()/K}const Z=function(){const{performance:t}=y;if(!t||!t.now)return V;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/K}();function Q(t,e=[]){return[t,e]}function X(t,e){const n=t[1];for(const t of n){if(e(t,t[0].type))return!0}return!1}function tt(t){return y.__SENTRY__&&y.__SENTRY__.encodePolyfill?y.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function et(t){const[e,n]=t;let r=JSON.stringify(e);function o(t){"string"==typeof r?r="string"==typeof t?r+t:[tt(r),t]:r.push("string"==typeof t?tt(t):t)}for(const t of n){const[e,n]=t;if(o(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let t;try{t=JSON.stringify(n)}catch(e){t=JSON.stringify(L(n))}o(t)}}return"string"==typeof r?r:function(t){const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}(()=>{const{performance:t}=y;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=o<e,i=t.timing&&t.timing.navigationStart,c="number"==typeof i?Math.abs(i+n-r):e;(s||c<e)&&(o<=c&&t.timeOrigin)})();const nt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function rt(t){return nt[t]}function ot(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}const st=6e4;function it(t,{statusCode:e,headers:n},r=Date.now()){const o={...t},s=n&&n["x-sentry-rate-limits"],i=n&&n["retry-after"];if(s)for(const t of s.trim().split(",")){const[e,n,,,s]=t.split(":",5),i=parseInt(e,10),c=1e3*(isNaN(i)?60:i);if(n)for(const t of n.split(";"))"metric_bucket"===t&&s&&!s.split(";").includes("custom")||(o[t]=r+c);else o.all=r+c}else i?o.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?st:r-e}(i,r):429===e&&(o.all=r+6e4);return o}const ct="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function ut(){return at(y),y}function at(t){return t.__SENTRY__||(t.__SENTRY__={extensions:{}}),t.__SENTRY__}function ft(t){const e=Z(),n={sid:M(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return j({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(n)};return t&&ht(n,t),n}function ht(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Z(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:M()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}const pt="_sentrySpan";function lt(t,e){e?function(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(n){S&&N.log(`Failed to add non-enumerable property "${e}" to object`,t)}}(t,pt,e):delete t[pt]}function dt(t){return t[pt]}class mt{constructor(){this._=!1,this.S=[],this.N=[],this.k=[],this.C=[],this.D={},this.T={},this.O={},this.j={},this.R={},this.A=gt()}clone(){const t=new mt;return t.k=[...this.k],t.T={...this.T},t.O={...this.O},t.j={...this.j},t.D=this.D,t.I=this.I,t.P=this.P,t.U=this.U,t.M=this.M,t.N=[...this.N],t.L=this.L,t.C=[...this.C],t.R={...this.R},t.A={...this.A},t.B=this.B,t.G=this.G,lt(t,dt(this)),t}setClient(t){this.B=t}setLastEventId(t){this.G=t}getClient(){return this.B}lastEventId(){return this.G}addScopeListener(t){this.S.push(t)}addEventProcessor(t){return this.N.push(t),this}setUser(t){return this.D=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.P&&ht(this.P,{user:t}),this.J(),this}getUser(){return this.D}getRequestSession(){return this.L}setRequestSession(t){return this.L=t,this}setTags(t){return this.T={...this.T,...t},this.J(),this}setTag(t,e){return this.T={...this.T,[t]:e},this.J(),this}setExtras(t){return this.O={...this.O,...t},this.J(),this}setExtra(t,e){return this.O={...this.O,[t]:e},this.J(),this}setFingerprint(t){return this.M=t,this.J(),this}setLevel(t){return this.I=t,this.J(),this}setTransactionName(t){return this.U=t,this.J(),this}setContext(t,e){return null===e?delete this.j[t]:this.j[t]=e,this.J(),this}setSession(t){return t?this.P=t:delete this.P,this.J(),this}getSession(){return this.P}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof mt?[e.getScopeData(),e.getRequestSession()]:d(e)?[t,t.requestSession]:[],{tags:o,extra:s,user:i,contexts:c,level:u,fingerprint:a=[],propagationContext:f}=n||{};return this.T={...this.T,...o},this.O={...this.O,...s},this.j={...this.j,...c},i&&Object.keys(i).length&&(this.D=i),u&&(this.I=u),a.length&&(this.M=a),f&&(this.A=f),r&&(this.L=r),this}clear(){return this.k=[],this.T={},this.O={},this.D={},this.j={},this.I=void 0,this.U=void 0,this.M=void 0,this.L=void 0,this.P=void 0,lt(this,void 0),this.C=[],this.A=gt(),this.J(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:V(),...t},o=this.k;return o.push(r),this.k=o.length>n?o.slice(-n):o,this.J(),this}getLastBreadcrumb(){return this.k[this.k.length-1]}clearBreadcrumbs(){return this.k=[],this.J(),this}addAttachment(t){return this.C.push(t),this}clearAttachments(){return this.C=[],this}getScopeData(){return{breadcrumbs:this.k,attachments:this.C,contexts:this.j,tags:this.T,extra:this.O,user:this.D,level:this.I,fingerprint:this.M||[],eventProcessors:this.N,propagationContext:this.A,sdkProcessingMetadata:this.R,transactionName:this.U,span:dt(this)}}setSDKProcessingMetadata(t){return this.R={...this.R,...t},this}setPropagationContext(t){return this.A=t,this}getPropagationContext(){return this.A}captureException(t,e){const n=e&&e.event_id?e.event_id:M();if(!this.B)return N.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.B.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:M();if(!this.B)return N.warn("No client configured on scope - will not capture message!"),r;const o=new Error(t);return this.B.captureMessage(t,e,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:M();return this.B?(this.B.captureEvent(t,{...e,event_id:n},this),n):(N.warn("No client configured on scope - will not capture event!"),n)}J(){this._||(this._=!0,this.S.forEach((t=>{t(this)})),this._=!1)}}function gt(){return{traceId:M(),spanId:M().substring(16)}}function yt(){return $t(ut()).getCurrentScope().getClient()}class bt{constructor(t,e){let n,r;n=t||new mt,r=e||new mt,this.H=[{scope:n}],this.W=r}withScope(t){const e=this.Y();let n;try{n=t(e)}catch(t){throw this.q(),t}return m(n)?n.then((t=>(this.q(),t)),(t=>{throw this.q(),t})):(this.q(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.W}getStack(){return this.H}getStackTop(){return this.H[this.H.length-1]}Y(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}q(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}}function vt(){const t=at(ut());return t.hub||(t.hub=new bt(b("defaultCurrentScope",(()=>new mt)),b("defaultIsolationScope",(()=>new mt)))),t.hub}function _t(t){return vt().withScope(t)}function wt(t,e){const n=vt();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function St(t){return vt().withScope((()=>t(vt().getIsolationScope())))}function $t(t){const e=at(t);return e.acs?e.acs:{withIsolationScope:St,withScope:_t,withSetScope:wt,withSetIsolationScope:(t,e)=>St(e),getCurrentScope:()=>vt().getScope(),getIsolationScope:()=>vt().getIsolationScope()}}const Et="sentry.source",xt="sentry.sample_rate",Nt="sentry.op",kt="sentry.origin",Ct=0,Dt=1,Tt="production",Ot="_frozenDsc";function jt(t){const e=yt();if(!e)return{};const n=function(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o=j({environment:n.environment||Tt,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",o),o}(Ut(t).trace_id||"",e),r=Bt(t);if(!r)return n;const o=r[Ot];if(o)return o;const s=Ut(r),i=s.data||{},c=i[xt];null!=c&&(n.sample_rate=`${c}`);const u=i[Et];return u&&"url"!==u&&(n.transaction=s.description),n.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return e===Rt}(r)),e.emit("createDsc",n),n}const Rt=1;function At(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=Ut(t);return j({parent_span_id:r,span_id:e,trace_id:n})}function It(t){return"number"==typeof t?Pt(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Pt(t.getTime()):Z()}function Pt(t){return t>9999999999?t/1e3:t}function Ut(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:o,name:s,endTime:i,parentSpanId:c,status:u}=t;return j({span_id:e,trace_id:n,data:r,description:s,parent_span_id:c,start_timestamp:It(o),timestamp:It(i)||void 0,status:Mt(u),op:r[Nt],origin:r[kt],F:void 0})}return{span_id:e,trace_id:n}}catch(t){return{}}}function Mt(t){if(t&&t.code!==Ct)return t.code===Dt?"ok":t.message||"unknown_error"}const Lt="_sentryRootSpan";function Bt(t){return t[Lt]||t}function Gt(t,e,n,r){const o=ot(n),s=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]])}(t,n&&n.sdk);const i=function(t,e,n,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:k(r)},...o&&{trace:j({...o})}}}(t,o,r,e);delete t.sdkProcessingMetadata;return Q(i,[[{type:s},t]])}const Jt="__SENTRY_SUPPRESS_TRACING__";function zt(t){const e=$t(ut());return e.suppressTracing?e.suppressTracing(t):function(...t){const e=$t(ut());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}((e=>(e.setSDKProcessingMetadata({[Jt]:!0}),t())))}function Ht(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;!function(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:c}=e,u=j(n);u&&Object.keys(u).length&&(t.extra={...u,...t.extra});const a=j(r);a&&Object.keys(a).length&&(t.tags={...a,...t.tags});const f=j(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=j(s);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts});i&&(t.level=i);c&&"transaction"!==t.type&&(t.transaction=c)}(t,e),r&&function(t,e){t.contexts={trace:At(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:jt(e),...t.sdkProcessingMetadata};const n=Bt(e),r=Ut(n).description;r&&!t.transaction&&"transaction"===t.type&&(t.transaction=r)}(t,r),function(t,e){t.fingerprint=t.fingerprint?function(t){return Array.isArray(t)?t:[t]}(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e));t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,o),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,s)}const Wt="7";function Yt(t,e){return n={sentry_key:t.publicKey,sentry_version:Wt,...e&&{sentry_client:`${e.name}/${e.version}`}},Object.keys(n).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(n[t])}`)).join("&");var n}const qt=64;function Ft(t,e,n=q(t.bufferSize||qt)){let r={};return{send:function(o){const s=[];if(X(o,((e,n)=>{const o=rt(n);if(function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,o)){const r=Kt(e,n);t.recordDroppedEvent("ratelimit_backoff",o,r)}else s.push(e)})),0===s.length)return W({});const i=Q(o[0],s),c=e=>{X(i,((n,r)=>{const o=Kt(n,r);t.recordDroppedEvent(e,rt(r),o)}))};return n.add((()=>e({body:et(i)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&ct&&N.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=it(r,t),t)),(t=>{throw c("network_error"),t})))).then((t=>t),(t=>{if(t instanceof C)return ct&&N.error("Skipped sending event because buffer is full."),c("queue_overflow"),W({});throw t}))},flush:t=>n.drain(t)}}function Kt(t,e){if("event"===e||"transaction"===e)return Array.isArray(t)?t[1]:void 0}const Vt=Symbol("AgentBaseInternalState");class Zt extends h.Agent{[Vt];options;keepAlive;constructor(t){super(t),this[Vt]={}}isSecureEndpoint(t){if(t){if("boolean"==typeof t.secureEndpoint)return t.secureEndpoint;if("string"==typeof t.protocol)return"https:"===t.protocol}const{stack:e}=new Error;return"string"==typeof e&&e.split("\n").some((t=>-1!==t.indexOf("(https.js:")||-1!==t.indexOf("node:https:")))}createSocket(t,e,n){const r={...e,secureEndpoint:this.isSecureEndpoint(e)};Promise.resolve().then((()=>this.connect(t,r))).then((o=>{if(o instanceof h.Agent)return o.addRequest(t,r);this[Vt].currentSocket=o,super.createSocket(t,e,n)}),n)}createConnection(){const t=this[Vt].currentSocket;if(this[Vt].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[Vt].defaultPort??("https:"===this.protocol?443:80)}set defaultPort(t){this[Vt]&&(this[Vt].defaultPort=t)}get protocol(){return this[Vt].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[Vt]&&(this[Vt].protocol=t)}}function Qt(...t){N.log("[https-proxy-agent:parse-proxy-response]",...t)}function Xt(t){return new Promise(((e,n)=>{let r=0;const o=[];function s(){const c=t.read();c?function(c){o.push(c),r+=c.length;const u=Buffer.concat(o,r),a=u.indexOf("\r\n\r\n");if(-1===a)return Qt("have not received end of HTTP headers yet..."),void s();const f=u.slice(0,a).toString("ascii").split("\r\n"),h=f.shift();if(!h)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));const p=h.split(" "),l=+p[1],d=p.slice(2).join(" "),m={};for(const e of f){if(!e)continue;const r=e.indexOf(":");if(-1===r)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${e}"`));const o=e.slice(0,r).toLowerCase(),s=e.slice(r+1).trimStart(),i=m[o];"string"==typeof i?m[o]=[i,s]:Array.isArray(i)?i.push(s):m[o]=s}Qt("got proxy server response: %o %o",h,m),i(),e({connect:{statusCode:l,statusText:d,headers:m},buffered:u})}(c):t.once("readable",s)}function i(){t.removeListener("end",c),t.removeListener("error",u),t.removeListener("readable",s)}function c(){i(),Qt("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function u(t){i(),Qt("onerror %o",t),n(t)}t.on("error",u),t.on("end",c),s()}))}function te(...t){N.log("[https-proxy-agent]",...t)}class ee extends Zt{static protocols=["http","https"];proxy;proxyHeaders;connectOpts;constructor(t,e){super(e),this.options={},this.proxy="string"==typeof t?new URL(t):t,this.proxyHeaders=e?.headers??{},te("Creating new HttpsProxyAgent instance: %o",this.proxy.href);const n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),r=this.proxy.port?parseInt(this.proxy.port,10):"https:"===this.proxy.protocol?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...e?re(e,"headers"):null,host:n,port:r}}async connect(t,e){const{proxy:n}=this;if(!e.host)throw new TypeError('No "host" provided');let r;if("https:"===n.protocol){te("Creating `tls.Socket`: %o",this.connectOpts);const t=this.connectOpts.servername||this.connectOpts.host;r=f.connect({...this.connectOpts,servername:t&&a.isIP(t)?void 0:t})}else te("Creating `net.Socket`: %o",this.connectOpts),r=a.connect(this.connectOpts);const o="function"==typeof this.proxyHeaders?this.proxyHeaders():{...this.proxyHeaders},s=a.isIPv6(e.host)?`[${e.host}]`:e.host;let i=`CONNECT ${s}:${e.port} HTTP/1.1\r\n`;if(n.username||n.password){const t=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(t).toString("base64")}`}o.Host=`${s}:${e.port}`,o["Proxy-Connection"]||(o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const t of Object.keys(o))i+=`${t}: ${o[t]}\r\n`;const c=Xt(r);r.write(`${i}\r\n`);const{connect:u,buffered:h}=await c;if(t.emit("proxyConnect",u),this.emit("proxyConnect",u,t),200===u.statusCode){if(t.once("socket",ne),e.secureEndpoint){te("Upgrading socket connection to TLS");const t=e.servername||e.host;return f.connect({...re(e,"host","path","port"),socket:r,servername:a.isIP(t)?void 0:t})}return r}r.destroy();const p=new a.Socket({writable:!1});return p.readable=!0,t.once("socket",(t=>{te("Replaying proxy buffer for failed request"),t.push(h),t.push(null)})),p}}function ne(t){t.resume()}function re(t,...e){const n={};let r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}const oe=32768;function se(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}const ie=n;let ce,ue=!1;function ae(t){ie.debug&&console.log(`[ANR Worker] ${t}`)}var fe,he,pe;const le=function(t){let e;try{e=new URL(t.url)}catch(e){return x((()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")})),Ft(t,(()=>Promise.resolve({})))}const n="https:"===e.protocol,r=function(t,e){const{no_proxy:n}=process.env;return n&&n.split(",").some((e=>t.host.endsWith(e)||t.hostname.endsWith(e)))?void 0:e}(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?i:s,a=void 0!==t.keepAlive&&t.keepAlive,f=r?new ee(r):new o.Agent({keepAlive:a,maxSockets:30,timeout:2e3});return zt((()=>{const e=function(t,e,n){const{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(f){return new Promise(((h,p)=>{let l=function(t){return new c({read(){this.push(t),this.push(null)}})}(f.body);const d={...t.headers};f.body.length>oe&&(d["content-encoding"]="gzip",l=l.pipe(u()));const m=e.request({method:"POST",agent:n,headers:d,hostname:r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},(t=>{t.on("data",(()=>{})),t.on("end",(()=>{})),t.setEncoding("utf8");const e=t.headers["retry-after"]??null,n=t.headers["x-sentry-rate-limits"]??null;h({statusCode:t.statusCode,headers:{"retry-after":e,"x-sentry-rate-limits":Array.isArray(n)?n[0]:n}})}));m.on("error",p),l.pipe(m)}))}}(t,t.httpModule??o,f);return Ft(t,e)}))}({url:(fe=ie.dsn,he=ie.tunnel,pe=ie.sdkMetadata.sdk,he||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(fe)}?${Yt(fe,pe)}`),recordDroppedEvent:()=>{}});async function de(){if(ce){ae("Sending abnormal session"),ht(ce,{status:"abnormal",abnormal_mechanism:"anr_foreground"});const t=function(t,e,n,r){const o=ot(n);return Q({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:k(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(ce,ie.dsn,ie.sdkMetadata,ie.tunnel);ae(JSON.stringify(t)),await le.send(t);try{e?.postMessage("session-ended")}catch(t){}}}function me(t){if(!t)return;const e=function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),P.test(e[e.length-1].function||"")&&(e.pop(),P.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,A).map((t=>({...t,filename:t.filename||e[e.length-1].filename,function:t.function||I})))}(t);if(ie.appRootPath)for(const t of e)t.filename&&(t.filename=G(t.filename,ie.appRootPath));return e}async function ge(t,e){if(ue)return;ue=!0,await de(),ae("Sending event");const n={event_id:M(),contexts:ie.contexts,release:ie.release,environment:ie.environment,dist:ie.dist,platform:"node",level:"error",exception:{values:[{type:"ApplicationNotResponding",value:`Application Not Responding for at least ${ie.anrThreshold} ms`,stacktrace:{frames:me(t)},mechanism:{type:"ANR"}}]},tags:ie.staticTags};e&&function(t,e){if(Ht(t,e),!t.contexts?.trace){const{traceId:n,spanId:r,parentSpanId:o}=e.propagationContext;t.contexts={trace:{trace_id:n,span_id:r,parent_span_id:o},...t.contexts}}}(n,e);const r=Gt(n,ie.dsn,ie.sdkMetadata,ie.tunnel);ae(JSON.stringify(r)),await le.send(r),await le.flush(2e3),setTimeout((()=>{process.exit(0)}),5e3)}let ye;if(ae("Started"),ie.captureStackTrace){ae("Connecting to debugger");const e=new t;e.connectToMainThread(),ae("Connected to debugger");const n=new Map;e.on("Debugger.scriptParsed",(t=>{n.set(t.params.scriptId,t.params.url)})),e.on("Debugger.paused",(t=>{if("other"===t.params.reason)try{ae("Debugger paused");const s=[...t.params.callFrames],i=ie.appRootPath?function(t=(process.argv[1]?z(process.argv[1]):process.cwd()),e="\\"===o){const n=e?se(t):t;return t=>{if(!t)return;const o=e?se(t):t;let{dir:s,base:i,ext:c}=r.parse(o);".js"!==c&&".mjs"!==c&&".cjs"!==c||(i=i.slice(0,-1*c.length)),s||(s=".");const u=s.lastIndexOf("/node_modules");if(u>-1)return`${s.slice(u+14).replace(/\//g,".")}:${i}`;if(s.startsWith(n)){let t=s.slice(n.length+1).replace(/\//g,".");return t&&(t+=":"),t+=i,t}return i}}(ie.appRootPath):()=>{},c=s.map((t=>function(t,e,n){const r=e?e.replace(/^file:\/\//,""):void 0,o=t.location.columnNumber?t.location.columnNumber+1:void 0,s=t.location.lineNumber?t.location.lineNumber+1:void 0;return j({filename:r,module:n(r),function:t.functionName||I,colno:o,lineno:s,in_app:r?F(r):void 0})}(t,n.get(t.location.scriptId),i))),u=setTimeout((()=>{ge(c).then(null,(()=>{ae("Sending ANR event failed.")}))}),5e3);e.post("Runtime.evaluate",{expression:"global.__SENTRY_GET_SCOPES__();",silent:!0,returnByValue:!0},((t,n)=>{t&&ae(`Error executing script: '${t.message}'`),clearTimeout(u);const r=n&&n.result?n.result.value:void 0;e.post("Debugger.resume"),e.post("Debugger.disable"),ge(c,r).then(null,(()=>{ae("Sending ANR event failed.")}))}))}catch(t){throw e.post("Debugger.resume"),e.post("Debugger.disable"),t}})),ye=()=>{try{e.post("Debugger.enable",(()=>{e.post("Debugger.pause")}))}catch(t){}}}const{poll:be}=function(t,e,n,r){const o=t();let s=!1,i=!0;return setInterval((()=>{const t=o.getTimeMs();!1===s&&t>e+n&&(s=!0,i&&r()),t<e+n&&(s=!1)}),20),{poll:()=>{o.reset()},enabled:t=>{i=t}}}((function(){let t=process.hrtime();return{getTimeMs:()=>{const[e,n]=process.hrtime(t);return Math.floor(1e3*e+n/1e6)},reset:()=>{t=process.hrtime()}}}),ie.pollInterval,ie.anrThreshold,(function(){ae("Watchdog timeout"),ye?(ae("Pausing debugger to capture stack trace"),ye()):(ae("Capturing event without a stack trace"),ge().then(null,(()=>{ae("Sending ANR event failed on watchdog timeout.")})))}));e?.on("message",(t=>{t.session&&(ce=ft(t.session)),be()}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as util from 'util';
|
|
2
|
+
import { defineIntegration, getClient, addBreadcrumb } from '@sentry/core';
|
|
3
|
+
import { addConsoleInstrumentationHandler, severityLevelFromString } from '@sentry/utils';
|
|
4
|
+
|
|
5
|
+
const INTEGRATION_NAME = 'Console';
|
|
6
|
+
|
|
7
|
+
const _consoleIntegration = (() => {
|
|
8
|
+
return {
|
|
9
|
+
name: INTEGRATION_NAME,
|
|
10
|
+
setup(client) {
|
|
11
|
+
addConsoleInstrumentationHandler(({ args, level }) => {
|
|
12
|
+
if (getClient() !== client) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
addBreadcrumb(
|
|
17
|
+
{
|
|
18
|
+
category: 'console',
|
|
19
|
+
level: severityLevelFromString(level),
|
|
20
|
+
message: util.format.apply(undefined, args),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
input: [...args],
|
|
24
|
+
level,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}) ;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Capture console logs as breadcrumbs.
|
|
34
|
+
*/
|
|
35
|
+
const consoleIntegration = defineIntegration(_consoleIntegration);
|
|
36
|
+
|
|
37
|
+
export { consoleIntegration };
|
|
38
|
+
//# sourceMappingURL=console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.js","sources":["../../../src/integrations/console.ts"],"sourcesContent":["import * as util from 'util';\nimport { addBreadcrumb, defineIntegration, getClient } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/types';\nimport { addConsoleInstrumentationHandler, severityLevelFromString } from '@sentry/utils';\n\nconst INTEGRATION_NAME = 'Console';\n\nconst _consoleIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client) {\n return;\n }\n\n addBreadcrumb(\n {\n category: 'console',\n level: severityLevelFromString(level),\n message: util.format.apply(undefined, args),\n },\n {\n input: [...args],\n level,\n },\n );\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Capture console logs as breadcrumbs.\n */\nexport const consoleIntegration = defineIntegration(_consoleIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,SAAS,CAAA;AAClC;AACA,MAAM,mBAAoB,IAAG,MAAM;AACnC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,gCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAA,EAAO,KAAK;AAC5D,QAAQ,IAAI,SAAS,EAAG,KAAI,MAAM,EAAE;AACpC,UAAU,OAAM;AAChB,SAAQ;AACR;AACA,QAAQ,aAAa;AACrB,UAAU;AACV,YAAY,QAAQ,EAAE,SAAS;AAC/B,YAAY,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC;AACjD,YAAY,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;AACvD,WAAW;AACX,UAAU;AACV,YAAY,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;AAC5B,YAAY,KAAK;AACjB,WAAW;AACX,SAAS,CAAA;AACT,OAAO,CAAC,CAAA;AACR,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;MACa,kBAAmB,GAAE,iBAAiB,CAAC,mBAAmB;;;;"}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { _optionalChain } from '@sentry/utils';
|
|
2
|
+
import { execFile } from 'child_process';
|
|
3
|
+
import { readFile, readdir } from 'fs';
|
|
4
|
+
import * as os from 'os';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { promisify } from 'util';
|
|
7
|
+
import { defineIntegration } from '@sentry/core';
|
|
8
|
+
|
|
9
|
+
const readFileAsync = promisify(readFile);
|
|
10
|
+
const readDirAsync = promisify(readdir);
|
|
11
|
+
|
|
12
|
+
const INTEGRATION_NAME = 'Context';
|
|
13
|
+
|
|
14
|
+
const _nodeContextIntegration = ((options = {}) => {
|
|
15
|
+
let cachedContext;
|
|
16
|
+
|
|
17
|
+
const _options = {
|
|
18
|
+
app: true,
|
|
19
|
+
os: true,
|
|
20
|
+
device: true,
|
|
21
|
+
culture: true,
|
|
22
|
+
cloudResource: true,
|
|
23
|
+
...options,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Add contexts to the event. Caches the context so we only look it up once. */
|
|
27
|
+
async function addContext(event) {
|
|
28
|
+
if (cachedContext === undefined) {
|
|
29
|
+
cachedContext = _getContexts();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const updatedContext = _updateContext(await cachedContext);
|
|
33
|
+
|
|
34
|
+
event.contexts = {
|
|
35
|
+
...event.contexts,
|
|
36
|
+
app: { ...updatedContext.app, ..._optionalChain([event, 'access', _ => _.contexts, 'optionalAccess', _2 => _2.app]) },
|
|
37
|
+
os: { ...updatedContext.os, ..._optionalChain([event, 'access', _3 => _3.contexts, 'optionalAccess', _4 => _4.os]) },
|
|
38
|
+
device: { ...updatedContext.device, ..._optionalChain([event, 'access', _5 => _5.contexts, 'optionalAccess', _6 => _6.device]) },
|
|
39
|
+
culture: { ...updatedContext.culture, ..._optionalChain([event, 'access', _7 => _7.contexts, 'optionalAccess', _8 => _8.culture]) },
|
|
40
|
+
cloud_resource: { ...updatedContext.cloud_resource, ..._optionalChain([event, 'access', _9 => _9.contexts, 'optionalAccess', _10 => _10.cloud_resource]) },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return event;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Get the contexts from node. */
|
|
47
|
+
async function _getContexts() {
|
|
48
|
+
const contexts = {};
|
|
49
|
+
|
|
50
|
+
if (_options.os) {
|
|
51
|
+
contexts.os = await getOsContext();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (_options.app) {
|
|
55
|
+
contexts.app = getAppContext();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (_options.device) {
|
|
59
|
+
contexts.device = getDeviceContext(_options.device);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (_options.culture) {
|
|
63
|
+
const culture = getCultureContext();
|
|
64
|
+
|
|
65
|
+
if (culture) {
|
|
66
|
+
contexts.culture = culture;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (_options.cloudResource) {
|
|
71
|
+
contexts.cloud_resource = getCloudResourceContext();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return contexts;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
name: INTEGRATION_NAME,
|
|
79
|
+
processEvent(event) {
|
|
80
|
+
return addContext(event);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}) ;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Capture context about the environment and the device that the client is running on, to events.
|
|
87
|
+
*/
|
|
88
|
+
const nodeContextIntegration = defineIntegration(_nodeContextIntegration);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Updates the context with dynamic values that can change
|
|
92
|
+
*/
|
|
93
|
+
function _updateContext(contexts) {
|
|
94
|
+
// Only update properties if they exist
|
|
95
|
+
if (_optionalChain([contexts, 'optionalAccess', _11 => _11.app, 'optionalAccess', _12 => _12.app_memory])) {
|
|
96
|
+
contexts.app.app_memory = process.memoryUsage().rss;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (_optionalChain([contexts, 'optionalAccess', _13 => _13.device, 'optionalAccess', _14 => _14.free_memory])) {
|
|
100
|
+
contexts.device.free_memory = os.freemem();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return contexts;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns the operating system context.
|
|
108
|
+
*
|
|
109
|
+
* Based on the current platform, this uses a different strategy to provide the
|
|
110
|
+
* most accurate OS information. Since this might involve spawning subprocesses
|
|
111
|
+
* or accessing the file system, this should only be executed lazily and cached.
|
|
112
|
+
*
|
|
113
|
+
* - On macOS (Darwin), this will execute the `sw_vers` utility. The context
|
|
114
|
+
* has a `name`, `version`, `build` and `kernel_version` set.
|
|
115
|
+
* - On Linux, this will try to load a distribution release from `/etc` and set
|
|
116
|
+
* the `name`, `version` and `kernel_version` fields.
|
|
117
|
+
* - On all other platforms, only a `name` and `version` will be returned. Note
|
|
118
|
+
* that `version` might actually be the kernel version.
|
|
119
|
+
*/
|
|
120
|
+
async function getOsContext() {
|
|
121
|
+
const platformId = os.platform();
|
|
122
|
+
switch (platformId) {
|
|
123
|
+
case 'darwin':
|
|
124
|
+
return getDarwinInfo();
|
|
125
|
+
case 'linux':
|
|
126
|
+
return getLinuxInfo();
|
|
127
|
+
default:
|
|
128
|
+
return {
|
|
129
|
+
name: PLATFORM_NAMES[platformId] || platformId,
|
|
130
|
+
version: os.release(),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function getCultureContext() {
|
|
136
|
+
try {
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
138
|
+
if (typeof (process.versions ).icu !== 'string') {
|
|
139
|
+
// Node was built without ICU support
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Check that node was built with full Intl support. Its possible it was built without support for non-English
|
|
144
|
+
// locales which will make resolvedOptions inaccurate
|
|
145
|
+
//
|
|
146
|
+
// https://nodejs.org/api/intl.html#detecting-internationalization-support
|
|
147
|
+
const january = new Date(9e8);
|
|
148
|
+
const spanish = new Intl.DateTimeFormat('es', { month: 'long' });
|
|
149
|
+
if (spanish.format(january) === 'enero') {
|
|
150
|
+
const options = Intl.DateTimeFormat().resolvedOptions();
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
locale: options.locale,
|
|
154
|
+
timezone: options.timeZone,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
} catch (err) {
|
|
158
|
+
//
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function getAppContext() {
|
|
165
|
+
const app_memory = process.memoryUsage().rss;
|
|
166
|
+
const app_start_time = new Date(Date.now() - process.uptime() * 1000).toISOString();
|
|
167
|
+
|
|
168
|
+
return { app_start_time, app_memory };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Gets device information from os
|
|
173
|
+
*/
|
|
174
|
+
function getDeviceContext(deviceOpt) {
|
|
175
|
+
const device = {};
|
|
176
|
+
|
|
177
|
+
// Sometimes os.uptime() throws due to lacking permissions: https://github.com/getsentry/sentry-javascript/issues/8202
|
|
178
|
+
let uptime;
|
|
179
|
+
try {
|
|
180
|
+
uptime = os.uptime && os.uptime();
|
|
181
|
+
} catch (e) {
|
|
182
|
+
// noop
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// os.uptime or its return value seem to be undefined in certain environments (e.g. Azure functions).
|
|
186
|
+
// Hence, we only set boot time, if we get a valid uptime value.
|
|
187
|
+
// @see https://github.com/getsentry/sentry-javascript/issues/5856
|
|
188
|
+
if (typeof uptime === 'number') {
|
|
189
|
+
device.boot_time = new Date(Date.now() - uptime * 1000).toISOString();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
device.arch = os.arch();
|
|
193
|
+
|
|
194
|
+
if (deviceOpt === true || deviceOpt.memory) {
|
|
195
|
+
device.memory_size = os.totalmem();
|
|
196
|
+
device.free_memory = os.freemem();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (deviceOpt === true || deviceOpt.cpu) {
|
|
200
|
+
const cpuInfo = os.cpus();
|
|
201
|
+
if (cpuInfo && cpuInfo.length) {
|
|
202
|
+
const firstCpu = cpuInfo[0];
|
|
203
|
+
|
|
204
|
+
device.processor_count = cpuInfo.length;
|
|
205
|
+
device.cpu_description = firstCpu.model;
|
|
206
|
+
device.processor_frequency = firstCpu.speed;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return device;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Mapping of Node's platform names to actual OS names. */
|
|
214
|
+
const PLATFORM_NAMES = {
|
|
215
|
+
aix: 'IBM AIX',
|
|
216
|
+
freebsd: 'FreeBSD',
|
|
217
|
+
openbsd: 'OpenBSD',
|
|
218
|
+
sunos: 'SunOS',
|
|
219
|
+
win32: 'Windows',
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** Linux version file to check for a distribution. */
|
|
223
|
+
|
|
224
|
+
/** Mapping of linux release files located in /etc to distributions. */
|
|
225
|
+
const LINUX_DISTROS = [
|
|
226
|
+
{ name: 'fedora-release', distros: ['Fedora'] },
|
|
227
|
+
{ name: 'redhat-release', distros: ['Red Hat Linux', 'Centos'] },
|
|
228
|
+
{ name: 'redhat_version', distros: ['Red Hat Linux'] },
|
|
229
|
+
{ name: 'SuSE-release', distros: ['SUSE Linux'] },
|
|
230
|
+
{ name: 'lsb-release', distros: ['Ubuntu Linux', 'Arch Linux'] },
|
|
231
|
+
{ name: 'debian_version', distros: ['Debian'] },
|
|
232
|
+
{ name: 'debian_release', distros: ['Debian'] },
|
|
233
|
+
{ name: 'arch-release', distros: ['Arch Linux'] },
|
|
234
|
+
{ name: 'gentoo-release', distros: ['Gentoo Linux'] },
|
|
235
|
+
{ name: 'novell-release', distros: ['SUSE Linux'] },
|
|
236
|
+
{ name: 'alpine-release', distros: ['Alpine Linux'] },
|
|
237
|
+
];
|
|
238
|
+
|
|
239
|
+
/** Functions to extract the OS version from Linux release files. */
|
|
240
|
+
const LINUX_VERSIONS
|
|
241
|
+
|
|
242
|
+
= {
|
|
243
|
+
alpine: content => content,
|
|
244
|
+
arch: content => matchFirst(/distrib_release=(.*)/, content),
|
|
245
|
+
centos: content => matchFirst(/release ([^ ]+)/, content),
|
|
246
|
+
debian: content => content,
|
|
247
|
+
fedora: content => matchFirst(/release (..)/, content),
|
|
248
|
+
mint: content => matchFirst(/distrib_release=(.*)/, content),
|
|
249
|
+
red: content => matchFirst(/release ([^ ]+)/, content),
|
|
250
|
+
suse: content => matchFirst(/VERSION = (.*)\n/, content),
|
|
251
|
+
ubuntu: content => matchFirst(/distrib_release=(.*)/, content),
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Executes a regular expression with one capture group.
|
|
256
|
+
*
|
|
257
|
+
* @param regex A regular expression to execute.
|
|
258
|
+
* @param text Content to execute the RegEx on.
|
|
259
|
+
* @returns The captured string if matched; otherwise undefined.
|
|
260
|
+
*/
|
|
261
|
+
function matchFirst(regex, text) {
|
|
262
|
+
const match = regex.exec(text);
|
|
263
|
+
return match ? match[1] : undefined;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Loads the macOS operating system context. */
|
|
267
|
+
async function getDarwinInfo() {
|
|
268
|
+
// Default values that will be used in case no operating system information
|
|
269
|
+
// can be loaded. The default version is computed via heuristics from the
|
|
270
|
+
// kernel version, but the build ID is missing.
|
|
271
|
+
const darwinInfo = {
|
|
272
|
+
kernel_version: os.release(),
|
|
273
|
+
name: 'Mac OS X',
|
|
274
|
+
version: `10.${Number(os.release().split('.')[0]) - 4}`,
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
try {
|
|
278
|
+
// We try to load the actual macOS version by executing the `sw_vers` tool.
|
|
279
|
+
// This tool should be available on every standard macOS installation. In
|
|
280
|
+
// case this fails, we stick with the values computed above.
|
|
281
|
+
|
|
282
|
+
const output = await new Promise((resolve, reject) => {
|
|
283
|
+
execFile('/usr/bin/sw_vers', (error, stdout) => {
|
|
284
|
+
if (error) {
|
|
285
|
+
reject(error);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
resolve(stdout);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
darwinInfo.name = matchFirst(/^ProductName:\s+(.*)$/m, output);
|
|
293
|
+
darwinInfo.version = matchFirst(/^ProductVersion:\s+(.*)$/m, output);
|
|
294
|
+
darwinInfo.build = matchFirst(/^BuildVersion:\s+(.*)$/m, output);
|
|
295
|
+
} catch (e) {
|
|
296
|
+
// ignore
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return darwinInfo;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** Returns a distribution identifier to look up version callbacks. */
|
|
303
|
+
function getLinuxDistroId(name) {
|
|
304
|
+
return name.split(' ')[0].toLowerCase();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Loads the Linux operating system context. */
|
|
308
|
+
async function getLinuxInfo() {
|
|
309
|
+
// By default, we cannot assume anything about the distribution or Linux
|
|
310
|
+
// version. `os.release()` returns the kernel version and we assume a generic
|
|
311
|
+
// "Linux" name, which will be replaced down below.
|
|
312
|
+
const linuxInfo = {
|
|
313
|
+
kernel_version: os.release(),
|
|
314
|
+
name: 'Linux',
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
// We start guessing the distribution by listing files in the /etc
|
|
319
|
+
// directory. This is were most Linux distributions (except Knoppix) store
|
|
320
|
+
// release files with certain distribution-dependent meta data. We search
|
|
321
|
+
// for exactly one known file defined in `LINUX_DISTROS` and exit if none
|
|
322
|
+
// are found. In case there are more than one file, we just stick with the
|
|
323
|
+
// first one.
|
|
324
|
+
const etcFiles = await readDirAsync('/etc');
|
|
325
|
+
const distroFile = LINUX_DISTROS.find(file => etcFiles.includes(file.name));
|
|
326
|
+
if (!distroFile) {
|
|
327
|
+
return linuxInfo;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Once that file is known, load its contents. To make searching in those
|
|
331
|
+
// files easier, we lowercase the file contents. Since these files are
|
|
332
|
+
// usually quite small, this should not allocate too much memory and we only
|
|
333
|
+
// hold on to it for a very short amount of time.
|
|
334
|
+
const distroPath = join('/etc', distroFile.name);
|
|
335
|
+
const contents = ((await readFileAsync(distroPath, { encoding: 'utf-8' })) ).toLowerCase();
|
|
336
|
+
|
|
337
|
+
// Some Linux distributions store their release information in the same file
|
|
338
|
+
// (e.g. RHEL and Centos). In those cases, we scan the file for an
|
|
339
|
+
// identifier, that basically consists of the first word of the linux
|
|
340
|
+
// distribution name (e.g. "red" for Red Hat). In case there is no match, we
|
|
341
|
+
// just assume the first distribution in our list.
|
|
342
|
+
const { distros } = distroFile;
|
|
343
|
+
linuxInfo.name = distros.find(d => contents.indexOf(getLinuxDistroId(d)) >= 0) || distros[0];
|
|
344
|
+
|
|
345
|
+
// Based on the found distribution, we can now compute the actual version
|
|
346
|
+
// number. This is different for every distribution, so several strategies
|
|
347
|
+
// are computed in `LINUX_VERSIONS`.
|
|
348
|
+
const id = getLinuxDistroId(linuxInfo.name);
|
|
349
|
+
linuxInfo.version = LINUX_VERSIONS[id](contents);
|
|
350
|
+
} catch (e) {
|
|
351
|
+
// ignore
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return linuxInfo;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Grabs some information about hosting provider based on best effort.
|
|
359
|
+
*/
|
|
360
|
+
function getCloudResourceContext() {
|
|
361
|
+
if (process.env.VERCEL) {
|
|
362
|
+
// https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#system-environment-variables
|
|
363
|
+
return {
|
|
364
|
+
'cloud.provider': 'vercel',
|
|
365
|
+
'cloud.region': process.env.VERCEL_REGION,
|
|
366
|
+
};
|
|
367
|
+
} else if (process.env.AWS_REGION) {
|
|
368
|
+
// https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html
|
|
369
|
+
return {
|
|
370
|
+
'cloud.provider': 'aws',
|
|
371
|
+
'cloud.region': process.env.AWS_REGION,
|
|
372
|
+
'cloud.platform': process.env.AWS_EXECUTION_ENV,
|
|
373
|
+
};
|
|
374
|
+
} else if (process.env.GCP_PROJECT) {
|
|
375
|
+
// https://cloud.google.com/composer/docs/how-to/managing/environment-variables#reserved_variables
|
|
376
|
+
return {
|
|
377
|
+
'cloud.provider': 'gcp',
|
|
378
|
+
};
|
|
379
|
+
} else if (process.env.ALIYUN_REGION_ID) {
|
|
380
|
+
// TODO: find where I found these environment variables - at least gc.github.com returns something
|
|
381
|
+
return {
|
|
382
|
+
'cloud.provider': 'alibaba_cloud',
|
|
383
|
+
'cloud.region': process.env.ALIYUN_REGION_ID,
|
|
384
|
+
};
|
|
385
|
+
} else if (process.env.WEBSITE_SITE_NAME && process.env.REGION_NAME) {
|
|
386
|
+
// https://learn.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#app-environment
|
|
387
|
+
return {
|
|
388
|
+
'cloud.provider': 'azure',
|
|
389
|
+
'cloud.region': process.env.REGION_NAME,
|
|
390
|
+
};
|
|
391
|
+
} else if (process.env.IBM_CLOUD_REGION) {
|
|
392
|
+
// TODO: find where I found these environment variables - at least gc.github.com returns something
|
|
393
|
+
return {
|
|
394
|
+
'cloud.provider': 'ibm_cloud',
|
|
395
|
+
'cloud.region': process.env.IBM_CLOUD_REGION,
|
|
396
|
+
};
|
|
397
|
+
} else if (process.env.TENCENTCLOUD_REGION) {
|
|
398
|
+
// https://www.tencentcloud.com/document/product/583/32748
|
|
399
|
+
return {
|
|
400
|
+
'cloud.provider': 'tencent_cloud',
|
|
401
|
+
'cloud.region': process.env.TENCENTCLOUD_REGION,
|
|
402
|
+
'cloud.account.id': process.env.TENCENTCLOUD_APPID,
|
|
403
|
+
'cloud.availability_zone': process.env.TENCENTCLOUD_ZONE,
|
|
404
|
+
};
|
|
405
|
+
} else if (process.env.NETLIFY) {
|
|
406
|
+
// https://docs.netlify.com/configure-builds/environment-variables/#read-only-variables
|
|
407
|
+
return {
|
|
408
|
+
'cloud.provider': 'netlify',
|
|
409
|
+
};
|
|
410
|
+
} else if (process.env.FLY_REGION) {
|
|
411
|
+
// https://fly.io/docs/reference/runtime-environment/
|
|
412
|
+
return {
|
|
413
|
+
'cloud.provider': 'fly.io',
|
|
414
|
+
'cloud.region': process.env.FLY_REGION,
|
|
415
|
+
};
|
|
416
|
+
} else if (process.env.DYNO) {
|
|
417
|
+
// https://devcenter.heroku.com/articles/dynos#local-environment-variables
|
|
418
|
+
return {
|
|
419
|
+
'cloud.provider': 'heroku',
|
|
420
|
+
};
|
|
421
|
+
} else {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export { getDeviceContext, nodeContextIntegration, readDirAsync, readFileAsync };
|
|
427
|
+
//# sourceMappingURL=context.js.map
|