@xcodleox/devinspector 1.0.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/angular.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,n)=>{for(var e in n)a(t,e,{get:n[e],enumerable:!0})},y=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!f.call(t,i)&&i!==e&&a(t,i,{get:()=>n[i],enumerable:!(r=l(n,i))||r.enumerable});return t};var g=t=>y(a({},"__esModule",{value:!0}),t);var E={};h(E,{AuditAngularErrorHandler:()=>p});module.exports=g(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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));this.captureError(r,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let r={};for(let[i,o]of Object.entries(n))r[i]=this.truncate(o,e);return r}return n}captureError(n,e={}){let r=n.message||"Erro Desconhecido",i=n.stack||"",o={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let r={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(n){let e=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":e},body:JSON.stringify(n),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__",w=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[s]||(t[s]=new c),t[s]},d=w();var p=class{handleError(n){let e=n instanceof Error?n:new Error(String(n));d.captureError(e,{framework:"Angular"}),console.error(n)}};0&&(module.exports={AuditAngularErrorHandler});
1
+ "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},g=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!h.call(r,i)&&i!==t&&s(r,i,{get:()=>e[i],enumerable:!(n=u(e,i))||n.enumerable});return r};var y=r=>g(s({},"__esModule",{value:!0}),r);var w={};f(w,{AuditAngularErrorHandler:()=>p});module.exports=y(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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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__",m=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},d=m();var p=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});
package/dist/angular.js CHANGED
@@ -1 +1 @@
1
- var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));this.captureError(r,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let r={};for(let[i,o]of Object.entries(n))r[i]=this.truncate(o,e);return r}return n}captureError(n,e={}){let r=n.message||"Erro Desconhecido",i=n.stack||"",o={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let r={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(n){let e=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":e},body:JSON.stringify(n),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__",p=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[a]||(t[a]=new s),t[a]},c=p();var d=class{handleError(n){let e=n instanceof Error?n:new Error(String(n));c.captureError(e,{framework:"Angular"}),console.error(n)}};export{d as AuditAngularErrorHandler};
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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},c=p();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};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,n)=>{for(var e in n)a(r,e,{get:n[e],enumerable:!0})},h=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(r,i)&&i!==e&&a(r,i,{get:()=>n[i],enumerable:!(t=p(n,i))||t.enumerable});return r};var y=r=>h(a({},"__esModule",{value:!0}),r);var w={};f(w,{audit:()=>d});module.exports=y(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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new c),r[s]},d=g();0&&(module.exports={audit});
1
+ "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=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 u(e))!l.call(r,i)&&i!==t&&s(r,i,{get:()=>e[i],enumerable:!(n=p(e,i))||n.enumerable});return r};var f=r=>y(s({},"__esModule",{value:!0}),r);var m={};h(m,{audit:()=>d});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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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();0&&(module.exports={audit});
package/dist/index.d.cts CHANGED
@@ -3,12 +3,21 @@ interface InitOptions {
3
3
  endpoint?: string;
4
4
  environment?: string;
5
5
  }
6
+ interface RequestMetricData {
7
+ method: string;
8
+ url: string;
9
+ statusCode: number;
10
+ durationMs: number;
11
+ userAgent?: string;
12
+ }
6
13
  declare class AuditCore {
7
14
  private apiKey;
8
15
  private endpoint;
9
16
  private environment;
10
17
  initialized: boolean;
18
+ private listenersAttached;
11
19
  init(options: InitOptions): void;
20
+ captureRequest(data: RequestMetricData): void;
12
21
  private listenGlobalErrors;
13
22
  private truncate;
14
23
  captureError(error: Error, metadata?: Record<string, any>): void;
package/dist/index.d.ts CHANGED
@@ -3,12 +3,21 @@ interface InitOptions {
3
3
  endpoint?: string;
4
4
  environment?: string;
5
5
  }
6
+ interface RequestMetricData {
7
+ method: string;
8
+ url: string;
9
+ statusCode: number;
10
+ durationMs: number;
11
+ userAgent?: string;
12
+ }
6
13
  declare class AuditCore {
7
14
  private apiKey;
8
15
  private endpoint;
9
16
  private environment;
10
17
  initialized: boolean;
18
+ private listenersAttached;
11
19
  init(options: InitOptions): void;
20
+ captureRequest(data: RequestMetricData): void;
12
21
  private listenGlobalErrors;
13
22
  private truncate;
14
23
  captureError(error: Error, metadata?: Record<string, any>): void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",c=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new s),r[a]},d=c();export{d as audit};
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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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__",c=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},d=c();export{d as audit};
package/dist/next.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(t,n)=>{for(var e in n)s(t,e,{get:n[e],enumerable:!0})},y=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(t,i)&&i!==e&&s(t,i,{get:()=>n[i],enumerable:!(r=d(n,i))||r.enumerable});return t};var h=t=>y(s({},"__esModule",{value:!0}),t);var b={};f(b,{audit:()=>o,captureNextError:()=>E,initNextDevInspector:()=>w});module.exports=h(b);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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));this.captureError(r,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let r={};for(let[i,a]of Object.entries(n))r[i]=this.truncate(a,e);return r}return n}captureError(n,e={}){let r=n.message||"Erro Desconhecido",i=n.stack||"",a={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(a)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let r={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(n){let e=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":e},body:JSON.stringify(n),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__",g=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[c]||(t[c]=new p),t[c]},o=g();function w(t){o.init(t)}function E(t,n={}){let e=t instanceof Error?t:new Error(String(t));o.captureError(e,{framework:"nextjs",...n})}0&&(module.exports={audit,captureNextError,initNextDevInspector});
1
+ "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var t in e)a(n,t,{get:e[t],enumerable:!0})},f=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u(e))!l.call(n,i)&&i!==t&&a(n,i,{get:()=>e[i],enumerable:!(r=d(e,i))||r.enumerable});return n};var g=n=>f(a({},"__esModule",{value:!0}),n);var E={};h(E,{audit:()=>o,captureNextError:()=>m,initNextDevInspector:()=>w});module.exports=g(E);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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let r=t instanceof Error?t:new Error(String(t));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 r={};for(let[i,s]of Object.entries(e))r[i]=this.truncate(s,t);return r}return e}captureError(e,t={}){let r=e.message||"Erro Desconhecido",i=e.stack||"",s={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(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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",y=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[c]||(n[c]=new p),n[c]},o=y();function w(n){o.init(n)}function m(n,e={}){let t=n instanceof Error?n:new Error(String(n));o.captureError(t,{framework:"nextjs",...e})}0&&(module.exports={audit,captureNextError,initNextDevInspector});
package/dist/next.js CHANGED
@@ -1 +1 @@
1
- var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new s),r[a]},c=p();function f(r){c.init(r)}function y(r,n={}){let e=r instanceof Error?r:new Error(String(r));c.captureError(e,{framework:"nextjs",...n})}export{c as audit,y 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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},c=p();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 a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(r,n)=>{for(var e in n)a(r,e,{get:n[e],enumerable:!0})},f=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(r,i)&&i!==e&&a(r,i,{get:()=>n[i],enumerable:!(t=p(n,i))||t.enumerable});return r};var h=r=>f(a({},"__esModule",{value:!0}),r);var m={};y(m,{devInspector:()=>E,devInspectorErrorHandler:()=>w});module.exports=h(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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new c),r[s]},d=g();function w(){return(r,n,e,t)=>{r&&d.captureException(r,{url:n.originalUrl||n.url,method:n.method,headers:n.headers}),t(r)}}function E(r){return d.init(r),(n,e,t)=>{t()}}0&&(module.exports={devInspector,devInspectorErrorHandler});
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var h=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!l.call(r,o)&&o!==t&&a(r,o,{get:()=>e[o],enumerable:!(n=p(e,o))||n.enumerable});return r};var f=r=>y(a({},"__esModule",{value:!0}),r);var E={};h(E,{devInspector:()=>m,devInspectorErrorHandler:()=>w});module.exports=f(E);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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 n={};for(let[o,i]of Object.entries(e))n[o]=this.truncate(i,t);return n}return e}captureError(e,t={}){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({...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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new d),r[c]},s=g();function m(r){return s.init(r),(e,t,n)=>{let o=performance.now();t.on("finish",()=>{let i=Math.round(performance.now()-o);s.captureRequest({method:e.method,url:e.originalUrl||e.url,statusCode:t.statusCode,durationMs:i,userAgent:e.headers["user-agent"]})}),n()}}function w(){return(r,e,t,n)=>{s.captureException(r,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),n(r)}}0&&(module.exports={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 devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
6
5
  declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => void;
6
+ declare function devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
7
7
 
8
8
  export { type DevInspectorNodeOptions, devInspector, devInspectorErrorHandler };
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 devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
6
5
  declare function devInspector(options: DevInspectorNodeOptions): (req: any, res: any, next: any) => void;
6
+ declare function devInspectorErrorHandler(): (err: any, req: any, res: any, next: any) => void;
7
7
 
8
8
  export { type DevInspectorNodeOptions, devInspector, devInspectorErrorHandler };
package/dist/node.js CHANGED
@@ -1 +1 @@
1
- var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new s),r[a]},c=d();function l(){return(r,n,e,t)=>{r&&c.captureException(r,{url:n.originalUrl||n.url,method:n.method,headers:n.headers}),t(r)}}function y(r){return c.init(r),(n,e,t)=>{t()}}export{y as devInspector,l as devInspectorErrorHandler};
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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 n={};for(let[o,i]of Object.entries(e))n[o]=this.truncate(i,t);return n}return e}captureError(e,t={}){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({...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 r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},s=d();function l(r){return s.init(r),(e,t,n)=>{let o=performance.now();t.on("finish",()=>{let i=Math.round(performance.now()-o);s.captureRequest({method:e.method,url:e.originalUrl||e.url,statusCode:t.statusCode,durationMs:i,userAgent:e.headers["user-agent"]})}),n()}}function h(){return(r,e,t,n)=>{s.captureException(r,{url:e.originalUrl||e.url,method:e.method,headers:e.headers}),n(r)}}export{l as devInspector,h as devInspectorErrorHandler};
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(r,e)=>{for(var n in e)a(r,n,{get:e[n],enumerable:!0})},E=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!g.call(r,o)&&o!==n&&a(r,o,{get:()=>e[o],enumerable:!(t=h(e,o))||t.enumerable});return r};var w=r=>E(a({},"__esModule",{value:!0}),r);var m={};y(m,{AuditErrorBoundary:()=>p});module.exports=w(m);var l=require("react");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}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()}listenGlobalErrors(){if(typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let n=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),e.on("unhandledRejection",n=>{let t=n instanceof Error?n:new Error(String(n));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 t={};for(let[o,i]of Object.entries(e))t[o]=this.truncate(i,n);return t}return e}captureError(e,n={}){let t=e.message||"Erro Desconhecido",o=e.stack||"",i={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({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){let t={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(t)}async send(e){let n=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":n},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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",b=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new c),r[s]},d=b();var u=require("react/jsx-runtime"),p=class extends l.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,t){d.captureError(n,{componentStack:t.componentStack})}render(){return this.state.hasError?this.props.fallback||(0,u.jsx)("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};0&&(module.exports={AuditErrorBoundary});
1
+ "use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)a(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))!g.call(n,o)&&o!==t&&a(n,o,{get:()=>e[o],enumerable:!(r=h(e,o))||r.enumerable});return n};var E=n=>m(a({},"__esModule",{value:!0}),n);var w={};y(w,{AuditErrorBoundary:()=>d});module.exports=E(w);var u=require("react");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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let r=t instanceof Error?t:new Error(String(t));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 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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",b=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[s]||(n[s]=new c),n[s]},p=b();var l=require("react/jsx-runtime"),d=class extends u.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){p.captureError(t,{componentStack:r.componentStack})}render(){return this.state.hasError?this.props.fallback||(0,l.jsx)("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};0&&(module.exports={AuditErrorBoundary});
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{Component as l}from"react";var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!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()}listenGlobalErrors(){if(typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let n=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),e.on("unhandledRejection",n=>{let t=n instanceof Error?n:new Error(String(n));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 t={};for(let[o,i]of Object.entries(e))t[o]=this.truncate(i,n);return t}return e}captureError(e,n={}){let t=e.message||"Erro Desconhecido",o=e.stack||"",i={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({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){let t={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(t)}async send(e){let n=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":n},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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new s),r[a]},c=d();import{jsx as u}from"react/jsx-runtime";var p=class extends l{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,t){c.captureError(n,{componentStack:t.componentStack})}render(){return this.state.hasError?this.props.fallback||u("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};export{p as AuditErrorBoundary};
1
+ import{Component as u}from"react";var s=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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let r=t instanceof Error?t:new Error(String(t));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 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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return n[a]||(n[a]=new s),n[a]},c=p();import{jsx as l}from"react/jsx-runtime";var d=class extends u{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){c.captureError(t,{componentStack:r.componentStack})}render(){return this.state.hasError?this.props.fallback||l("h1",{children:"Algo deu errado na aplica\xE7\xE3o."}):this.props.children}};export{d as AuditErrorBoundary};
package/dist/svelte.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,n)=>{for(var e in n)a(r,e,{get:n[e],enumerable:!0})},h=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(r,i)&&i!==e&&a(r,i,{get:()=>n[i],enumerable:!(t=d(n,i))||t.enumerable});return r};var y=r=>h(a({},"__esModule",{value:!0}),r);var E={};f(E,{audit:()=>p,initSvelteDevInspector:()=>w});module.exports=y(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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new c),r[s]},p=g();function w(r){p.init(r)}0&&(module.exports={audit,initSvelteDevInspector});
1
+ "use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=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 u(e))!l.call(r,i)&&i!==t&&s(r,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return r};var f=r=>y(s({},"__esModule",{value:!0}),r);var w={};h(w,{audit:()=>p,initSvelteDevInspector:()=>m});module.exports=f(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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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]},p=g();function m(r){p.init(r)}0&&(module.exports={audit,initSvelteDevInspector});
package/dist/svelte.js CHANGED
@@ -1 +1 @@
1
- var s=class{constructor(){this.apiKey="PENDING_API_KEY";this.endpoint="https://api.devinspector.com.br/api/ingest/track";this.environment="production";this.initialized=!1}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,o]of Object.entries(n))t[i]=this.truncate(o,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",o={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new s),r[a]},c=p();function f(r){c.init(r)}export{c as audit,f as initSvelteDevInspector};
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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new a),r[s]},c=p();function h(r){c.init(r)}export{c as audit,h as initSvelteDevInspector};
package/dist/vanilla.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,n)=>{for(var e in n)s(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(r,i)&&i!==e&&s(r,i,{get:()=>n[i],enumerable:!(t=d(n,i))||t.enumerable});return r};var h=r=>y(s({},"__esModule",{value:!0}),r);var E={};f(E,{audit:()=>o,default:()=>w});module.exports=h(E);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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,a]of Object.entries(n))t[i]=this.truncate(a,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",a={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(a)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new p),r[c]},o=g();typeof window<"u"&&(window.DevInspector=o);var w=o;0&&(module.exports={audit});
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=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 u(e))!l.call(r,i)&&i!==t&&a(r,i,{get:()=>e[i],enumerable:!(n=p(e,i))||n.enumerable});return r};var y=r=>f(a({},"__esModule",{value:!0}),r);var m={};h(m,{audit:()=>o,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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 n={};for(let[i,s]of Object.entries(e))n[i]=this.truncate(s,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",s={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(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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new d),r[c]},o=g();typeof window<"u"&&(window.DevInspector=o);var w=o;0&&(module.exports={audit});
@@ -0,0 +1 @@
1
+ "use strict";var DevInspector=(()=>{var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=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 u(e))!l.call(r,i)&&i!==t&&a(r,i,{get:()=>e[i],enumerable:!(n=p(e,i))||n.enumerable});return r};var y=r=>f(a({},"__esModule",{value:!0}),r);var m={};h(m,{audit:()=>o,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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 n={};for(let[i,s]of Object.entries(e))n[i]=this.truncate(s,t);return n}return e}captureError(e,t={}){let n=e.message||"Erro Desconhecido",i=e.stack||"",s={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(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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new d),r[c]},o=g();typeof window<"u"&&(window.DevInspector=o);var w=o;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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[o,a]of Object.entries(n))t[o]=this.truncate(a,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",o=n.stack||"",a={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(a)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},s="__DEVINSPECT_AUDIT_CORE_INSTANCE__",p=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[s]||(r[s]=new c),r[s]},i=p();typeof window<"u"&&(window.DevInspector=i);var h=i;export{i 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()}};this.send(t)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(t,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",t=>{this.captureError(t,{type:"uncaught_exception"})}),e.on("unhandledRejection",t=>{let n=t instanceof Error?t:new Error(String(t));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 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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",d=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},i=d();typeof window<"u"&&(window.DevInspector=i);var y=i;export{i as audit,y as default};
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(t,n)=>{for(var e in n)s(t,e,{get:n[e],enumerable:!0})},y=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of l(n))!f.call(t,o)&&o!==e&&s(t,o,{get:()=>n[o],enumerable:!(r=u(n,o))||r.enumerable});return t};var h=t=>y(s({},"__esModule",{value:!0}),t);var b={};g(b,{DevInspectorVue:()=>E,audit:()=>a});module.exports=h(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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));this.captureError(r,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let r={};for(let[o,i]of Object.entries(n))r[o]=this.truncate(i,e);return r}return n}captureError(n,e={}){let r=n.message||"Erro Desconhecido",o=n.stack||"",i={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let r={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(n){let e=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":e},body:JSON.stringify(n),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 d),t[c]},a=w();var E={install(t,n){if(a.init(n),t.config&&t.config.errorHandler){let e=t.config.errorHandler;t.config.errorHandler=(r,o,i)=>{let p=r instanceof Error?r:new Error(String(r));a.captureError(p,{framework:"vue",vueInfo:i}),e&&e(r,o,i)}}else t.config&&(t.config.errorHandler=(e,r,o)=>{let i=e instanceof Error?e:new Error(String(e));a.captureError(i,{framework:"vue",vueInfo:o}),console.error(e)})}};0&&(module.exports={DevInspectorVue,audit});
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(r,e)=>{for(var n in e)a(r,n,{get:e[n],enumerable:!0})},h=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!f.call(r,i)&&i!==n&&a(r,i,{get:()=>e[i],enumerable:!(t=p(e,i))||t.enumerable});return r};var y=r=>h(a({},"__esModule",{value:!0}),r);var E={};g(E,{DevInspectorVue:()=>m,audit:()=>s});module.exports=y(E);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()}};this.send(n)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let n=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),e.on("unhandledRejection",n=>{let t=n instanceof Error?n:new Error(String(n));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 t={};for(let[i,o]of Object.entries(e))t[i]=this.truncate(o,n);return t}return e}captureError(e,n={}){let t=e.message||"Erro Desconhecido",i=e.stack||"",o={type:"error",message:this.truncate(t,500),stackTrace:this.truncate(i,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(o)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){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({...n,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(e){let n=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":n},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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",w=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new d),r[c]},s=w();var m={install(r,e){if(s.init(e),r.config&&r.config.errorHandler){let n=r.config.errorHandler;r.config.errorHandler=(t,i,o)=>{let u=t instanceof Error?t:new Error(String(t));s.captureError(u,{framework:"vue",vueInfo:o}),n&&n(t,i,o)}}else r.config&&(r.config.errorHandler=(n,t,i)=>{let o=n instanceof Error?n:new Error(String(n));s.captureError(o,{framework:"vue",vueInfo:i}),console.error(n)})}};0&&(module.exports={DevInspectorVue,audit});
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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));this.captureError(r,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let r={};for(let[i,o]of Object.entries(n))r[i]=this.truncate(o,e);return r}return n}captureError(n,e={}){let r=n.message||"Erro Desconhecido",i=n.stack||"",o={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({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(o)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let r={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(r)}async send(n){let e=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":e},body:JSON.stringify(n),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__",p=()=>{let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t[s]||(t[s]=new c),t[s]},a=p();var g={install(t,n){if(a.init(n),t.config&&t.config.errorHandler){let e=t.config.errorHandler;t.config.errorHandler=(r,i,o)=>{let d=r instanceof Error?r:new Error(String(r));a.captureError(d,{framework:"vue",vueInfo:o}),e&&e(r,i,o)}}else t.config&&(t.config.errorHandler=(e,r,i)=>{let o=e instanceof Error?e:new Error(String(e));a.captureError(o,{framework:"vue",vueInfo:i}),console.error(e)})}};export{g as DevInspectorVue,a as audit};
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()}};this.send(n)}listenGlobalErrors(){if(!this.listenersAttached){if(this.listenersAttached=!0,typeof window<"u")window.addEventListener("error",e=>{this.captureError(e.error||new Error(e.message||"Erro global desconhecido"),{filename:e.filename,lineno:e.lineno,colno:e.colno})}),window.addEventListener("unhandledrejection",e=>{let n=e.reason instanceof Error?e.reason:new Error(String(e.reason));this.captureError(n,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let e=globalThis.process;e.on("uncaughtException",n=>{this.captureError(n,{type:"uncaught_exception"})}),e.on("unhandledRejection",n=>{let t=n instanceof Error?n:new Error(String(n));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 t={};for(let[o,i]of Object.entries(e))t[o]=this.truncate(i,n);return t}return e}captureError(e,n={}){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({...n,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(i)}captureException(e,n={}){this.captureError(e,n)}captureMessage(e,n={}){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({...n,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(e){let n=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":n},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)}}},a="__DEVINSPECT_AUDIT_CORE_INSTANCE__",u=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[a]||(r[a]=new c),r[a]},s=u();var g={install(r,e){if(s.init(e),r.config&&r.config.errorHandler){let n=r.config.errorHandler;r.config.errorHandler=(t,o,i)=>{let d=t instanceof Error?t:new Error(String(t));s.captureError(d,{framework:"vue",vueInfo:i}),n&&n(t,o,i)}}else r.config&&(r.config.errorHandler=(n,t,o)=>{let i=n instanceof Error?n:new Error(String(n));s.captureError(i,{framework:"vue",vueInfo:o}),console.error(n)})}};export{g as DevInspectorVue,s as audit};
package/package.json CHANGED
@@ -1,89 +1,182 @@
1
- {
2
- "name": "@xcodleox/devinspector",
3
- "version": "1.0.8",
4
- "description": "SDK de monitoramento e auditoria de erros em tempo real | Dev Inspector",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "files": [
10
- "dist"
11
- ],
12
- "scripts": {
13
- "build": "tsup"
14
- },
15
- "peerDependencies": {
16
- "@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
17
- "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
18
- "svelte": "^4.0.0 || ^5.0.0",
19
- "vue": "^3.0.0"
20
- },
21
- "peerDependenciesMeta": {
22
- "react": {
23
- "optional": true
24
- },
25
- "@angular/core": {
26
- "optional": true
27
- },
28
- "vue": {
29
- "optional": true
30
- },
31
- "svelte": {
32
- "optional": true
33
- }
34
- },
35
- "devDependencies": {
36
- "@angular/core": "^21.2.18",
37
- "@types/react": "^18.3.31",
38
- "react": "^19.2.8",
39
- "rxjs": "^7.8.2",
40
- "svelte": "^5.0.0",
41
- "tsup": "^8.0.0",
42
- "typescript": "^5.0.0",
43
- "vue": "^3.4.0",
44
- "zone.js": "^0.16.2"
45
- },
46
- "exports": {
47
- ".": {
48
- "types": "./dist/index.d.ts",
49
- "import": "./dist/index.js",
50
- "require": "./dist/index.cjs"
51
- },
52
- "./next": {
53
- "types": "./dist/next.d.ts",
54
- "import": "./dist/next.js",
55
- "require": "./dist/next.cjs"
56
- },
57
- "./react": {
58
- "types": "./dist/react.d.ts",
59
- "import": "./dist/react.js",
60
- "require": "./dist/react.cjs"
61
- },
62
- "./angular": {
63
- "types": "./dist/angular.d.ts",
64
- "import": "./dist/angular.js",
65
- "require": "./dist/angular.cjs"
66
- },
67
- "./vue": {
68
- "types": "./dist/vue.d.ts",
69
- "import": "./dist/vue.js",
70
- "require": "./dist/vue.cjs"
71
- },
72
- "./svelte": {
73
- "types": "./dist/svelte.d.ts",
74
- "import": "./dist/svelte.js",
75
- "require": "./dist/svelte.cjs"
76
- },
77
- "./node": {
78
- "types": "./dist/node.d.ts",
79
- "import": "./dist/node.js",
80
- "require": "./dist/node.cjs"
81
- },
82
- "./vanilla": {
83
- "types": "./dist/vanilla.d.ts",
84
- "import": "./dist/vanilla.js",
85
- "require": "./dist/vanilla.cjs",
86
- "script": "./dist/vanilla.global.js"
87
- }
88
- }
89
- }
1
+ {
2
+ "name": "@xcodleox/devinspector",
3
+ "version": "2.0.0",
4
+ "description": "SDK de monitoramento e auditoria de erros em tempo real | Dev Inspector",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "unpkg": "./dist/vanilla.global.js",
10
+ "jsdelivr": "./dist/vanilla.global.js",
11
+ "sideEffects": false,
12
+ "engines": {
13
+ "node": ">=16.0.0"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsup",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "keywords": [
26
+ "monitoring",
27
+ "error-tracking",
28
+ "audit",
29
+ "devinspector",
30
+ "logger",
31
+ "react",
32
+ "angular",
33
+ "vue",
34
+ "svelte",
35
+ "nextjs"
36
+ ],
37
+ "license": "MIT",
38
+ "exports": {
39
+ ".": {
40
+ "import": {
41
+ "types": "./dist/index.d.ts",
42
+ "default": "./dist/index.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
47
+ },
48
+ "default": "./dist/index.js"
49
+ },
50
+ "./next": {
51
+ "import": {
52
+ "types": "./dist/next.d.ts",
53
+ "default": "./dist/next.js"
54
+ },
55
+ "require": {
56
+ "types": "./dist/next.d.cts",
57
+ "default": "./dist/next.cjs"
58
+ },
59
+ "default": "./dist/next.js"
60
+ },
61
+ "./react": {
62
+ "import": {
63
+ "types": "./dist/react.d.ts",
64
+ "default": "./dist/react.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/react.d.cts",
68
+ "default": "./dist/react.cjs"
69
+ },
70
+ "default": "./dist/react.js"
71
+ },
72
+ "./angular": {
73
+ "import": {
74
+ "types": "./dist/angular.d.ts",
75
+ "default": "./dist/angular.js"
76
+ },
77
+ "require": {
78
+ "types": "./dist/angular.d.cts",
79
+ "default": "./dist/angular.cjs"
80
+ },
81
+ "default": "./dist/angular.js"
82
+ },
83
+ "./vue": {
84
+ "types": {
85
+ "require": "./dist/vue.d.cts",
86
+ "import": "./dist/vue.d.ts"
87
+ },
88
+ "require": "./dist/vue.cjs",
89
+ "import": "./dist/vue.js"
90
+ },
91
+ "./svelte": {
92
+ "import": {
93
+ "types": "./dist/svelte.d.ts",
94
+ "default": "./dist/svelte.js"
95
+ },
96
+ "require": {
97
+ "types": "./dist/svelte.d.cts",
98
+ "default": "./dist/svelte.cjs"
99
+ },
100
+ "default": "./dist/svelte.js"
101
+ },
102
+ "./node": {
103
+ "import": {
104
+ "types": "./dist/node.d.ts",
105
+ "default": "./dist/node.js"
106
+ },
107
+ "require": {
108
+ "types": "./dist/node.d.cts",
109
+ "default": "./dist/node.cjs"
110
+ },
111
+ "default": "./dist/node.js"
112
+ },
113
+ "./vanilla": {
114
+ "script": "./dist/vanilla.global.js",
115
+ "import": {
116
+ "types": "./dist/vanilla.d.ts",
117
+ "default": "./dist/vanilla.js"
118
+ },
119
+ "require": {
120
+ "types": "./dist/vanilla.d.cts",
121
+ "default": "./dist/vanilla.cjs"
122
+ },
123
+ "default": "./dist/vanilla.js"
124
+ }
125
+ },
126
+ "typesVersions": {
127
+ "*": {
128
+ "next": [
129
+ "./dist/next.d.ts"
130
+ ],
131
+ "react": [
132
+ "./dist/react.d.ts"
133
+ ],
134
+ "angular": [
135
+ "./dist/angular.d.ts"
136
+ ],
137
+ "vue": [
138
+ "./dist/vue.d.ts"
139
+ ],
140
+ "svelte": [
141
+ "./dist/svelte.d.ts"
142
+ ],
143
+ "node": [
144
+ "./dist/node.d.ts"
145
+ ],
146
+ "vanilla": [
147
+ "./dist/vanilla.d.ts"
148
+ ]
149
+ }
150
+ },
151
+ "peerDependencies": {
152
+ "@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
153
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
154
+ "svelte": "^4.0.0 || ^5.0.0",
155
+ "vue": "^3.0.0"
156
+ },
157
+ "peerDependenciesMeta": {
158
+ "react": {
159
+ "optional": true
160
+ },
161
+ "@angular/core": {
162
+ "optional": true
163
+ },
164
+ "vue": {
165
+ "optional": true
166
+ },
167
+ "svelte": {
168
+ "optional": true
169
+ }
170
+ },
171
+ "devDependencies": {
172
+ "@angular/core": "^21.2.18",
173
+ "@types/react": "^18.3.31",
174
+ "react": "^19.2.8",
175
+ "rxjs": "^7.8.2",
176
+ "svelte": "^5.0.0",
177
+ "tsup": "^8.0.0",
178
+ "typescript": "^5.0.0",
179
+ "vue": "^3.4.0",
180
+ "zone.js": "^0.16.2"
181
+ }
182
+ }
@@ -1 +0,0 @@
1
- "use strict";var DevInspector=(()=>{var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(r,n)=>{for(var e in n)s(r,e,{get:n[e],enumerable:!0})},y=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!l.call(r,i)&&i!==e&&s(r,i,{get:()=>n[i],enumerable:!(t=d(n,i))||t.enumerable});return r};var h=r=>y(s({},"__esModule",{value:!0}),r);var E={};f(E,{audit:()=>o,default:()=>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}init(n){if(!n.apiKey){console.warn("[AuditSDK] API Key n\xE3o fornecida no init().");return}this.apiKey=n.apiKey,n.endpoint&&(this.endpoint=n.endpoint),n.environment&&(this.environment=n.environment),this.initialized=!0,this.listenGlobalErrors()}listenGlobalErrors(){if(typeof window<"u")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 e=n.reason instanceof Error?n.reason:new Error(String(n.reason));this.captureError(e,{type:"unhandled_rejection"})});else if(typeof globalThis<"u"&&globalThis.process?.on){let n=globalThis.process;n.on("uncaughtException",e=>{this.captureError(e,{type:"uncaught_exception"})}),n.on("unhandledRejection",e=>{let t=e instanceof Error?e:new Error(String(e));this.captureError(t,{type:"unhandled_rejection"})})}}truncate(n,e=5e3){if(typeof n=="string")return n.length>e?n.substring(0,e)+"... [truncated]":n;if(n&&typeof n=="object"&&n!==null){let t={};for(let[i,a]of Object.entries(n))t[i]=this.truncate(a,e);return t}return n}captureError(n,e={}){let t=n.message||"Erro Desconhecido",i=n.stack||"",a={message:this.truncate(t,500),stackTrace:this.truncate(i,1e4),url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(a)}captureException(n,e={}){this.captureError(n,e)}captureMessage(n,e={}){let t={message:this.truncate(n,500),stackTrace:"",url:typeof window<"u"?window.location.href:"",browser:typeof navigator<"u"?navigator.userAgent:"",metadata:this.truncate({...e,level:"info",environment:this.environment,timestamp:new Date().toISOString()},5e3)};this.send(t)}async send(n){let e=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":e},body:JSON.stringify(n),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)}}},c="__DEVINSPECT_AUDIT_CORE_INSTANCE__",g=()=>{let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r[c]||(r[c]=new p),r[c]},o=g();typeof window<"u"&&(window.DevInspector=o);var w=o;return h(E);})();