warning_sdk 2.0.2 → 2.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var K=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var f=K((C,m)=>{var d=require("https"),h=300,j="2.0.1";function k(n,t){if(!t)return null;if(t.scheme==="bearer"){let e=n.headers?.authorization;return e?e.split(" ")[1]:null}else{let e=t.name;if(!e)return null;let r=String(e).toLowerCase();return n.headers?.[r]??n.query?.[e]??n.body?.[e]??null}}m.exports=function(t={}){let e=t.url,r=t.project_id;if(!e)throw new Error("[Warning-SDK] config missing: url");if(!r)throw new Error("[Warning-SDK] config missing: project_id");let a=new URL(e);if(a.protocol!=="https:")throw new Error("[Warning-SDK] config invalid: url must be https");let g=d,y=t.apiKeys||null,S=new d.Agent({keepAlive:!0,keepAliveMsecs:6e4,maxSockets:50,maxFreeSockets:10,timeout:h});return function(o,i,w){try{let u=i.end,c=200;i.end=function(..._){c=i.statusCode||200;let x=(o.originalUrl||o.url||o.path||"/").split("?")[0].split("#")[0]||"/",l={time_stamp:Math.floor(Date.now()/6e4),method:o.method,path:x,ip:o.ip,project_id:r,status_code:c},p=k(o,y);p&&(l.api_key=p);let s=g.request(a,{method:"POST",headers:{"Content-Type":"application/json","X-SDK-Version":j},timeout:h,agent:S},E=>E.resume());return s.on("timeout",()=>s.destroy()),s.on("error",()=>{}),s.end(JSON.stringify(l)),u.apply(i,_)}}catch{}w()}}});module.exports={express:f()};
1
+ var K=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var f=K((C,m)=>{var d=require("https"),h=300,j="2.0.3";function k(n,t){if(!t)return null;if(t.scheme==="bearer"){let e=n.headers?.authorization;return e?e.split(" ")[1]:null}else{let e=t.name;if(!e)return null;let r=String(e).toLowerCase();return n.headers?.[r]??n.query?.[e]??n.body?.[e]??null}}m.exports=function(t={}){let e=t.url,r=t.project_id;if(!e)throw new Error("[Warning-SDK] config missing: url");if(!r)throw new Error("[Warning-SDK] config missing: project_id");let a=new URL(e);if(a.protocol!=="https:")throw new Error("[Warning-SDK] config invalid: url must be https");let g=d,y=t.apiKeys||null,S=new d.Agent({keepAlive:!0,keepAliveMsecs:6e4,maxSockets:50,maxFreeSockets:10,timeout:h});return function(o,i,w){try{let u=i.end,c=200;i.end=function(..._){c=i.statusCode||200;let x=(o.originalUrl||o.url||o.path||"/").split("?")[0].split("#")[0]||"/",l={time_stamp:Math.floor(Date.now()/6e4),method:o.method,path:x,ip:o.ip,project_id:r,status_code:c},p=k(o,y);p&&(l.api_key=p);let s=g.request(a,{method:"POST",headers:{"Content-Type":"application/json","X-SDK-Version":j},timeout:h,agent:S},E=>E.resume());return s.on("timeout",()=>s.destroy()),s.on("error",()=>{}),s.end(JSON.stringify(l)),u.apply(i,_)}}catch{}w()}}});module.exports={express:f()};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warning_sdk",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Warning SDK for Express",
5
5
  "main": "dist/index.js",
6
6
  "files": [