picosanity
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -6,3 +6,3 @@ "use strict"; | ||
module.exports = function (cfg) { | ||
return new Client(cfg, window.fetch); | ||
return new Client(cfg, (input, init) => window.fetch(input, init)); | ||
}; |
{ | ||
"name": "picosanity", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Tiny Sanity client alternative should you only need to do queries", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
const Client = require('./client') | ||
module.exports = function(cfg) { | ||
return new Client(cfg, window.fetch) | ||
return new Client(cfg, (input, init) => window.fetch(input, init)) | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PicoSanity=e():t.PicoSanity=e()}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";const o=n(1);t.exports=function(t){return new o(t,window.fetch)}},function(t,e,n){"use strict";const o=encodeURIComponent;function r(t,e){if(!(this instanceof r))return new r(t);this.clientConfig=t,this.fetcher=e}["clone","create","createIfNotExists","createOrReplace","delete","listen","mutate","patch","transaction"].forEach(t=>{r.prototype[t]=function(t){return()=>{throw new Error(`Method "${t}" not implemented, use @sanity/client`)}}(t)}),r.prototype.config=function(t){return t?(this.clientConfig=Object.assign({},this.clientConfig,t),this):this.clientConfig},r.prototype.fetch=function(t,e){const n=this.clientConfig,r=n.useCdn?"apicdn.sanity.io":"api.sanity.io",i={credentials:n.withCredentials?"include":"omit"},c=function(t,e){const n=`?query=${o(t)}`;return Object.keys(e||{}).reduce((t,n)=>`${t}&${o(`$${n}`)}=${o(JSON.stringify(e[n]))}`,n)}(t,e);return this.fetcher(`https://${n.projectId}.${r}/v1/data/query/${n.dataset}${c}`,i).then(t=>t.json()).then(t=>t.result)},t.exports=r}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PicoSanity=e():t.PicoSanity=e()}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";const o=n(1);t.exports=function(t){return new o(t,(t,e)=>window.fetch(t,e))}},function(t,e,n){"use strict";const o=encodeURIComponent;function r(t,e){if(!(this instanceof r))return new r(t);this.clientConfig=t,this.fetcher=e}["clone","create","createIfNotExists","createOrReplace","delete","listen","mutate","patch","transaction"].forEach(t=>{r.prototype[t]=function(t){return()=>{throw new Error(`Method "${t}" not implemented, use @sanity/client`)}}(t)}),r.prototype.config=function(t){return t?(this.clientConfig=Object.assign({},this.clientConfig,t),this):this.clientConfig},r.prototype.fetch=function(t,e){const n=this.clientConfig,r=n.useCdn?"apicdn.sanity.io":"api.sanity.io",i={credentials:n.withCredentials?"include":"omit"},c=function(t,e){const n=`?query=${o(t)}`;return Object.keys(e||{}).reduce((t,n)=>`${t}&${o(`$${n}`)}=${o(JSON.stringify(e[n]))}`,n)}(t,e);return this.fetcher(`https://${n.projectId}.${r}/v1/data/query/${n.dataset}${c}`,i).then(t=>t.json()).then(t=>t.result)},t.exports=r}])})); |
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
12157