@xcodleox/devinspector 2.2.1 → 4.0.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/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +2 -1
- package/dist/angular.d.ts +2 -1
- package/dist/angular.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.js +1 -1
- package/package.json +2 -1
package/dist/angular.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var $=Object.create;var l=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var R=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),w=t=>{throw TypeError(t)};var Y=(t,e,n)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var T=(t,e)=>l(t,"name",{value:e,configurable:!0});var z=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of L(e))!W.call(t,o)&&o!==n&&l(t,o,{get:()=>e[o],enumerable:!(r=P(e,o))||r.enumerable});return t};var F=t=>B(l({},"__esModule",{value:!0}),t);var x=t=>[,,,$(t?.[R("metadata")]??null)],j=["class","method","getter","setter","accessor","field","value","get","set"],y=t=>t!==void 0&&typeof t!="function"?w("Function expected"):t,J=(t,e,n,r,o)=>({kind:j[t],name:e,metadata:r,addInitializer:s=>n._?w("Already initialized"):o.push(y(s||null))}),V=(t,e)=>Y(e,R("metadata"),t[3]),G=(t,e,n,r)=>{for(var o=0,s=t[e>>1],p=s&&s.length;o<p;o++)e&1?s[o].call(n):r=s[o].call(n,r);return r},N=(t,e,n,r,o,s)=>{var p,c,M,m,g,i=e&7,E=!!(e&8),d=!!(e&16),b=i>3?t.length+1:i?E?1:2:0,A=j[i+5],K=i>3&&(t[b-1]=[]),H=t[b]||(t[b]=[]),u=i&&(!d&&!E&&(o=o.prototype),i<5&&(i>3||!d)&&P(i<4?o:{get[n](){return C(this,s)},set[n](a){return O(this,s,a)}},n));i?d&&i<4&&T(s,(i>2?"set ":i>1?"get ":"")+n):T(o,n);for(var v=r.length-1;v>=0;v--)m=J(i,n,M={},t[3],H),i&&(m.static=E,m.private=d,g=m.access={has:d?a=>X(o,a):a=>n in a},i^3&&(g.get=d?a=>(i^1?C:Z)(a,o,i^4?s:u.get):a=>a[n]),i>2&&(g.set=d?(a,I)=>O(a,o,I,i^4?s:u.set):(a,I)=>a[n]=I)),c=(0,r[v])(i?i<4?d?s:u[A]:i>4?void 0:{get:u.get,set:u.set}:o,m),M._=1,i^4||c===void 0?y(c)&&(i>4?K.unshift(c):i?d?s=c:u[A]=c:o=c):typeof c!="object"||c===null?w("Object expected"):(y(p=c.get)&&(u.get=p),y(p=c.set)&&(u.set=p),y(p=c.init)&&K.unshift(p));return i||V(t,o),u&&l(o,n,u),d?i^4?s:u:o};var k=(t,e,n)=>e.has(t)||w("Cannot "+n),X=(t,e)=>Object(e)!==e?w('Cannot use the "in" operator on this value'):t.has(e),C=(t,e,n)=>(k(t,e,"read from private field"),n?n.call(t):e.get(t));var O=(t,e,n,r)=>(k(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Z=(t,e,n)=>(k(t,e,"access private method"),n);var te={};z(te,{AuditAngularErrorHandler:()=>h,auditInterceptor:()=>ee});module.exports=F(te);var U=require("@angular/core");var D=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let n={type:"request_metric",method:e.method,url:e.url,statusCode:e.statusCode,durationMs:e.durationMs,browser:e.userAgent||"",metadata:{environment:this.environment,timestamp:new Date().toISOString(),route:e.route||e.url,dbQueriesCount:e.dbQueriesCount||0,slowQueryMs:e.slowQueryMs||0}};this.send(n)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let n=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((r,o)=>{let s=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(s,{type:"react_native_error",isFatal:!!o}),n&&n(r,o)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",n=>{this.captureError(n.error||new Error(n.message||"Erro global desconhecido"),{filename:n.filename,lineno:n.lineno,colno:n.colno})}),window.addEventListener("unhandledrejection",n=>{let r=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(r,{type:"unhandled_rejection"})});else if(e.process?.on){let n=e.process;n.on("uncaughtException",r=>{this.captureError(r,{type:"uncaught_exception"})}),n.on("unhandledRejection",r=>{let o=r instanceof Error?r:new Error(String(r));this.captureError(o,{type:"unhandled_rejection"})})}}truncate(e,n=5e3){if(typeof e=="string")return e.length>n?e.substring(0,n)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let r={};for(let[o,s]of Object.entries(e))r[o]=this.truncate(s,n);return r}return e}captureError(e,n={}){let r=e.message||"Erro Desconhecido",o=e.stack||"",s={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(o,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(s)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...n,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let n=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},_="__DEVINSPECT_AUDIT_CORE_INSTANCE__",q=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[_]||(t[_]=new D),t[_]},f=q();var Q,S;Q=[(0,U.Injectable)()];var h=class{handleError(e){let n=e instanceof Error?e:new Error(String(e));f.captureError(n,{framework:"Angular",platform:"browser",url:typeof window<"u"?window.location.href:""}),console.error("[DevInspector Angular Error]:",e)}};S=x(null),h=N(S,0,"AuditAngularErrorHandler",Q,h),G(S,1,h);var ee=(t,e)=>{if(t.url&&t.url.includes("devinspector.com.br"))return e(t);let n=typeof performance<"u"?performance.now():Date.now();return e(t).pipe({next:r=>{if(r&&r.constructor&&r.constructor.name==="HttpResponse"){let o=Math.round((typeof performance<"u"?performance.now():Date.now())-n),s=r.status;(s>=400||o>=300)&&f.captureRequest({method:t.method,url:t.urlWithParams||t.url,statusCode:s,durationMs:o,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t.url})}},error:r=>{let o=Math.round((typeof performance<"u"?performance.now():Date.now())-n);f.captureRequest({method:t.method,url:t.urlWithParams||t.url,statusCode:r?.status||0,durationMs:o,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t.url}),f.captureException(new Error(`HTTP Error ${r?.status||0}: ${r?.message||"Erro desconhecido"}`),{url:t.urlWithParams||t.url,method:t.method,status:r?.status})}})};0&&(module.exports={AuditAngularErrorHandler,auditInterceptor});
|
package/dist/angular.d.cts
CHANGED
|
@@ -3,5 +3,6 @@ import { ErrorHandler } from '@angular/core';
|
|
|
3
3
|
declare class AuditAngularErrorHandler implements ErrorHandler {
|
|
4
4
|
handleError(error: unknown): void;
|
|
5
5
|
}
|
|
6
|
+
declare const auditInterceptor: any;
|
|
6
7
|
|
|
7
|
-
export { AuditAngularErrorHandler };
|
|
8
|
+
export { AuditAngularErrorHandler, auditInterceptor };
|
package/dist/angular.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import { ErrorHandler } from '@angular/core';
|
|
|
3
3
|
declare class AuditAngularErrorHandler implements ErrorHandler {
|
|
4
4
|
handleError(error: unknown): void;
|
|
5
5
|
}
|
|
6
|
+
declare const auditInterceptor: any;
|
|
6
7
|
|
|
7
|
-
export { AuditAngularErrorHandler };
|
|
8
|
+
export { AuditAngularErrorHandler, auditInterceptor };
|
package/dist/angular.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let
|
|
1
|
+
var U=Object.create;var I=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var P=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),m=t=>{throw TypeError(t)};var $=(t,e,n)=>e in t?I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var T=(t,e)=>I(t,"name",{value:e,configurable:!0});var R=t=>[,,,U(t?.[P("metadata")]??null)],x=["class","method","getter","setter","accessor","field","value","get","set"],h=t=>t!==void 0&&typeof t!="function"?m("Function expected"):t,L=(t,e,n,r,o)=>({kind:x[t],name:e,metadata:r,addInitializer:s=>n._?m("Already initialized"):o.push(h(s||null))}),W=(t,e)=>$(e,P("metadata"),t[3]),j=(t,e,n,r)=>{for(var o=0,s=t[e>>1],p=s&&s.length;o<p;o++)e&1?s[o].call(n):r=s[o].call(n,r);return r},G=(t,e,n,r,o,s)=>{var p,c,M,f,w,i=e&7,g=!!(e&8),d=!!(e&16),E=i>3?t.length+1:i?g?1:2:0,A=x[i+5],K=i>3&&(t[E-1]=[]),Q=t[E]||(t[E]=[]),u=i&&(!d&&!g&&(o=o.prototype),i<5&&(i>3||!d)&&H(i<4?o:{get[n](){return C(this,s)},set[n](a){return O(this,s,a)}},n));i?d&&i<4&&T(s,(i>2?"set ":i>1?"get ":"")+n):T(o,n);for(var b=r.length-1;b>=0;b--)f=L(i,n,M={},t[3],Q),i&&(f.static=g,f.private=d,w=f.access={has:d?a=>Y(o,a):a=>n in a},i^3&&(w.get=d?a=>(i^1?C:z)(a,o,i^4?s:u.get):a=>a[n]),i>2&&(w.set=d?(a,v)=>O(a,o,v,i^4?s:u.set):(a,v)=>a[n]=v)),c=(0,r[b])(i?i<4?d?s:u[A]:i>4?void 0:{get:u.get,set:u.set}:o,f),M._=1,i^4||c===void 0?h(c)&&(i>4?K.unshift(c):i?d?s=c:u[A]=c:o=c):typeof c!="object"||c===null?m("Object expected"):(h(p=c.get)&&(u.get=p),h(p=c.set)&&(u.set=p),h(p=c.init)&&K.unshift(p));return i||W(t,o),u&&I(o,n,u),d?i^4?s:u:o};var k=(t,e,n)=>e.has(t)||m("Cannot "+n),Y=(t,e)=>Object(e)!==e?m('Cannot use the "in" operator on this value'):t.has(e),C=(t,e,n)=>(k(t,e,"read from private field"),n?n.call(t):e.get(t));var O=(t,e,n,r)=>(k(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),z=(t,e,n)=>(k(t,e,"access private method"),n);import{Injectable as F}from"@angular/core";var D=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let n={type:"request_metric",method:e.method,url:e.url,statusCode:e.statusCode,durationMs:e.durationMs,browser:e.userAgent||"",metadata:{environment:this.environment,timestamp:new Date().toISOString(),route:e.route||e.url,dbQueriesCount:e.dbQueriesCount||0,slowQueryMs:e.slowQueryMs||0}};this.send(n)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let n=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((r,o)=>{let s=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(s,{type:"react_native_error",isFatal:!!o}),n&&n(r,o)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",n=>{this.captureError(n.error||new Error(n.message||"Erro global desconhecido"),{filename:n.filename,lineno:n.lineno,colno:n.colno})}),window.addEventListener("unhandledrejection",n=>{let r=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(r,{type:"unhandled_rejection"})});else if(e.process?.on){let n=e.process;n.on("uncaughtException",r=>{this.captureError(r,{type:"uncaught_exception"})}),n.on("unhandledRejection",r=>{let o=r instanceof Error?r:new Error(String(r));this.captureError(o,{type:"unhandled_rejection"})})}}truncate(e,n=5e3){if(typeof e=="string")return e.length>n?e.substring(0,n)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let r={};for(let[o,s]of Object.entries(e))r[o]=this.truncate(s,n);return r}return e}captureError(e,n={}){let r=e.message||"Erro Desconhecido",o=e.stack||"",s={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(o,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(s)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...n,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let n=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},_="__DEVINSPECT_AUDIT_CORE_INSTANCE__",B=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[_]||(t[_]=new D),t[_]},l=B();var N,S;N=[F()];var y=class{handleError(e){let n=e instanceof Error?e:new Error(String(e));l.captureError(n,{framework:"Angular",platform:"browser",url:typeof window<"u"?window.location.href:""}),console.error("[DevInspector Angular Error]:",e)}};S=R(null),y=G(S,0,"AuditAngularErrorHandler",N,y),j(S,1,y);var ne=(t,e)=>{if(t.url&&t.url.includes("devinspector.com.br"))return e(t);let n=typeof performance<"u"?performance.now():Date.now();return e(t).pipe({next:r=>{if(r&&r.constructor&&r.constructor.name==="HttpResponse"){let o=Math.round((typeof performance<"u"?performance.now():Date.now())-n),s=r.status;(s>=400||o>=300)&&l.captureRequest({method:t.method,url:t.urlWithParams||t.url,statusCode:s,durationMs:o,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t.url})}},error:r=>{let o=Math.round((typeof performance<"u"?performance.now():Date.now())-n);l.captureRequest({method:t.method,url:t.urlWithParams||t.url,statusCode:r?.status||0,durationMs:o,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t.url}),l.captureException(new Error(`HTTP Error ${r?.status||0}: ${r?.message||"Erro desconhecido"}`),{url:t.urlWithParams||t.url,method:t.method,status:r?.status})}})};export{y as AuditAngularErrorHandler,ne as auditInterceptor};
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var w=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},m=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!y.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(r=h(e,o))||r.enumerable});return n};var E=n=>m(c({},"__esModule",{value:!0}),n);var S={};w(S,{AuditErrorBoundary:()=>p,auditFetch:()=>v});module.exports=E(S);var l=require("react");var u=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let t={type:"request_metric",method:e.method,url:e.url,statusCode:e.statusCode,durationMs:e.durationMs,browser:e.userAgent||"",metadata:{environment:this.environment,timestamp:new Date().toISOString(),route:e.route||e.url,dbQueriesCount:e.dbQueriesCount||0,slowQueryMs:e.slowQueryMs||0}};this.send(t)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let t=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((r,o)=>{let i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!o}),t&&t(r,o)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",t=>{this.captureError(t.error||new Error(t.message||"Erro global desconhecido"),{filename:t.filename,lineno:t.lineno,colno:t.colno})}),window.addEventListener("unhandledrejection",t=>{let r=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(r,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",r=>{this.captureError(r,{type:"uncaught_exception"})}),t.on("unhandledRejection",r=>{let o=r instanceof Error?r:new Error(String(r));this.captureError(o,{type:"unhandled_rejection"})})}}truncate(e,t=5e3){if(typeof e=="string")return e.length>t?e.substring(0,t)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let r={};for(let[o,i]of Object.entries(e))r[o]=this.truncate(i,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",o=e.stack||"",i={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(o,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},d="__DEVINSPECT_AUDIT_CORE_INSTANCE__",b=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[d]||(n[d]=new u),n[d]},s=b();var f=require("react/jsx-runtime"),p=class extends l.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){s.captureError(t,{framework:"React",componentStack:r.componentStack,url:typeof window<"u"?window.location.href:""})}render(){return this.state.hasError?this.props.fallback||(0,f.jsx)("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};async function v(n,e){let t=typeof n=="string"?n:n instanceof URL?n.toString():n.url;if(t.includes("devinspector.com.br"))return fetch(n,e);let r=e?.method||"GET",o=typeof performance<"u"?performance.now():Date.now();try{let i=await fetch(n,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);return(i.status>=400||a>=300)&&s.captureRequest({method:r,url:t,statusCode:i.status,durationMs:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t}),i}catch(i){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);throw s.captureRequest({method:r,url:t,statusCode:0,durationMs:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t}),s.captureException(i instanceof Error?i:new Error(String(i)),{url:t,method:r,type:"network_error"}),i}}0&&(module.exports={AuditErrorBoundary,auditFetch});
|
package/dist/react.d.cts
CHANGED
|
@@ -13,5 +13,6 @@ declare class AuditErrorBoundary extends Component<Props, State> {
|
|
|
13
13
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
14
14
|
render(): ReactNode;
|
|
15
15
|
}
|
|
16
|
+
declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
16
17
|
|
|
17
|
-
export { AuditErrorBoundary };
|
|
18
|
+
export { AuditErrorBoundary, auditFetch };
|
package/dist/react.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ declare class AuditErrorBoundary extends Component<Props, State> {
|
|
|
13
13
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
14
14
|
render(): ReactNode;
|
|
15
15
|
}
|
|
16
|
+
declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
16
17
|
|
|
17
|
-
export { AuditErrorBoundary };
|
|
18
|
+
export { AuditErrorBoundary, auditFetch };
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as
|
|
1
|
+
import{Component as l}from"react";var d=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let t={type:"request_metric",method:e.method,url:e.url,statusCode:e.statusCode,durationMs:e.durationMs,browser:e.userAgent||"",metadata:{environment:this.environment,timestamp:new Date().toISOString(),route:e.route||e.url,dbQueriesCount:e.dbQueriesCount||0,slowQueryMs:e.slowQueryMs||0}};this.send(t)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let t=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((r,i)=>{let n=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(n,{type:"react_native_error",isFatal:!!i}),t&&t(r,i)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",t=>{this.captureError(t.error||new Error(t.message||"Erro global desconhecido"),{filename:t.filename,lineno:t.lineno,colno:t.colno})}),window.addEventListener("unhandledrejection",t=>{let r=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(r,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",r=>{this.captureError(r,{type:"uncaught_exception"})}),t.on("unhandledRejection",r=>{let i=r instanceof Error?r:new Error(String(r));this.captureError(i,{type:"unhandled_rejection"})})}}truncate(e,t=5e3){if(typeof e=="string")return e.length>t?e.substring(0,t)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let r={};for(let[i,n]of Object.entries(e))r[i]=this.truncate(n,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",i=e.stack||"",n={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(n)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return o[c]||(o[c]=new d),o[c]},s=p();import{jsx as f}from"react/jsx-runtime";var u=class extends l{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){s.captureError(t,{framework:"React",componentStack:r.componentStack,url:typeof window<"u"?window.location.href:""})}render(){return this.state.hasError?this.props.fallback||f("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};async function b(o,e){let t=typeof o=="string"?o:o instanceof URL?o.toString():o.url;if(t.includes("devinspector.com.br"))return fetch(o,e);let r=e?.method||"GET",i=typeof performance<"u"?performance.now():Date.now();try{let n=await fetch(o,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);return(n.status>=400||a>=300)&&s.captureRequest({method:r,url:t,statusCode:n.status,durationMs:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t}),n}catch(n){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);throw s.captureRequest({method:r,url:t,statusCode:0,durationMs:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",route:t}),s.captureException(n instanceof Error?n:new Error(String(n)),{url:t,method:r,type:"network_error"}),n}}export{u as AuditErrorBoundary,b as auditFetch};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcodleox/devinspector",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "SDK de monitoramento e auditoria de erros em tempo real | Dev Inspector",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -169,6 +169,7 @@
|
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
171
|
"devDependencies": {
|
|
172
|
+
"@angular/common": "^21.2.22",
|
|
172
173
|
"@angular/core": "^21.2.18",
|
|
173
174
|
"@types/node": "^26.4.1",
|
|
174
175
|
"@types/react": "^18.3.31",
|