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

@uxland/fetch-client

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uxland/fetch-client - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-alpha.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.0.1-alpha.0](https://github.com/uxland/uxland/compare/@uxland/fetch-client@1.0.0...@uxland/fetch-client@1.0.1-alpha.0) (2021-03-10)
**Note:** Version bump only for package @uxland/fetch-client
# [1.0.0](https://github.com/uxland/uxland/compare/@uxland/fetch-client@1.0.0-alpha.21...@uxland/fetch-client@1.0.0) (2021-03-09)

@@ -8,0 +16,0 @@

4

es/index.js

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

var x=1;x=1;x=1;var I=class{constructor(e,n){this.messageType=e,this.callback=n}handle(e){e instanceof this.messageType&&this.callback.call(null,e)}},D=(e,n,r)=>{try{e(n,r)}catch(t){console.error(t)}},L=(e,n)=>{try{e.handle(n)}catch(r){console.error(r)}},U=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(e,n){let r,t;if(!e)throw new Error("Event channel/type is invalid.");if(typeof e=="string"){if(r=this.eventLookup[e],r)for(r=r.slice(),t=r.length;t--;)D(r[t],n,e)}else for(r=this.messageHandlers.slice(),t=r.length;t--;)L(r[t],e)}subscribe(e,n){let r,t;if(!e)throw new Error("Event channel/type is invalid.");return typeof e=="string"?(r=n,t=this.eventLookup[e]||(this.eventLookup[e]=[])):(r=new I(e,n),t=this.messageHandlers),t.push(r),{dispose(){let s=t.indexOf(r);s!==-1&&t.splice(s,1)}}}subscribeOnce(e,n){let r=this.subscribe(e,(t,s)=>(r.dispose(),n(t,s)));return r}},p=new U,ie=p.subscribe.bind(p),ae=p.subscribeOnce.bind(p),h=p.publish.bind(p);console.log("@uxland/event-aggregator loaded");var g="UXL-FETCH:INVALID_CREDENTIALS_EVENT",y="UXL-FETCH:INVALID_REQUEST_EVENT",T=async e=>{let n=()=>new Promise(r=>r());if(!e.ok){let r;try{let t=await e.json();r={...new Error,data:t,status:e.status,statusText:e.statusText}}catch(t){r={...new Error,status:e.status,statusText:e.statusText}}throw e.status===401?(await n(),h(g,r)):(await n(),h(y,r)),r}return e};var A="Content-Type",S="application/json",V=e=>e.headers?.get(A)?.indexOf(S)!==-1,R=async(e,n=[])=>V(e)?await e.json().then(r=>n.reduce((t,s)=>s(t),r)):await e.text();var j=function(e){return e===null||typeof e=="undefined"?"":encodeURIComponent(e)};var v=function(e){let n=[];for(let r in e){let t=e[r];n.push(t!==null&&typeof t=="object"?`${encodeURIComponent(r)}=${JSON.stringify(t)}`:encodeURIComponent(r)+"="+j(t))}return n.join("&")};var k=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Q={},N=function(e,n,r={}){if(k.test(n))return n;let t=(e||"")+(n||""),s=v({...Q,...r});return s?t+"?"+s:t};function i(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function u(e){return function n(r){return arguments.length===0||i(r)?n:e.apply(this,arguments)}}function l(e){return function n(r,t){switch(arguments.length){case 0:return n;case 1:return i(r)?n:u(function(s){return e(r,s)});default:return i(r)&&i(t)?n:i(r)?u(function(s){return e(s,t)}):i(t)?u(function(s){return e(r,s)}):e(r,t)}}}function m(e){return function n(r,t,s){switch(arguments.length){case 0:return n;case 1:return i(r)?n:l(function(o,a){return e(r,o,a)});case 2:return i(r)&&i(t)?n:i(r)?l(function(o,a){return e(o,t,a)}):i(t)?l(function(o,a){return e(r,o,a)}):u(function(o){return e(r,t,o)});default:return i(r)&&i(t)&&i(s)?n:i(r)&&i(t)?l(function(o,a){return e(o,a,s)}):i(r)&&i(s)?l(function(o,a){return e(o,t,a)}):i(t)&&i(s)?l(function(o,a){return e(r,o,a)}):i(r)?u(function(o){return e(o,t,s)}):i(t)?u(function(o){return e(r,o,s)}):i(s)?u(function(o){return e(r,t,o)}):e(r,t,s)}}}function f(e,n){return Object.prototype.hasOwnProperty.call(n,e)}var K=u(function(n){return n==null}),b=K;function d(e){return Object.prototype.toString.call(e)==="[object Object]"}var W=m(function(n,r,t){var s={},o;for(o in r)f(o,r)&&(s[o]=f(o,t)?n(o,r[o],t[o]):r[o]);for(o in t)f(o,t)&&!f(o,s)&&(s[o]=t[o]);return s}),w=W;var q=m(function e(n,r,t){return w(function(s,o,a){return d(o)&&d(a)?e(n,o,a):n(s,o,a)},r,t)}),P=q;var z=l(function(n,r){return P(function(t,s,o){return o},n,r)}),C=z;var O=(e,n)=>b(n)?e:C(e,n);var J="application/json",_,E=[],H={"Content-Type":J},c={headers:{...H},credentials:"include",mode:"cors"},B=e=>_=e,F=()=>_,X=e=>{E.push(e)},Y=()=>E,$=e=>{c={...c,...e}},G=()=>c,M=e=>{c={...c,headers:{...c.headers,...e}}},Z=()=>c?.headers,ee=e=>{c?.headers[e]&&delete c.headers[e]},re=()=>{c={...c,headers:{...H}}},te=async(e,n,r)=>{let t=await fetch(N(_,e,r),O(n,c)),s=await T(t);return await R(s,E)};console.log("@uxland/fetch-client loaded");export{g as INVALID_CREDENTIALS_EVENT,y as INVALID_REQUEST_EVENT,$ as configure,te as doFetch,F as getBaseUrl,G as getConfiguration,Z as getHeaders,Y as getResponseHandlers,X as registerResponseHandler,ee as removeHeader,re as resetHeaders,B as setBaseUrl,M as setHeaders};
/*

@@ -18,4 +19,1 @@ * @license

*/
/** @namespace FetchClient */
export * from './fetch-client';
export { INVALID_CREDENTIALS_EVENT, INVALID_REQUEST_EVENT } from './handlers/handle-errors';

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

"use strict";
(()=>{var _=1;_=1;_=1;var I=class{constructor(e,n){this.messageType=e,this.callback=n}handle(e){e instanceof this.messageType&&this.callback.call(null,e)}},D=(e,n,r)=>{try{e(n,r)}catch(t){console.error(t)}},L=(e,n)=>{try{e.handle(n)}catch(r){console.error(r)}},U=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(e,n){let r,t;if(!e)throw new Error("Event channel/type is invalid.");if(typeof e=="string"){if(r=this.eventLookup[e],r)for(r=r.slice(),t=r.length;t--;)D(r[t],n,e)}else for(r=this.messageHandlers.slice(),t=r.length;t--;)L(r[t],e)}subscribe(e,n){let r,t;if(!e)throw new Error("Event channel/type is invalid.");return typeof e=="string"?(r=n,t=this.eventLookup[e]||(this.eventLookup[e]=[])):(r=new I(e,n),t=this.messageHandlers),t.push(r),{dispose(){let s=t.indexOf(r);s!==-1&&t.splice(s,1)}}}subscribeOnce(e,n){let r=this.subscribe(e,(t,s)=>(r.dispose(),n(t,s)));return r}},p=new U,Y=p.subscribe.bind(p),$=p.subscribeOnce.bind(p),h=p.publish.bind(p);console.log("@uxland/event-aggregator loaded");var E="UXL-FETCH:INVALID_CREDENTIALS_EVENT",x="UXL-FETCH:INVALID_REQUEST_EVENT",T=async e=>{let n=()=>new Promise(r=>r());if(!e.ok){let r;try{let t=await e.json();r={...new Error,data:t,status:e.status,statusText:e.statusText}}catch(t){r={...new Error,status:e.status,statusText:e.statusText}}throw e.status===401?(await n(),h(E,r)):(await n(),h(x,r)),r}return e};var A="Content-Type",S="application/json",V=e=>{var r;let n=(r=e.headers)==null?void 0:r.get(A);return(n==null?void 0:n.indexOf(S))!==-1},R=async(e,n=[])=>V(e)?await e.json().then(r=>n.reduce((t,s)=>s(t),r)):await e.text();var j=function(e){return e===null||typeof e=="undefined"?"":encodeURIComponent(e)};var v=function(e){let n=[];for(let r in e){let t=e[r];n.push(t!==null&&typeof t=="object"?`${encodeURIComponent(r)}=${JSON.stringify(t)}`:encodeURIComponent(r)+"="+j(t))}return n.join("&")};var k=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Q={},N=function(e,n,r={}){if(k.test(n))return n;let t=(e||"")+(n||""),s=v({...Q,...r});return s?t+"?"+s:t};function i(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function c(e){return function n(r){return arguments.length===0||i(r)?n:e.apply(this,arguments)}}function l(e){return function n(r,t){switch(arguments.length){case 0:return n;case 1:return i(r)?n:c(function(s){return e(r,s)});default:return i(r)&&i(t)?n:i(r)?c(function(s){return e(s,t)}):i(t)?c(function(s){return e(r,s)}):e(r,t)}}}function d(e){return function n(r,t,s){switch(arguments.length){case 0:return n;case 1:return i(r)?n:l(function(o,u){return e(r,o,u)});case 2:return i(r)&&i(t)?n:i(r)?l(function(o,u){return e(o,t,u)}):i(t)?l(function(o,u){return e(r,o,u)}):c(function(o){return e(r,t,o)});default:return i(r)&&i(t)&&i(s)?n:i(r)&&i(t)?l(function(o,u){return e(o,u,s)}):i(r)&&i(s)?l(function(o,u){return e(o,t,u)}):i(t)&&i(s)?l(function(o,u){return e(r,o,u)}):i(r)?c(function(o){return e(o,t,s)}):i(t)?c(function(o){return e(r,o,s)}):i(s)?c(function(o){return e(r,t,o)}):e(r,t,s)}}}function m(e,n){return Object.prototype.hasOwnProperty.call(n,e)}var K=c(function(n){return n==null}),b=K;function f(e){return Object.prototype.toString.call(e)==="[object Object]"}var W=d(function(n,r,t){var s={},o;for(o in r)m(o,r)&&(s[o]=m(o,t)?n(o,r[o],t[o]):r[o]);for(o in t)m(o,t)&&!m(o,s)&&(s[o]=t[o]);return s}),w=W;var q=d(function e(n,r,t){return w(function(s,o,u){return f(o)&&f(u)?e(n,o,u):n(s,o,u)},r,t)}),P=q;var z=l(function(n,r){return P(function(t,s,o){return o},n,r)}),C=z;var O=(e,n)=>b(n)?e:C(e,n);var J="application/json",g,y=[],H={"Content-Type":J},a={headers:{...H},credentials:"include",mode:"cors"},Ae=e=>g=e,Se=()=>g,Ve=e=>{y.push(e)},ke=()=>y,Qe=e=>{a={...a,...e}},Ke=()=>a,We=e=>{a={...a,headers:{...a.headers,...e}}},qe=()=>a==null?void 0:a.headers,ze=e=>{(a==null?void 0:a.headers[e])&&delete a.headers[e]},Je=()=>{a={...a,headers:{...H}}},Be=async(e,n,r)=>{let t=await fetch(N(g,e,r),O(n,a)),s=await T(t);return await R(s,y)};console.log("@uxland/fetch-client loaded");})();
/*

@@ -19,9 +19,1 @@ * @license

*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.INVALID_REQUEST_EVENT = exports.INVALID_CREDENTIALS_EVENT = void 0;
const tslib_1 = require("tslib");
/** @namespace FetchClient */
tslib_1.__exportStar(require("./fetch-client"), exports);
var handle_errors_1 = require("./handlers/handle-errors");
Object.defineProperty(exports, "INVALID_CREDENTIALS_EVENT", { enumerable: true, get: function () { return handle_errors_1.INVALID_CREDENTIALS_EVENT; } });
Object.defineProperty(exports, "INVALID_REQUEST_EVENT", { enumerable: true, get: function () { return handle_errors_1.INVALID_REQUEST_EVENT; } });
{
"name": "@uxland/fetch-client",
"version": "1.0.0",
"version": "1.0.1-alpha.0",
"description": "Fetch Client",

@@ -45,3 +45,7 @@ "author": "UXLand <dev@uxland.es>",

"jsdoc:mv": "mkdirp ../../docs/$npm_package_name/$npm_package_version && ncp docs/$npm_package_name/$npm_package_version ../../docs/$npm_package_name/$npm_package_version",
"postjsdoc": "yarn jsdoc:styles && yarn jsdoc:mv"
"postjsdoc": "yarn jsdoc:styles && yarn jsdoc:mv",
"esbuild:dts": "tsc --emitDeclarationOnly --noEmit false --declaration --removeComments false --outDir lib",
"esbuild:cjs": "esbuild src/index.ts --bundle --minify --target=es2018 --outfile=lib/index.js && yarn esbuild:dts",
"esbuild:es": "esbuild src/index.ts --bundle --minify --format=esm --outfile=es/index.js",
"esbuild": "npm-run-all --parallel esbuild:es esbuild:cjs"
},

@@ -61,2 +65,3 @@ "bugs": {

"cucumber": "^6.0.5",
"esbuild": "^0.9.0",
"jest": "^26.4.2",

@@ -75,6 +80,6 @@ "jest-cucumber": "^3.0.0",

"dependencies": {
"@uxland/event-aggregator": "^1.0.0",
"@uxland/event-aggregator": "^1.0.1-alpha.0",
"ramda": "^0.27.1"
},
"gitHead": "37a9a5a4c7bfade3e33dd14a09927c50298d005b"
"gitHead": "9e778804c70f26afdd596974b8cfa67f52ec97fe"
}

@@ -5,3 +5,3 @@ # UXL Fetch Client [![npm version](https://badge.fury.io/js/%40uxland%2Ffetch-client.svg)](https://badge.fury.io/js/%40uxland%2Ffetch-client)

| ----------------------------------------------- | --------------------------------------------- | ----------------------------------------- | ------------------------------------------- | ----------------------------------- |
| ![BuildStatus](#buildstatus# "Building Status") | ![Statements](#statements# "Make me better!") | ![Branches](#branches# "Make me better!") | ![Functions](#functions# "Make me better!") | ![Lines](#lines# "Make me better!") |
| ![BuildStatus](#buildstatus# "Building Status") | ![Statements](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg "Make me better!") | ![Branches](https://img.shields.io/badge/Coverage-96.43%25-brightgreen.svg "Make me better!") | ![Functions](https://img.shields.io/badge/Coverage-90%25-brightgreen.svg "Make me better!") | ![Lines](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg "Make me better!") |

@@ -8,0 +8,0 @@ ## Installation

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