Socket
Socket
Sign inDemoInstall

data-relay

Package Overview
Dependencies
7
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

2

dist/index.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dataRelay=e():t.dataRelay=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>o});var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},i=function(t){return"Relay SDK: ".concat(t)};const o=new(function(){function t(t,e){var i=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(t){t.fetch&&(i.fetch=t.fetch),t.apiURL&&(i.apiURL=t.apiURL),t.apiKey&&(i.apiKey=t.apiKey)},this.sendEvent=function(t,e){var o=e.tags,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["tags"]);(null==r?void 0:r.apiKey)&&i.init(n(n({},r),{apiKey:r.apiKey})),i._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(o||[]).concat([i.id])});return i.fetch("".concat(i.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":i.apiKey},method:"POST"}).then((function(t){return t.json()}))},this.fetch=t||fetch,this.id=e,this.fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return t.prototype._validateSendEvent=function(t){if(!t)throw new Error(i("Attempting to send null data"));if(!this.apiKey)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},t}())(null,"JavaScript SDK");return e})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dataRelay=e():t.dataRelay=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>o});var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},i=function(t){return"Relay SDK: ".concat(t)};const o=new(function(){function t(t,e){var i=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(t){t.fetch&&(i.fetch=t.fetch),t.apiURL&&(i.apiURL=t.apiURL),t.apiKey&&(i.apiKey=t.apiKey)},this.sendEvent=function(t,e){var o=e.tags,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["tags"]);(null==r?void 0:r.apiKey)&&i.init(n(n({},r),{apiKey:r.apiKey})),i._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(o||[]).concat([i.id])});return(i.fetch||fetch)("".concat(i.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":i.apiKey},method:"POST"}).then((function(t){return t.json()}))},t&&(this.fetch=t),this.id=e,this.fetch||"undefined"!=typeof fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return t.prototype._validateSendEvent=function(t){if(!t)throw new Error(i("Attempting to send null data"));if(!this.apiKey)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch&&"undefined"==typeof fetch)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},t}())(null,"JavaScript SDK");return e})()));
//# sourceMappingURL=index.js.map

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dataRelay=t():e.dataRelay=t()}(this,(()=>(()=>{"use strict";var e={300:(e,t,n)=>{var o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("unable to locate global object")}();e.exports=t=o.fetch,o.fetch&&(t.default=o.fetch.bind(o)),t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{default:()=>a});var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)},t=function(e){return"Relay SDK: ".concat(e)},r=function(){function n(t,n){var o=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(e){e.fetch&&(o.fetch=e.fetch),e.apiURL&&(o.apiURL=e.apiURL),e.apiKey&&(o.apiKey=e.apiKey)},this.sendEvent=function(t,n){var r=n.tags,i=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(n,["tags"]);(null==i?void 0:i.apiKey)&&o.init(e(e({},i),{apiKey:i.apiKey})),o._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(r||[]).concat([o.id])});return o.fetch("".concat(o.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":o.apiKey},method:"POST"}).then((function(e){return e.json()}))},this.fetch=t||fetch,this.id=n,this.fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return n.prototype._validateSendEvent=function(e){if(!e)throw new Error(t("Attempting to send null data"));if(!this.apiKey)throw new Error(t("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch)throw new Error(t("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},n}(),i=n(300);const a=function(e,t){return new r(e,"NodeJS SDK")}(n.n(i)())})(),o})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dataRelay=t():e.dataRelay=t()}(this,(()=>(()=>{"use strict";var e={300:(e,t,n)=>{var o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("unable to locate global object")}();e.exports=t=o.fetch,o.fetch&&(t.default=o.fetch.bind(o)),t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{default:()=>a});var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)},t=function(e){return"Relay SDK: ".concat(e)},r=function(){function n(t,n){var o=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(e){e.fetch&&(o.fetch=e.fetch),e.apiURL&&(o.apiURL=e.apiURL),e.apiKey&&(o.apiKey=e.apiKey)},this.sendEvent=function(t,n){var r=n.tags,i=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(n,["tags"]);(null==i?void 0:i.apiKey)&&o.init(e(e({},i),{apiKey:i.apiKey})),o._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(r||[]).concat([o.id])});return(o.fetch||fetch)("".concat(o.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":o.apiKey},method:"POST"}).then((function(e){return e.json()}))},t&&(this.fetch=t),this.id=n,this.fetch||"undefined"!=typeof fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return n.prototype._validateSendEvent=function(e){if(!e)throw new Error(t("Attempting to send null data"));if(!this.apiKey)throw new Error(t("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch&&"undefined"==typeof fetch)throw new Error(t("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},n}(),i=n(300);const a=function(e,t){return new r(e,"NodeJS SDK")}(n.n(i)())})(),o})()));
//# sourceMappingURL=node.js.map

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dataRelay=e():t.dataRelay=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>r});var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},i=function(t){return"Relay SDK: ".concat(t)},o=function(){function t(t,e){var i=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(t){t.fetch&&(i.fetch=t.fetch),t.apiURL&&(i.apiURL=t.apiURL),t.apiKey&&(i.apiKey=t.apiKey)},this.sendEvent=function(t,e){var o=e.tags,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["tags"]);(null==r?void 0:r.apiKey)&&i.init(n(n({},r),{apiKey:r.apiKey})),i._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(o||[]).concat([i.id])});return i.fetch("".concat(i.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":i.apiKey},method:"POST"}).then((function(t){return t.json()}))},this.fetch=t||fetch,this.id=e,this.fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return t.prototype._validateSendEvent=function(t){if(!t)throw new Error(i("Attempting to send null data"));if(!this.apiKey)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},t}();const r=function(t,e){return new o(t,"React Native SDK")}(fetch);return e})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dataRelay=e():t.dataRelay=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>r});var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},i=function(t){return"Relay SDK: ".concat(t)},o=function(){function t(t,e){var i=this;this.apiURL="https://relay-plantkit.vercel.app/api/",this.apiKey="",this.id="",this.init=function(t){t.fetch&&(i.fetch=t.fetch),t.apiURL&&(i.apiURL=t.apiURL),t.apiKey&&(i.apiKey=t.apiKey)},this.sendEvent=function(t,e){var o=e.tags,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]])}return n}(e,["tags"]);(null==r?void 0:r.apiKey)&&i.init(n(n({},r),{apiKey:r.apiKey})),i._validateSendEvent(t);var a=JSON.stringify({data:t,tags:(o||[]).concat([i.id])});return(i.fetch||fetch)("".concat(i.apiURL,"submissions"),{body:a,headers:{"Content-Type":"application/json","X-API-Key":i.apiKey},method:"POST"}).then((function(t){return t.json()}))},t&&(this.fetch=t),this.id=e,this.fetch||"undefined"!=typeof fetch||console.error("Fetch function is undefined"),this.id||console.error("ID is undefined")}return t.prototype._validateSendEvent=function(t){if(!t)throw new Error(i("Attempting to send null data"));if(!this.apiKey)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"));if(!this.fetch&&"undefined"==typeof fetch)throw new Error(i("Attempting to send data with no API key, make sure you set it in sendEvent or init"))},t}();const r=function(t,e){return new o(t,"React Native SDK")}(fetch);return e})()));
//# sourceMappingURL=react-native.js.map
{
"name": "data-relay",
"version": "0.0.3",
"version": "0.0.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -13,7 +13,5 @@ import { InitParameters, SendEventParameters } from './types'

this.fetch = _fetch
} else {
this.fetch = fetch
}
this.id = id
if (!this.fetch) {
if (!this.fetch && typeof fetch === 'undefined') {
console.error('Fetch function is undefined')

@@ -53,3 +51,3 @@ }

})
return this.fetch(`${this.apiURL}submissions`, {
return (this.fetch || fetch)(`${this.apiURL}submissions`, {
body,

@@ -75,3 +73,3 @@ headers: {

}
if (!this.fetch) {
if (!this.fetch && typeof fetch === 'undefined') {
throw new Error(

@@ -78,0 +76,0 @@ generateError(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc