@sanity/client 6.25.0-alpha.0 → 6.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/resolveEditInfo.cjs +1 -2
- package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaClean.cjs +1 -2
- package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -2
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
- package/dist/_chunks-es/resolveEditInfo.js +1 -2
- package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
- package/dist/_chunks-es/stegaClean.js +1 -2
- package/dist/_chunks-es/stegaClean.js.map +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -2
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
- package/dist/csm.cjs +1 -2
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.d.cts +99 -34
- package/dist/csm.d.ts +99 -34
- package/dist/csm.js +1 -2
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +31 -20
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +11 -4
- package/dist/index.browser.d.ts +11 -4
- package/dist/index.browser.js +31 -20
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +32 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +32 -21
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +3419 -96
- package/dist/stega.browser.d.ts +3419 -96
- package/dist/stega.d.cts +3419 -96
- package/dist/stega.d.ts +3419 -96
- package/package.json +8 -8
- package/src/data/transaction.ts +26 -1
- package/src/defineCreateClient.ts +5 -3
- package/src/http/request.ts +15 -8
- package/src/types.ts +1 -0
- package/umd/sanityClient.js +156 -161
- package/umd/sanityClient.min.js +2 -2
package/umd/sanityClient.js
CHANGED
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const e=!(typeof navigator>"u")&&"ReactNative"===navigator.product,t={timeout:e?6e4:12e4},r=function(r){const a={...t,..."string"==typeof r?{url:r}:r};if(a.timeout=n$1(a.timeout),a.query){const{url:t,searchParams:r}=function(t){const r=t.indexOf("?");if(-1===r)return {url:t,searchParams:new URLSearchParams};const n=t.slice(0,r),a=t.slice(r+1);if(!e)return {url:n,searchParams:new URLSearchParams(a)};if("function"!=typeof decodeURIComponent)throw new Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");const s=new URLSearchParams;for(const e of a.split("&")){const[t,r]=e.split("=");t&&s.append(o$1(t),o$1(r||""));}return {url:n,searchParams:s}}(a.url);for(const[e,o]of Object.entries(a.query)){if(
|
|
22
|
+
const e=!(typeof navigator>"u")&&"ReactNative"===navigator.product,t={timeout:e?6e4:12e4},r=function(r){const a={...t,..."string"==typeof r?{url:r}:r};if(a.timeout=n$1(a.timeout),a.query){const{url:t,searchParams:r}=function(t){const r=t.indexOf("?");if(-1===r)return {url:t,searchParams:new URLSearchParams};const n=t.slice(0,r),a=t.slice(r+1);if(!e)return {url:n,searchParams:new URLSearchParams(a)};if("function"!=typeof decodeURIComponent)throw new Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");const s=new URLSearchParams;for(const e of a.split("&")){const[t,r]=e.split("=");t&&s.append(o$1(t),o$1(r||""));}return {url:n,searchParams:s}}(a.url);for(const[e,o]of Object.entries(a.query)){if(undefined!==o)if(Array.isArray(o))for(const t of o)r.append(e,t);else r.append(e,o);const n=r.toString();n&&(a.url=`${t}?${n}`);}}return a.method=a.body&&!a.method?"POST":(a.method||"GET").toUpperCase(),a};function o$1(e){return decodeURIComponent(e.replace(/\+/g," "))}function n$1(e){if(false===e||0===e)return false;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n$1(t.timeout):{connect:r,socket:r}}const a$2=/^https?:\/\//i,s$2=function(e){if(!a$2.test(e.url))throw new Error(`"${e.url}" is not a valid URL`)};function c$3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}
|
|
23
23
|
|
|
24
|
-
const o=["request","response","progress","error","abort"],s$1=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function n(r$1,a){const i=[],u=s$1.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s$2]});function l(e){const t=o.reduce(((e,t)=>(e[t]=function(){const e
|
|
24
|
+
const o=["request","response","progress","error","abort"],s$1=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function n(r$1,a){const i=[],u=s$1.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s$2]});function l(e){const t=o.reduce(((e,t)=>(e[t]=function(){const e=/* @__PURE__ */Object.create(null);let t=0;return {publish:function(t){for(const r in e)e[r](t);},subscribe:function(r){const o=t++;return e[o]=r,function(){delete e[o];}}}}(),e)),{}),r=(e=>function(t,r,...o){const s="onError"===t;let n=r;for(let r=0;r<e[t].length&&(n=(0, e[t][r])(n,...o),!s||n);r++);return n})(u),s=r("processOptions",e);r("validateOptions",s);const n={options:s,channels:t,applyMiddleware:r};let i;const l=t.request.subscribe((e=>{i=a(e,((o,s)=>((e,o,s)=>{let n=e,a=o;if(!n)try{a=r("onResponse",o,s);}catch(e){a=null,n=e;}n=n&&r("onError",n,s),n?t.error.publish(n):a&&t.response.publish(a);})(o,s,e)));}));t.abort.subscribe((()=>{l(),i&&i.abort();}));const c=r("onReturn",t,n);return c===t&&t.request.publish(n),c}return l.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&u.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return s$1.forEach((t=>{e[t]&&u[t].push(e[t]);})),i.push(e),l},l.clone=()=>n(i,a),r$1.forEach(l.use),l}var a$1,i,u$2=/* @__PURE__ */c$3(function(){if(i)return a$1;i=1;var e=function(e){return e.replace(/^\s+|\s+$/g,"")};return a$1=function(t){if(!t)return {};for(var r={},o=e(t).split("\n"),s=0;s<o.length;s++){var n=o[s],a=n.indexOf(":"),i=e(n.slice(0,a)).toLowerCase(),u=e(n.slice(a+1));typeof r[i]>"u"?r[i]=u:(l=r[i],"[object Array]"===Object.prototype.toString.call(l)?r[i].push(u):r[i]=[r[i],u]);}var l;return r}}());let l$1 = class l{onabort;onerror;onreadystatechange;ontimeout;readyState=0;response;responseText="";responseType="";status;statusText;withCredentials;#e;#t;#r;#o={};#s;#n={};#a;open(e,t,r){this.#e=e,this.#t=t,this.#r="",this.readyState=1,this.onreadystatechange?.(),this.#s=undefined;}abort(){this.#s&&this.#s.abort();}getAllResponseHeaders(){return this.#r}setRequestHeader(e,t){this.#o[e]=t;}setInit(e,t=true){this.#n=e,this.#a=t;}send(e){const t="arraybuffer"!==this.responseType,r={...this.#n,method:this.#e,headers:this.#o,body:e};"function"==typeof AbortController&&this.#a&&(this.#s=new AbortController,typeof EventTarget<"u"&&this.#s.signal instanceof EventTarget&&(r.signal=this.#s.signal)),typeof document<"u"&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this.#t,r).then((e=>(e.headers.forEach(((e,t)=>{this.#r+=`${t}: ${e}\r\n`;})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,this.onreadystatechange?.(),t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange?.();})).catch((e=>{"AbortError"!==e.name?this.onerror?.(e):this.onabort?.();}));}};const c$2="function"==typeof XMLHttpRequest?"xhr":"fetch",h="xhr"===c$2?XMLHttpRequest:l$1,d$1=(e,t)=>{const r=e.options,o=e.applyMiddleware("finalizeOptions",r),s={},n=e.applyMiddleware("interceptRequest",undefined,{adapter:c$2,context:e});if(n){const e=setTimeout(t,0,null,n);return {abort:()=>clearTimeout(e)}}let a=new h;a instanceof l$1&&"object"==typeof o.fetch&&a.setInit(o.fetch,o.useAbortSignal??true);const i=o.headers,d=o.timeout;let p=false,f=false,b=false;if(a.onerror=e=>{m(a instanceof l$1?e instanceof Error?e:new Error(`Request error while attempting to reach is ${o.url}`,{cause:e}):new Error(`Request error while attempting to reach is ${o.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`));},a.ontimeout=e=>{m(new Error(`Request timeout while attempting to reach ${o.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`));},a.onabort=()=>{w(true),p=true;},a.onreadystatechange=()=>{d&&(w(),s.socket=setTimeout((()=>y("ESOCKETTIMEDOUT")),d.socket)),!p&&4===a.readyState&&0!==a.status&&function(){if(!(p||f||b)){if(0===a.status)return void m(new Error("Unknown XHR error"));w(),f=true,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:u$2(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText});}}();},a.open(o.method,o.url,true),a.withCredentials=!!o.withCredentials,i&&a.setRequestHeader)for(const e in i)i.hasOwnProperty(e)&&a.setRequestHeader(e,i[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:c$2,request:a,context:e}),a.send(o.body||null),d&&(s.connect=setTimeout((()=>y("ETIMEDOUT")),d.connect)),{abort:function(){p=true,a&&a.abort();}};function y(t){b=true,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?`Socket timed out on request to ${o.url}`:`Connection timed out on request to ${o.url}`);r.code=t,e.channels.error.publish(r);}function w(e){(e||p||a.readyState>=2&&s.connect)&&clearTimeout(s.connect),s.socket&&clearTimeout(s.socket);}function m(e){if(f)return;w(true),f=true,a=null;const r=e||new Error(`Network error while attempting to reach ${o.url}`);r.isNetworkError=true,r.request=o,t(r);}},p$1=(e=[],t=d$1)=>n(e,t),f$1="browser";
|
|
25
25
|
|
|
26
|
-
var a,c$1,u$1={exports:{}}
|
|
26
|
+
var a,c$1,u$1,l,p,d={exports:{}};/* @__PURE__ */c$3((p||(p=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;t.splice(1,0,s,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(r=n));})),t.splice(r,0,s);},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug");}catch{}},t.load=function(){let e;try{e=t.storage.getItem("debug");}catch{}return !e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return !(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch{}}(),t.destroy=/* @__PURE__ */(()=>{let e=false;return ()=>{e||(e=true,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=(l?u$1:(l=1,u$1=function(e){function t(e){let n,r,o,i=null;function a(...e){if(!a.enabled)return;const s=a,r=Number(/* @__PURE__ */new Date),o=r-(n||r);s.diff=o,s.prev=n,s.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return "%";i++;const o=t.formatters[r];if("function"==typeof o){const t=e[i];n=o.call(s,t),e.splice(i,1),i--;}return n})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e);}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=s,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:true,configurable:false,get:()=>null!==i?i:(r!==t.namespaces&&(r=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e;}}),"function"==typeof t.init&&t.init(a),a}function s(e,s){const n=t(this.namespace+(typeof s>"u"?":":s)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let s;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),r=n.length;for(s=0;s<r;s++)n[s]&&("-"===(e=n[s].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")));},t.enabled=function(e){if("*"===e[e.length-1])return true;let s,n;for(s=0,n=t.skips.length;s<n;s++)if(t.skips[s].test(e))return false;for(s=0,n=t.names.length;s<n;s++)if(t.names[s].test(e))return true;return false},t.humanize=function(){if(c$1)return a;c$1=1;var e=1e3,t=60*e,s=60*t,n=24*s,r=7*n;function o(e,t,s,n){var r=t>=1.5*s;return Math.round(e/s)+" "+n+(r?"s":"")}return a=function(i,a){a=a||{};var c,u,l=typeof i;if("string"===l&&i.length>0)return function(o){if(!((o=String(o)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(i){var a=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return 315576e5*a;case "weeks":case "week":case "w":return a*r;case "days":case "day":case "d":return a*n;case "hours":case "hour":case "hrs":case "hr":case "h":return a*s;case "minutes":case "minute":case "mins":case "min":case "m":return a*t;case "seconds":case "second":case "secs":case "sec":case "s":return a*e;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return a;default:return}}}}(i);if("number"===l&&isFinite(i))return a.long?(c=i,(u=Math.abs(c))>=n?o(c,u,n,"day"):u>=s?o(c,u,s,"hour"):u>=t?o(c,u,t,"minute"):u>=e?o(c,u,e,"second"):c+" ms"):function(r){var o=Math.abs(r);return o>=n?Math.round(r/n)+"d":o>=s?Math.round(r/s)+"h":o>=t?Math.round(r/t)+"m":o>=e?Math.round(r/e)+"s":r+"ms"}(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");},Object.keys(e).forEach((s=>{t[s]=e[s];})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let s=0;for(let t=0;t<e.length;t++)s=(s<<5)-s+e.charCodeAt(t),s|=0;return t.colors[Math.abs(s)%t.colors.length]},t.enable(t.load()),t}))(t);const{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return "[UnexpectedJSONParseError]: "+e.message}};}(d,d.exports)),d.exports));const F=typeof Buffer>"u"?()=>false:e=>Buffer.isBuffer(e);function O$1(e){return "[object Object]"===Object.prototype.toString.call(e)}function j(e){if(false===O$1(e))return false;const t=e.constructor;if(undefined===t)return true;const s=t.prototype;return !(false===O$1(s)||false===s.hasOwnProperty("isPrototypeOf"))}const v=["boolean","string","number"];function x(){return {processOptions:e=>{const t=e.body;return !t||"function"==typeof t.pipe||F(t)||-1===v.indexOf(typeof t)&&!Array.isArray(t)&&!j(t)?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})})}}}function E$1(e){return {onResponse:s=>{const n=s.headers["content-type"]||"",r=e&&e.force||-1!==n.indexOf("application/json");return s.body&&n&&r?Object.assign({},s,{body:t(s.body)}):s},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}}let k={};typeof globalThis<"u"?k=globalThis:typeof window<"u"?k=window:typeof global<"u"?k=global:typeof self<"u"&&(k=self);var q=k;function A(e={}){const t=e.implementation||q.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return {onReturn:(e,s)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete();})),e.request.publish(s),()=>e.abort.publish())))}}function S$1(){return {onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,s=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;s.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable});}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"));}}}var M=(e,t,s)=>("GET"===s.method||"HEAD"===s.method)&&(e.isNetworkError||false);function _$1(e){return 100*Math.pow(2,e)+100*Math.random()}const P=(e={})=>(e=>{const t=e.maxRetries||5,s=e.retryDelay||_$1,n=e.shouldRetry;return {onError:(e,r)=>{const o=r.options,i=o.maxRetries||t,a=o.retryDelay||s,c=o.shouldRetry||n,u=o.attemptNumber||0;if(null!==(l=o.body)&&"object"==typeof l&&"function"==typeof l.pipe||!c(e,u,o)||u>=i)return e;var l;const p=Object.assign({},r,{options:Object.assign({},o,{attemptNumber:u+1})});return setTimeout((()=>r.channels.request.publish(p)),a(u)),null}}})({shouldRetry:M,...e});P.shouldRetry=M;
|
|
27
27
|
|
|
28
28
|
/******************************************************************************
|
|
29
29
|
Copyright (c) Microsoft Corporation.
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
}
|
|
91
91
|
op = body.call(thisArg, _);
|
|
92
92
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
93
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] :
|
|
93
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : undefined, done: true };
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
if (m) return m.call(o);
|
|
100
100
|
if (o && typeof o.length === "number") return {
|
|
101
101
|
next: function () {
|
|
102
|
-
if (o && i >= o.length) o =
|
|
102
|
+
if (o && i >= o.length) o = undefined;
|
|
103
103
|
return { value: o && o[i++], done: !o };
|
|
104
104
|
}
|
|
105
105
|
};
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
}
|
|
286
286
|
teardown._addParent(this);
|
|
287
287
|
}
|
|
288
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !==
|
|
288
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== undefined ? _a : []).push(teardown);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
};
|
|
@@ -348,11 +348,11 @@
|
|
|
348
348
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
349
349
|
args[_i - 2] = arguments[_i];
|
|
350
350
|
}
|
|
351
|
-
return setTimeout.apply(
|
|
351
|
+
return setTimeout.apply(undefined, __spreadArray([handler, timeout], __read(args)));
|
|
352
352
|
},
|
|
353
353
|
clearTimeout: function (handle) {
|
|
354
354
|
var delegate = timeoutProvider.delegate;
|
|
355
|
-
return ((delegate === null || delegate ===
|
|
355
|
+
return ((delegate === null || delegate === undefined ? undefined : delegate.clearTimeout) || clearTimeout)(handle);
|
|
356
356
|
},
|
|
357
357
|
delegate: undefined,
|
|
358
358
|
};
|
|
@@ -440,10 +440,6 @@
|
|
|
440
440
|
};
|
|
441
441
|
return Subscriber;
|
|
442
442
|
}(Subscription));
|
|
443
|
-
var _bind = Function.prototype.bind;
|
|
444
|
-
function bind(fn, thisArg) {
|
|
445
|
-
return _bind.call(fn, thisArg);
|
|
446
|
-
}
|
|
447
443
|
var ConsumerObserver = (function () {
|
|
448
444
|
function ConsumerObserver(partialObserver) {
|
|
449
445
|
this.partialObserver = partialObserver;
|
|
@@ -493,23 +489,13 @@
|
|
|
493
489
|
var partialObserver;
|
|
494
490
|
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
495
491
|
partialObserver = {
|
|
496
|
-
next: (observerOrNext !== null && observerOrNext !==
|
|
497
|
-
error: error !== null && error !==
|
|
498
|
-
complete: complete !== null && complete !==
|
|
492
|
+
next: (observerOrNext !== null && observerOrNext !== undefined ? observerOrNext : undefined),
|
|
493
|
+
error: error !== null && error !== undefined ? error : undefined,
|
|
494
|
+
complete: complete !== null && complete !== undefined ? complete : undefined,
|
|
499
495
|
};
|
|
500
496
|
}
|
|
501
497
|
else {
|
|
502
|
-
|
|
503
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
504
|
-
context_1 = Object.create(observerOrNext);
|
|
505
|
-
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
506
|
-
partialObserver = {
|
|
507
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
508
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
509
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
498
|
+
{
|
|
513
499
|
partialObserver = observerOrNext;
|
|
514
500
|
}
|
|
515
501
|
}
|
|
@@ -616,7 +602,7 @@
|
|
|
616
602
|
};
|
|
617
603
|
Observable.prototype._subscribe = function (subscriber) {
|
|
618
604
|
var _a;
|
|
619
|
-
return (_a = this.source) === null || _a ===
|
|
605
|
+
return (_a = this.source) === null || _a === undefined ? undefined : _a.subscribe(subscriber);
|
|
620
606
|
};
|
|
621
607
|
Observable.prototype[observable] = function () {
|
|
622
608
|
return this;
|
|
@@ -643,7 +629,7 @@
|
|
|
643
629
|
}());
|
|
644
630
|
function getPromiseCtor(promiseCtor) {
|
|
645
631
|
var _a;
|
|
646
|
-
return (_a = promiseCtor !== null && promiseCtor !==
|
|
632
|
+
return (_a = promiseCtor !== null && promiseCtor !== undefined ? promiseCtor : config.Promise) !== null && _a !== undefined ? _a : Promise;
|
|
647
633
|
}
|
|
648
634
|
function isObserver(value) {
|
|
649
635
|
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
@@ -653,7 +639,7 @@
|
|
|
653
639
|
}
|
|
654
640
|
|
|
655
641
|
function hasLift(source) {
|
|
656
|
-
return isFunction(source === null || source ===
|
|
642
|
+
return isFunction(source === null || source === undefined ? undefined : source.lift);
|
|
657
643
|
}
|
|
658
644
|
function operate(init) {
|
|
659
645
|
return function (source) {
|
|
@@ -723,7 +709,7 @@
|
|
|
723
709
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
724
710
|
var closed_1 = this.closed;
|
|
725
711
|
_super.prototype.unsubscribe.call(this);
|
|
726
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a ===
|
|
712
|
+
!closed_1 && ((_a = this.onFinalize) === null || _a === undefined ? undefined : _a.call(this));
|
|
727
713
|
}
|
|
728
714
|
};
|
|
729
715
|
return OperatorSubscriber;
|
|
@@ -818,7 +804,7 @@
|
|
|
818
804
|
Object.defineProperty(Subject.prototype, "observed", {
|
|
819
805
|
get: function () {
|
|
820
806
|
var _a;
|
|
821
|
-
return ((_a = this.observers) === null || _a ===
|
|
807
|
+
return ((_a = this.observers) === null || _a === undefined ? undefined : _a.length) > 0;
|
|
822
808
|
},
|
|
823
809
|
enumerable: false,
|
|
824
810
|
configurable: true
|
|
@@ -874,19 +860,19 @@
|
|
|
874
860
|
}
|
|
875
861
|
AnonymousSubject.prototype.next = function (value) {
|
|
876
862
|
var _a, _b;
|
|
877
|
-
(_b = (_a = this.destination) === null || _a ===
|
|
863
|
+
(_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.next) === null || _b === undefined ? undefined : _b.call(_a, value);
|
|
878
864
|
};
|
|
879
865
|
AnonymousSubject.prototype.error = function (err) {
|
|
880
866
|
var _a, _b;
|
|
881
|
-
(_b = (_a = this.destination) === null || _a ===
|
|
867
|
+
(_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.error) === null || _b === undefined ? undefined : _b.call(_a, err);
|
|
882
868
|
};
|
|
883
869
|
AnonymousSubject.prototype.complete = function () {
|
|
884
870
|
var _a, _b;
|
|
885
|
-
(_b = (_a = this.destination) === null || _a ===
|
|
871
|
+
(_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.complete) === null || _b === undefined ? undefined : _b.call(_a);
|
|
886
872
|
};
|
|
887
873
|
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
888
874
|
var _a, _b;
|
|
889
|
-
return (_b = (_a = this.source) === null || _a ===
|
|
875
|
+
return (_b = (_a = this.source) === null || _a === undefined ? undefined : _a.subscribe(subscriber)) !== null && _b !== undefined ? _b : EMPTY_SUBSCRIPTION;
|
|
890
876
|
};
|
|
891
877
|
return AnonymousSubject;
|
|
892
878
|
}(Subject));
|
|
@@ -901,9 +887,9 @@
|
|
|
901
887
|
var ReplaySubject = (function (_super) {
|
|
902
888
|
__extends(ReplaySubject, _super);
|
|
903
889
|
function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) {
|
|
904
|
-
if (_bufferSize ===
|
|
905
|
-
if (_windowTime ===
|
|
906
|
-
if (_timestampProvider ===
|
|
890
|
+
if (_bufferSize === undefined) { _bufferSize = Infinity; }
|
|
891
|
+
if (_windowTime === undefined) { _windowTime = Infinity; }
|
|
892
|
+
if (_timestampProvider === undefined) { _timestampProvider = dateTimestampProvider; }
|
|
907
893
|
var _this = _super.call(this) || this;
|
|
908
894
|
_this._bufferSize = _bufferSize;
|
|
909
895
|
_this._windowTime = _windowTime;
|
|
@@ -969,7 +955,7 @@
|
|
|
969
955
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
970
956
|
args[_i - 2] = arguments[_i];
|
|
971
957
|
}
|
|
972
|
-
return setInterval.apply(
|
|
958
|
+
return setInterval.apply(undefined, __spreadArray([handler, timeout], __read(args)));
|
|
973
959
|
},
|
|
974
960
|
clearInterval: function (handle) {
|
|
975
961
|
return (clearInterval)(handle);
|
|
@@ -988,7 +974,7 @@
|
|
|
988
974
|
}
|
|
989
975
|
AsyncAction.prototype.schedule = function (state, delay) {
|
|
990
976
|
var _a;
|
|
991
|
-
if (delay ===
|
|
977
|
+
if (delay === undefined) { delay = 0; }
|
|
992
978
|
if (this.closed) {
|
|
993
979
|
return this;
|
|
994
980
|
}
|
|
@@ -1000,15 +986,15 @@
|
|
|
1000
986
|
}
|
|
1001
987
|
this.pending = true;
|
|
1002
988
|
this.delay = delay;
|
|
1003
|
-
this.id = (_a = this.id) !== null && _a !==
|
|
989
|
+
this.id = (_a = this.id) !== null && _a !== undefined ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
|
1004
990
|
return this;
|
|
1005
991
|
};
|
|
1006
992
|
AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
|
|
1007
|
-
if (delay ===
|
|
993
|
+
if (delay === undefined) { delay = 0; }
|
|
1008
994
|
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
1009
995
|
};
|
|
1010
996
|
AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
|
|
1011
|
-
if (delay ===
|
|
997
|
+
if (delay === undefined) { delay = 0; }
|
|
1012
998
|
if (delay != null && this.delay === delay && this.pending === false) {
|
|
1013
999
|
return id;
|
|
1014
1000
|
}
|
|
@@ -1064,12 +1050,12 @@
|
|
|
1064
1050
|
|
|
1065
1051
|
var Scheduler = (function () {
|
|
1066
1052
|
function Scheduler(schedulerActionCtor, now) {
|
|
1067
|
-
if (now ===
|
|
1053
|
+
if (now === undefined) { now = Scheduler.now; }
|
|
1068
1054
|
this.schedulerActionCtor = schedulerActionCtor;
|
|
1069
1055
|
this.now = now;
|
|
1070
1056
|
}
|
|
1071
1057
|
Scheduler.prototype.schedule = function (work, delay, state) {
|
|
1072
|
-
if (delay ===
|
|
1058
|
+
if (delay === undefined) { delay = 0; }
|
|
1073
1059
|
return new this.schedulerActionCtor(this, work).schedule(state, delay);
|
|
1074
1060
|
};
|
|
1075
1061
|
Scheduler.now = dateTimestampProvider.now;
|
|
@@ -1079,7 +1065,7 @@
|
|
|
1079
1065
|
var AsyncScheduler = (function (_super) {
|
|
1080
1066
|
__extends(AsyncScheduler, _super);
|
|
1081
1067
|
function AsyncScheduler(SchedulerAction, now) {
|
|
1082
|
-
if (now ===
|
|
1068
|
+
if (now === undefined) { now = Scheduler.now; }
|
|
1083
1069
|
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1084
1070
|
_this.actions = [];
|
|
1085
1071
|
_this._active = false;
|
|
@@ -1131,7 +1117,7 @@
|
|
|
1131
1117
|
var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
|
1132
1118
|
|
|
1133
1119
|
function isPromise(value) {
|
|
1134
|
-
return isFunction(value === null || value ===
|
|
1120
|
+
return isFunction(value === null || value === undefined ? undefined : value.then);
|
|
1135
1121
|
}
|
|
1136
1122
|
|
|
1137
1123
|
function isInteropObservable(input) {
|
|
@@ -1139,7 +1125,7 @@
|
|
|
1139
1125
|
}
|
|
1140
1126
|
|
|
1141
1127
|
function isAsyncIterable(obj) {
|
|
1142
|
-
return Symbol.asyncIterator && isFunction(obj === null || obj ===
|
|
1128
|
+
return Symbol.asyncIterator && isFunction(obj === null || obj === undefined ? undefined : obj[Symbol.asyncIterator]);
|
|
1143
1129
|
}
|
|
1144
1130
|
|
|
1145
1131
|
function createInvalidObservableTypeError(input) {
|
|
@@ -1155,7 +1141,7 @@
|
|
|
1155
1141
|
var iterator = getSymbolIterator();
|
|
1156
1142
|
|
|
1157
1143
|
function isIterable(input) {
|
|
1158
|
-
return isFunction(input === null || input ===
|
|
1144
|
+
return isFunction(input === null || input === undefined ? undefined : input[iterator]);
|
|
1159
1145
|
}
|
|
1160
1146
|
|
|
1161
1147
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
@@ -1174,7 +1160,7 @@
|
|
|
1174
1160
|
case 3:
|
|
1175
1161
|
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
1176
1162
|
if (!done) return [3, 5];
|
|
1177
|
-
return [4, __await(
|
|
1163
|
+
return [4, __await(undefined)];
|
|
1178
1164
|
case 4: return [2, _b.sent()];
|
|
1179
1165
|
case 5: return [4, __await(value)];
|
|
1180
1166
|
case 6: return [4, _b.sent()];
|
|
@@ -1191,7 +1177,7 @@
|
|
|
1191
1177
|
});
|
|
1192
1178
|
}
|
|
1193
1179
|
function isReadableStreamLike(obj) {
|
|
1194
|
-
return isFunction(obj === null || obj ===
|
|
1180
|
+
return isFunction(obj === null || obj === undefined ? undefined : obj.getReader);
|
|
1195
1181
|
}
|
|
1196
1182
|
|
|
1197
1183
|
function innerFrom(input) {
|
|
@@ -1282,7 +1268,7 @@
|
|
|
1282
1268
|
function process$1(asyncIterable, subscriber) {
|
|
1283
1269
|
var asyncIterable_1, asyncIterable_1_1;
|
|
1284
1270
|
var e_2, _a;
|
|
1285
|
-
return __awaiter(this,
|
|
1271
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
1286
1272
|
var value, e_2_1;
|
|
1287
1273
|
return __generator(this, function (_b) {
|
|
1288
1274
|
switch (_b.label) {
|
|
@@ -1326,8 +1312,8 @@
|
|
|
1326
1312
|
}
|
|
1327
1313
|
|
|
1328
1314
|
function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
|
|
1329
|
-
if (delay ===
|
|
1330
|
-
if (repeat ===
|
|
1315
|
+
if (delay === undefined) { delay = 0; }
|
|
1316
|
+
if (repeat === undefined) { repeat = false; }
|
|
1331
1317
|
var scheduleSubscription = scheduler.schedule(function () {
|
|
1332
1318
|
work();
|
|
1333
1319
|
if (repeat) {
|
|
@@ -1344,14 +1330,14 @@
|
|
|
1344
1330
|
}
|
|
1345
1331
|
|
|
1346
1332
|
function observeOn(scheduler, delay) {
|
|
1347
|
-
if (delay ===
|
|
1333
|
+
if (delay === undefined) { delay = 0; }
|
|
1348
1334
|
return operate(function (source, subscriber) {
|
|
1349
1335
|
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
|
|
1350
1336
|
});
|
|
1351
1337
|
}
|
|
1352
1338
|
|
|
1353
1339
|
function subscribeOn(scheduler, delay) {
|
|
1354
|
-
if (delay ===
|
|
1340
|
+
if (delay === undefined) { delay = 0; }
|
|
1355
1341
|
return operate(function (source, subscriber) {
|
|
1356
1342
|
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
1357
1343
|
});
|
|
@@ -1406,7 +1392,7 @@
|
|
|
1406
1392
|
}
|
|
1407
1393
|
}, 0, true);
|
|
1408
1394
|
});
|
|
1409
|
-
return function () { return isFunction(iterator$1 === null || iterator$1 ===
|
|
1395
|
+
return function () { return isFunction(iterator$1 === null || iterator$1 === undefined ? undefined : iterator$1.return) && iterator$1.return(); };
|
|
1410
1396
|
});
|
|
1411
1397
|
}
|
|
1412
1398
|
|
|
@@ -1525,14 +1511,14 @@
|
|
|
1525
1511
|
|
|
1526
1512
|
var isArray$2 = Array.isArray;
|
|
1527
1513
|
function callOrApply(fn, args) {
|
|
1528
|
-
return isArray$2(args) ? fn.apply(
|
|
1514
|
+
return isArray$2(args) ? fn.apply(undefined, __spreadArray([], __read(args))) : fn(args);
|
|
1529
1515
|
}
|
|
1530
1516
|
function mapOneOrManyArgs(fn) {
|
|
1531
1517
|
return map(function (args) { return callOrApply(fn, args); });
|
|
1532
1518
|
}
|
|
1533
1519
|
|
|
1534
1520
|
function combineLatestInit(observables, scheduler, valueTransform) {
|
|
1535
|
-
if (valueTransform ===
|
|
1521
|
+
if (valueTransform === undefined) { valueTransform = identity; }
|
|
1536
1522
|
return function (subscriber) {
|
|
1537
1523
|
maybeSchedule(scheduler, function () {
|
|
1538
1524
|
var length = observables.length;
|
|
@@ -1622,7 +1608,7 @@
|
|
|
1622
1608
|
}
|
|
1623
1609
|
|
|
1624
1610
|
function mergeMap(project, resultSelector, concurrent) {
|
|
1625
|
-
if (concurrent ===
|
|
1611
|
+
if (concurrent === undefined) { concurrent = Infinity; }
|
|
1626
1612
|
if (isFunction(resultSelector)) {
|
|
1627
1613
|
return mergeMap(function (a, i) { return map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
|
|
1628
1614
|
}
|
|
@@ -1655,9 +1641,9 @@
|
|
|
1655
1641
|
}
|
|
1656
1642
|
|
|
1657
1643
|
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1658
|
-
if (scheduler ===
|
|
1644
|
+
if (scheduler === undefined) { scheduler = async; }
|
|
1659
1645
|
return new Observable(function (subscriber) {
|
|
1660
|
-
var due = isValidDate$1(dueTime) ?
|
|
1646
|
+
var due = isValidDate$1(dueTime) ? 1e3 - scheduler.now() : dueTime;
|
|
1661
1647
|
if (due < 0) {
|
|
1662
1648
|
due = 0;
|
|
1663
1649
|
}
|
|
@@ -1716,7 +1702,7 @@
|
|
|
1716
1702
|
}
|
|
1717
1703
|
var resultSelector = popResultSelector(args);
|
|
1718
1704
|
return resultSelector
|
|
1719
|
-
? pipe(combineLatest.apply(
|
|
1705
|
+
? pipe(combineLatest.apply(undefined, __spreadArray([], __read(args))), mapOneOrManyArgs(resultSelector))
|
|
1720
1706
|
: operate(function (source, subscriber) {
|
|
1721
1707
|
combineLatestInit(__spreadArray([source], __read(argsOrArgArray(args))))(subscriber);
|
|
1722
1708
|
});
|
|
@@ -1727,12 +1713,12 @@
|
|
|
1727
1713
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1728
1714
|
otherSources[_i] = arguments[_i];
|
|
1729
1715
|
}
|
|
1730
|
-
return combineLatest.apply(
|
|
1716
|
+
return combineLatest.apply(undefined, __spreadArray([], __read(otherSources)));
|
|
1731
1717
|
}
|
|
1732
1718
|
|
|
1733
1719
|
function share(options) {
|
|
1734
|
-
if (options ===
|
|
1735
|
-
var _a = options.connector, connector = _a ===
|
|
1720
|
+
if (options === undefined) { options = {}; }
|
|
1721
|
+
var _a = options.connector, connector = _a === undefined ? function () { return new Subject(); } : _a, _b = options.resetOnError, resetOnError = _b === undefined ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === undefined ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === undefined ? true : _d;
|
|
1736
1722
|
return function (wrapperSource) {
|
|
1737
1723
|
var connection;
|
|
1738
1724
|
var resetConnection;
|
|
@@ -1741,7 +1727,7 @@
|
|
|
1741
1727
|
var hasCompleted = false;
|
|
1742
1728
|
var hasErrored = false;
|
|
1743
1729
|
var cancelReset = function () {
|
|
1744
|
-
resetConnection === null || resetConnection ===
|
|
1730
|
+
resetConnection === null || resetConnection === undefined ? undefined : resetConnection.unsubscribe();
|
|
1745
1731
|
resetConnection = undefined;
|
|
1746
1732
|
};
|
|
1747
1733
|
var reset = function () {
|
|
@@ -1752,7 +1738,7 @@
|
|
|
1752
1738
|
var resetAndUnsubscribe = function () {
|
|
1753
1739
|
var conn = connection;
|
|
1754
1740
|
reset();
|
|
1755
|
-
conn === null || conn ===
|
|
1741
|
+
conn === null || conn === undefined ? undefined : conn.unsubscribe();
|
|
1756
1742
|
};
|
|
1757
1743
|
return operate(function (source, subscriber) {
|
|
1758
1744
|
refCount++;
|
|
@@ -1807,7 +1793,7 @@
|
|
|
1807
1793
|
reset();
|
|
1808
1794
|
},
|
|
1809
1795
|
});
|
|
1810
|
-
return innerFrom(on.apply(
|
|
1796
|
+
return innerFrom(on.apply(undefined, __spreadArray([], __read(args)))).subscribe(onSubscriber);
|
|
1811
1797
|
}
|
|
1812
1798
|
|
|
1813
1799
|
function shareReplay(configOrBufferSize, windowTime, scheduler) {
|
|
@@ -1829,31 +1815,30 @@
|
|
|
1829
1815
|
let e = JSON.stringify(t);
|
|
1830
1816
|
return `${u}${Array.from(e).map((r) => {
|
|
1831
1817
|
let n = r.charCodeAt(0);
|
|
1832
|
-
if (n > 255)
|
|
1833
|
-
throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);
|
|
1818
|
+
if (n > 255) throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);
|
|
1834
1819
|
return Array.from(n.toString(4).padStart(4, "0")).map((o) => String.fromCodePoint(c[o])).join("");
|
|
1835
1820
|
}).join("")}`;
|
|
1836
1821
|
}
|
|
1837
1822
|
function I(t) {
|
|
1838
|
-
return !Number.isNaN(Number(t)) || /[a-z]/i.test(t) && !/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t) ?
|
|
1823
|
+
return !Number.isNaN(Number(t)) || /[a-z]/i.test(t) && !/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t) ? false : !!Date.parse(t);
|
|
1839
1824
|
}
|
|
1840
1825
|
function T(t) {
|
|
1841
1826
|
try {
|
|
1842
1827
|
new URL(t, t.startsWith("/") ? "https://acme.com" : void 0);
|
|
1843
1828
|
} catch {
|
|
1844
|
-
return
|
|
1829
|
+
return false;
|
|
1845
1830
|
}
|
|
1846
|
-
return
|
|
1831
|
+
return true;
|
|
1847
1832
|
}
|
|
1848
1833
|
function C(t, e, r = "auto") {
|
|
1849
|
-
return r ===
|
|
1834
|
+
return r === true || r === "auto" && (I(t) || T(t)) ? t : `${t}${E(e)}`;
|
|
1850
1835
|
}
|
|
1851
1836
|
Object.fromEntries(Object.entries(c).map((t) => t.reverse()));
|
|
1852
1837
|
Object.fromEntries(Object.entries(s).map((t) => t.reverse()));
|
|
1853
1838
|
var S = `${Object.values(s).map((t) => `\\u{${t.toString(16)}}`).join("")}`, f = new RegExp(`[${S}]{4,}`, "gu");
|
|
1854
1839
|
function _(t) {
|
|
1855
1840
|
var e;
|
|
1856
|
-
return { cleaned: t.replace(f, ""), encoded: ((e = t.match(f)) == null ?
|
|
1841
|
+
return { cleaned: t.replace(f, ""), encoded: ((e = t.match(f)) == null ? undefined : e[0]) || "" };
|
|
1857
1842
|
}
|
|
1858
1843
|
function O(t) {
|
|
1859
1844
|
return t && JSON.parse(_(JSON.stringify(t)).cleaned);
|
|
@@ -1888,7 +1873,7 @@
|
|
|
1888
1873
|
statusCode: res.statusCode,
|
|
1889
1874
|
responseBody: stringifyBody(body, res),
|
|
1890
1875
|
message: "",
|
|
1891
|
-
details:
|
|
1876
|
+
details: undefined
|
|
1892
1877
|
};
|
|
1893
1878
|
if (body.error && body.message)
|
|
1894
1879
|
return props.message = `${body.error} - ${body.message}`, props;
|
|
@@ -1939,29 +1924,34 @@
|
|
|
1939
1924
|
throw new ClientError(res);
|
|
1940
1925
|
return res;
|
|
1941
1926
|
}
|
|
1942
|
-
}, printWarnings = {
|
|
1943
|
-
onResponse: (res) => {
|
|
1944
|
-
const warn = res.headers["x-sanity-warning"];
|
|
1945
|
-
return (Array.isArray(warn) ? warn : [warn]).filter(Boolean).forEach((msg) => console.warn(msg)), res;
|
|
1946
|
-
}
|
|
1947
1927
|
};
|
|
1928
|
+
function printWarnings() {
|
|
1929
|
+
const seen = {};
|
|
1930
|
+
return {
|
|
1931
|
+
onResponse: (res) => {
|
|
1932
|
+
const warn = res.headers["x-sanity-warning"], warnings = Array.isArray(warn) ? warn : [warn];
|
|
1933
|
+
for (const msg of warnings)
|
|
1934
|
+
!msg || seen[msg] || (seen[msg] = true, console.warn(msg));
|
|
1935
|
+
return res;
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1948
1939
|
function defineHttpRequest(envMiddleware2) {
|
|
1949
|
-
return
|
|
1950
|
-
|
|
1940
|
+
return p$1([
|
|
1941
|
+
P({ shouldRetry }),
|
|
1951
1942
|
...envMiddleware2,
|
|
1952
|
-
printWarnings,
|
|
1953
|
-
v(),
|
|
1943
|
+
printWarnings(),
|
|
1954
1944
|
x(),
|
|
1955
|
-
|
|
1945
|
+
E$1(),
|
|
1946
|
+
S$1(),
|
|
1956
1947
|
httpError,
|
|
1957
|
-
|
|
1948
|
+
A({ implementation: Observable })
|
|
1958
1949
|
]);
|
|
1959
1950
|
}
|
|
1960
1951
|
function shouldRetry(err, attempt, options) {
|
|
1961
|
-
if (options.maxRetries === 0)
|
|
1962
|
-
return !1;
|
|
1952
|
+
if (options.maxRetries === 0) return false;
|
|
1963
1953
|
const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
|
|
1964
|
-
return (isSafe || isQuery) && isRetriableResponse ?
|
|
1954
|
+
return (isSafe || isQuery) && isRetriableResponse ? true : P.shouldRetry(err, attempt, options);
|
|
1965
1955
|
}
|
|
1966
1956
|
const BASE_URL = "https://www.sanity.io/help/";
|
|
1967
1957
|
function generateHelpUrl(slug) {
|
|
@@ -2010,8 +2000,8 @@
|
|
|
2010
2000
|
return tag;
|
|
2011
2001
|
};
|
|
2012
2002
|
function once(fn) {
|
|
2013
|
-
let didCall =
|
|
2014
|
-
return (...args) => (didCall || (returnValue = fn(...args), didCall =
|
|
2003
|
+
let didCall = false, returnValue;
|
|
2004
|
+
return (...args) => (didCall || (returnValue = fn(...args), didCall = true), returnValue);
|
|
2015
2005
|
}
|
|
2016
2006
|
const createWarningPrinter = (message) => (
|
|
2017
2007
|
// eslint-disable-next-line no-console
|
|
@@ -2039,8 +2029,8 @@
|
|
|
2039
2029
|
]), defaultCdnHost = "apicdn.sanity.io", defaultConfig = {
|
|
2040
2030
|
apiHost: "https://api.sanity.io",
|
|
2041
2031
|
apiVersion: "1",
|
|
2042
|
-
useProjectHostname:
|
|
2043
|
-
stega: { enabled:
|
|
2032
|
+
useProjectHostname: true,
|
|
2033
|
+
stega: { enabled: false }
|
|
2044
2034
|
}, LOCALHOSTS = ["localhost", "127.0.0.1", "0.0.0.0"], isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1;
|
|
2045
2035
|
function validateApiVersion(apiVersion) {
|
|
2046
2036
|
if (apiVersion === "1" || apiVersion === "X")
|
|
@@ -2100,14 +2090,14 @@
|
|
|
2100
2090
|
);
|
|
2101
2091
|
if (typeof newConfig.stega.enabled != "boolean")
|
|
2102
2092
|
throw new Error(`stega.enabled must be a boolean, received ${newConfig.stega.enabled}`);
|
|
2103
|
-
if (newConfig.stega.enabled && newConfig.stega.studioUrl ===
|
|
2093
|
+
if (newConfig.stega.enabled && newConfig.stega.studioUrl === undefined)
|
|
2104
2094
|
throw new Error("stega.studioUrl must be defined when stega.enabled is true");
|
|
2105
2095
|
if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl != "string" && typeof newConfig.stega.studioUrl != "function")
|
|
2106
2096
|
throw new Error(
|
|
2107
2097
|
`stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}`
|
|
2108
2098
|
);
|
|
2109
2099
|
const isBrowser = typeof window < "u" && window.location && window.location.hostname, isLocalhost = isBrowser && isLocal(window.location.hostname);
|
|
2110
|
-
isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !==
|
|
2100
|
+
isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== true ? printBrowserTokenWarning() : typeof newConfig.useCdn > "u" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), "requestTagPrefix" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : undefined), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, ""), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn === true && newConfig.withCredentials && printCdnAndWithCredentialsWarning(), newConfig.useCdn = newConfig.useCdn !== false && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion);
|
|
2111
2101
|
const hostParts = newConfig.apiHost.split("://", 2), protocol = hostParts[0], host = hostParts[1], cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host;
|
|
2112
2102
|
return newConfig.useProjectHostname ? (newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`, newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`) : (newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`, newConfig.cdnUrl = newConfig.url), newConfig;
|
|
2113
2103
|
};
|
|
@@ -2214,8 +2204,8 @@
|
|
|
2214
2204
|
}
|
|
2215
2205
|
function isEmptyObject(data) {
|
|
2216
2206
|
for (const _ in data)
|
|
2217
|
-
return
|
|
2218
|
-
return
|
|
2207
|
+
return false;
|
|
2208
|
+
return true;
|
|
2219
2209
|
}
|
|
2220
2210
|
function getSelection(sel) {
|
|
2221
2211
|
if (typeof sel == "string")
|
|
@@ -2360,13 +2350,13 @@ ${selectionOpts}`);
|
|
|
2360
2350
|
reset() {
|
|
2361
2351
|
return this.operations = {}, this;
|
|
2362
2352
|
}
|
|
2363
|
-
_assign(op, props, merge =
|
|
2353
|
+
_assign(op, props, merge = true) {
|
|
2364
2354
|
return validateObject(op, props), this.operations = Object.assign({}, this.operations, {
|
|
2365
2355
|
[op]: Object.assign({}, merge && this.operations[op] || {}, props)
|
|
2366
2356
|
}), this;
|
|
2367
2357
|
}
|
|
2368
2358
|
_set(op, props) {
|
|
2369
|
-
return this._assign(op, props,
|
|
2359
|
+
return this._assign(op, props, false);
|
|
2370
2360
|
}
|
|
2371
2361
|
}
|
|
2372
2362
|
class ObservablePatch extends BasePatch {
|
|
@@ -2385,7 +2375,7 @@ ${selectionOpts}`);
|
|
|
2385
2375
|
throw new Error(
|
|
2386
2376
|
"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
|
|
2387
2377
|
);
|
|
2388
|
-
const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments:
|
|
2378
|
+
const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: true }, options);
|
|
2389
2379
|
return this.#client.mutate({ patch: this.serialize() }, opts);
|
|
2390
2380
|
}
|
|
2391
2381
|
}
|
|
@@ -2405,11 +2395,11 @@ ${selectionOpts}`);
|
|
|
2405
2395
|
throw new Error(
|
|
2406
2396
|
"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
|
|
2407
2397
|
);
|
|
2408
|
-
const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments:
|
|
2398
|
+
const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: true }, options);
|
|
2409
2399
|
return this.#client.mutate({ patch: this.serialize() }, opts);
|
|
2410
2400
|
}
|
|
2411
2401
|
}
|
|
2412
|
-
const defaultMutateOptions = { returnDocuments:
|
|
2402
|
+
const defaultMutateOptions = { returnDocuments: false };
|
|
2413
2403
|
class BaseTransaction {
|
|
2414
2404
|
operations;
|
|
2415
2405
|
trxId;
|
|
@@ -2501,8 +2491,8 @@ ${selectionOpts}`);
|
|
|
2501
2491
|
);
|
|
2502
2492
|
}
|
|
2503
2493
|
patch(patchOrDocumentId, patchOps) {
|
|
2504
|
-
const isBuilder = typeof patchOps == "function";
|
|
2505
|
-
if (
|
|
2494
|
+
const isBuilder = typeof patchOps == "function", isPatch = typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof Patch, isMutationSelection = typeof patchOrDocumentId == "object" && ("query" in patchOrDocumentId || "id" in patchOrDocumentId);
|
|
2495
|
+
if (isPatch)
|
|
2506
2496
|
return this._add({ patch: patchOrDocumentId.serialize() });
|
|
2507
2497
|
if (isBuilder) {
|
|
2508
2498
|
const patch = patchOps(new Patch(patchOrDocumentId, {}, this.#client));
|
|
@@ -2510,6 +2500,10 @@ ${selectionOpts}`);
|
|
|
2510
2500
|
throw new Error("function passed to `patch()` must return the patch");
|
|
2511
2501
|
return this._add({ patch: patch.serialize() });
|
|
2512
2502
|
}
|
|
2503
|
+
if (isMutationSelection) {
|
|
2504
|
+
const patch = new Patch(patchOrDocumentId, patchOps || {}, this.#client);
|
|
2505
|
+
return this._add({ patch: patch.serialize() });
|
|
2506
|
+
}
|
|
2513
2507
|
return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
|
|
2514
2508
|
}
|
|
2515
2509
|
}
|
|
@@ -2556,7 +2550,7 @@ ${selectionOpts}`);
|
|
|
2556
2550
|
headers: Object.assign({}, headers, overrides.headers || {}),
|
|
2557
2551
|
timeout: typeof timeout > "u" ? 5 * 60 * 1e3 : timeout,
|
|
2558
2552
|
proxy: overrides.proxy || config.proxy,
|
|
2559
|
-
json:
|
|
2553
|
+
json: true,
|
|
2560
2554
|
withCredentials,
|
|
2561
2555
|
fetch: typeof overrides.fetch == "object" && typeof config.fetch == "object" ? { ...config.fetch, ...overrides.fetch } : overrides.fetch || config.fetch
|
|
2562
2556
|
});
|
|
@@ -2572,11 +2566,11 @@ ${selectionOpts}`);
|
|
|
2572
2566
|
searchParams.append(`$${key}`, JSON.stringify(value));
|
|
2573
2567
|
for (const [key, value] of Object.entries(opts))
|
|
2574
2568
|
value && searchParams.append(key, `${value}`);
|
|
2575
|
-
return returnQuery ===
|
|
2576
|
-
}, excludeFalsey = (param, defValue) => param ===
|
|
2569
|
+
return returnQuery === false && searchParams.append("returnQuery", "false"), includeMutations === false && searchParams.append("includeMutations", "false"), `?${searchParams}`;
|
|
2570
|
+
}, excludeFalsey = (param, defValue) => param === false ? undefined : typeof param > "u" ? defValue : param, getMutationQuery = (options = {}) => ({
|
|
2577
2571
|
dryRun: options.dryRun,
|
|
2578
|
-
returnIds:
|
|
2579
|
-
returnDocuments: excludeFalsey(options.returnDocuments,
|
|
2572
|
+
returnIds: true,
|
|
2573
|
+
returnDocuments: excludeFalsey(options.returnDocuments, true),
|
|
2580
2574
|
visibility: options.visibility || "sync",
|
|
2581
2575
|
autoGenerateArrayKeys: options.autoGenerateArrayKeys,
|
|
2582
2576
|
skipCrossDatasetReferenceValidation: options.skipCrossDatasetReferenceValidation
|
|
@@ -2585,7 +2579,7 @@ ${selectionOpts}`);
|
|
|
2585
2579
|
const stega = "stega" in options ? {
|
|
2586
2580
|
..._stega || {},
|
|
2587
2581
|
...typeof options.stega == "boolean" ? { enabled: options.stega } : options.stega || {}
|
|
2588
|
-
} : _stega, params = stega.enabled ? stegaClean(_params) : _params, mapResponse = options.filterResponse ===
|
|
2582
|
+
} : _stega, params = stega.enabled ? stegaClean(_params) : _params, mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result, { cache, next, ...opts } = {
|
|
2589
2583
|
// Opt out of setting a `signal` on an internal `fetch` if one isn't provided.
|
|
2590
2584
|
// This is necessary in React Server Components to avoid opting out of Request Memoization.
|
|
2591
2585
|
useAbortSignal: typeof options.signal < "u",
|
|
@@ -2594,7 +2588,7 @@ ${selectionOpts}`);
|
|
|
2594
2588
|
...options,
|
|
2595
2589
|
// Default to not returning the query, unless `filterResponse` is `false`,
|
|
2596
2590
|
// or `returnQuery` is explicitly set. `true` is the default in Content Lake, so skip if truthy
|
|
2597
|
-
returnQuery: options.filterResponse ===
|
|
2591
|
+
returnQuery: options.filterResponse === false && options.returnQuery !== false
|
|
2598
2592
|
}, reqOpts = typeof cache < "u" || typeof next < "u" ? { ...opts, fetch: { cache, next } } : opts, $request = _dataRequest(client, httpRequest, "query", { query, params }, reqOpts);
|
|
2599
2593
|
return stega.enabled ? $request.pipe(
|
|
2600
2594
|
combineLatestWith(
|
|
@@ -2617,7 +2611,7 @@ ${selectionOpts}`);
|
|
|
2617
2611
|
function _getDocument(client, httpRequest, id, opts = {}) {
|
|
2618
2612
|
const options = {
|
|
2619
2613
|
uri: _getDataUrl(client, "doc", id),
|
|
2620
|
-
json:
|
|
2614
|
+
json: true,
|
|
2621
2615
|
tag: opts.tag,
|
|
2622
2616
|
signal: opts.signal
|
|
2623
2617
|
};
|
|
@@ -2629,7 +2623,7 @@ ${selectionOpts}`);
|
|
|
2629
2623
|
function _getDocuments(client, httpRequest, ids, opts = {}) {
|
|
2630
2624
|
const options = {
|
|
2631
2625
|
uri: _getDataUrl(client, "doc", ids.join(",")),
|
|
2632
|
-
json:
|
|
2626
|
+
json: true,
|
|
2633
2627
|
tag: opts.tag,
|
|
2634
2628
|
signal: opts.signal
|
|
2635
2629
|
};
|
|
@@ -2659,11 +2653,11 @@ ${selectionOpts}`);
|
|
|
2659
2653
|
function _mutate(client, httpRequest, mutations, options) {
|
|
2660
2654
|
let mut;
|
|
2661
2655
|
mutations instanceof Patch || mutations instanceof ObservablePatch ? mut = { patch: mutations.serialize() } : mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mut = mutations.serialize() : mut = mutations;
|
|
2662
|
-
const muts = Array.isArray(mut) ? mut : [mut], transactionId = options && options.transactionId ||
|
|
2656
|
+
const muts = Array.isArray(mut) ? mut : [mut], transactionId = options && options.transactionId || undefined;
|
|
2663
2657
|
return _dataRequest(client, httpRequest, "mutate", { mutations: muts, transactionId }, options);
|
|
2664
2658
|
}
|
|
2665
2659
|
function _action(client, httpRequest, actions, options) {
|
|
2666
|
-
const acts = Array.isArray(actions) ? actions : [actions], transactionId = options && options.transactionId ||
|
|
2660
|
+
const acts = Array.isArray(actions) ? actions : [actions], transactionId = options && options.transactionId || undefined, skipCrossDatasetReferenceValidation = options && options.skipCrossDatasetReferenceValidation || undefined, dryRun = options && options.dryRun || undefined;
|
|
2667
2661
|
return _dataRequest(
|
|
2668
2662
|
client,
|
|
2669
2663
|
httpRequest,
|
|
@@ -2676,8 +2670,8 @@ ${selectionOpts}`);
|
|
|
2676
2670
|
const isMutation = endpoint === "mutate", isAction = endpoint === "actions", isQuery = endpoint === "query", strQuery = isMutation || isAction ? "" : encodeQueryString(body), useGet = !isMutation && !isAction && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId, cacheMode } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
|
|
2677
2671
|
method: useGet ? "GET" : "POST",
|
|
2678
2672
|
uri,
|
|
2679
|
-
json:
|
|
2680
|
-
body: useGet ?
|
|
2673
|
+
json: true,
|
|
2674
|
+
body: useGet ? undefined : body,
|
|
2681
2675
|
query: isMutation && getMutationQuery(options),
|
|
2682
2676
|
timeout,
|
|
2683
2677
|
headers,
|
|
@@ -2713,7 +2707,7 @@ ${selectionOpts}`);
|
|
|
2713
2707
|
);
|
|
2714
2708
|
}
|
|
2715
2709
|
function _create(client, httpRequest, doc, op, options = {}) {
|
|
2716
|
-
const mutation = { [op]: doc }, opts = Object.assign({ returnFirst:
|
|
2710
|
+
const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: true, returnDocuments: true }, options);
|
|
2717
2711
|
return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
|
|
2718
2712
|
}
|
|
2719
2713
|
function _requestObservable(client, httpRequest, options) {
|
|
@@ -2722,12 +2716,12 @@ ${selectionOpts}`);
|
|
|
2722
2716
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
2723
2717
|
if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
2724
2718
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
2725
|
-
resultSourceMap !==
|
|
2719
|
+
resultSourceMap !== undefined && resultSourceMap !== false && (options.query = { resultSourceMap, ...options.query });
|
|
2726
2720
|
const perspectiveOption = options.perspective || config.perspective;
|
|
2727
2721
|
typeof perspectiveOption < "u" && (validateApiPerspective(perspectiveOption), options.query = {
|
|
2728
2722
|
perspective: Array.isArray(perspectiveOption) ? perspectiveOption.join(",") : perspectiveOption,
|
|
2729
2723
|
...options.query
|
|
2730
|
-
}, perspectiveOption === "previewDrafts" && useCdn && (useCdn =
|
|
2724
|
+
}, perspectiveOption === "previewDrafts" && useCdn && (useCdn = false, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === false && (options.query = { returnQuery: "false", ...options.query }), useCdn && options.cacheMode == "noStale" && (options.query = { cacheMode: "noStale", ...options.query });
|
|
2731
2725
|
}
|
|
2732
2726
|
const reqOptions = requestOptions(
|
|
2733
2727
|
config,
|
|
@@ -2749,7 +2743,7 @@ ${selectionOpts}`);
|
|
|
2749
2743
|
const config = client.config(), catalog = hasDataset(config), baseUri = `/${operation}/${catalog}`;
|
|
2750
2744
|
return `/data${path ? `${baseUri}/${path}` : baseUri}`.replace(/\/($|\?)/, "$1");
|
|
2751
2745
|
}
|
|
2752
|
-
function _getUrl(client, uri, canUseCdn =
|
|
2746
|
+
function _getUrl(client, uri, canUseCdn = false) {
|
|
2753
2747
|
const { url, cdnUrl } = client.config();
|
|
2754
2748
|
return `${canUseCdn ? cdnUrl : url}/${uri.replace(/^\//, "")}`;
|
|
2755
2749
|
}
|
|
@@ -2803,7 +2797,7 @@ ${selectionOpts}`);
|
|
|
2803
2797
|
}
|
|
2804
2798
|
function _upload(client, httpRequest, assetType, body, opts = {}) {
|
|
2805
2799
|
validateAssetType(assetType);
|
|
2806
|
-
let meta = opts.extract ||
|
|
2800
|
+
let meta = opts.extract || undefined;
|
|
2807
2801
|
meta && !meta.length && (meta = ["none"]);
|
|
2808
2802
|
const dataset2 = hasDataset(client.config()), assetEndpoint = assetType === "image" ? "images" : "files", options = optionsFromFile(opts, body), { tag, label, title, description, creditLine, filename, source } = options, query = {
|
|
2809
2803
|
label,
|
|
@@ -2826,7 +2820,7 @@ ${selectionOpts}`);
|
|
|
2826
2820
|
function optionsFromFile(opts, file) {
|
|
2827
2821
|
return typeof File > "u" || !(file instanceof File) ? opts : Object.assign(
|
|
2828
2822
|
{
|
|
2829
|
-
filename: opts.preserveFilename ===
|
|
2823
|
+
filename: opts.preserveFilename === false ? undefined : file.name,
|
|
2830
2824
|
contentType: file.type
|
|
2831
2825
|
},
|
|
2832
2826
|
opts
|
|
@@ -2852,14 +2846,14 @@ ${selectionOpts}`);
|
|
|
2852
2846
|
"effectFormat",
|
|
2853
2847
|
"tag"
|
|
2854
2848
|
], defaultOptions = {
|
|
2855
|
-
includeResult:
|
|
2849
|
+
includeResult: true
|
|
2856
2850
|
};
|
|
2857
2851
|
function _listen(query, params, opts = {}) {
|
|
2858
2852
|
const { url, token, withCredentials, requestTagPrefix } = this.config(), tag = opts.tag && requestTagPrefix ? [requestTagPrefix, opts.tag].join(".") : opts.tag, options = { ...defaults(opts, defaultOptions), tag }, listenOpts = pick(options, possibleOptions), qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } }), uri = `${url}${_getDataUrl(this, "listen", qs)}`;
|
|
2859
2853
|
if (uri.length > MAX_URL_LENGTH)
|
|
2860
2854
|
return throwError(() => new Error("Query too large for listener"));
|
|
2861
2855
|
const listenFor = options.events ? options.events : ["mutation"], esOptions = {};
|
|
2862
|
-
return (token || withCredentials) && (esOptions.withCredentials =
|
|
2856
|
+
return (token || withCredentials) && (esOptions.withCredentials = true), token && (esOptions.headers = {
|
|
2863
2857
|
Authorization: `Bearer ${token}`
|
|
2864
2858
|
}), connectEventSource(() => (
|
|
2865
2859
|
// use polyfill if there is no global EventSource or if we need to set headers
|
|
@@ -2885,7 +2879,7 @@ ${selectionOpts}`);
|
|
|
2885
2879
|
* Requires `apiVersion` to be `2021-03-26` or later.
|
|
2886
2880
|
*/
|
|
2887
2881
|
events({
|
|
2888
|
-
includeDrafts =
|
|
2882
|
+
includeDrafts = false,
|
|
2889
2883
|
tag: _tag
|
|
2890
2884
|
} = {}) {
|
|
2891
2885
|
const {
|
|
@@ -2907,12 +2901,12 @@ ${selectionOpts}`);
|
|
|
2907
2901
|
throw new Error(
|
|
2908
2902
|
"The live events API requires API version X when 'includeDrafts: true'. This API is experimental and may change or even be removed."
|
|
2909
2903
|
);
|
|
2910
|
-
const path = _getDataUrl(this.#client, "live/events"), url = new URL(this.#client.getUrl(path,
|
|
2904
|
+
const path = _getDataUrl(this.#client, "live/events"), url = new URL(this.#client.getUrl(path, false)), tag = _tag && requestTagPrefix ? [requestTagPrefix, _tag].join(".") : _tag;
|
|
2911
2905
|
tag && url.searchParams.set("tag", tag), includeDrafts && url.searchParams.set("includeDrafts", "true");
|
|
2912
2906
|
const esOptions = {};
|
|
2913
2907
|
includeDrafts && token && (esOptions.headers = {
|
|
2914
2908
|
Authorization: `Bearer ${token}`
|
|
2915
|
-
}), includeDrafts && withCredentials && (esOptions.withCredentials =
|
|
2909
|
+
}), includeDrafts && withCredentials && (esOptions.withCredentials = true);
|
|
2916
2910
|
const events = connectEventSource(() => (
|
|
2917
2911
|
// use polyfill if there is no global EventSource or if we need to set headers
|
|
2918
2912
|
(typeof EventSource > "u" || esOptions.headers ? eventSourcePolyfill : of(EventSource)).pipe(map((EventSource2) => new EventSource2(url.href, esOptions)))
|
|
@@ -3059,7 +3053,7 @@ ${selectionOpts}`);
|
|
|
3059
3053
|
this.#client = client, this.#httpRequest = httpRequest;
|
|
3060
3054
|
}
|
|
3061
3055
|
list(options) {
|
|
3062
|
-
const uri = options?.includeMembers ===
|
|
3056
|
+
const uri = options?.includeMembers === false ? "/projects?includeMembers=false" : "/projects";
|
|
3063
3057
|
return _request(this.#client, this.#httpRequest, { uri });
|
|
3064
3058
|
}
|
|
3065
3059
|
/**
|
|
@@ -3078,7 +3072,7 @@ ${selectionOpts}`);
|
|
|
3078
3072
|
this.#client = client, this.#httpRequest = httpRequest;
|
|
3079
3073
|
}
|
|
3080
3074
|
list(options) {
|
|
3081
|
-
const uri = options?.includeMembers ===
|
|
3075
|
+
const uri = options?.includeMembers === false ? "/projects?includeMembers=false" : "/projects";
|
|
3082
3076
|
return lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
|
|
3083
3077
|
}
|
|
3084
3078
|
/**
|
|
@@ -3155,9 +3149,9 @@ ${selectionOpts}`);
|
|
|
3155
3149
|
return new ObservableSanityClient(this.#httpRequest, this.config());
|
|
3156
3150
|
}
|
|
3157
3151
|
config(newConfig) {
|
|
3158
|
-
if (newConfig ===
|
|
3152
|
+
if (newConfig === undefined)
|
|
3159
3153
|
return { ...this.#clientConfig };
|
|
3160
|
-
if (this.#clientConfig && this.#clientConfig.allowReconfigure ===
|
|
3154
|
+
if (this.#clientConfig && this.#clientConfig.allowReconfigure === false)
|
|
3161
3155
|
throw new Error(
|
|
3162
3156
|
"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
|
|
3163
3157
|
);
|
|
@@ -3308,9 +3302,9 @@ ${selectionOpts}`);
|
|
|
3308
3302
|
return new SanityClient(this.#httpRequest, this.config());
|
|
3309
3303
|
}
|
|
3310
3304
|
config(newConfig) {
|
|
3311
|
-
if (newConfig ===
|
|
3305
|
+
if (newConfig === undefined)
|
|
3312
3306
|
return { ...this.#clientConfig };
|
|
3313
|
-
if (this.#clientConfig && this.#clientConfig.allowReconfigure ===
|
|
3307
|
+
if (this.#clientConfig && this.#clientConfig.allowReconfigure === false)
|
|
3314
3308
|
throw new Error(
|
|
3315
3309
|
"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
|
|
3316
3310
|
);
|
|
@@ -3457,16 +3451,18 @@ ${selectionOpts}`);
|
|
|
3457
3451
|
}
|
|
3458
3452
|
}
|
|
3459
3453
|
function defineCreateClientExports(envMiddleware2, ClassConstructor) {
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3454
|
+
return { requester: defineHttpRequest(envMiddleware2), createClient: (config) => {
|
|
3455
|
+
const clientRequester = defineHttpRequest(envMiddleware2);
|
|
3456
|
+
return new ClassConstructor(
|
|
3457
|
+
(options, requester2) => (requester2 || clientRequester)({
|
|
3458
|
+
maxRedirects: 0,
|
|
3459
|
+
maxRetries: config.maxRetries,
|
|
3460
|
+
retryDelay: config.retryDelay,
|
|
3461
|
+
...options
|
|
3462
|
+
}),
|
|
3463
|
+
config
|
|
3464
|
+
);
|
|
3465
|
+
} };
|
|
3470
3466
|
}
|
|
3471
3467
|
function defineDeprecatedCreateClient(createClient2) {
|
|
3472
3468
|
return function(config) {
|
|
@@ -3521,16 +3517,16 @@ ${selectionOpts}`);
|
|
|
3521
3517
|
const parsed = [], parseRe = /\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;
|
|
3522
3518
|
let match;
|
|
3523
3519
|
for (; (match = parseRe.exec(path)) !== null; ) {
|
|
3524
|
-
if (match[1] !==
|
|
3520
|
+
if (match[1] !== undefined) {
|
|
3525
3521
|
const key = match[1].replace(/\\(\\|f|n|r|t|')/g, (m) => UNESCAPE[m]);
|
|
3526
3522
|
parsed.push(key);
|
|
3527
3523
|
continue;
|
|
3528
3524
|
}
|
|
3529
|
-
if (match[2] !==
|
|
3525
|
+
if (match[2] !== undefined) {
|
|
3530
3526
|
parsed.push(parseInt(match[2], 10));
|
|
3531
3527
|
continue;
|
|
3532
3528
|
}
|
|
3533
|
-
if (match[3] !==
|
|
3529
|
+
if (match[3] !== undefined) {
|
|
3534
3530
|
const _key = match[3].replace(/\\(\\')/g, (m) => UNESCAPE[m]);
|
|
3535
3531
|
parsed.push({
|
|
3536
3532
|
_key,
|
|
@@ -3565,7 +3561,7 @@ ${selectionOpts}`);
|
|
|
3565
3561
|
if (!csm?.mappings)
|
|
3566
3562
|
return;
|
|
3567
3563
|
const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath));
|
|
3568
|
-
if (csm.mappings[resultMappingPath] !==
|
|
3564
|
+
if (csm.mappings[resultMappingPath] !== undefined)
|
|
3569
3565
|
return {
|
|
3570
3566
|
mapping: csm.mappings[resultMappingPath],
|
|
3571
3567
|
matchedPath: resultMappingPath,
|
|
@@ -3646,7 +3642,7 @@ ${selectionOpts}`);
|
|
|
3646
3642
|
throw new Error("id is required");
|
|
3647
3643
|
if (baseUrl !== "/" && baseUrl.endsWith("/"))
|
|
3648
3644
|
throw new Error("baseUrl must not end with a slash");
|
|
3649
|
-
const workspace = _workspace === "default" ?
|
|
3645
|
+
const workspace = _workspace === "default" ? undefined : _workspace, tool = _tool === "default" ? undefined : _tool, id = getPublishedId(_id), stringifiedPath = Array.isArray(path) ? toString(jsonPathToStudioPath(path)) : path, searchParams = new URLSearchParams({
|
|
3650
3646
|
baseUrl,
|
|
3651
3647
|
id,
|
|
3652
3648
|
type,
|
|
@@ -3669,7 +3665,7 @@ ${selectionOpts}`);
|
|
|
3669
3665
|
}
|
|
3670
3666
|
const filterDefault = ({ sourcePath, resultPath, value }) => {
|
|
3671
3667
|
if (isValidDate(value) || isValidURL(value))
|
|
3672
|
-
return
|
|
3668
|
+
return false;
|
|
3673
3669
|
const endPath = sourcePath.at(-1);
|
|
3674
3670
|
return !(sourcePath.at(-2) === "slug" && endPath === "current" || typeof endPath == "string" && (endPath.startsWith("_") || endPath.endsWith("Id")) || sourcePath.some(
|
|
3675
3671
|
(path) => path === "meta" || path === "metadata" || path === "openGraph" || path === "seo"
|
|
@@ -3716,15 +3712,15 @@ ${selectionOpts}`);
|
|
|
3716
3712
|
"website"
|
|
3717
3713
|
]);
|
|
3718
3714
|
function isValidDate(dateString) {
|
|
3719
|
-
return /^\d{4}-\d{2}-\d{2}/.test(dateString) ? !!Date.parse(dateString) :
|
|
3715
|
+
return /^\d{4}-\d{2}-\d{2}/.test(dateString) ? !!Date.parse(dateString) : false;
|
|
3720
3716
|
}
|
|
3721
3717
|
function isValidURL(url) {
|
|
3722
3718
|
try {
|
|
3723
3719
|
new URL(url, url.startsWith("/") ? "https://acme.com" : void 0);
|
|
3724
3720
|
} catch {
|
|
3725
|
-
return
|
|
3721
|
+
return false;
|
|
3726
3722
|
}
|
|
3727
|
-
return
|
|
3723
|
+
return true;
|
|
3728
3724
|
}
|
|
3729
3725
|
function hasTypeLike(path) {
|
|
3730
3726
|
return path.some((segment) => typeof segment == "string" && segment.match(/type/i) !== null);
|
|
@@ -3753,7 +3749,7 @@ ${selectionOpts}`);
|
|
|
3753
3749
|
result,
|
|
3754
3750
|
resultSourceMap,
|
|
3755
3751
|
({ sourcePath, sourceDocument, resultPath, value }) => {
|
|
3756
|
-
if ((typeof filter == "function" ? filter({ sourcePath, resultPath, filterDefault, sourceDocument, value }) : filterDefault({ sourcePath, resultPath, filterDefault, sourceDocument, value })) ===
|
|
3752
|
+
if ((typeof filter == "function" ? filter({ sourcePath, resultPath, filterDefault, sourceDocument, value }) : filterDefault({ sourcePath, resultPath, filterDefault, sourceDocument, value })) === false)
|
|
3757
3753
|
return logger && report.skipped.push({
|
|
3758
3754
|
path: prettyPathForLogging(sourcePath),
|
|
3759
3755
|
value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? "..." : ""}`,
|
|
@@ -3767,8 +3763,7 @@ ${selectionOpts}`);
|
|
|
3767
3763
|
const { baseUrl, workspace, tool } = resolveStudioBaseRoute(
|
|
3768
3764
|
typeof config.studioUrl == "function" ? config.studioUrl(sourceDocument) : config.studioUrl
|
|
3769
3765
|
);
|
|
3770
|
-
if (!baseUrl)
|
|
3771
|
-
return value;
|
|
3766
|
+
if (!baseUrl) return value;
|
|
3772
3767
|
const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument;
|
|
3773
3768
|
return C(
|
|
3774
3769
|
value,
|
|
@@ -3785,7 +3780,7 @@ ${selectionOpts}`);
|
|
|
3785
3780
|
})
|
|
3786
3781
|
},
|
|
3787
3782
|
// We use custom logic to determine if we should skip encoding
|
|
3788
|
-
|
|
3783
|
+
false
|
|
3789
3784
|
);
|
|
3790
3785
|
}
|
|
3791
3786
|
);
|
|
@@ -4914,8 +4909,8 @@ ${selectionOpts}`);
|
|
|
4914
4909
|
exports.createClient = createClient;
|
|
4915
4910
|
exports.default = deprecatedCreateClient;
|
|
4916
4911
|
exports.requester = requester;
|
|
4917
|
-
exports.unstable__adapter =
|
|
4918
|
-
exports.unstable__environment =
|
|
4912
|
+
exports.unstable__adapter = c$2;
|
|
4913
|
+
exports.unstable__environment = f$1;
|
|
4919
4914
|
exports.validateApiPerspective = validateApiPerspective;
|
|
4920
4915
|
|
|
4921
4916
|
Object.defineProperty(exports, '__esModule', { value: true });
|