Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@objectiv/transport-xhr

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@objectiv/transport-xhr - npm Package Compare versions

Comparing version 0.0.27-experimental.5 to 0.0.27-experimental.6

2

dist/esm/index.js

@@ -1,1 +0,1 @@

function e(e,o,t,r,n,i,s){try{var l=e[i](s);var a=l.value}catch(c){t(c);return}if(l.done){o(a)}else{Promise.resolve(a).then(r,n)}}function o(o){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=o.apply(t,r);function l(o){e(s,n,i,l,a,"next",o)}function a(o){e(s,n,i,l,a,"throw",o)}l(undefined)})}}function t(e,o){if(!(e instanceof o)){throw new TypeError("Cannot call a class as a function")}}function r(e,o){for(var t=0;t<o.length;t++){var r=o[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function n(e,o,t){if(o)r(e.prototype,o);if(t)r(e,t);return e}var i=function(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e};var s=this&&this.__generator||function(e,o){var t,r,n,i,s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]};return i={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(o){return a([e,o])}}function a(i){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,r&&(n=i[0]&2?r["return"]:i[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;if(r=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:s.label++;return{value:i[1],done:false};case 5:s.label++;r=i[1];i=[0];continue;case 7:i=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){s=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){s.label=i[1];break}if(i[0]===6&&s.label<n[1]){s.label=n[1];n=i;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(i);break}if(n[2])s.ops.pop();s.trys.pop();continue}i=o.call(e,s)}catch(l){i=[6,l];r=0}finally{t=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var l={name:"@objectiv/transport-xhr",version:"0.0.27-experimental.5",description:"A TrackerTransport based on XMLHttpRequest API",license:"Apache-2.0",homepage:"https://objectiv.io",keywords:["objectiv","tracking","analytics","events","taxonomy","transport","xmlhttprequest","xhr"],repository:{type:"git",url:"https://github.com/objectiv/objectiv-analytics.git",directory:"tracker/transports/xhr"},bugs:"https://github.com/objectiv/objectiv-analytics/issues",contributors:[{name:"Surai Di Rosa",email:"surai.dirosa@gmail.com",url:"https://github.com/sdirosa"}],main:"./dist/index.js",module:"./dist/esm/index.js",types:"./dist/index.d.ts",files:["dist"],exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"}},scripts:{build:"tsup src/index.ts --target es5 --format cjs,esm --legacy-output --minify --dts --sourcemap --clean","deploy:verdaccio":"npm publish",prettify:"prettier --write .",tsc:"tsc --noEmit",test:"jest --silent","test:ci":"jest --silent --ci","test:coverage":"jest --silent --coverage",depcheck:"npx depcheck"},devDependencies:{"@objectiv/developer-tools":"^0.0.27-experimental.5","@objectiv/testing-tools":"^0.0.27-experimental.5",jest:"^28.1.3",prettier:"^2.7.1","ts-jest":"^28.0.7",tsup:"^6.2.1",typescript:"^4.7.4","xhr-mock":"^2.5.1"},dependencies:{"@objectiv/schema":"^0.0.27-experimental.5","@objectiv/tracker-core":"^0.0.27-experimental.5"}};import{makeTransportSendError as a}from"@objectiv/tracker-core";var c=function(e){var o=e.endpoint,t=e.events;return new Promise(function(e,r){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd());var n=new XMLHttpRequest,i=!0;n.open("POST",o,i),n.setRequestHeader("Content-Type","text/plain"),n.withCredentials=!0,n.onload=function(){n.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),e(n.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.log("Response: ".concat(n)),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r(a()))},n.onerror=function(){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r(a())},n.send(JSON.stringify({events:t,client_session_id:globalThis.objectiv.clientSessionId,transport_time:Date.now()}))})};import{isNonEmptyArray as u}from"@objectiv/tracker-core";var v=function(){"use strict";function e(){t(this,e);this.transportName="XHRTransport";this.xmlHttpRequestFunction=c}n(e,[{key:"initialize",value:function e(e){this.endpoint=e.endpoint,globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:".concat(this.transportName,"」 Initialized")),globalThis.objectiv.devTools.TrackerConsole.log("Endpoint: ".concat(this.endpoint)),globalThis.objectiv.devTools.TrackerConsole.groupEnd())}},{key:"handle",value:function e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=this;return o(function(){var e;return s(this,function(o){switch(o.label){case 0:return[4,Promise.all(t)];case 1:e=o.sent();if(n.endpoint&&u(e))return[2,n.xmlHttpRequestFunction({endpoint:n.endpoint,events:e})];return[2]}})})()}},{key:"isUsable",value:function e(){return(typeof XMLHttpRequest==="undefined"?"undefined":i(XMLHttpRequest))<"u"}}]);return e}();var p;globalThis.objectiv=(p=globalThis.objectiv)!==null&&p!==void 0?p:{};var d;globalThis.objectiv.versions=(d=globalThis.objectiv.versions)!==null&&d!==void 0?d:new Map;globalThis.objectiv.versions.set(l.name,l.version);export{v as XHRTransport,c as defaultXHRFunction};//# sourceMappingURL=index.js.map
function e(e,o,t,r,n,i,s){try{var l=e[i](s);var a=l.value}catch(c){t(c);return}if(l.done){o(a)}else{Promise.resolve(a).then(r,n)}}function o(o){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=o.apply(t,r);function l(o){e(s,n,i,l,a,"next",o)}function a(o){e(s,n,i,l,a,"throw",o)}l(undefined)})}}function t(e,o){if(!(e instanceof o)){throw new TypeError("Cannot call a class as a function")}}function r(e,o){for(var t=0;t<o.length;t++){var r=o[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function n(e,o,t){if(o)r(e.prototype,o);if(t)r(e,t);return e}var i=function(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e};var s=this&&this.__generator||function(e,o){var t,r,n,i,s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]};return i={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(o){return a([e,o])}}function a(i){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,r&&(n=i[0]&2?r["return"]:i[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;if(r=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:s.label++;return{value:i[1],done:false};case 5:s.label++;r=i[1];i=[0];continue;case 7:i=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){s=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){s.label=i[1];break}if(i[0]===6&&s.label<n[1]){s.label=n[1];n=i;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(i);break}if(n[2])s.ops.pop();s.trys.pop();continue}i=o.call(e,s)}catch(l){i=[6,l];r=0}finally{t=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var l={name:"@objectiv/transport-xhr",version:"0.0.27-experimental.6",description:"A TrackerTransport based on XMLHttpRequest API",license:"Apache-2.0",homepage:"https://objectiv.io",keywords:["objectiv","tracking","analytics","events","taxonomy","transport","xmlhttprequest","xhr"],repository:{type:"git",url:"https://github.com/objectiv/objectiv-analytics.git",directory:"tracker/transports/xhr"},bugs:"https://github.com/objectiv/objectiv-analytics/issues",contributors:[{name:"Surai Di Rosa",email:"surai.dirosa@gmail.com",url:"https://github.com/sdirosa"}],main:"./dist/index.js",module:"./dist/esm/index.js",types:"./dist/index.d.ts",files:["dist"],exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"}},scripts:{build:"tsup src/index.ts --target es5 --format cjs,esm --legacy-output --minify --dts --sourcemap --clean","deploy:verdaccio":"npm publish",prettify:"prettier --write .",tsc:"tsc --noEmit",test:"jest --silent","test:ci":"jest --silent --ci","test:coverage":"jest --silent --coverage",depcheck:"npx depcheck"},devDependencies:{"@objectiv/developer-tools":"^0.0.27-experimental.6","@objectiv/testing-tools":"^0.0.27-experimental.6",jest:"^28.1.3",prettier:"^2.7.1","ts-jest":"^28.0.7",tsup:"^6.2.1",typescript:"^4.7.4","xhr-mock":"^2.5.1"},dependencies:{"@objectiv/schema":"^0.0.27-experimental.6","@objectiv/tracker-core":"^0.0.27-experimental.6"}};import{makeTransportSendError as a}from"@objectiv/tracker-core";var c=function(e){var o=e.endpoint,t=e.events;return new Promise(function(e,r){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd());var n=new XMLHttpRequest,i=!0;n.open("POST",o,i),n.setRequestHeader("Content-Type","text/plain"),n.withCredentials=!0,n.onload=function(){n.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),e(n.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.log("Response: ".concat(n)),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r(a()))},n.onerror=function(){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r(a())},n.send(JSON.stringify({events:t,client_session_id:globalThis.objectiv.clientSessionId,transport_time:Date.now()}))})};import{isNonEmptyArray as u}from"@objectiv/tracker-core";var v=function(){"use strict";function e(){t(this,e);this.transportName="XHRTransport";this.xmlHttpRequestFunction=c}n(e,[{key:"initialize",value:function e(e){this.endpoint=e.endpoint,globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:".concat(this.transportName,"」 Initialized")),globalThis.objectiv.devTools.TrackerConsole.log("Endpoint: ".concat(this.endpoint)),globalThis.objectiv.devTools.TrackerConsole.groupEnd())}},{key:"handle",value:function e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=this;return o(function(){var e;return s(this,function(o){switch(o.label){case 0:return[4,Promise.all(t)];case 1:e=o.sent();if(n.endpoint&&u(e))return[2,n.xmlHttpRequestFunction({endpoint:n.endpoint,events:e})];return[2]}})})()}},{key:"isUsable",value:function e(){return(typeof XMLHttpRequest==="undefined"?"undefined":i(XMLHttpRequest))<"u"}}]);return e}();var p;globalThis.objectiv=(p=globalThis.objectiv)!==null&&p!==void 0?p:{};var d;globalThis.objectiv.versions=(d=globalThis.objectiv.versions)!==null&&d!==void 0?d:new Map;globalThis.objectiv.versions.set(l.name,l.version);export{v as XHRTransport,c as defaultXHRFunction};//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

"use strict";function e(e,o,t,r,n,i,s){try{var l=e[i](s);var a=l.value}catch(c){t(c);return}if(l.done){o(a)}else{Promise.resolve(a).then(r,n)}}function o(o){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=o.apply(t,r);function l(o){e(s,n,i,l,a,"next",o)}function a(o){e(s,n,i,l,a,"throw",o)}l(undefined)})}}function t(e,o){if(!(e instanceof o)){throw new TypeError("Cannot call a class as a function")}}function r(e,o){for(var t=0;t<o.length;t++){var r=o[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function n(e,o,t){if(o)r(e.prototype,o);if(t)r(e,t);return e}var i=function(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e};var s=this&&this.__generator||function(e,o){var t,r,n,i,s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]};return i={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(o){return a([e,o])}}function a(i){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,r&&(n=i[0]&2?r["return"]:i[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;if(r=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:s.label++;return{value:i[1],done:false};case 5:s.label++;r=i[1];i=[0];continue;case 7:i=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){s=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){s.label=i[1];break}if(i[0]===6&&s.label<n[1]){s.label=n[1];n=i;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(i);break}if(n[2])s.ops.pop();s.trys.pop();continue}i=o.call(e,s)}catch(l){i=[6,l];r=0}finally{t=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var l=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var v=function(e,o){for(var t in o)l(e,t,{get:o[t],enumerable:!0})},p=function(e,o,t,r){var n=true,i=false,s=undefined;if(o&&typeof o=="object"||typeof o=="function")try{var v=function(){var n=d.value;!u.call(e,n)&&n!==t&&l(e,n,{get:function(){return o[n]},enumerable:!(r=a(o,n))||r.enumerable})};for(var p=c(o)[Symbol.iterator](),d;!(n=(d=p.next()).done);n=true)v()}catch(b){i=true;s=b}finally{try{if(!n&&p.return!=null){p.return()}}finally{if(i){throw s}}}return e};var d=function(e){return p(l({},"__esModule",{value:!0}),e)};var b={};v(b,{XHRTransport:function(){return j},defaultXHRFunction:function(){return h}});module.exports=d(b);var T={name:"@objectiv/transport-xhr",version:"0.0.27-experimental.5",description:"A TrackerTransport based on XMLHttpRequest API",license:"Apache-2.0",homepage:"https://objectiv.io",keywords:["objectiv","tracking","analytics","events","taxonomy","transport","xmlhttprequest","xhr"],repository:{type:"git",url:"https://github.com/objectiv/objectiv-analytics.git",directory:"tracker/transports/xhr"},bugs:"https://github.com/objectiv/objectiv-analytics/issues",contributors:[{name:"Surai Di Rosa",email:"surai.dirosa@gmail.com",url:"https://github.com/sdirosa"}],main:"./dist/index.js",module:"./dist/esm/index.js",types:"./dist/index.d.ts",files:["dist"],exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"}},scripts:{build:"tsup src/index.ts --target es5 --format cjs,esm --legacy-output --minify --dts --sourcemap --clean","deploy:verdaccio":"npm publish",prettify:"prettier --write .",tsc:"tsc --noEmit",test:"jest --silent","test:ci":"jest --silent --ci","test:coverage":"jest --silent --coverage",depcheck:"npx depcheck"},devDependencies:{"@objectiv/developer-tools":"^0.0.27-experimental.5","@objectiv/testing-tools":"^0.0.27-experimental.5",jest:"^28.1.3",prettier:"^2.7.1","ts-jest":"^28.0.7",tsup:"^6.2.1",typescript:"^4.7.4","xhr-mock":"^2.5.1"},dependencies:{"@objectiv/schema":"^0.0.27-experimental.5","@objectiv/tracker-core":"^0.0.27-experimental.5"}};var f=require("@objectiv/tracker-core"),h=function(e){var o=e.endpoint,t=e.events;return new Promise(function(e,r){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd());var n=new XMLHttpRequest,i=!0;n.open("POST",o,i),n.setRequestHeader("Content-Type","text/plain"),n.withCredentials=!0,n.onload=function(){n.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),e(n.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.log("Response: ".concat(n)),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r((0,f.makeTransportSendError)()))},n.onerror=function(){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r((0,f.makeTransportSendError)())},n.send(JSON.stringify({events:t,client_session_id:globalThis.objectiv.clientSessionId,transport_time:Date.now()}))})};var g=require("@objectiv/tracker-core");var j=function(){function e(){t(this,e);this.transportName="XHRTransport";this.xmlHttpRequestFunction=h}n(e,[{key:"initialize",value:function e(e){this.endpoint=e.endpoint,globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:".concat(this.transportName,"」 Initialized")),globalThis.objectiv.devTools.TrackerConsole.log("Endpoint: ".concat(this.endpoint)),globalThis.objectiv.devTools.TrackerConsole.groupEnd())}},{key:"handle",value:function e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=this;return o(function(){var e;return s(this,function(o){switch(o.label){case 0:return[4,Promise.all(t)];case 1:e=o.sent();if(n.endpoint&&(0,g.isNonEmptyArray)(e))return[2,n.xmlHttpRequestFunction({endpoint:n.endpoint,events:e})];return[2]}})})()}},{key:"isUsable",value:function e(){return(typeof XMLHttpRequest==="undefined"?"undefined":i(XMLHttpRequest))<"u"}}]);return e}();var y;globalThis.objectiv=(y=globalThis.objectiv)!==null&&y!==void 0?y:{};var m;globalThis.objectiv.versions=(m=globalThis.objectiv.versions)!==null&&m!==void 0?m:new Map;globalThis.objectiv.versions.set(T.name,T.version);0&&(module.exports={XHRTransport:XHRTransport,defaultXHRFunction:defaultXHRFunction});//# sourceMappingURL=index.js.map
"use strict";function e(e,o,t,r,n,i,s){try{var l=e[i](s);var a=l.value}catch(c){t(c);return}if(l.done){o(a)}else{Promise.resolve(a).then(r,n)}}function o(o){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=o.apply(t,r);function l(o){e(s,n,i,l,a,"next",o)}function a(o){e(s,n,i,l,a,"throw",o)}l(undefined)})}}function t(e,o){if(!(e instanceof o)){throw new TypeError("Cannot call a class as a function")}}function r(e,o){for(var t=0;t<o.length;t++){var r=o[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function n(e,o,t){if(o)r(e.prototype,o);if(t)r(e,t);return e}var i=function(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e};var s=this&&this.__generator||function(e,o){var t,r,n,i,s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]};return i={next:l(0),"throw":l(1),"return":l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(o){return a([e,o])}}function a(i){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,r&&(n=i[0]&2?r["return"]:i[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;if(r=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:s.label++;return{value:i[1],done:false};case 5:s.label++;r=i[1];i=[0];continue;case 7:i=s.ops.pop();s.trys.pop();continue;default:if(!(n=s.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){s=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){s.label=i[1];break}if(i[0]===6&&s.label<n[1]){s.label=n[1];n=i;break}if(n&&s.label<n[2]){s.label=n[2];s.ops.push(i);break}if(n[2])s.ops.pop();s.trys.pop();continue}i=o.call(e,s)}catch(l){i=[6,l];r=0}finally{t=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var l=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var v=function(e,o){for(var t in o)l(e,t,{get:o[t],enumerable:!0})},p=function(e,o,t,r){var n=true,i=false,s=undefined;if(o&&typeof o=="object"||typeof o=="function")try{var v=function(){var n=d.value;!u.call(e,n)&&n!==t&&l(e,n,{get:function(){return o[n]},enumerable:!(r=a(o,n))||r.enumerable})};for(var p=c(o)[Symbol.iterator](),d;!(n=(d=p.next()).done);n=true)v()}catch(b){i=true;s=b}finally{try{if(!n&&p.return!=null){p.return()}}finally{if(i){throw s}}}return e};var d=function(e){return p(l({},"__esModule",{value:!0}),e)};var b={};v(b,{XHRTransport:function(){return j},defaultXHRFunction:function(){return h}});module.exports=d(b);var T={name:"@objectiv/transport-xhr",version:"0.0.27-experimental.6",description:"A TrackerTransport based on XMLHttpRequest API",license:"Apache-2.0",homepage:"https://objectiv.io",keywords:["objectiv","tracking","analytics","events","taxonomy","transport","xmlhttprequest","xhr"],repository:{type:"git",url:"https://github.com/objectiv/objectiv-analytics.git",directory:"tracker/transports/xhr"},bugs:"https://github.com/objectiv/objectiv-analytics/issues",contributors:[{name:"Surai Di Rosa",email:"surai.dirosa@gmail.com",url:"https://github.com/sdirosa"}],main:"./dist/index.js",module:"./dist/esm/index.js",types:"./dist/index.d.ts",files:["dist"],exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"}},scripts:{build:"tsup src/index.ts --target es5 --format cjs,esm --legacy-output --minify --dts --sourcemap --clean","deploy:verdaccio":"npm publish",prettify:"prettier --write .",tsc:"tsc --noEmit",test:"jest --silent","test:ci":"jest --silent --ci","test:coverage":"jest --silent --coverage",depcheck:"npx depcheck"},devDependencies:{"@objectiv/developer-tools":"^0.0.27-experimental.6","@objectiv/testing-tools":"^0.0.27-experimental.6",jest:"^28.1.3",prettier:"^2.7.1","ts-jest":"^28.0.7",tsup:"^6.2.1",typescript:"^4.7.4","xhr-mock":"^2.5.1"},dependencies:{"@objectiv/schema":"^0.0.27-experimental.6","@objectiv/tracker-core":"^0.0.27-experimental.6"}};var f=require("@objectiv/tracker-core"),h=function(e){var o=e.endpoint,t=e.events;return new Promise(function(e,r){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Sending"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd());var n=new XMLHttpRequest,i=!0;n.open("POST",o,i),n.setRequestHeader("Content-Type","text/plain"),n.withCredentials=!0,n.onload=function(){n.status===200?(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:XHRTransport」 Succeeded"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),e(n.response)):(globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Failed","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.log("Response: ".concat(n)),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r((0,f.makeTransportSendError)()))},n.onerror=function(){globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("%c「objectiv:XHRTransport」 Error","color:red"),globalThis.objectiv.devTools.TrackerConsole.log("Events:"),globalThis.objectiv.devTools.TrackerConsole.log(t),globalThis.objectiv.devTools.TrackerConsole.groupEnd()),r((0,f.makeTransportSendError)())},n.send(JSON.stringify({events:t,client_session_id:globalThis.objectiv.clientSessionId,transport_time:Date.now()}))})};var g=require("@objectiv/tracker-core");var j=function(){function e(){t(this,e);this.transportName="XHRTransport";this.xmlHttpRequestFunction=h}n(e,[{key:"initialize",value:function e(e){this.endpoint=e.endpoint,globalThis.objectiv.devTools&&(globalThis.objectiv.devTools.TrackerConsole.groupCollapsed("「objectiv:".concat(this.transportName,"」 Initialized")),globalThis.objectiv.devTools.TrackerConsole.log("Endpoint: ".concat(this.endpoint)),globalThis.objectiv.devTools.TrackerConsole.groupEnd())}},{key:"handle",value:function e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=this;return o(function(){var e;return s(this,function(o){switch(o.label){case 0:return[4,Promise.all(t)];case 1:e=o.sent();if(n.endpoint&&(0,g.isNonEmptyArray)(e))return[2,n.xmlHttpRequestFunction({endpoint:n.endpoint,events:e})];return[2]}})})()}},{key:"isUsable",value:function e(){return(typeof XMLHttpRequest==="undefined"?"undefined":i(XMLHttpRequest))<"u"}}]);return e}();var y;globalThis.objectiv=(y=globalThis.objectiv)!==null&&y!==void 0?y:{};var m;globalThis.objectiv.versions=(m=globalThis.objectiv.versions)!==null&&m!==void 0?m:new Map;globalThis.objectiv.versions.set(T.name,T.version);0&&(module.exports={XHRTransport:XHRTransport,defaultXHRFunction:defaultXHRFunction});//# sourceMappingURL=index.js.map
{
"name": "@objectiv/transport-xhr",
"version": "0.0.27-experimental.5",
"version": "0.0.27-experimental.6",
"description": "A TrackerTransport based on XMLHttpRequest API",

@@ -54,4 +54,4 @@ "license": "Apache-2.0",

"devDependencies": {
"@objectiv/developer-tools": "^0.0.27-experimental.5",
"@objectiv/testing-tools": "^0.0.27-experimental.5",
"@objectiv/developer-tools": "^0.0.27-experimental.6",
"@objectiv/testing-tools": "^0.0.27-experimental.6",
"jest": "^28.1.3",

@@ -65,5 +65,5 @@ "prettier": "^2.7.1",

"dependencies": {
"@objectiv/schema": "^0.0.27-experimental.5",
"@objectiv/tracker-core": "^0.0.27-experimental.5"
"@objectiv/schema": "^0.0.27-experimental.6",
"@objectiv/tracker-core": "^0.0.27-experimental.6"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc