@xcodleox/devinspector 5.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 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});
1
+ "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var m=(n,e)=>{for(var t in e)u(n,t,{get:e[t],enumerable:!0})},g=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of y(e))!w.call(n,o)&&o!==t&&u(n,o,{get:()=>e[o],enumerable:!(r=h(e,o))||r.enumerable});return n};var E=n=>g(u({},"__esModule",{value:!0}),n);var M={};m(M,{audit:()=>i,auditFetch:()=>I,captureNextError:()=>f,initNextDevInspector:()=>v,withAuditAction:()=>D,withAuditApi:()=>_});module.exports=E(M);var p=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 s=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(s,{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,s]of Object.entries(e))r[o]=this.truncate(s,t);return r}return e}captureError(e,t={}){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({...t,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(s)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},d="__DEVINSPECT_AUDIT_CORE_INSTANCE__",b=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[d]||(n[d]=new p),n[d]},i=b();function v(n){i.init(n)}function f(n,e={}){let t=n instanceof Error?n:new Error(String(n));i.captureError(t,{framework:"nextjs",...e})}async function I(n,e){let t=typeof n=="string"?n:n instanceof URL?n.toString():n.url;if(t&&t.includes("devinspector.com.br"))return fetch(n,e);let r=e?.method||"GET",o=typeof performance<"u"?performance.now():Date.now();try{let s=await fetch(n,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);return(s.status>=400||a>=300)&&i.captureRequest({method:r,url:t,statusCode:s.status,durationMs:a,route:t}),s}catch(s){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);throw i.captureRequest({method:r,url:t,statusCode:0,durationMs:a,route:t}),i.captureException(s instanceof Error?s:new Error(String(s)),{url:t,method:r,type:"nextjs_network_error"}),s}}function _(n){return async function(...e){let t=typeof performance<"u"?performance.now():Date.now(),r=e[0],o=r?.method||"GET",s=r?.url||r?.nextUrl?.href||"/api";try{let a=await n(...e),c=Math.round((typeof performance<"u"?performance.now():Date.now())-t),l=a?.status||200;return i.captureRequest({method:o,url:s,statusCode:l,durationMs:c,route:s}),a}catch(a){let c=Math.round((typeof performance<"u"?performance.now():Date.now())-t);throw i.captureRequest({method:o,url:s,statusCode:500,durationMs:c,route:s}),f(a,{url:s,method:o,type:"api_route_error"}),a}}}function D(n,e){return(async(...t)=>{let r=typeof performance<"u"?performance.now():Date.now();try{let o=await e(...t),s=Math.round((typeof performance<"u"?performance.now():Date.now())-r);return i.captureRequest({method:"ACTION",url:n,statusCode:200,durationMs:s,route:n}),o}catch(o){let s=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw i.captureRequest({method:"ACTION",url:n,statusCode:500,durationMs:s,route:n}),f(o,{actionName:n,type:"server_action_error"}),o}})}0&&(module.exports={audit,auditFetch,captureNextError,initNextDevInspector,withAuditAction,withAuditApi});
package/dist/next.d.cts CHANGED
@@ -3,5 +3,8 @@ export { audit } from './index.cjs';
3
3
 
4
4
  declare function initNextDevInspector(options: InitOptions): void;
5
5
  declare function captureNextError(error: unknown, metadata?: Record<string, any>): void;
6
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
7
+ declare function withAuditApi(handler: Function): (...args: any[]) => Promise<any>;
8
+ declare function withAuditAction<T extends (...args: any[]) => Promise<any>>(actionName: string, action: T): T;
6
9
 
7
- export { InitOptions, captureNextError, initNextDevInspector };
10
+ export { InitOptions, auditFetch, captureNextError, initNextDevInspector, withAuditAction, withAuditApi };
package/dist/next.d.ts CHANGED
@@ -3,5 +3,8 @@ export { audit } from './index.js';
3
3
 
4
4
  declare function initNextDevInspector(options: InitOptions): void;
5
5
  declare function captureNextError(error: unknown, metadata?: Record<string, any>): void;
6
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
7
+ declare function withAuditApi(handler: Function): (...args: any[]) => Promise<any>;
8
+ declare function withAuditAction<T extends (...args: any[]) => Promise<any>>(actionName: string, action: T): T;
6
9
 
7
- export { InitOptions, captureNextError, initNextDevInspector };
10
+ export { InitOptions, auditFetch, captureNextError, initNextDevInspector, withAuditAction, withAuditApi };
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 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};
1
+ 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,s)=>{let o=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!s}),t&&t(r,s)})}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 s=r instanceof Error?r:new Error(String(r));this.captureError(s,{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[s,o]of Object.entries(e))r[s]=this.truncate(o,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",s=e.stack||"",o={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(s,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 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)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",l=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[u]||(n[u]=new d),n[u]},a=l();function m(n){a.init(n)}function p(n,e={}){let t=n instanceof Error?n:new Error(String(n));a.captureError(t,{framework:"nextjs",...e})}async function g(n,e){let t=typeof n=="string"?n:n instanceof URL?n.toString():n.url;if(t&&t.includes("devinspector.com.br"))return fetch(n,e);let r=e?.method||"GET",s=typeof performance<"u"?performance.now():Date.now();try{let o=await fetch(n,e),i=Math.round((typeof performance<"u"?performance.now():Date.now())-s);return(o.status>=400||i>=300)&&a.captureRequest({method:r,url:t,statusCode:o.status,durationMs:i,route:t}),o}catch(o){let i=Math.round((typeof performance<"u"?performance.now():Date.now())-s);throw a.captureRequest({method:r,url:t,statusCode:0,durationMs:i,route:t}),a.captureException(o instanceof Error?o:new Error(String(o)),{url:t,method:r,type:"nextjs_network_error"}),o}}function E(n){return async function(...e){let t=typeof performance<"u"?performance.now():Date.now(),r=e[0],s=r?.method||"GET",o=r?.url||r?.nextUrl?.href||"/api";try{let i=await n(...e),c=Math.round((typeof performance<"u"?performance.now():Date.now())-t),f=i?.status||200;return a.captureRequest({method:s,url:o,statusCode:f,durationMs:c,route:o}),i}catch(i){let c=Math.round((typeof performance<"u"?performance.now():Date.now())-t);throw a.captureRequest({method:s,url:o,statusCode:500,durationMs:c,route:o}),p(i,{url:o,method:s,type:"api_route_error"}),i}}}function b(n,e){return(async(...t)=>{let r=typeof performance<"u"?performance.now():Date.now();try{let s=await e(...t),o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);return a.captureRequest({method:"ACTION",url:n,statusCode:200,durationMs:o,route:n}),s}catch(s){let o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw a.captureRequest({method:"ACTION",url:n,statusCode:500,durationMs:o,route:n}),p(s,{actionName:n,type:"server_action_error"}),s}})}export{a as audit,g as auditFetch,p as captureNextError,m as initNextDevInspector,b as withAuditAction,E as withAuditApi};
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 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});
1
+ "use strict";var c=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},w=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!h.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(r=l(e,o))||r.enumerable});return n};var m=n=>w(c({},"__esModule",{value:!0}),n);var k={};y(k,{audit:()=>s,auditFetch:()=>b,auditHandle:()=>v,handleSvelteKitError:()=>I,initSvelteDevInspector:()=>E});module.exports=m(k);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)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[u]||(n[u]=new d),n[u]},s=g();function E(n){s.init(n)}async function b(n,e){let t=typeof n=="string"?n:n instanceof URL?n.toString():n.url;if(t&&t.includes("devinspector.com.br"))return fetch(n,e);let r=e?.method||"GET",o=typeof performance<"u"?performance.now():Date.now();try{let i=await fetch(n,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);return(i.status>=400||a>=300)&&s.captureRequest({method:r,url:t,statusCode:i.status,durationMs:a,route:t}),i}catch(i){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);throw s.captureRequest({method:r,url:t,statusCode:0,durationMs:a,route:t}),s.captureException(i instanceof Error?i:new Error(String(i)),{url:t,method:r,type:"svelte_network_error"}),i}}async function v({event:n,resolve:e}){let t=typeof performance<"u"?performance.now():Date.now(),r=n.request?.method||"GET",o=n.url?.pathname||n.url?.href||"/";try{let i=await e(n),a=Math.round((typeof performance<"u"?performance.now():Date.now())-t);return s.captureRequest({method:r,url:o,statusCode:i.status,durationMs:a,route:o}),i}catch(i){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-t);s.captureRequest({method:r,url:o,statusCode:500,durationMs:a,route:o});let p=i instanceof Error?i:new Error(String(i));throw s.captureError(p,{framework:"sveltekit",url:o,method:r}),i}}function I({error:n,event:e}){let t=n instanceof Error?n:new Error(String(n));s.captureError(t,{framework:"sveltekit",url:e?.url?.href||"",route:e?.route?.id||""})}0&&(module.exports={audit,auditFetch,auditHandle,handleSvelteKitError,initSvelteDevInspector});
package/dist/svelte.d.cts CHANGED
@@ -2,5 +2,8 @@ import { InitOptions } from './index.cjs';
2
2
  export { audit } from './index.cjs';
3
3
 
4
4
  declare function initSvelteDevInspector(options: InitOptions): void;
5
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
6
+ declare function auditHandle({ event, resolve }: any): Promise<any>;
7
+ declare function handleSvelteKitError({ error, event }: any): void;
5
8
 
6
- export { InitOptions, initSvelteDevInspector };
9
+ export { InitOptions, auditFetch, auditHandle, handleSvelteKitError, initSvelteDevInspector };
package/dist/svelte.d.ts CHANGED
@@ -2,5 +2,8 @@ import { InitOptions } from './index.js';
2
2
  export { audit } from './index.js';
3
3
 
4
4
  declare function initSvelteDevInspector(options: InitOptions): void;
5
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
6
+ declare function auditHandle({ event, resolve }: any): Promise<any>;
7
+ declare function handleSvelteKitError({ error, event }: any): void;
5
8
 
6
- export { InitOptions, initSvelteDevInspector };
9
+ export { InitOptions, auditFetch, auditHandle, handleSvelteKitError, initSvelteDevInspector };
package/dist/svelte.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,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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return i[s]||(i[s]=new a),i[s]},c=d();function h(i){c.init(i)}export{c as audit,h as initSvelteDevInspector};
1
+ var u=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1;this.listenersAttached=!1}init(e){if(!e.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=e.apiKey,e.endpoint&&(this.endpoint=e.endpoint),e.environment&&(this.environment=e.environment),this.initialized=!0,this.listenGlobalErrors()}captureRequest(e){let t={type:"request_metric",method:e.method,url:e.url,statusCode:e.statusCode,durationMs:e.durationMs,browser:e.userAgent||"",metadata:{environment:this.environment,timestamp:new Date().toISOString(),route:e.route||e.url,dbQueriesCount:e.dbQueriesCount||0,slowQueryMs:e.slowQueryMs||0}};this.send(t)}listenGlobalErrors(){if(this.listenersAttached)return;this.listenersAttached=!0;let e=globalThis;if(e.ErrorUtils&&typeof e.ErrorUtils.setGlobalHandler=="function"){let t=e.ErrorUtils.getGlobalHandler();e.ErrorUtils.setGlobalHandler((r,i)=>{let o=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(o,{type:"react_native_error",isFatal:!!i}),t&&t(r,i)})}else if(typeof window<"u"&&window.addEventListener)window.addEventListener("error",t=>{this.captureError(t.error||new Error(t.message||"Erro global desconhecido"),{filename:t.filename,lineno:t.lineno,colno:t.colno})}),window.addEventListener("unhandledrejection",t=>{let r=t.reason instanceof Error?t.reason:new Error(String(t.reason));this.captureError(r,{type:"unhandled_rejection"})});else if(e.process?.on){let t=e.process;t.on("uncaughtException",r=>{this.captureError(r,{type:"uncaught_exception"})}),t.on("unhandledRejection",r=>{let i=r instanceof Error?r:new Error(String(r));this.captureError(i,{type:"unhandled_rejection"})})}}truncate(e,t=5e3){if(typeof e=="string")return e.length>t?e.substring(0,t)+"... [truncated]":e;if(e&&typeof e=="object"&&e!==null){let r={};for(let[i,o]of Object.entries(e))r[i]=this.truncate(o,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(e,t={}){this.captureError(e,t)}captureMessage(e,t={}){let r={type:"message",message:this.truncate(e,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...t,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(e){let t=this.apiKey&&this.apiKey!=="PENDING_API_KEY"?this.apiKey:"dev-fallback-key";try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify(e),keepalive:!0});r.ok||console.error(`[DevInspector] Erro na API (${r.status}): ${r.statusText}`)}catch(r){console.error("[DevInspector] Falha ao enviar requisi\xE7\xE3o para o painel:",r)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[c]||(n[c]=new u),n[c]},s=p();function y(n){s.init(n)}async function w(n,e){let t=typeof n=="string"?n:n instanceof URL?n.toString():n.url;if(t&&t.includes("devinspector.com.br"))return fetch(n,e);let r=e?.method||"GET",i=typeof performance<"u"?performance.now():Date.now();try{let o=await fetch(n,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);return(o.status>=400||a>=300)&&s.captureRequest({method:r,url:t,statusCode:o.status,durationMs:a,route:t}),o}catch(o){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);throw s.captureRequest({method:r,url:t,statusCode:0,durationMs:a,route:t}),s.captureException(o instanceof Error?o:new Error(String(o)),{url:t,method:r,type:"svelte_network_error"}),o}}async function m({event:n,resolve:e}){let t=typeof performance<"u"?performance.now():Date.now(),r=n.request?.method||"GET",i=n.url?.pathname||n.url?.href||"/";try{let o=await e(n),a=Math.round((typeof performance<"u"?performance.now():Date.now())-t);return s.captureRequest({method:r,url:i,statusCode:o.status,durationMs:a,route:i}),o}catch(o){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-t);s.captureRequest({method:r,url:i,statusCode:500,durationMs:a,route:i});let d=o instanceof Error?o:new Error(String(o));throw s.captureError(d,{framework:"sveltekit",url:i,method:r}),o}}function g({error:n,event:e}){let t=n instanceof Error?n:new Error(String(n));s.captureError(t,{framework:"sveltekit",url:e?.url?.href||"",route:e?.route?.id||""})}export{s as audit,w as auditFetch,m as auditHandle,g as handleSvelteKitError,y as 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})},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
+ "use strict";var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var t in e)d(r,t,{get:e[t],enumerable:!0})},b=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!E.call(r,o)&&o!==t&&d(r,o,{get:()=>e[o],enumerable:!(n=y(e,o))||n.enumerable});return r};var v=r=>b(d({},"__esModule",{value:!0}),r);var R={};m(R,{audit:()=>i,auditFetch:()=>l,default:()=>I,enableNetworkTracing:()=>w});module.exports=v(R);var p=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,o)=>{let s=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(s,{type:"react_native_error",isFatal:!!o}),t&&t(n,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 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 o=n instanceof Error?n:new Error(String(n));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 n={};for(let[o,s]of Object.entries(e))n[o]=this.truncate(s,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",o=e.stack||"",s={type:"error",message:this.truncate(n,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(s)}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)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",_=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[u]||(r[u]=new p),r[u]},i=_();var h=null;async function l(r,e,t){let n=t||h||(typeof window<"u"?window.fetch:fetch),o=typeof r=="string"?r:r instanceof URL?r.toString():r.url;if(o&&o.includes("devinspector.com.br"))return n(r,e);let s=e?.method||"GET",f=typeof performance<"u"?performance.now():Date.now();try{let a=await n(r,e),c=Math.round((typeof performance<"u"?performance.now():Date.now())-f);return(a.status>=400||c>=300)&&i.captureRequest({method:s,url:o,statusCode:a.status,durationMs:c,route:o}),a}catch(a){let c=Math.round((typeof performance<"u"?performance.now():Date.now())-f);throw i.captureRequest({method:s,url:o,statusCode:0,durationMs:c,route:o}),i.captureException(a instanceof Error?a:new Error(String(a)),{url:o,method:s,type:"vanilla_network_error"}),a}}function w(){if(typeof window>"u"||!window.fetch)return;let r=window;if(r.__DEVINSPECTOR_FETCH_PATCHED__)return;let e=window.fetch.bind(window);h=e,r.__DEVINSPECTOR_FETCH_PATCHED__=!0,r.fetch=async function(...t){let[n,o]=t;return l(n,o,e)}}typeof window<"u"&&(window.DevInspector={init:r=>i.init(r),captureError:(r,e)=>i.captureError(r,e),captureException:(r,e)=>i.captureException(r,e),captureMessage:(r,e)=>i.captureMessage(r,e),auditFetch:l,enableNetworkTracing:w,core:i});var I=i;0&&(module.exports={audit,auditFetch,enableNetworkTracing});
@@ -1,6 +1,7 @@
1
1
  import { audit } from './index.cjs';
2
2
  export { InitOptions } from './index.cjs';
3
3
 
4
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit, fetchImpl?: typeof fetch): Promise<Response>;
5
+ declare function enableNetworkTracing(): void;
4
6
 
5
-
6
- export { audit, audit as default };
7
+ export { audit, auditFetch, audit as default, enableNetworkTracing };
package/dist/vanilla.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { audit } from './index.js';
2
2
  export { InitOptions } from './index.js';
3
3
 
4
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit, fetchImpl?: typeof fetch): Promise<Response>;
5
+ declare function enableNetworkTracing(): void;
4
6
 
5
-
6
- export { audit, audit as default };
7
+ export { audit, auditFetch, audit as default, enableNetworkTracing };
@@ -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})},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);})();
1
+ "use strict";var DevInspector=(()=>{var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var t in e)d(r,t,{get:e[t],enumerable:!0})},b=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!E.call(r,o)&&o!==t&&d(r,o,{get:()=>e[o],enumerable:!(n=y(e,o))||n.enumerable});return r};var v=r=>b(d({},"__esModule",{value:!0}),r);var R={};m(R,{audit:()=>i,auditFetch:()=>l,default:()=>I,enableNetworkTracing:()=>w});var p=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,o)=>{let s=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(s,{type:"react_native_error",isFatal:!!o}),t&&t(n,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 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 o=n instanceof Error?n:new Error(String(n));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 n={};for(let[o,s]of Object.entries(e))n[o]=this.truncate(s,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",o=e.stack||"",s={type:"error",message:this.truncate(n,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(s)}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)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",_=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[u]||(r[u]=new p),r[u]},i=_();var h=null;async function l(r,e,t){let n=t||h||(typeof window<"u"?window.fetch:fetch),o=typeof r=="string"?r:r instanceof URL?r.toString():r.url;if(o&&o.includes("devinspector.com.br"))return n(r,e);let s=e?.method||"GET",f=typeof performance<"u"?performance.now():Date.now();try{let a=await n(r,e),c=Math.round((typeof performance<"u"?performance.now():Date.now())-f);return(a.status>=400||c>=300)&&i.captureRequest({method:s,url:o,statusCode:a.status,durationMs:c,route:o}),a}catch(a){let c=Math.round((typeof performance<"u"?performance.now():Date.now())-f);throw i.captureRequest({method:s,url:o,statusCode:0,durationMs:c,route:o}),i.captureException(a instanceof Error?a:new Error(String(a)),{url:o,method:s,type:"vanilla_network_error"}),a}}function w(){if(typeof window>"u"||!window.fetch)return;let r=window;if(r.__DEVINSPECTOR_FETCH_PATCHED__)return;let e=window.fetch.bind(window);h=e,r.__DEVINSPECTOR_FETCH_PATCHED__=!0,r.fetch=async function(...t){let[n,o]=t;return l(n,o,e)}}typeof window<"u"&&(window.DevInspector={init:r=>i.init(r),captureError:(r,e)=>i.captureError(r,e),captureException:(r,e)=>i.captureException(r,e),captureMessage:(r,e)=>i.captureMessage(r,e),auditFetch:l,enableNetworkTracing:w,core:i});var I=i;return v(R);})();
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 y=s;export{s as audit,y as default};
1
+ 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,o)=>{let s=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(s,{type:"react_native_error",isFatal:!!o}),t&&t(n,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 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 o=n instanceof Error?n:new Error(String(n));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 n={};for(let[o,s]of Object.entries(e))n[o]=this.truncate(s,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",o=e.stack||"",s={type:"error",message:this.truncate(n,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(s)}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)}}},d="__DEVINSPECT_AUDIT_CORE_INSTANCE__",h=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[d]||(r[d]=new u),r[d]},i=h();var l=null;async function f(r,e,t){let n=t||l||(typeof window<"u"?window.fetch:fetch),o=typeof r=="string"?r:r instanceof URL?r.toString():r.url;if(o&&o.includes("devinspector.com.br"))return n(r,e);let s=e?.method||"GET",p=typeof performance<"u"?performance.now():Date.now();try{let a=await n(r,e),c=Math.round((typeof performance<"u"?performance.now():Date.now())-p);return(a.status>=400||c>=300)&&i.captureRequest({method:s,url:o,statusCode:a.status,durationMs:c,route:o}),a}catch(a){let c=Math.round((typeof performance<"u"?performance.now():Date.now())-p);throw i.captureRequest({method:s,url:o,statusCode:0,durationMs:c,route:o}),i.captureException(a instanceof Error?a:new Error(String(a)),{url:o,method:s,type:"vanilla_network_error"}),a}}function w(){if(typeof window>"u"||!window.fetch)return;let r=window;if(r.__DEVINSPECTOR_FETCH_PATCHED__)return;let e=window.fetch.bind(window);l=e,r.__DEVINSPECTOR_FETCH_PATCHED__=!0,r.fetch=async function(...t){let[n,o]=t;return f(n,o,e)}}typeof window<"u"&&(window.DevInspector={init:r=>i.init(r),captureError:(r,e)=>i.captureError(r,e),captureException:(r,e)=>i.captureException(r,e),captureMessage:(r,e)=>i.captureMessage(r,e),auditFetch:f,enableNetworkTracing:w,core:i});var m=i;export{i as audit,f as auditFetch,m as default,w as enableNetworkTracing};
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})},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});
1
+ "use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},g=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!f.call(t,o)&&o!==r&&c(t,o,{get:()=>e[o],enumerable:!(n=p(e,o))||n.enumerable});return t};var y=t=>g(c({},"__esModule",{value:!0}),t);var b={};h(b,{DevInspectorVue:()=>E,audit:()=>s,auditFetch:()=>m});module.exports=y(b);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 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((n,o)=>{let i=n instanceof Error?n:new Error(String(n?.message||n||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!o}),r&&r(n,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 n=r.reason instanceof Error?r.reason:new Error(String(r.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let r=e.process;r.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),r.on("unhandledRejection",n=>{let o=n instanceof Error?n:new Error(String(n));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 n={};for(let[o,i]of Object.entries(e))n[o]=this.truncate(i,r);return n}return e}captureError(e,r={}){let n=e.message||"Erro Desconhecido",o=e.stack||"",i={type:"error",message:this.truncate(n,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 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({...r,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(n)}async send(e){let r=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":r},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)}}},u="__DEVINSPECT_AUDIT_CORE_INSTANCE__",w=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[u]||(t[u]=new d),t[u]},s=w();async function m(t,e){let r=typeof t=="string"?t:t instanceof URL?t.toString():t.url;if(r&&r.includes("devinspector.com.br"))return fetch(t,e);let n=e?.method||"GET",o=typeof performance<"u"?performance.now():Date.now();try{let i=await fetch(t,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);return(i.status>=400||a>=300)&&s.captureRequest({method:n,url:r,statusCode:i.status,durationMs:a,route:r}),i}catch(i){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-o);throw s.captureRequest({method:n,url:r,statusCode:0,durationMs:a,route:r}),s.captureException(i instanceof Error?i:new Error(String(i)),{url:r,method:n,type:"vue_network_error"}),i}}var E={install(t,e){if(s.init(e),t.config&&t.config.errorHandler){let r=t.config.errorHandler;t.config.errorHandler=(n,o,i)=>{let a=n instanceof Error?n:new Error(String(n));s.captureError(a,{framework:"vue",vueInfo:i}),r&&r(n,o,i)}}else t.config&&(t.config.errorHandler=(r,n,o)=>{let i=r instanceof Error?r:new Error(String(r));s.captureError(i,{framework:"vue",vueInfo:o}),console.error(r)})}};0&&(module.exports={DevInspectorVue,audit,auditFetch});
package/dist/vue.d.cts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { InitOptions } from './index.cjs';
2
2
  export { audit } from './index.cjs';
3
3
 
4
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
4
5
  declare const DevInspectorVue: {
5
6
  install(app: any, options: InitOptions): void;
6
7
  };
7
8
 
8
- export { DevInspectorVue, InitOptions };
9
+ export { DevInspectorVue, InitOptions, auditFetch };
package/dist/vue.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { InitOptions } from './index.js';
2
2
  export { audit } from './index.js';
3
3
 
4
+ declare function auditFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
4
5
  declare const DevInspectorVue: {
5
6
  install(app: any, options: InitOptions): void;
6
7
  };
7
8
 
8
- export { DevInspectorVue, InitOptions };
9
+ export { DevInspectorVue, InitOptions, auditFetch };
package/dist/vue.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 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,t)=>{let i=r instanceof Error?r:new Error(String(r?.message||r||"Erro React Native desconhecido"));this.captureError(i,{type:"react_native_error",isFatal:!!t}),n&&n(r,t)})}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 t=r instanceof Error?r:new Error(String(r));this.captureError(t,{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[t,i]of Object.entries(e))r[t]=this.truncate(i,n);return r}return e}captureError(e,n={}){let r=e.message||"Erro Desconhecido",t=e.stack||"",i={type:"error",message:this.truncate(r,500),stackTrace:this.truncate(t,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)}}},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();var g={install(o,e){if(s.init(e),o.config&&o.config.errorHandler){let n=o.config.errorHandler;o.config.errorHandler=(r,t,i)=>{let u=r instanceof Error?r:new Error(String(r));s.captureError(u,{framework:"vue",vueInfo:i}),n&&n(r,t,i)}}else o.config&&(o.config.errorHandler=(n,r,t)=>{let i=n instanceof Error?n:new Error(String(n));s.captureError(i,{framework:"vue",vueInfo:t}),console.error(n)})}};export{g as DevInspectorVue,s as audit};
1
+ 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 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((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}),r&&r(n,i)})}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 n=r.reason instanceof Error?r.reason:new Error(String(r.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(e.process?.on){let r=e.process;r.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),r.on("unhandledRejection",n=>{let i=n instanceof Error?n:new Error(String(n));this.captureError(i,{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 n={};for(let[i,o]of Object.entries(e))n[i]=this.truncate(o,r);return n}return e}captureError(e,r={}){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({...r,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(e,r={}){this.captureError(e,r)}captureMessage(e,r={}){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({...r,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(n)}async send(e){let r=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":r},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__",d=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[c]||(t[c]=new u),t[c]},s=d();async function h(t,e){let r=typeof t=="string"?t:t instanceof URL?t.toString():t.url;if(r&&r.includes("devinspector.com.br"))return fetch(t,e);let n=e?.method||"GET",i=typeof performance<"u"?performance.now():Date.now();try{let o=await fetch(t,e),a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);return(o.status>=400||a>=300)&&s.captureRequest({method:n,url:r,statusCode:o.status,durationMs:a,route:r}),o}catch(o){let a=Math.round((typeof performance<"u"?performance.now():Date.now())-i);throw s.captureRequest({method:n,url:r,statusCode:0,durationMs:a,route:r}),s.captureException(o instanceof Error?o:new Error(String(o)),{url:r,method:n,type:"vue_network_error"}),o}}var g={install(t,e){if(s.init(e),t.config&&t.config.errorHandler){let r=t.config.errorHandler;t.config.errorHandler=(n,i,o)=>{let a=n instanceof Error?n:new Error(String(n));s.captureError(a,{framework:"vue",vueInfo:o}),r&&r(n,i,o)}}else t.config&&(t.config.errorHandler=(r,n,i)=>{let o=r instanceof Error?r:new Error(String(r));s.captureError(o,{framework:"vue",vueInfo:i}),console.error(r)})}};export{g as DevInspectorVue,s as audit,h as auditFetch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcodleox/devinspector",
3
- "version": "5.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "SDK de monitoramento e auditoria de erros em tempo real | Dev Inspector",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",