byproxy-link
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,1 +0,1 @@ | ||
var byproxy=function(t,n){"use strict";function e(t){return function(e){return new Promise((r,o)=>{(async function(t,e,r){const o={method:"POST",credentials:r?"include":"same-origin",body:JSON.stringify(e)},a=new Headers;a.append("Content-Type","application/json"),o.headers=a;const i=new Request(t,o),c=await fetch(i);if(!c.ok){const t=await c.text();throw new n.RestError(c.status,t)}return await c.json()})(t,e,!1).then(t=>{t.error?o(t.error):r(t.value)}).catch(t=>{o(t)})})}}return t.link=function(t){return function t(n,e=[]){return new Proxy(function(){},{get(r,o,a){if("then"===o){if(0===e.length)return{then:()=>a};const t=n({type:"GET",path:e});return t.then.bind(t)}return t(n,e.concat(o))},set:(t,r,o)=>n({type:"SET",path:e.concat(r),args:[o]}),apply:(t,r,o)=>n({type:"APPLY",path:e,args:o||[]})})}(e(t))},t}({},byproxyCommon); | ||
var byproxy=function(t){"use strict";class n extends Error{constructor(t,n){super(n),this.code=t}}function e(t){return function(e){return new Promise((r,o)=>{(async function(t,e,r){const o={method:"POST",credentials:r?"include":"same-origin",body:JSON.stringify(e)},a=new Headers;a.append("Content-Type","application/json"),o.headers=a;const c=new Request(t,o),s=await fetch(c);if(!s.ok){const t=await s.text();throw new n(s.status,t)}return await s.json()})(t,e,!1).then(t=>{t.error?o(t.error):r(t.value)}).catch(t=>{o(t)})})}}return t.link=function(t){return function t(n,e=[]){return new Proxy(function(){},{get(r,o,a){if("then"===o){if(0===e.length)return{then:()=>a};const t=n({type:"GET",path:e});return t.then.bind(t)}return t(n,e.concat(o))},set:(t,r,o)=>n({type:"SET",path:e.concat(r),args:[o]}),apply:(t,r,o)=>n({type:"APPLY",path:e,args:o||[]})})}(e(t))},t}({}); |
@@ -1,1 +0,1 @@ | ||
import{RestError as t}from"byproxy-common";function n(n){return function(e){return new Promise((r,o)=>{(async function(n,e,r){const o={method:"POST",credentials:r?"include":"same-origin",body:JSON.stringify(e)},a=new Headers;a.append("Content-Type","application/json"),o.headers=a;const i=new Request(n,o),c=await fetch(i);if(!c.ok){const n=await c.text();throw new t(c.status,n)}return await c.json()})(n,e,!1).then(t=>{t.error?o(t.error):r(t.value)}).catch(t=>{o(t)})})}}function e(t){return function t(n,e=[]){return new Proxy(function(){},{get(r,o,a){if("then"===o){if(0===e.length)return{then:()=>a};const t=n({type:"GET",path:e});return t.then.bind(t)}return t(n,e.concat(o))},set:(t,r,o)=>n({type:"SET",path:e.concat(r),args:[o]}),apply:(t,r,o)=>n({type:"APPLY",path:e,args:o||[]})})}(n(t))}export{e as link}; | ||
class t extends Error{constructor(t,n){super(n),this.code=t}}function n(n){return function(e){return new Promise((r,o)=>{(async function(n,e,r){const o={method:"POST",credentials:r?"include":"same-origin",body:JSON.stringify(e)},a=new Headers;a.append("Content-Type","application/json"),o.headers=a;const c=new Request(n,o),s=await fetch(c);if(!s.ok){const n=await s.text();throw new t(s.status,n)}return await s.json()})(n,e,!1).then(t=>{t.error?o(t.error):r(t.value)}).catch(t=>{o(t)})})}}function e(t){return function t(n,e=[]){return new Proxy(function(){},{get(r,o,a){if("then"===o){if(0===e.length)return{then:()=>a};const t=n({type:"GET",path:e});return t.then.bind(t)}return t(n,e.concat(o))},set:(t,r,o)=>n({type:"SET",path:e.concat(r),args:[o]}),apply:(t,r,o)=>n({type:"APPLY",path:e,args:o||[]})})}(n(t))}export{e as link}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("byproxy-common")):"function"==typeof define&&define.amd?define(["exports","byproxy-common"],t):t((e=e||self).byproxy={},e.byproxyCommon)}(this,function(e,t){"use strict";function n(e){return function(n){return new Promise((o,r)=>{(async function(e,n,o){const r={method:"POST",credentials:o?"include":"same-origin",body:JSON.stringify(n)},i=new Headers;i.append("Content-Type","application/json"),r.headers=i;const c=new Request(e,r),s=await fetch(c);if(!s.ok){const e=await s.text();throw new t.RestError(s.status,e)}return await s.json()})(e,n,!1).then(e=>{e.error?r(e.error):o(e.value)}).catch(e=>{r(e)})})}}e.link=function(e){return function e(t,n=[]){return new Proxy(function(){},{get(o,r,i){if("then"===r){if(0===n.length)return{then:()=>i};const e=t({type:"GET",path:n});return e.then.bind(e)}return e(t,n.concat(r))},set:(e,o,r)=>t({type:"SET",path:n.concat(o),args:[r]}),apply:(e,o,r)=>t({type:"APPLY",path:n,args:r||[]})})}(n(e))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).byproxy={})}(this,function(e){"use strict";class t extends Error{constructor(e,t){super(t),this.code=e}}function n(e){return function(n){return new Promise((r,o)=>{(async function(e,n,r){const o={method:"POST",credentials:r?"include":"same-origin",body:JSON.stringify(n)},i=new Headers;i.append("Content-Type","application/json"),o.headers=i;const s=new Request(e,o),c=await fetch(s);if(!c.ok){const e=await c.text();throw new t(c.status,e)}return await c.json()})(e,n,!1).then(e=>{e.error?o(e.error):r(e.value)}).catch(e=>{o(e)})})}}e.link=function(e){return function e(t,n=[]){return new Proxy(function(){},{get(r,o,i){if("then"===o){if(0===n.length)return{then:()=>i};const e=t({type:"GET",path:n});return e.then.bind(e)}return e(t,n.concat(o))},set:(e,r,o)=>t({type:"SET",path:n.concat(r),args:[o]}),apply:(e,r,o)=>t({type:"APPLY",path:n,args:o||[]})})}(n(e))},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "byproxy-link", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Simple solution to proxy objects on the server to the client", | ||
@@ -30,7 +30,8 @@ "main": "lib/byproxy-link.umd.js", | ||
"devDependencies": { | ||
"byproxy-common": "^0.0.1", | ||
"byproxy-common": "^0.0.2", | ||
"rollup": "^1.7.0", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-terser": "^4.0.4" | ||
}, | ||
"gitHead": "0c39608c44568c545ec8016a12d9620594c3f7bf" | ||
"gitHead": "aca38af6700f275ed6d5fa089924446f7112d967" | ||
} |
@@ -0,1 +1,2 @@ | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import { terser } from "rollup-plugin-terser"; | ||
@@ -11,3 +12,3 @@ | ||
}, | ||
plugins: [terser()] | ||
plugins: [resolve(), terser()] | ||
}, | ||
@@ -21,3 +22,3 @@ { | ||
}, | ||
plugins: [terser()] | ||
plugins: [resolve(), terser()] | ||
}, | ||
@@ -30,4 +31,4 @@ { | ||
}, | ||
plugins: [terser()] | ||
plugins: [resolve(), terser()] | ||
} | ||
]; |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
9427
156
2
4