@objectiv/transport-xhr
Advanced tools
Comparing version 0.0.19-0 to 0.0.19
@@ -1,2 +0,2 @@ | ||
import{makeTransportSendError as l}from"@objectiv/tracker-core";var a=({endpoint:r,events:o})=>new Promise(function(t,n){globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd());let e=new XMLHttpRequest,c=!0;e.open("POST",r,c),e.setRequestHeader("Content-Type","text/plain"),e.withCredentials=!0,e.onload=()=>{e.status===200?(globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd()),t(e.response)):(globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Failed"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.log(`Response: ${e}`),globalThis.objectiv.TrackerConsole.groupEnd()),n(l()))},e.onerror=()=>{globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Error"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd()),n(l())},e.send(JSON.stringify({events:o,transport_time:Date.now()}))});import{isNonEmptyArray as p}from"@objectiv/tracker-core";var T=class{constructor(o){this.transportName="XHRTransport";var t;this.endpoint=o.endpoint,this.xmlHttpRequestFunction=(t=o.xmlHttpRequestFunction)!=null?t:a}async handle(...o){let t=await Promise.all(o);if(this.endpoint&&p(t))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:t})}isUsable(){return typeof XMLHttpRequest<"u"}};export{T as XHRTransport,a as defaultXHRFunction}; | ||
import{makeTransportSendError as p,TrackerConsole as t}from"@objectiv/tracker-core";var l=({endpoint:r,events:n})=>new Promise(function(o,s){t.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),t.log("Events:"),t.log(n),t.groupEnd();let e=new XMLHttpRequest,u=!0;e.open("POST",r,u),e.setRequestHeader("Content-Type","text/plain"),e.withCredentials=!0,e.onload=()=>{e.status===200?(t.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),t.log("Events:"),t.log(n),t.groupEnd(),o(e.response)):(t.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Failed"),t.log("Events:"),t.log(n),t.log(`Response: ${e}`),t.groupEnd(),s(p()))},e.onerror=()=>{t.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Error"),t.log("Events:"),t.log(n),t.groupEnd(),s(p())},e.send(JSON.stringify({events:n,transport_time:Date.now()}))});import{isNonEmptyArray as d}from"@objectiv/tracker-core";var c=class{constructor(n){this.transportName="XHRTransport";var o;this.endpoint=n.endpoint,this.xmlHttpRequestFunction=(o=n.xmlHttpRequestFunction)!=null?o:l}async handle(...n){let o=await Promise.all(n);if(this.endpoint&&d(o))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:o})}isUsable(){return typeof XMLHttpRequest<"u"}};export{c as XHRTransport,l as defaultXHRFunction}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=t=>l(t,"__esModule",{value:!0});var v=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},h=(t,o,e,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of g(o))!u.call(t,r)&&(e||r!=="default")&&l(t,r,{get:()=>o[r],enumerable:!(n=b(o,r))||n.enumerable});return t};var m=(t=>(o,e)=>t&&t.get(o)||(e=h(d({}),o,1),t&&t.set(o,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var C={};v(C,{XHRTransport:()=>p,defaultXHRFunction:()=>i});var s=require("@objectiv/tracker-core"),i=({endpoint:t,events:o})=>new Promise(function(e,n){globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd());let r=new XMLHttpRequest,T=!0;r.open("POST",t,T),r.setRequestHeader("Content-Type","text/plain"),r.withCredentials=!0,r.onload=()=>{r.status===200?(globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd()),e(r.response)):(globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Failed"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.log(`Response: ${r}`),globalThis.objectiv.TrackerConsole.groupEnd()),n((0,s.makeTransportSendError)()))},r.onerror=()=>{globalThis.objectiv&&(globalThis.objectiv.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Error"),globalThis.objectiv.TrackerConsole.log("Events:"),globalThis.objectiv.TrackerConsole.log(o),globalThis.objectiv.TrackerConsole.groupEnd()),n((0,s.makeTransportSendError)())},r.send(JSON.stringify({events:o,transport_time:Date.now()}))});var c=require("@objectiv/tracker-core");var p=class{constructor(o){this.transportName="XHRTransport";var e;this.endpoint=o.endpoint,this.xmlHttpRequestFunction=(e=o.xmlHttpRequestFunction)!=null?e:i}async handle(...o){let e=await Promise.all(o);if(this.endpoint&&(0,c.isNonEmptyArray)(e))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:e})}isUsable(){return typeof XMLHttpRequest<"u"}};module.exports=m(C);0&&(module.exports={XHRTransport,defaultXHRFunction}); | ||
var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var f=o=>p(o,"__esModule",{value:!0});var R=(o,t)=>{for(var e in t)p(o,e,{get:t[e],enumerable:!0})},T=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of m(t))!g.call(o,r)&&(e||r!=="default")&&p(o,r,{get:()=>t[r],enumerable:!(s=c(t,r))||s.enumerable});return o};var H=(o=>(t,e)=>o&&o.get(t)||(e=T(f({}),t,1),o&&o.set(t,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var y={};R(y,{XHRTransport:()=>u,defaultXHRFunction:()=>a});var n=require("@objectiv/tracker-core"),a=({endpoint:o,events:t})=>new Promise(function(e,s){n.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),n.TrackerConsole.log("Events:"),n.TrackerConsole.log(t),n.TrackerConsole.groupEnd();let r=new XMLHttpRequest,d=!0;r.open("POST",o,d),r.setRequestHeader("Content-Type","text/plain"),r.withCredentials=!0,r.onload=()=>{r.status===200?(n.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),n.TrackerConsole.log("Events:"),n.TrackerConsole.log(t),n.TrackerConsole.groupEnd(),e(r.response)):(n.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Failed"),n.TrackerConsole.log("Events:"),n.TrackerConsole.log(t),n.TrackerConsole.log(`Response: ${r}`),n.TrackerConsole.groupEnd(),s((0,n.makeTransportSendError)()))},r.onerror=()=>{n.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Error"),n.TrackerConsole.log("Events:"),n.TrackerConsole.log(t),n.TrackerConsole.groupEnd(),s((0,n.makeTransportSendError)())},r.send(JSON.stringify({events:t,transport_time:Date.now()}))});var l=require("@objectiv/tracker-core");var u=class{constructor(t){this.transportName="XHRTransport";var e;this.endpoint=t.endpoint,this.xmlHttpRequestFunction=(e=t.xmlHttpRequestFunction)!=null?e:a}async handle(...t){let e=await Promise.all(t);if(this.endpoint&&(0,l.isNonEmptyArray)(e))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:e})}isUsable(){return typeof XMLHttpRequest<"u"}};module.exports=H(y);0&&(module.exports={XHRTransport,defaultXHRFunction}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@objectiv/transport-xhr", | ||
"version": "0.0.19-0", | ||
"version": "0.0.19", | ||
"description": "A TrackerTransport based on XMLHttpRequest API", | ||
@@ -51,8 +51,7 @@ "license": "Apache-2.0", | ||
"check:dependencies": "npx depcheck", | ||
"npm-publish": "shx rm -f .npmrc && npm publish --access=public --tag=$TAG", | ||
"npm-publish:verdaccio": "shx cp ../../verdaccio/.npmrc .npmrc && npm publish --tag=$TAG && shx rm -f .npmrc" | ||
"npm-publish": "shx rm -f .npmrc && npm publish --access=public", | ||
"npm-publish:verdaccio": "shx cp ../../verdaccio/.npmrc .npmrc && npm publish && shx rm -f .npmrc" | ||
}, | ||
"devDependencies": { | ||
"@objectiv/developer-tools": "^0.0.19-0", | ||
"@objectiv/testing-tools": "^0.0.19-0", | ||
"@objectiv/testing-tools": "^0.0.19", | ||
"@types/jest": "^27.4.1", | ||
@@ -69,5 +68,4 @@ "jest": "^27.5.1", | ||
"dependencies": { | ||
"@objectiv/tracker-core": "~0.0.19-0" | ||
}, | ||
"stableVersion": "0.0.18" | ||
"@objectiv/tracker-core": "~0.0.19" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
16516
48
1