@objectiv/transport-xhr
Advanced tools
Comparing version 0.0.21-0 to 0.0.21-1
@@ -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("%c\uFF62objectiv:XHRTransport\uFF63 Failed","color:red"),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("%c\uFF62objectiv:XHRTransport\uFF63 Error","color:red"),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 l}from"@objectiv/tracker-core";var a=({endpoint:r,events:o})=>new Promise(function(t,n){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd());let e=new XMLHttpRequest,T=!0;e.open("POST",r,T),e.setRequestHeader("Content-Type","text/plain"),e.withCredentials=!0,e.onload=()=>{e.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),t(e.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c\uFF62objectiv:XHRTransport\uFF63 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.log(`Response: ${e}`),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),n(l()))},e.onerror=()=>{globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c\uFF62objectiv:XHRTransport\uFF63 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),n(l())},e.send(JSON.stringify({events:o,transport_time:Date.now()}))});import{isNonEmptyArray as c}from"@objectiv/tracker-core";var p=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&&c(t))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:t})}isUsable(){return typeof XMLHttpRequest<"u"}};export{p as XHRTransport,a 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("%c\uFF62objectiv:XHRTransport\uFF63 Failed","color:red"),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("%c\uFF62objectiv:XHRTransport\uFF63 Error","color:red"),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 l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=t=>l(t,"__esModule",{value:!0});var u=(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 v(o))!b.call(t,r)&&(e||r!=="default")&&l(t,r,{get:()=>o[r],enumerable:!(n=d(o,r))||n.enumerable});return t};var m=(t=>(o,e)=>t&&t.get(o)||(e=h(g({}),o,1),t&&t.set(o,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var C={};u(C,{XHRTransport:()=>c,defaultXHRFunction:()=>i});var s=require("@objectiv/tracker-core"),i=({endpoint:t,events:o})=>new Promise(function(e,n){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd());let r=new XMLHttpRequest,p=!0;r.open("POST",t,p),r.setRequestHeader("Content-Type","text/plain"),r.withCredentials=!0,r.onload=()=>{r.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("\uFF62objectiv:XHRTransport\uFF63 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),e(r.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c\uFF62objectiv:XHRTransport\uFF63 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.log(`Response: ${r}`),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),n((0,s.makeTransportSendError)()))},r.onerror=()=>{globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c\uFF62objectiv:XHRTransport\uFF63 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(o),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),n((0,s.makeTransportSendError)())},r.send(JSON.stringify({events:o,transport_time:Date.now()}))});var T=require("@objectiv/tracker-core");var c=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,T.isNonEmptyArray)(e))return this.xmlHttpRequestFunction({endpoint:this.endpoint,events:e})}isUsable(){return typeof XMLHttpRequest<"u"}};module.exports=m(C);0&&(module.exports={XHRTransport,defaultXHRFunction}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@objectiv/transport-xhr", | ||
"version": "0.0.21-0", | ||
"version": "0.0.21-1", | ||
"description": "A TrackerTransport based on XMLHttpRequest API", | ||
@@ -55,4 +55,4 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@objectiv/developer-tools": "^0.0.21-0", | ||
"@objectiv/testing-tools": "^0.0.21-0", | ||
"@objectiv/developer-tools": "^0.0.21-1", | ||
"@objectiv/testing-tools": "^0.0.21-1", | ||
"@types/jest": "^27.4.1", | ||
@@ -68,4 +68,4 @@ "jest": "^27.5.1", | ||
"dependencies": { | ||
"@objectiv/tracker-core": "~0.0.21-0" | ||
"@objectiv/tracker-core": "~0.0.21-1" | ||
} | ||
} |
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
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
20119
54