@xcodleox/devinspector 2.2.0 → 3.2.1

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},y=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!f.call(o,n)&&n!==t&&s(o,n,{get:()=>e[n],enumerable:!(r=p(e,n))||r.enumerable});return o};var g=o=>y(s({},"__esModule",{value:!0}),o);var w={};h(w,{AuditAngularErrorHandler:()=>u});module.exports=g(w);var c=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,n)=>{let i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!n}),t&&t(r,n)})}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 n=r instanceof Error?r:new Error(String(r));this.captureError(n,{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[n,i]of Object.entries(e))r[n]=this.truncate(i,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",n=e.stack||"",i={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(n,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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",m=()=>{let o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return o[a]||(o[a]=new c),o[a]},d=m();var u=class{handleError(e){let t=e instanceof Error?e:new Error(String(e));d.captureError(t,{framework:"Angular"}),console.error(e)}};0&&(module.exports={AuditAngularErrorHandler});
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});
@@ -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 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,n)=>{let i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!n}),t&&t(r,n)})}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 n=r instanceof Error?r:new Error(String(r));this.captureError(n,{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[n,i]of Object.entries(e))r[n]=this.truncate(i,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",n=e.stack||"",i={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(n,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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",u=()=>{let o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return o[s]||(o[s]=new a),o[s]},c=u();var d=class{handleError(e){let t=e instanceof Error?e:new Error(String(e));c.captureError(t,{framework:"Angular"}),console.error(e)}};export{d as AuditAngularErrorHandler};
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/index.d.cts CHANGED
@@ -2,6 +2,7 @@ interface InitOptions {
2
2
  apiKey: string;
3
3
  endpoint?: string;
4
4
  environment?: string;
5
+ slowThresholdMs?: number;
5
6
  }
6
7
  interface RequestMetricData {
7
8
  method: string;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ interface InitOptions {
2
2
  apiKey: string;
3
3
  endpoint?: string;
4
4
  environment?: string;
5
+ slowThresholdMs?: number;
5
6
  }
6
7
  interface RequestMetricData {
7
8
  method: string;
package/dist/next.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!l.call(r,i)&&i!==t&&a(r,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return r};var y=r=>h(a({},"__esModule",{value:!0}),r);var m={};f(m,{audit:()=>s,captureNextError:()=>E,initNextDevInspector:()=>w});module.exports=y(m);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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new u),r[c]},s=g();function w(r){s.init(r)}function E(r,e={}){let t=r instanceof Error?r:new Error(String(r));s.captureError(t,{framework:"nextjs",...e})}0&&(module.exports={audit,captureNextError,initNextDevInspector});
1
+ "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!l.call(r,i)&&i!==t&&a(r,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return r};var y=r=>f(a({},"__esModule",{value:!0}),r);var m={};h(m,{audit:()=>s,captureNextError:()=>E,initNextDevInspector:()=>w});module.exports=y(m);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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new u),r[c]},s=g();function w(r){s.init(r)}function E(r,e={}){let t=r instanceof Error?r:new Error(String(r));s.captureError(t,{framework:"nextjs",...e})}0&&(module.exports={audit,captureNextError,initNextDevInspector});
package/dist/next.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 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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",u=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},c=u();function f(r){c.init(r)}function h(r,e={}){let t=r instanceof Error?r:new Error(String(r));c.captureError(t,{framework:"nextjs",...e})}export{c as audit,h as captureNextError,f as initNextDevInspector};
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 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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",u=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},c=u();function h(r){c.init(r)}function f(r,e={}){let t=r instanceof Error?r:new Error(String(r));c.captureError(t,{framework:"nextjs",...e})}export{c as audit,f as captureNextError,h as initNextDevInspector};
package/dist/node.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var t in e)u(n,t,{get:e[t],enumerable:!0})},m=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!y.call(n,o)&&o!==t&&u(n,o,{get:()=>e[o],enumerable:!(r=h(e,o))||r.enumerable});return n};var w=n=>m(u({},"__esModule",{value:!0}),n);var S={};g(S,{auditOperation:()=>v,devInspector:()=>b,devInspectorErrorHandler:()=>I});module.exports=w(S);var l=require("async_hooks");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,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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",E=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[c]||(n[c]=new d),n[c]},a=E();var p=new l.AsyncLocalStorage;function b(n){return a.init(n),(e,t,r)=>{let o=performance.now();p.run({req:e,queriesCount:0,slowQueries:0},()=>{t.on("finish",()=>{let i=Math.round(performance.now()-o),s=p.getStore();a.captureRequest({method:e.method,url:e.originalUrl||e.url,statusCode:t.statusCode,durationMs:i,userAgent:e.headers["user-agent"],route:e.route?.path||e.baseUrl||e.url,dbQueriesCount:s?.queriesCount||0,slowQueryMs:s?.slowQueries||0})}),r()})}}async function v(n,e,t=300){let r=p.getStore(),o=performance.now();r&&r.queriesCount++;try{let i=await e(),s=performance.now()-o;return s>t&&r&&(r.slowQueries=Math.max(r.slowQueries,Math.round(s)),a.captureMessage(`Slow Query detectada em [${n}]`,{durationMs:Math.round(s),operationName:n,url:r.req?.originalUrl})),i}catch(i){let s=performance.now()-o;throw a.captureException(i,{operationName:n,durationMs:Math.round(s)}),i}}function I(){return(n,e,t,r)=>{a.captureException(n,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),r(n)}}0&&(module.exports={auditOperation,devInspector,devInspectorErrorHandler});
1
+ "use strict";var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},I=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!b.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(r=g(e,o))||r.enumerable});return n};var M=n=>I(c({},"__esModule",{value:!0}),n);var O={};v(O,{auditOperation:()=>A,devInspector:()=>C,devInspectorErrorHandler:()=>_});module.exports=M(O);var f=require("async_hooks");var l=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__",S=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[d]||(n[d]=new l),n[d]},a=S();var p=new f.AsyncLocalStorage;function C(n){a.init(n);let e=n.slowThresholdMs??300;return(t,r,o)=>{if(t.url&&t.url.startsWith("/uploads"))return o();let i=performance.now();p.run({req:t,queriesCount:0,slowQueries:0},()=>{r.on("finish",()=>{let s=Math.round(performance.now()-i),u=p.getStore(),h=r.statusCode,y=h>=400,w=s>=e,m=(u?.slowQueries||0)>0;(y||w||m)&&a.captureRequest({method:t.method,url:t.originalUrl||t.url,statusCode:h,durationMs:s,userAgent:t.headers["user-agent"],route:t.route?.path||t.baseUrl||t.url,dbQueriesCount:u?.queriesCount||0,slowQueryMs:u?.slowQueries||0})}),o()})}}async function A(n,e,t=300){let r=p.getStore(),o=performance.now();r&&r.queriesCount++;try{let i=await e(),s=performance.now()-o;return s>t&&r&&(r.slowQueries=Math.max(r.slowQueries,Math.round(s)),a.captureMessage(`Slow Query detectada em [${n}]`,{durationMs:Math.round(s),operationName:n,url:r.req?.originalUrl})),i}catch(i){let s=performance.now()-o;throw a.captureException(i,{operationName:n,durationMs:Math.round(s)}),i}}function _(){return(n,e,t,r)=>{a.captureException(n,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),r(n)}}0&&(module.exports={auditOperation,devInspector,devInspectorErrorHandler});
package/dist/node.d.cts CHANGED
@@ -2,7 +2,7 @@ import { InitOptions } from './index.cjs';
2
2
 
3
3
  interface DevInspectorNodeOptions extends InitOptions {
4
4
  }
5
- declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => void;
5
+ declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => any;
6
6
  declare function auditOperation<T>(name: string, operation: () => Promise<T>, thresholdMs?: number): Promise<T>;
7
7
  declare function devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
8
8
 
package/dist/node.d.ts CHANGED
@@ -2,7 +2,7 @@ import { InitOptions } from './index.js';
2
2
 
3
3
  interface DevInspectorNodeOptions extends InitOptions {
4
4
  }
5
- declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => void;
5
+ declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => any;
6
6
  declare function auditOperation<T>(name: string, operation: () => Promise<T>, thresholdMs?: number): Promise<T>;
7
7
  declare function devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
8
8
 
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- import{AsyncLocalStorage as l}from"async_hooks";var c=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 r={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(r)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let r=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((t,o)=>{let i=t instanceof Error?t:new Error(String(t?.message||t||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!o}),r&&r(t,o)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",r=>{this.captureError(r.error||new Error(r.message||"Erro global desconhecido"),{filename:r.filename,lineno:r.lineno,colno:r.colno})}),window.addEventListener("unhandledrejection",r=>{let t=r.reason instanceof Error?r.reason:new Error(String(r.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(e.process?.on){let r=e.process;r.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),r.on("unhandledRejection",t=>{let o=t instanceof Error?t:new Error(String(t));this.captureError(o,{type:"unhandled_rejection"})})}}truncate(e,r=5e3){if(typeof e=="string")return e.length>r?e.substring(0,r)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let t={};for(let[o,i]of Object.entries(e))t[o]=this.truncate(i,r);return t}return e}captureError(e,r={}){let t=e.message||"Erro Desconhecido",o=e.stack||"",i={type:"error",message:this.truncate(t,500),stackTrace:this.truncate(o,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...r,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(e,r={}){this.captureError(e,r)}captureMessage(e,r={}){let t={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...r,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(e){let r=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let t=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":r},body:JSON.stringify(e),keepalive:!0});t.ok||console.error(`[DevInspector] Erro na API (${t.status}): ${t.statusText}`)}catch(t){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",t)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[u]||(n[u]=new c),n[u]},a=p();var d=new l;function g(n){return a.init(n),(e,r,t)=>{let o=performance.now();d.run({req:e,queriesCount:0,slowQueries:0},()=>{r.on("finish",()=>{let i=Math.round(performance.now()-o),s=d.getStore();a.captureRequest({method:e.method,url:e.originalUrl||e.url,statusCode:r.statusCode,durationMs:i,userAgent:e.headers["user-agent"],route:e.route?.path||e.baseUrl||e.url,dbQueriesCount:s?.queriesCount||0,slowQueryMs:s?.slowQueries||0})}),t()})}}async function m(n,e,r=300){let t=d.getStore(),o=performance.now();t&&t.queriesCount++;try{let i=await e(),s=performance.now()-o;return s>r&&t&&(t.slowQueries=Math.max(t.slowQueries,Math.round(s)),a.captureMessage(`Slow Query detectada em [${n}]`,{durationMs:Math.round(s),operationName:n,url:t.req?.originalUrl})),i}catch(i){let s=performance.now()-o;throw a.captureException(i,{operationName:n,durationMs:Math.round(s)}),i}}function w(){return(n,e,r,t)=>{a.captureException(n,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),t(n)}}export{m as auditOperation,g as devInspector,w as devInspectorErrorHandler};
1
+ import{AsyncLocalStorage as m}from"async_hooks";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,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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",w=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[c]||(n[c]=new d),n[c]},a=w();var l=new m;function v(n){a.init(n);let e=n.slowThresholdMs??300;return(t,r,o)=>{if(t.url&&t.url.startsWith("/uploads"))return o();let i=performance.now();l.run({req:t,queriesCount:0,slowQueries:0},()=>{r.on("finish",()=>{let s=Math.round(performance.now()-i),u=l.getStore(),p=r.statusCode,h=p>=400,f=s>=e,y=(u?.slowQueries||0)>0;(h||f||y)&&a.captureRequest({method:t.method,url:t.originalUrl||t.url,statusCode:p,durationMs:s,userAgent:t.headers["user-agent"],route:t.route?.path||t.baseUrl||t.url,dbQueriesCount:u?.queriesCount||0,slowQueryMs:u?.slowQueries||0})}),o()})}}async function I(n,e,t=300){let r=l.getStore(),o=performance.now();r&&r.queriesCount++;try{let i=await e(),s=performance.now()-o;return s>t&&r&&(r.slowQueries=Math.max(r.slowQueries,Math.round(s)),a.captureMessage(`Slow Query detectada em [${n}]`,{durationMs:Math.round(s),operationName:n,url:r.req?.originalUrl})),i}catch(i){let s=performance.now()-o;throw a.captureException(i,{operationName:n,durationMs:Math.round(s)}),i}}function M(){return(n,e,t,r)=>{a.captureException(n,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),r(n)}}export{I as auditOperation,v as devInspector,M as devInspectorErrorHandler};
package/dist/svelte.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!l.call(r,i)&&i!==t&&s(r,i,{get:()=>e[i],enumerable:!(n=u(e,i))||n.enumerable});return r};var f=r=>y(s({},"__esModule",{value:!0}),r);var E={};h(E,{audit:()=>d,initSvelteDevInspector:()=>w});module.exports=f(E);var c=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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},d=g();function w(r){d.init(r)}0&&(module.exports={audit,initSvelteDevInspector});
1
+ "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!l.call(r,i)&&i!==t&&s(r,i,{get:()=>e[i],enumerable:!(n=u(e,i))||n.enumerable});return r};var f=r=>y(s({},"__esModule",{value:!0}),r);var m={};h(m,{audit:()=>d,initSvelteDevInspector:()=>w});module.exports=f(m);var c=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((n,i)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(n,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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(n,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},d=g();function w(r){d.init(r)}0&&(module.exports={audit,initSvelteDevInspector});
package/dist/vanilla.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(i,e)=>{for(var t in e)a(i,t,{get:e[t],enumerable:!0})},y=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!l.call(i,r)&&r!==t&&a(i,r,{get:()=>e[r],enumerable:!(n=u(e,r))||n.enumerable});return i};var h=i=>y(a({},"__esModule",{value:!0}),i);var m={};f(m,{audit:()=>s,default:()=>w});module.exports=h(m);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((n,r)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,o]of Object.entries(e))n[r]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",o={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return i[c]||(i[c]=new d),i[c]},s=g();typeof window<"u"&&(window.DevInspector=s);var w=s;0&&(module.exports={audit});
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(i,e)=>{for(var t in e)a(i,t,{get:e[t],enumerable:!0})},h=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!l.call(i,r)&&r!==t&&a(i,r,{get:()=>e[r],enumerable:!(n=u(e,r))||n.enumerable});return i};var y=i=>h(a({},"__esModule",{value:!0}),i);var m={};f(m,{audit:()=>s,default:()=>w});module.exports=y(m);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((n,r)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,o]of Object.entries(e))n[r]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",o={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return i[c]||(i[c]=new d),i[c]},s=g();typeof window<"u"&&(window.DevInspector=s);var w=s;0&&(module.exports={audit});
@@ -1 +1 @@
1
- "use strict";var DevInspector=(()=>{var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(i,e)=>{for(var t in e)a(i,t,{get:e[t],enumerable:!0})},y=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!l.call(i,r)&&r!==t&&a(i,r,{get:()=>e[r],enumerable:!(n=u(e,r))||n.enumerable});return i};var h=i=>y(a({},"__esModule",{value:!0}),i);var m={};f(m,{audit:()=>s,default:()=>w});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((n,r)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,o]of Object.entries(e))n[r]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",o={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return i[c]||(i[c]=new d),i[c]},s=g();typeof window<"u"&&(window.DevInspector=s);var w=s;return h(m);})();
1
+ "use strict";var DevInspector=(()=>{var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(i,e)=>{for(var t in e)a(i,t,{get:e[t],enumerable:!0})},h=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!l.call(i,r)&&r!==t&&a(i,r,{get:()=>e[r],enumerable:!(n=u(e,r))||n.enumerable});return i};var y=i=>h(a({},"__esModule",{value:!0}),i);var m={};f(m,{audit:()=>s,default:()=>w});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((n,r)=>{let o=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,o]of Object.entries(e))n[r]=this.truncate(o,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",o={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return i[c]||(i[c]=new d),i[c]},s=g();typeof window<"u"&&(window.DevInspector=s);var w=s;return y(m);})();
package/dist/vanilla.js CHANGED
@@ -1 +1 @@
1
- var c=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((n,r)=>{let i=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,i]of Object.entries(e))n[r]=this.truncate(i,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",i={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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 n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return o[a]||(o[a]=new c),o[a]},s=d();typeof window<"u"&&(window.DevInspector=s);var h=s;export{s as audit,h as default};
1
+ var c=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((n,r)=>{let i=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!r}),t&&t(n,r)})}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 n=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),t.on("unhandledRejection",n=>{let r=n instanceof Error?n:new Error(String(n));this.captureError(r,{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 n={};for(let[r,i]of Object.entries(e))n[r]=this.truncate(i,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",r=e.stack||"",i={type:"error",message:this.truncate(n,500),stackTrace:this.truncate(r,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 n={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(n)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});n.ok||console.error(`[DevInspector] Erro na API (${n.status}): ${n.statusText}`)}catch(n){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",n)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return o[a]||(o[a]=new c),o[a]},s=d();typeof window<"u"&&(window.DevInspector=s);var y=s;export{s as audit,y as default};
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},y=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p(e))!f.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=l(e,o))||r.enumerable});return t};var h=t=>y(a({},"__esModule",{value:!0}),t);var m={};g(m,{DevInspectorVue:()=>E,audit:()=>s});module.exports=h(m);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 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 i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{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,i]of Object.entries(e))r[o]=this.truncate(i,n);return r}return e}captureError(e,n={}){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({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",w=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[c]||(t[c]=new u),t[c]},s=w();var E={install(t,e){if(s.init(e),t.config&&t.config.errorHandler){let n=t.config.errorHandler;t.config.errorHandler=(r,o,i)=>{let d=r instanceof Error?r:new Error(String(r));s.captureError(d,{framework:"vue",vueInfo:i}),n&&n(r,o,i)}}else t.config&&(t.config.errorHandler=(n,r,o)=>{let i=n instanceof Error?n:new Error(String(n));s.captureError(i,{framework:"vue",vueInfo:o}),console.error(n)})}};0&&(module.exports={DevInspectorVue,audit});
1
+ "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},h=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p(e))!f.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=l(e,o))||r.enumerable});return t};var y=t=>h(a({},"__esModule",{value:!0}),t);var m={};g(m,{DevInspectorVue:()=>E,audit:()=>s});module.exports=y(m);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 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 i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{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,i]of Object.entries(e))r[o]=this.truncate(i,n);return r}return e}captureError(e,n={}){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({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",w=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[c]||(t[c]=new u),t[c]},s=w();var E={install(t,e){if(s.init(e),t.config&&t.config.errorHandler){let n=t.config.errorHandler;t.config.errorHandler=(r,o,i)=>{let d=r instanceof Error?r:new Error(String(r));s.captureError(d,{framework:"vue",vueInfo:i}),n&&n(r,o,i)}}else t.config&&(t.config.errorHandler=(n,r,o)=>{let i=n instanceof Error?n:new Error(String(n));s.captureError(i,{framework:"vue",vueInfo:o}),console.error(n)})}};0&&(module.exports={DevInspectorVue,audit});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcodleox/devinspector",
3
- "version": "2.2.0",
3
+ "version": "3.2.1",
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",