@janbox/contentful-marketplace-sdk 1.0.14 → 1.0.16
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/entries/blog-category.d.ts +3 -9
- package/dist/entries/blog.d.ts +0 -1
- package/dist/index.cjs +28 -33
- package/dist/index.js +211 -216
- package/dist/types/content-model.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { PaginatedResponse } from '../utils';
|
|
2
|
-
import {
|
|
2
|
+
import { GraphQLAsset, TypeBlogCategorySkeleton } from '../types';
|
|
3
3
|
import { Entry } from 'contentful';
|
|
4
4
|
type BlogCategoryEntry = Entry<TypeBlogCategorySkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
5
|
export type BlogCategoryGraphQLItem = {
|
|
6
6
|
sys: {
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
|
+
featuredImage: GraphQLAsset | null;
|
|
9
10
|
} & Pick<BlogCategoryEntry["fields"], "title" | "slug">;
|
|
10
11
|
export interface BlogCategoryDetailGraphQLItem extends BlogCategoryGraphQLItem {
|
|
11
|
-
description:
|
|
12
|
-
json: NonNullable<BlogCategoryEntry["fields"]["description"]>;
|
|
13
|
-
links: {
|
|
14
|
-
assets: {
|
|
15
|
-
block: GraphQLAssetLink[];
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
} | null;
|
|
12
|
+
description: string | null;
|
|
19
13
|
}
|
|
20
14
|
export type GetBlogCategoriesResponse = PaginatedResponse<BlogCategoryGraphQLItem>;
|
|
21
15
|
export type GetBlogCategoryDetailResponse = BlogCategoryDetailGraphQLItem;
|
package/dist/entries/blog.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var St=Function.prototype.toString,O=Object.create,kt=Object.prototype.toString,At=(function(){function t(){this._keys=[],this._values=[]}return t.prototype.has=function(e){return!!~this._keys.indexOf(e)},t.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},t.prototype.set=function(e,r){this._keys.push(e),this._values.push(r)},t})();function Ot(){return new At}function jt(){return new WeakMap}var Tt=typeof WeakMap<"u"?jt:Ot;function Q(t){if(!t)return O(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:O(t);if(e&&~St.call(e).indexOf("[native code]"))try{return new e}catch{}return O(t)}function qt(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}function _t(t){return t.flags}var Pt=/test/g.flags==="g"?_t:qt;function lt(t){var e=kt.call(t);return e.substring(8,e.length-1)}function xt(t){return t[Symbol.toStringTag]||lt(t)}var Dt=typeof Symbol<"u"?xt:lt,It=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,ut=Object.prototype,gt=ut.hasOwnProperty,Mt=ut.propertyIsEnumerable,ft=typeof F=="function";function zt(t){return ct(t).concat(F(t))}var Bt=ft?zt:ct;function k(t,e,r){for(var a=Bt(t),s=0,i=a.length,o=void 0,n=void 0;s<i;++s)if(o=a[s],!(o==="callee"||o==="caller")){if(n=Rt(t,o),!n){e[o]=r.copier(t[o],r);continue}!n.get&&!n.set&&(n.value=r.copier(n.value,r));try{It(e,o,n)}catch{e[o]=n.value}}return e}function Et(t,e){var r=new e.Constructor;e.cache.set(t,r);for(var a=0,s=t.length;a<s;++a)r[a]=e.copier(t[a],e);return r}function Lt(t,e){var r=new e.Constructor;return e.cache.set(t,r),k(t,r,e)}function pt(t,e){return t.slice(0)}function Vt(t,e){return t.slice(0,t.size,t.type)}function Nt(t,e){return new e.Constructor(pt(t.buffer))}function Qt(t,e){return new e.Constructor(t.getTime())}function ht(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(a,s){r.set(s,e.copier(a,e))}),r}function Ft(t,e){return k(t,ht(t,e),e)}function Gt(t,e){var r=Q(e.prototype);e.cache.set(t,r);for(var a in t)gt.call(t,a)&&(r[a]=e.copier(t[a],e));return r}function Ut(t,e){var r=Q(e.prototype);e.cache.set(t,r);for(var a in t)gt.call(t,a)&&(r[a]=e.copier(t[a],e));for(var s=F(t),i=0,o=s.length,n=void 0;i<o;++i)n=s[i],Mt.call(t,n)&&(r[n]=e.copier(t[n],e));return r}var Kt=ft?Ut:Gt;function Wt(t,e){var r=Q(e.prototype);return e.cache.set(t,r),k(t,r,e)}function j(t,e){return new e.Constructor(t.valueOf())}function Ht(t,e){var r=new e.Constructor(t.source,Pt(t));return r.lastIndex=t.lastIndex,r}function S(t,e){return t}function yt(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(a){r.add(e.copier(a,e))}),r}function Jt(t,e){return k(t,yt(t,e),e)}var Yt=Array.isArray,G=Object.assign,Xt=Object.getPrototypeOf||(function(t){return t.__proto__}),mt={array:Et,arrayBuffer:pt,blob:Vt,dataView:Nt,date:Qt,error:S,map:ht,object:Kt,regExp:Ht,set:yt},Zt=G({},mt,{array:Lt,map:Ft,object:Wt,set:Jt});function te(t){return{Arguments:t.object,Array:t.array,ArrayBuffer:t.arrayBuffer,Blob:t.blob,Boolean:j,DataView:t.dataView,Date:t.date,Error:t.error,Float32Array:t.arrayBuffer,Float64Array:t.arrayBuffer,Int8Array:t.arrayBuffer,Int16Array:t.arrayBuffer,Int32Array:t.arrayBuffer,Map:t.map,Number:j,Object:t.object,Promise:S,RegExp:t.regExp,Set:t.set,String:j,WeakMap:S,WeakSet:S,Uint8Array:t.arrayBuffer,Uint8ClampedArray:t.arrayBuffer,Uint16Array:t.arrayBuffer,Uint32Array:t.arrayBuffer,Uint64Array:t.arrayBuffer}}function dt(t){var e=G({},mt,t),r=te(e),a=r.Array,s=r.Object;function i(o,n){if(n.prototype=n.Constructor=void 0,!o||typeof o!="object")return o;if(n.cache.has(o))return n.cache.get(o);if(n.prototype=Xt(o),n.Constructor=n.prototype&&n.prototype.constructor,!n.Constructor||n.Constructor===Object)return s(o,n);if(Yt(o))return a(o,n);var l=r[Dt(o)];return l?l(o,n):typeof o.then=="function"?o:s(o,n)}return function(n){return i(n,{Constructor:void 0,cache:Tt(),copier:i,prototype:void 0})}}function ee(t){return dt(G({},Zt,t))}ee({});dt({});var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T={exports:{}},U;function re(){if(U)return T.exports;U=1;var t=T.exports={},e,r;function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=a}catch{e=a}try{typeof clearTimeout=="function"?r=clearTimeout:r=s}catch{r=s}})();function i(h){if(e===setTimeout)return setTimeout(h,0);if((e===a||!e)&&setTimeout)return e=setTimeout,setTimeout(h,0);try{return e(h,0)}catch{try{return e.call(null,h,0)}catch{return e.call(this,h,0)}}}function o(h){if(r===clearTimeout)return clearTimeout(h);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(h);try{return r(h)}catch{try{return r.call(null,h)}catch{return r.call(this,h)}}}var n=[],l=!1,c,u=-1;function g(){!l||!c||(l=!1,c.length?n=c.concat(n):u=-1,n.length&&f())}function f(){if(!l){var h=i(g);l=!0;for(var d=n.length;d;){for(c=n,n=[];++u<d;)c&&c[u].run();u=-1,d=n.length}c=null,l=!1,o(h)}}t.nextTick=function(h){var d=new Array(arguments.length-1);if(arguments.length>1)for(var $=1;$<arguments.length;$++)d[$-1]=arguments[$];n.push(new y(h,d)),n.length===1&&!l&&i(f)};function y(h,d){this.fun=h,this.array=d}y.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function p(){}return t.on=p,t.addListener=p,t.once=p,t.off=p,t.removeListener=p,t.removeAllListeners=p,t.emit=p,t.prependListener=p,t.prependOnceListener=p,t.listeners=function(h){return[]},t.binding=function(h){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(h){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},T.exports}re();var q,K;function oe(){if(K)return q;K=1;var t=typeof C=="object"&&C&&C.Object===Object&&C;return q=t,q}var _,W;function ne(){if(W)return _;W=1;var t=oe(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return _=r,_}var P,H;function bt(){if(H)return P;H=1;var t=ne(),e=t.Symbol;return P=e,P}var x,J;function ie(){if(J)return x;J=1;var t=bt(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,s=t?t.toStringTag:void 0;function i(o){var n=r.call(o,s),l=o[s];try{o[s]=void 0;var c=!0}catch{}var u=a.call(o);return c&&(n?o[s]=l:delete o[s]),u}return x=i,x}var D,Y;function se(){if(Y)return D;Y=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return D=r,D}var I,X;function $t(){if(X)return I;X=1;var t=bt(),e=ie(),r=se(),a="[object Null]",s="[object Undefined]",i=t?t.toStringTag:void 0;function o(n){return n==null?n===void 0?s:a:i&&i in Object(n)?e(n):r(n)}return I=o,I}var R,Z;function ae(){if(Z)return R;Z=1;var t=Array.isArray;return R=t,R}var M,tt;function wt(){if(tt)return M;tt=1;function t(e){return e!=null&&typeof e=="object"}return M=t,M}var z,et;function le(){if(et)return z;et=1;var t=$t(),e=ae(),r=wt(),a="[object String]";function s(i){return typeof i=="string"||!e(i)&&r(i)&&t(i)==a}return z=s,z}le();var B,rt;function ce(){if(rt)return B;rt=1;function t(e,r){return function(a){return e(r(a))}}return B=t,B}var E,ot;function ue(){if(ot)return E;ot=1;var t=ce(),e=t(Object.getPrototypeOf,Object);return E=e,E}var L,nt;function ge(){if(nt)return L;nt=1;var t=$t(),e=ue(),r=wt(),a="[object Object]",s=Function.prototype,i=Object.prototype,o=s.toString,n=i.hasOwnProperty,l=o.call(Object);function c(u){if(!r(u)||t(u)!=a)return!1;var g=e(u);if(g===null)return!0;var f=n.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&o.call(f)==l}return L=c,L}ge();var Ct={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},vt={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(vt[0])).join("");Object.fromEntries(Object.entries(vt).map(t=>t.reverse()));Object.fromEntries(Object.entries(Ct).map(t=>t.reverse()));`${Object.values(Ct).map(t=>`\\u{${t.toString(16)}}`).join("")}`;var V,it;function fe(){if(it)return V;it=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString;return V=function(r,a,s){if(e.call(a)!=="[object Function]")throw new TypeError("iterator must be a function");var i=r.length;if(i===+i)for(var o=0;o<i;o++)a.call(s,r[o],o,r);else for(var n in r)t.call(r,n)&&a.call(s,r[n],n,r)},V}var N,st;function pe(){if(st)return N;st=1;var t=fe();N=e;function e(r,a,s){if(arguments.length===3)return e.set(r,a,s);if(arguments.length===2)return e.get(r,a);var i=e.bind(e,r);for(var o in e)e.hasOwnProperty(o)&&(i[o]=e[o].bind(i,r));return i}return e.get=function(r,a){for(var s=Array.isArray(a)?a:e.parse(a),i=0;i<s.length;++i){var o=s[i];if(!(typeof r=="object"&&o in r))throw new Error("Invalid reference token: "+o);r=r[o]}return r},e.set=function(r,a,s){var i=Array.isArray(a)?a:e.parse(a),o=i[0];if(i.length===0)throw Error("Can not set the root object");for(var n=0;n<i.length-1;++n){var l=i[n];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(r)&&(l=r.length),o=i[n+1],l in r||(o.match(/^(\d+|-)$/)?r[l]=[]:r[l]={}),r=r[l])}return o==="-"&&Array.isArray(r)&&(o=r.length),r[o]=s,this},e.remove=function(r,a){var s=Array.isArray(a)?a:e.parse(a),i=s[s.length-1];if(i===void 0)throw new Error('Invalid JSON pointer for remove: "'+a+'"');var o=e.get(r,s.slice(0,-1));if(Array.isArray(o)){var n=+i;if(i===""&&isNaN(n))throw new Error('Invalid array index: "'+i+'"');Array.prototype.splice.call(o,n,1)}else delete o[i]},e.dict=function(r,a){var s={};return e.walk(r,function(i,o){s[o]=i},a),s},e.walk=function(r,a,s){var i=[];s=s||function(o){var n=Object.prototype.toString.call(o);return n==="[object Object]"||n==="[object Array]"},(function o(n){t(n,function(l,c){i.push(String(c)),s(l)?o(l):a(l,e.compile(i)),i.pop()})})(r)},e.has=function(r,a){try{e.get(r,a)}catch{return!1}return!0},e.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},e.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},e.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(e.unescape)},e.compile=function(r){return r.length===0?"":"/"+r.map(e.escape).join("/")},N}pe();var v={exports:{}},at;function he(){return at||(at=1,(function(t,e){e=t.exports=r,e.getSerialize=a;function r(s,i,o,n){return JSON.stringify(s,a(i,n),o)}function a(s,i){var o=[],n=[];return i==null&&(i=function(l,c){return o[0]===c?"[Circular ~]":"[Circular ~."+n.slice(0,o.indexOf(c)).join(".")+"]"}),function(l,c){if(o.length>0){var u=o.indexOf(this);~u?o.splice(u+1):o.push(this),~u?n.splice(u,1/0,l):n.push(l),~o.indexOf(c)&&(c=i.call(this,l,c))}else o.push(c);return s==null?c:s.call(this,l,c)}}})(v,v.exports)),v.exports}he();class m{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(e){this._clientParams={...e,environment:e.environment??"master"}}static async graphqlQuery(e,r={}){const{space:a,accessToken:s,environment:i="master"}=this.clientParams,o=await fetch(`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${i}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({query:e,variables:r})});if(!o.ok){const l=await o.text();throw new Error(`GraphQL request failed: ${o.status} ${o.statusText}
|
|
2
|
-
${l}`)}const n=await o.json();if(n.errors)throw new Error(`GraphQL errors: ${JSON.stringify(n.errors,null,2)}`);return n.data}}class b{page;total;size;items;constructor({page:e,total:r,size:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var St=Function.prototype.toString,O=Object.create,kt=Object.prototype.toString,At=(function(){function t(){this._keys=[],this._values=[]}return t.prototype.has=function(e){return!!~this._keys.indexOf(e)},t.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},t.prototype.set=function(e,r){this._keys.push(e),this._values.push(r)},t})();function Ot(){return new At}function jt(){return new WeakMap}var Tt=typeof WeakMap<"u"?jt:Ot;function Q(t){if(!t)return O(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:O(t);if(e&&~St.call(e).indexOf("[native code]"))try{return new e}catch{}return O(t)}function qt(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}function _t(t){return t.flags}var Pt=/test/g.flags==="g"?_t:qt;function lt(t){var e=kt.call(t);return e.substring(8,e.length-1)}function xt(t){return t[Symbol.toStringTag]||lt(t)}var It=typeof Symbol<"u"?xt:lt,Dt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,ut=Object.prototype,gt=ut.hasOwnProperty,Mt=ut.propertyIsEnumerable,ft=typeof F=="function";function zt(t){return ct(t).concat(F(t))}var Bt=ft?zt:ct;function k(t,e,r){for(var s=Bt(t),a=0,i=s.length,o=void 0,n=void 0;a<i;++a)if(o=s[a],!(o==="callee"||o==="caller")){if(n=Rt(t,o),!n){e[o]=r.copier(t[o],r);continue}!n.get&&!n.set&&(n.value=r.copier(n.value,r));try{Dt(e,o,n)}catch{e[o]=n.value}}return e}function Et(t,e){var r=new e.Constructor;e.cache.set(t,r);for(var s=0,a=t.length;s<a;++s)r[s]=e.copier(t[s],e);return r}function Lt(t,e){var r=new e.Constructor;return e.cache.set(t,r),k(t,r,e)}function pt(t,e){return t.slice(0)}function Vt(t,e){return t.slice(0,t.size,t.type)}function Nt(t,e){return new e.Constructor(pt(t.buffer))}function Qt(t,e){return new e.Constructor(t.getTime())}function ht(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(s,a){r.set(a,e.copier(s,e))}),r}function Ft(t,e){return k(t,ht(t,e),e)}function Gt(t,e){var r=Q(e.prototype);e.cache.set(t,r);for(var s in t)gt.call(t,s)&&(r[s]=e.copier(t[s],e));return r}function Ut(t,e){var r=Q(e.prototype);e.cache.set(t,r);for(var s in t)gt.call(t,s)&&(r[s]=e.copier(t[s],e));for(var a=F(t),i=0,o=a.length,n=void 0;i<o;++i)n=a[i],Mt.call(t,n)&&(r[n]=e.copier(t[n],e));return r}var Kt=ft?Ut:Gt;function Wt(t,e){var r=Q(e.prototype);return e.cache.set(t,r),k(t,r,e)}function j(t,e){return new e.Constructor(t.valueOf())}function Ht(t,e){var r=new e.Constructor(t.source,Pt(t));return r.lastIndex=t.lastIndex,r}function S(t,e){return t}function yt(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(s){r.add(e.copier(s,e))}),r}function Jt(t,e){return k(t,yt(t,e),e)}var Yt=Array.isArray,G=Object.assign,Xt=Object.getPrototypeOf||(function(t){return t.__proto__}),mt={array:Et,arrayBuffer:pt,blob:Vt,dataView:Nt,date:Qt,error:S,map:ht,object:Kt,regExp:Ht,set:yt},Zt=G({},mt,{array:Lt,map:Ft,object:Wt,set:Jt});function te(t){return{Arguments:t.object,Array:t.array,ArrayBuffer:t.arrayBuffer,Blob:t.blob,Boolean:j,DataView:t.dataView,Date:t.date,Error:t.error,Float32Array:t.arrayBuffer,Float64Array:t.arrayBuffer,Int8Array:t.arrayBuffer,Int16Array:t.arrayBuffer,Int32Array:t.arrayBuffer,Map:t.map,Number:j,Object:t.object,Promise:S,RegExp:t.regExp,Set:t.set,String:j,WeakMap:S,WeakSet:S,Uint8Array:t.arrayBuffer,Uint8ClampedArray:t.arrayBuffer,Uint16Array:t.arrayBuffer,Uint32Array:t.arrayBuffer,Uint64Array:t.arrayBuffer}}function dt(t){var e=G({},mt,t),r=te(e),s=r.Array,a=r.Object;function i(o,n){if(n.prototype=n.Constructor=void 0,!o||typeof o!="object")return o;if(n.cache.has(o))return n.cache.get(o);if(n.prototype=Xt(o),n.Constructor=n.prototype&&n.prototype.constructor,!n.Constructor||n.Constructor===Object)return a(o,n);if(Yt(o))return s(o,n);var l=r[It(o)];return l?l(o,n):typeof o.then=="function"?o:a(o,n)}return function(n){return i(n,{Constructor:void 0,cache:Tt(),copier:i,prototype:void 0})}}function ee(t){return dt(G({},Zt,t))}ee({});dt({});var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T={exports:{}},U;function re(){if(U)return T.exports;U=1;var t=T.exports={},e,r;function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=s}catch{e=s}try{typeof clearTimeout=="function"?r=clearTimeout:r=a}catch{r=a}})();function i(h){if(e===setTimeout)return setTimeout(h,0);if((e===s||!e)&&setTimeout)return e=setTimeout,setTimeout(h,0);try{return e(h,0)}catch{try{return e.call(null,h,0)}catch{return e.call(this,h,0)}}}function o(h){if(r===clearTimeout)return clearTimeout(h);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(h);try{return r(h)}catch{try{return r.call(null,h)}catch{return r.call(this,h)}}}var n=[],l=!1,c,u=-1;function g(){!l||!c||(l=!1,c.length?n=c.concat(n):u=-1,n.length&&f())}function f(){if(!l){var h=i(g);l=!0;for(var d=n.length;d;){for(c=n,n=[];++u<d;)c&&c[u].run();u=-1,d=n.length}c=null,l=!1,o(h)}}t.nextTick=function(h){var d=new Array(arguments.length-1);if(arguments.length>1)for(var $=1;$<arguments.length;$++)d[$-1]=arguments[$];n.push(new y(h,d)),n.length===1&&!l&&i(f)};function y(h,d){this.fun=h,this.array=d}y.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function p(){}return t.on=p,t.addListener=p,t.once=p,t.off=p,t.removeListener=p,t.removeAllListeners=p,t.emit=p,t.prependListener=p,t.prependOnceListener=p,t.listeners=function(h){return[]},t.binding=function(h){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(h){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},T.exports}re();var q,K;function oe(){if(K)return q;K=1;var t=typeof C=="object"&&C&&C.Object===Object&&C;return q=t,q}var _,W;function ne(){if(W)return _;W=1;var t=oe(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return _=r,_}var P,H;function bt(){if(H)return P;H=1;var t=ne(),e=t.Symbol;return P=e,P}var x,J;function ie(){if(J)return x;J=1;var t=bt(),e=Object.prototype,r=e.hasOwnProperty,s=e.toString,a=t?t.toStringTag:void 0;function i(o){var n=r.call(o,a),l=o[a];try{o[a]=void 0;var c=!0}catch{}var u=s.call(o);return c&&(n?o[a]=l:delete o[a]),u}return x=i,x}var I,Y;function ae(){if(Y)return I;Y=1;var t=Object.prototype,e=t.toString;function r(s){return e.call(s)}return I=r,I}var D,X;function $t(){if(X)return D;X=1;var t=bt(),e=ie(),r=ae(),s="[object Null]",a="[object Undefined]",i=t?t.toStringTag:void 0;function o(n){return n==null?n===void 0?a:s:i&&i in Object(n)?e(n):r(n)}return D=o,D}var R,Z;function se(){if(Z)return R;Z=1;var t=Array.isArray;return R=t,R}var M,tt;function wt(){if(tt)return M;tt=1;function t(e){return e!=null&&typeof e=="object"}return M=t,M}var z,et;function le(){if(et)return z;et=1;var t=$t(),e=se(),r=wt(),s="[object String]";function a(i){return typeof i=="string"||!e(i)&&r(i)&&t(i)==s}return z=a,z}le();var B,rt;function ce(){if(rt)return B;rt=1;function t(e,r){return function(s){return e(r(s))}}return B=t,B}var E,ot;function ue(){if(ot)return E;ot=1;var t=ce(),e=t(Object.getPrototypeOf,Object);return E=e,E}var L,nt;function ge(){if(nt)return L;nt=1;var t=$t(),e=ue(),r=wt(),s="[object Object]",a=Function.prototype,i=Object.prototype,o=a.toString,n=i.hasOwnProperty,l=o.call(Object);function c(u){if(!r(u)||t(u)!=s)return!1;var g=e(u);if(g===null)return!0;var f=n.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&o.call(f)==l}return L=c,L}ge();var Ct={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},vt={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(vt[0])).join("");Object.fromEntries(Object.entries(vt).map(t=>t.reverse()));Object.fromEntries(Object.entries(Ct).map(t=>t.reverse()));`${Object.values(Ct).map(t=>`\\u{${t.toString(16)}}`).join("")}`;var V,it;function fe(){if(it)return V;it=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString;return V=function(r,s,a){if(e.call(s)!=="[object Function]")throw new TypeError("iterator must be a function");var i=r.length;if(i===+i)for(var o=0;o<i;o++)s.call(a,r[o],o,r);else for(var n in r)t.call(r,n)&&s.call(a,r[n],n,r)},V}var N,at;function pe(){if(at)return N;at=1;var t=fe();N=e;function e(r,s,a){if(arguments.length===3)return e.set(r,s,a);if(arguments.length===2)return e.get(r,s);var i=e.bind(e,r);for(var o in e)e.hasOwnProperty(o)&&(i[o]=e[o].bind(i,r));return i}return e.get=function(r,s){for(var a=Array.isArray(s)?s:e.parse(s),i=0;i<a.length;++i){var o=a[i];if(!(typeof r=="object"&&o in r))throw new Error("Invalid reference token: "+o);r=r[o]}return r},e.set=function(r,s,a){var i=Array.isArray(s)?s:e.parse(s),o=i[0];if(i.length===0)throw Error("Can not set the root object");for(var n=0;n<i.length-1;++n){var l=i[n];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(r)&&(l=r.length),o=i[n+1],l in r||(o.match(/^(\d+|-)$/)?r[l]=[]:r[l]={}),r=r[l])}return o==="-"&&Array.isArray(r)&&(o=r.length),r[o]=a,this},e.remove=function(r,s){var a=Array.isArray(s)?s:e.parse(s),i=a[a.length-1];if(i===void 0)throw new Error('Invalid JSON pointer for remove: "'+s+'"');var o=e.get(r,a.slice(0,-1));if(Array.isArray(o)){var n=+i;if(i===""&&isNaN(n))throw new Error('Invalid array index: "'+i+'"');Array.prototype.splice.call(o,n,1)}else delete o[i]},e.dict=function(r,s){var a={};return e.walk(r,function(i,o){a[o]=i},s),a},e.walk=function(r,s,a){var i=[];a=a||function(o){var n=Object.prototype.toString.call(o);return n==="[object Object]"||n==="[object Array]"},(function o(n){t(n,function(l,c){i.push(String(c)),a(l)?o(l):s(l,e.compile(i)),i.pop()})})(r)},e.has=function(r,s){try{e.get(r,s)}catch{return!1}return!0},e.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},e.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},e.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(e.unescape)},e.compile=function(r){return r.length===0?"":"/"+r.map(e.escape).join("/")},N}pe();var v={exports:{}},st;function he(){return st||(st=1,(function(t,e){e=t.exports=r,e.getSerialize=s;function r(a,i,o,n){return JSON.stringify(a,s(i,n),o)}function s(a,i){var o=[],n=[];return i==null&&(i=function(l,c){return o[0]===c?"[Circular ~]":"[Circular ~."+n.slice(0,o.indexOf(c)).join(".")+"]"}),function(l,c){if(o.length>0){var u=o.indexOf(this);~u?o.splice(u+1):o.push(this),~u?n.splice(u,1/0,l):n.push(l),~o.indexOf(c)&&(c=i.call(this,l,c))}else o.push(c);return a==null?c:a.call(this,l,c)}}})(v,v.exports)),v.exports}he();class m{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(e){this._clientParams={...e,environment:e.environment??"master"}}static async graphqlQuery(e,r={}){const{space:s,accessToken:a,environment:i="master"}=this.clientParams,o=await fetch(`https://graphql.contentful.com/content/v1/spaces/${s}/environments/${i}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({query:e,variables:r})});if(!o.ok){const l=await o.text();throw new Error(`GraphQL request failed: ${o.status} ${o.statusText}
|
|
2
|
+
${l}`)}const n=await o.json();if(n.errors)throw new Error(`GraphQL errors: ${JSON.stringify(n.errors,null,2)}`);return n.data}}class b{page;total;size;items;constructor({page:e,total:r,size:s,items:a}){this.page=e,this.total=r,this.size=s,this.items=a}get totalPages(){return Math.ceil(this.total/this.size)}}const ye=async({slot:t,page:e=1,size:r=20,platform:s,marketCode:a,locale:i})=>{const o=Math.max(1,Math.floor(e)),n=Math.max(1,Math.floor(r)),l=["$slot: String!","$limit: Int!","$skip: Int!"],c={slot:t,limit:n,skip:(o-1)*n},u=["{ slot: $slot }"];s&&(l.push("$platform: String!"),c.platform=s,u.push("{ platform_contains_some: [$platform] }")),a&&(l.push("$marketCode: String!"),c.marketCode=a,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),i&&(l.push("$locale: String!"),c.locale=i,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const g=`(${l.join(", ")})`,f=`(
|
|
3
3
|
limit: $limit
|
|
4
4
|
skip: $skip
|
|
5
5
|
where: {
|
|
@@ -45,7 +45,7 @@ query${g} {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`,{bannerCollectionCollection:p}=await m.graphqlQuery(y,{...c});return new b({page:o,total:p.total,size:n,items:p.items})};class w extends Response{constructor(...e){super(e[0]??"Not Found",{status:404,...e[1]})}}const me=async({marketCode:t,locale:e,collectionId:r,categoryId:
|
|
48
|
+
`,{bannerCollectionCollection:p}=await m.graphqlQuery(y,{...c});return new b({page:o,total:p.total,size:n,items:p.items})};class w extends Response{constructor(...e){super(e[0]??"Not Found",{status:404,...e[1]})}}const me=async({marketCode:t,locale:e,collectionId:r,categoryId:s,page:a=1,size:i=20}={})=>{const o=Math.max(1,Math.floor(a)),n=Math.max(1,Math.floor(i));if(r){const d=`
|
|
49
49
|
query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
50
50
|
blogCollectionCollection(limit: 1 where: { sys: { id: $collectionId } }) {
|
|
51
51
|
items {
|
|
@@ -83,7 +83,7 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`,{blogCollectionCollection:$}=await m.graphqlQuery(d,{collectionId:r,limit:n,skip:(o-1)*n}),A=$.items.at(0);if(!A)throw new w;return new b({page:o,total:A.postsCollection?.total??0,size:n,items:A.postsCollection?.items??[]})}const l=["$limit: Int!","$skip: Int!"],c={limit:n,skip:(o-1)*n},u=["limit: $limit","skip: $skip"],g=[];t&&(l.push("$marketCode: String!"),c.marketCode=t,g.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(l.push("$locale: String!"),c.locale=e,g.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),
|
|
86
|
+
`,{blogCollectionCollection:$}=await m.graphqlQuery(d,{collectionId:r,limit:n,skip:(o-1)*n}),A=$.items.at(0);if(!A)throw new w;return new b({page:o,total:A.postsCollection?.total??0,size:n,items:A.postsCollection?.items??[]})}const l=["$limit: Int!","$skip: Int!"],c={limit:n,skip:(o-1)*n},u=["limit: $limit","skip: $skip"],g=[];t&&(l.push("$marketCode: String!"),c.marketCode=t,g.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(l.push("$locale: String!"),c.locale=e,g.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),s&&(l.push("$categoryId: String!"),c.categoryId=s,g.push("{ categories: { sys: { id: $categoryId } } }")),g.length&&u.push(`where: {
|
|
87
87
|
AND: [
|
|
88
88
|
${g.join(`
|
|
89
89
|
`)}
|
|
@@ -125,7 +125,7 @@ query${f} {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
`,{blogPostCollection:h}=await m.graphqlQuery(p,{...c});return new b({page:o,total:h.total,size:n,items:h.items})},de=async({id:t,slug:e,marketCode:r,locale:
|
|
128
|
+
`,{blogPostCollection:h}=await m.graphqlQuery(p,{...c});return new b({page:o,total:h.total,size:n,items:h.items})},de=async({id:t,slug:e,marketCode:r,locale:s})=>{const a=[],i={},o=[];if(t)a.push("$id: String!"),i.id=t,o.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),i.slug=e,o.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),i.marketCode=r,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(a.push("$locale: String!"),i.locale=s,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${a.join(", ")})`,l=`(
|
|
129
129
|
limit: 1
|
|
130
130
|
where: {
|
|
131
131
|
AND: [
|
|
@@ -199,7 +199,7 @@ query${n} {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
`,{blogPostCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},be=async({marketCode:t,locale:e,page:r=1,size:
|
|
202
|
+
`,{blogPostCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},be=async({marketCode:t,locale:e,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),i=Math.max(1,Math.floor(s)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=["limit: $limit","skip: $skip"],c=[];t&&(o.push("$marketCode: String!"),n.marketCode=t,c.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(o.push("$locale: String!"),n.locale=e,c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),c.length&&l.push(`where: {
|
|
203
203
|
AND: [
|
|
204
204
|
${c.join(`
|
|
205
205
|
`)}
|
|
@@ -217,10 +217,16 @@ query${u} {
|
|
|
217
217
|
}
|
|
218
218
|
title
|
|
219
219
|
slug
|
|
220
|
+
featuredImage {
|
|
221
|
+
url
|
|
222
|
+
width
|
|
223
|
+
height
|
|
224
|
+
contentType
|
|
225
|
+
}
|
|
220
226
|
}
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
`,{blogCategoryCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:
|
|
229
|
+
`,{blogCategoryCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:a,total:y.total,size:i,items:y.items})},$e=async({id:t,slug:e,marketCode:r,locale:s})=>{const a=[],i={},o=[];if(t)a.push("$id: String!"),i.id=t,o.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),i.slug=e,o.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),i.marketCode=r,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(a.push("$locale: String!"),i.locale=s,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${a.join(", ")})`,l=`(
|
|
224
230
|
limit: 1
|
|
225
231
|
where: {
|
|
226
232
|
AND: [
|
|
@@ -237,28 +243,17 @@ query${n} {
|
|
|
237
243
|
}
|
|
238
244
|
title
|
|
239
245
|
slug
|
|
240
|
-
description
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
id
|
|
247
|
-
}
|
|
248
|
-
url
|
|
249
|
-
width
|
|
250
|
-
height
|
|
251
|
-
contentType
|
|
252
|
-
title
|
|
253
|
-
description
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
246
|
+
description
|
|
247
|
+
featuredImage {
|
|
248
|
+
url
|
|
249
|
+
width
|
|
250
|
+
height
|
|
251
|
+
contentType
|
|
257
252
|
}
|
|
258
253
|
}
|
|
259
254
|
}
|
|
260
255
|
}
|
|
261
|
-
`,{blogCategoryCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},we=async({marketCode:t,locale:e,page:r=1,size:
|
|
256
|
+
`,{blogCategoryCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},we=async({marketCode:t,locale:e,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),i=Math.max(1,Math.floor(s)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=["limit: $limit","skip: $skip"],c=[];t&&(o.push("$marketCode: String!"),n.marketCode=t,c.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(o.push("$locale: String!"),n.locale=e,c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),c.length&&l.push(`where: {
|
|
262
257
|
AND: [
|
|
263
258
|
${c.join(`
|
|
264
259
|
`)}
|
|
@@ -293,7 +288,7 @@ query${u} {
|
|
|
293
288
|
}
|
|
294
289
|
}
|
|
295
290
|
}
|
|
296
|
-
`,{blogCollectionCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:
|
|
291
|
+
`,{blogCollectionCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:a,total:y.total,size:i,items:y.items.map(p=>({...p,category:p.type==="category"?p.category:null,categoryId:p.type==="category"?p.category?.sys.id??null:null,collectionId:p.type==="manual"?p.sys.id:null}))})},Ce=async({page:t=1,size:e=20,marketCode:r,locale:s}={})=>{const a=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=[];r&&(o.push("$marketCode: String!"),n.marketCode=r,l.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(o.push("$locale: String!"),n.locale=s,l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const c=`(${o.join(", ")})`,u=l.length?`(
|
|
297
292
|
limit: $limit
|
|
298
293
|
skip: $skip
|
|
299
294
|
where: {
|
|
@@ -341,7 +336,7 @@ query${c} {
|
|
|
341
336
|
}
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
|
-
`,{brandCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:
|
|
339
|
+
`,{brandCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:a,total:f.total,size:i,items:f.items})},ve=async({marketCode:t,locale:e,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),i=Math.max(1,Math.floor(s)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=["limit: $limit","skip: $skip"],c=[];t&&(o.push("$marketCode: String!"),n.marketCode=t,c.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(o.push("$locale: String!"),n.locale=e,c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),c.length&&l.push(`where: {
|
|
345
340
|
AND: [
|
|
346
341
|
${c.join(`
|
|
347
342
|
`)}
|
|
@@ -372,7 +367,7 @@ query${u} {
|
|
|
372
367
|
}
|
|
373
368
|
}
|
|
374
369
|
}
|
|
375
|
-
`,{documentationCategoryCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:
|
|
370
|
+
`,{documentationCategoryCollection:y}=await m.graphqlQuery(f,{...n});return new b({page:a,total:y.total,size:i,items:y.items})},Se=async({id:t,slug:e,marketCode:r,locale:s})=>{const a=[],i={},o=[];if(t)a.push("$id: String!"),i.id=t,o.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),i.slug=e,o.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),i.marketCode=r,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(a.push("$locale: String!"),i.locale=s,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${a.join(", ")})`,l=`(
|
|
376
371
|
limit: 1
|
|
377
372
|
where: {
|
|
378
373
|
AND: [
|
|
@@ -402,7 +397,7 @@ query${n} {
|
|
|
402
397
|
}
|
|
403
398
|
}
|
|
404
399
|
}
|
|
405
|
-
`,{documentationCategoryCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},ke=async({marketCode:t,locale:e,categorySlug:r,page:
|
|
400
|
+
`,{documentationCategoryCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},ke=async({marketCode:t,locale:e,categorySlug:r,page:s=1,size:a=20}={})=>{const i=Math.max(1,Math.floor(s)),o=Math.max(1,Math.floor(a)),n=["$limit: Int!","$skip: Int!"],l={limit:o,skip:(i-1)*o},c=["limit: $limit","skip: $skip"],u=[];t&&(n.push("$marketCode: String!"),l.marketCode=t,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(n.push("$locale: String!"),l.locale=e,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),r&&(n.push("$categorySlug: String!"),l.categorySlug=r,u.push("{ category: { slug: $categorySlug } }")),u.length&&c.push(`where: {
|
|
406
401
|
AND: [
|
|
407
402
|
${u.join(`
|
|
408
403
|
`)}
|
|
@@ -440,7 +435,7 @@ query${g} {
|
|
|
440
435
|
}
|
|
441
436
|
}
|
|
442
437
|
}
|
|
443
|
-
`,{documentationArticleCollection:p}=await m.graphqlQuery(y,{...l});return new b({page:i,total:p.total,size:o,items:p.items})},Ae=async({id:t,slug:e,marketCode:r,locale:
|
|
438
|
+
`,{documentationArticleCollection:p}=await m.graphqlQuery(y,{...l});return new b({page:i,total:p.total,size:o,items:p.items})},Ae=async({id:t,slug:e,marketCode:r,locale:s})=>{const a=[],i={},o=[];if(t)a.push("$id: String!"),i.id=t,o.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),i.slug=e,o.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),i.marketCode=r,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(a.push("$locale: String!"),i.locale=s,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${a.join(", ")})`,l=`(
|
|
444
439
|
limit: 1
|
|
445
440
|
where: {
|
|
446
441
|
AND: [
|
|
@@ -501,7 +496,7 @@ query${n} {
|
|
|
501
496
|
}
|
|
502
497
|
}
|
|
503
498
|
}
|
|
504
|
-
`,{documentationArticleCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},Oe=async({page:t=1,size:e=20,marketCode:r,locale:
|
|
499
|
+
`,{documentationArticleCollection:u}=await m.graphqlQuery(c,{...i}),g=u.items.at(0);if(!g)throw new w;return g},Oe=async({page:t=1,size:e=20,marketCode:r,locale:s}={})=>{const a=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=[];r&&(o.push("$marketCode: String!"),n.marketCode=r,l.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(o.push("$locale: String!"),n.locale=s,l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const c=o.length?`(${o.join(", ")})`:"",u=l.length?`(
|
|
505
500
|
limit: $limit
|
|
506
501
|
skip: $skip
|
|
507
502
|
order: order_ASC
|
|
@@ -540,7 +535,7 @@ query${c} {
|
|
|
540
535
|
}
|
|
541
536
|
}
|
|
542
537
|
}
|
|
543
|
-
`,{hyperlinkCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:
|
|
538
|
+
`,{hyperlinkCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:a,total:f.total,size:i,items:f.items})},je=async({page:t=1,size:e=20,marketCode:r,locale:s}={})=>{const a=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),o=["$limit: Int!","$skip: Int!"],n={limit:i,skip:(a-1)*i},l=[];r&&(o.push("$marketCode: String!"),n.marketCode=r,l.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),s&&(o.push("$locale: String!"),n.locale=s,l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const c=`(${o.join(", ")})`,u=l.length?`(
|
|
544
539
|
limit: $limit
|
|
545
540
|
skip: $skip
|
|
546
541
|
where: {
|
|
@@ -566,4 +561,4 @@ query${c} {
|
|
|
566
561
|
}
|
|
567
562
|
}
|
|
568
563
|
}
|
|
569
|
-
`,{keywordCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:
|
|
564
|
+
`,{keywordCollectionCollection:f}=await m.graphqlQuery(g,{...n});return new b({page:a,total:f.total,size:i,items:f.items})};exports.ContentfulSDK=m;exports.PaginatedResponse=b;exports.getBannerCollections=ye;exports.getBlogCategories=be;exports.getBlogCategoryDetail=$e;exports.getBlogCollections=we;exports.getBlogPostDetail=de;exports.getBlogPosts=me;exports.getBrandCollections=Ce;exports.getDocArticleDetail=Ae;exports.getDocArticles=ke;exports.getDocCategories=ve;exports.getDocCategoryDetail=Se;exports.getHyperlinkCollections=Oe;exports.getKeywordCollections=je;
|
package/dist/index.js
CHANGED
|
@@ -54,8 +54,8 @@ function zt(t) {
|
|
|
54
54
|
}
|
|
55
55
|
var Et = gt ? zt : ct;
|
|
56
56
|
function k(t, e, r) {
|
|
57
|
-
for (var
|
|
58
|
-
if (n = a
|
|
57
|
+
for (var s = Et(t), a = 0, i = s.length, n = void 0, o = void 0; a < i; ++a)
|
|
58
|
+
if (n = s[a], !(n === "callee" || n === "caller")) {
|
|
59
59
|
if (o = Dt(t, n), !o) {
|
|
60
60
|
e[n] = r.copier(t[n], r);
|
|
61
61
|
continue;
|
|
@@ -72,49 +72,49 @@ function k(t, e, r) {
|
|
|
72
72
|
function Lt(t, e) {
|
|
73
73
|
var r = new e.Constructor();
|
|
74
74
|
e.cache.set(t, r);
|
|
75
|
-
for (var
|
|
76
|
-
r[
|
|
75
|
+
for (var s = 0, a = t.length; s < a; ++s)
|
|
76
|
+
r[s] = e.copier(t[s], e);
|
|
77
77
|
return r;
|
|
78
78
|
}
|
|
79
79
|
function Vt(t, e) {
|
|
80
80
|
var r = new e.Constructor();
|
|
81
81
|
return e.cache.set(t, r), k(t, r, e);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function ht(t, e) {
|
|
84
84
|
return t.slice(0);
|
|
85
85
|
}
|
|
86
86
|
function Nt(t, e) {
|
|
87
87
|
return t.slice(0, t.size, t.type);
|
|
88
88
|
}
|
|
89
89
|
function Bt(t, e) {
|
|
90
|
-
return new e.Constructor(
|
|
90
|
+
return new e.Constructor(ht(t.buffer));
|
|
91
91
|
}
|
|
92
92
|
function Qt(t, e) {
|
|
93
93
|
return new e.Constructor(t.getTime());
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function pt(t, e) {
|
|
96
96
|
var r = new e.Constructor();
|
|
97
|
-
return e.cache.set(t, r), t.forEach(function(
|
|
98
|
-
r.set(
|
|
97
|
+
return e.cache.set(t, r), t.forEach(function(s, a) {
|
|
98
|
+
r.set(a, e.copier(s, e));
|
|
99
99
|
}), r;
|
|
100
100
|
}
|
|
101
101
|
function Ft(t, e) {
|
|
102
|
-
return k(t,
|
|
102
|
+
return k(t, pt(t, e), e);
|
|
103
103
|
}
|
|
104
104
|
function Gt(t, e) {
|
|
105
105
|
var r = Q(e.prototype);
|
|
106
106
|
e.cache.set(t, r);
|
|
107
|
-
for (var
|
|
108
|
-
ft.call(t,
|
|
107
|
+
for (var s in t)
|
|
108
|
+
ft.call(t, s) && (r[s] = e.copier(t[s], e));
|
|
109
109
|
return r;
|
|
110
110
|
}
|
|
111
111
|
function Ut(t, e) {
|
|
112
112
|
var r = Q(e.prototype);
|
|
113
113
|
e.cache.set(t, r);
|
|
114
|
-
for (var
|
|
115
|
-
ft.call(t,
|
|
116
|
-
for (var
|
|
117
|
-
o =
|
|
114
|
+
for (var s in t)
|
|
115
|
+
ft.call(t, s) && (r[s] = e.copier(t[s], e));
|
|
116
|
+
for (var a = F(t), i = 0, n = a.length, o = void 0; i < n; ++i)
|
|
117
|
+
o = a[i], Mt.call(t, o) && (r[o] = e.copier(t[o], e));
|
|
118
118
|
return r;
|
|
119
119
|
}
|
|
120
120
|
var Kt = gt ? Ut : Gt;
|
|
@@ -134,8 +134,8 @@ function S(t, e) {
|
|
|
134
134
|
}
|
|
135
135
|
function yt(t, e) {
|
|
136
136
|
var r = new e.Constructor();
|
|
137
|
-
return e.cache.set(t, r), t.forEach(function(
|
|
138
|
-
r.add(e.copier(
|
|
137
|
+
return e.cache.set(t, r), t.forEach(function(s) {
|
|
138
|
+
r.add(e.copier(s, e));
|
|
139
139
|
}), r;
|
|
140
140
|
}
|
|
141
141
|
function Ht(t, e) {
|
|
@@ -145,12 +145,12 @@ var Yt = Array.isArray, G = Object.assign, Xt = Object.getPrototypeOf || (functi
|
|
|
145
145
|
return t.__proto__;
|
|
146
146
|
}), mt = {
|
|
147
147
|
array: Lt,
|
|
148
|
-
arrayBuffer:
|
|
148
|
+
arrayBuffer: ht,
|
|
149
149
|
blob: Nt,
|
|
150
150
|
dataView: Bt,
|
|
151
151
|
date: Qt,
|
|
152
152
|
error: S,
|
|
153
|
-
map:
|
|
153
|
+
map: pt,
|
|
154
154
|
object: Kt,
|
|
155
155
|
regExp: Jt,
|
|
156
156
|
set: yt
|
|
@@ -192,18 +192,18 @@ function te(t) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
function dt(t) {
|
|
195
|
-
var e = G({}, mt, t), r = te(e),
|
|
195
|
+
var e = G({}, mt, t), r = te(e), s = r.Array, a = r.Object;
|
|
196
196
|
function i(n, o) {
|
|
197
197
|
if (o.prototype = o.Constructor = void 0, !n || typeof n != "object")
|
|
198
198
|
return n;
|
|
199
199
|
if (o.cache.has(n))
|
|
200
200
|
return o.cache.get(n);
|
|
201
201
|
if (o.prototype = Xt(n), o.Constructor = o.prototype && o.prototype.constructor, !o.Constructor || o.Constructor === Object)
|
|
202
|
-
return s(n, o);
|
|
203
|
-
if (Yt(n))
|
|
204
202
|
return a(n, o);
|
|
203
|
+
if (Yt(n))
|
|
204
|
+
return s(n, o);
|
|
205
205
|
var l = r[It(n)];
|
|
206
|
-
return l ? l(n, o) : typeof n.then == "function" ? n :
|
|
206
|
+
return l ? l(n, o) : typeof n.then == "function" ? n : a(n, o);
|
|
207
207
|
}
|
|
208
208
|
return function(o) {
|
|
209
209
|
return i(o, {
|
|
@@ -224,51 +224,51 @@ function re() {
|
|
|
224
224
|
if (U) return T.exports;
|
|
225
225
|
U = 1;
|
|
226
226
|
var t = T.exports = {}, e, r;
|
|
227
|
-
function
|
|
227
|
+
function s() {
|
|
228
228
|
throw new Error("setTimeout has not been defined");
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function a() {
|
|
231
231
|
throw new Error("clearTimeout has not been defined");
|
|
232
232
|
}
|
|
233
233
|
(function() {
|
|
234
234
|
try {
|
|
235
|
-
typeof setTimeout == "function" ? e = setTimeout : e =
|
|
235
|
+
typeof setTimeout == "function" ? e = setTimeout : e = s;
|
|
236
236
|
} catch {
|
|
237
|
-
e =
|
|
237
|
+
e = s;
|
|
238
238
|
}
|
|
239
239
|
try {
|
|
240
|
-
typeof clearTimeout == "function" ? r = clearTimeout : r =
|
|
240
|
+
typeof clearTimeout == "function" ? r = clearTimeout : r = a;
|
|
241
241
|
} catch {
|
|
242
|
-
r =
|
|
242
|
+
r = a;
|
|
243
243
|
}
|
|
244
244
|
})();
|
|
245
|
-
function i(
|
|
245
|
+
function i(p) {
|
|
246
246
|
if (e === setTimeout)
|
|
247
|
-
return setTimeout(
|
|
248
|
-
if ((e ===
|
|
249
|
-
return e = setTimeout, setTimeout(
|
|
247
|
+
return setTimeout(p, 0);
|
|
248
|
+
if ((e === s || !e) && setTimeout)
|
|
249
|
+
return e = setTimeout, setTimeout(p, 0);
|
|
250
250
|
try {
|
|
251
|
-
return e(
|
|
251
|
+
return e(p, 0);
|
|
252
252
|
} catch {
|
|
253
253
|
try {
|
|
254
|
-
return e.call(null,
|
|
254
|
+
return e.call(null, p, 0);
|
|
255
255
|
} catch {
|
|
256
|
-
return e.call(this,
|
|
256
|
+
return e.call(this, p, 0);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function n(
|
|
260
|
+
function n(p) {
|
|
261
261
|
if (r === clearTimeout)
|
|
262
|
-
return clearTimeout(
|
|
263
|
-
if ((r ===
|
|
264
|
-
return r = clearTimeout, clearTimeout(
|
|
262
|
+
return clearTimeout(p);
|
|
263
|
+
if ((r === a || !r) && clearTimeout)
|
|
264
|
+
return r = clearTimeout, clearTimeout(p);
|
|
265
265
|
try {
|
|
266
|
-
return r(
|
|
266
|
+
return r(p);
|
|
267
267
|
} catch {
|
|
268
268
|
try {
|
|
269
|
-
return r.call(null,
|
|
269
|
+
return r.call(null, p);
|
|
270
270
|
} catch {
|
|
271
|
-
return r.call(this,
|
|
271
|
+
return r.call(this, p);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -278,38 +278,38 @@ function re() {
|
|
|
278
278
|
}
|
|
279
279
|
function g() {
|
|
280
280
|
if (!l) {
|
|
281
|
-
var
|
|
281
|
+
var p = i(f);
|
|
282
282
|
l = !0;
|
|
283
283
|
for (var d = o.length; d; ) {
|
|
284
284
|
for (c = o, o = []; ++u < d; )
|
|
285
285
|
c && c[u].run();
|
|
286
286
|
u = -1, d = o.length;
|
|
287
287
|
}
|
|
288
|
-
c = null, l = !1, n(
|
|
288
|
+
c = null, l = !1, n(p);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
t.nextTick = function(
|
|
291
|
+
t.nextTick = function(p) {
|
|
292
292
|
var d = new Array(arguments.length - 1);
|
|
293
293
|
if (arguments.length > 1)
|
|
294
294
|
for (var $ = 1; $ < arguments.length; $++)
|
|
295
295
|
d[$ - 1] = arguments[$];
|
|
296
|
-
o.push(new y(
|
|
296
|
+
o.push(new y(p, d)), o.length === 1 && !l && i(g);
|
|
297
297
|
};
|
|
298
|
-
function y(
|
|
299
|
-
this.fun =
|
|
298
|
+
function y(p, d) {
|
|
299
|
+
this.fun = p, this.array = d;
|
|
300
300
|
}
|
|
301
301
|
y.prototype.run = function() {
|
|
302
302
|
this.fun.apply(null, this.array);
|
|
303
303
|
}, t.title = "browser", t.browser = !0, t.env = {}, t.argv = [], t.version = "", t.versions = {};
|
|
304
|
-
function
|
|
304
|
+
function h() {
|
|
305
305
|
}
|
|
306
|
-
return t.on =
|
|
306
|
+
return t.on = h, t.addListener = h, t.once = h, t.off = h, t.removeListener = h, t.removeAllListeners = h, t.emit = h, t.prependListener = h, t.prependOnceListener = h, t.listeners = function(p) {
|
|
307
307
|
return [];
|
|
308
|
-
}, t.binding = function(
|
|
308
|
+
}, t.binding = function(p) {
|
|
309
309
|
throw new Error("process.binding is not supported");
|
|
310
310
|
}, t.cwd = function() {
|
|
311
311
|
return "/";
|
|
312
|
-
}, t.chdir = function(
|
|
312
|
+
}, t.chdir = function(p) {
|
|
313
313
|
throw new Error("process.chdir is not supported");
|
|
314
314
|
}, t.umask = function() {
|
|
315
315
|
return 0;
|
|
@@ -341,26 +341,26 @@ var x, H;
|
|
|
341
341
|
function ie() {
|
|
342
342
|
if (H) return x;
|
|
343
343
|
H = 1;
|
|
344
|
-
var t = bt(), e = Object.prototype, r = e.hasOwnProperty,
|
|
344
|
+
var t = bt(), e = Object.prototype, r = e.hasOwnProperty, s = e.toString, a = t ? t.toStringTag : void 0;
|
|
345
345
|
function i(n) {
|
|
346
|
-
var o = r.call(n,
|
|
346
|
+
var o = r.call(n, a), l = n[a];
|
|
347
347
|
try {
|
|
348
|
-
n[
|
|
348
|
+
n[a] = void 0;
|
|
349
349
|
var c = !0;
|
|
350
350
|
} catch {
|
|
351
351
|
}
|
|
352
|
-
var u =
|
|
353
|
-
return c && (o ? n[
|
|
352
|
+
var u = s.call(n);
|
|
353
|
+
return c && (o ? n[a] = l : delete n[a]), u;
|
|
354
354
|
}
|
|
355
355
|
return x = i, x;
|
|
356
356
|
}
|
|
357
357
|
var I, Y;
|
|
358
|
-
function
|
|
358
|
+
function ae() {
|
|
359
359
|
if (Y) return I;
|
|
360
360
|
Y = 1;
|
|
361
361
|
var t = Object.prototype, e = t.toString;
|
|
362
|
-
function r(
|
|
363
|
-
return e.call(
|
|
362
|
+
function r(s) {
|
|
363
|
+
return e.call(s);
|
|
364
364
|
}
|
|
365
365
|
return I = r, I;
|
|
366
366
|
}
|
|
@@ -368,14 +368,14 @@ var R, X;
|
|
|
368
368
|
function $t() {
|
|
369
369
|
if (X) return R;
|
|
370
370
|
X = 1;
|
|
371
|
-
var t = bt(), e = ie(), r =
|
|
371
|
+
var t = bt(), e = ie(), r = ae(), s = "[object Null]", a = "[object Undefined]", i = t ? t.toStringTag : void 0;
|
|
372
372
|
function n(o) {
|
|
373
|
-
return o == null ? o === void 0 ?
|
|
373
|
+
return o == null ? o === void 0 ? a : s : i && i in Object(o) ? e(o) : r(o);
|
|
374
374
|
}
|
|
375
375
|
return R = n, R;
|
|
376
376
|
}
|
|
377
377
|
var D, Z;
|
|
378
|
-
function
|
|
378
|
+
function se() {
|
|
379
379
|
if (Z) return D;
|
|
380
380
|
Z = 1;
|
|
381
381
|
var t = Array.isArray;
|
|
@@ -394,11 +394,11 @@ var z, et;
|
|
|
394
394
|
function le() {
|
|
395
395
|
if (et) return z;
|
|
396
396
|
et = 1;
|
|
397
|
-
var t = $t(), e =
|
|
398
|
-
function
|
|
399
|
-
return typeof i == "string" || !e(i) && r(i) && t(i) ==
|
|
397
|
+
var t = $t(), e = se(), r = wt(), s = "[object String]";
|
|
398
|
+
function a(i) {
|
|
399
|
+
return typeof i == "string" || !e(i) && r(i) && t(i) == s;
|
|
400
400
|
}
|
|
401
|
-
return z =
|
|
401
|
+
return z = a, z;
|
|
402
402
|
}
|
|
403
403
|
le();
|
|
404
404
|
var E, rt;
|
|
@@ -406,8 +406,8 @@ function ce() {
|
|
|
406
406
|
if (rt) return E;
|
|
407
407
|
rt = 1;
|
|
408
408
|
function t(e, r) {
|
|
409
|
-
return function(
|
|
410
|
-
return e(r(
|
|
409
|
+
return function(s) {
|
|
410
|
+
return e(r(s));
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
413
|
return E = t, E;
|
|
@@ -423,9 +423,9 @@ var V, ot;
|
|
|
423
423
|
function fe() {
|
|
424
424
|
if (ot) return V;
|
|
425
425
|
ot = 1;
|
|
426
|
-
var t = $t(), e = ue(), r = wt(),
|
|
426
|
+
var t = $t(), e = ue(), r = wt(), s = "[object Object]", a = Function.prototype, i = Object.prototype, n = a.toString, o = i.hasOwnProperty, l = n.call(Object);
|
|
427
427
|
function c(u) {
|
|
428
|
-
if (!r(u) || t(u) !=
|
|
428
|
+
if (!r(u) || t(u) != s)
|
|
429
429
|
return !1;
|
|
430
430
|
var f = e(u);
|
|
431
431
|
if (f === null)
|
|
@@ -446,56 +446,56 @@ function ge() {
|
|
|
446
446
|
if (it) return N;
|
|
447
447
|
it = 1;
|
|
448
448
|
var t = Object.prototype.hasOwnProperty, e = Object.prototype.toString;
|
|
449
|
-
return N = function(r,
|
|
450
|
-
if (e.call(
|
|
449
|
+
return N = function(r, s, a) {
|
|
450
|
+
if (e.call(s) !== "[object Function]")
|
|
451
451
|
throw new TypeError("iterator must be a function");
|
|
452
452
|
var i = r.length;
|
|
453
453
|
if (i === +i)
|
|
454
454
|
for (var n = 0; n < i; n++)
|
|
455
|
-
|
|
455
|
+
s.call(a, r[n], n, r);
|
|
456
456
|
else
|
|
457
457
|
for (var o in r)
|
|
458
|
-
t.call(r, o) &&
|
|
458
|
+
t.call(r, o) && s.call(a, r[o], o, r);
|
|
459
459
|
}, N;
|
|
460
460
|
}
|
|
461
|
-
var B,
|
|
462
|
-
function
|
|
463
|
-
if (
|
|
464
|
-
|
|
461
|
+
var B, at;
|
|
462
|
+
function he() {
|
|
463
|
+
if (at) return B;
|
|
464
|
+
at = 1;
|
|
465
465
|
var t = ge();
|
|
466
466
|
B = e;
|
|
467
|
-
function e(r,
|
|
467
|
+
function e(r, s, a) {
|
|
468
468
|
if (arguments.length === 3)
|
|
469
|
-
return e.set(r,
|
|
469
|
+
return e.set(r, s, a);
|
|
470
470
|
if (arguments.length === 2)
|
|
471
|
-
return e.get(r,
|
|
471
|
+
return e.get(r, s);
|
|
472
472
|
var i = e.bind(e, r);
|
|
473
473
|
for (var n in e)
|
|
474
474
|
e.hasOwnProperty(n) && (i[n] = e[n].bind(i, r));
|
|
475
475
|
return i;
|
|
476
476
|
}
|
|
477
|
-
return e.get = function(r,
|
|
478
|
-
for (var
|
|
479
|
-
var n =
|
|
477
|
+
return e.get = function(r, s) {
|
|
478
|
+
for (var a = Array.isArray(s) ? s : e.parse(s), i = 0; i < a.length; ++i) {
|
|
479
|
+
var n = a[i];
|
|
480
480
|
if (!(typeof r == "object" && n in r))
|
|
481
481
|
throw new Error("Invalid reference token: " + n);
|
|
482
482
|
r = r[n];
|
|
483
483
|
}
|
|
484
484
|
return r;
|
|
485
|
-
}, e.set = function(r,
|
|
486
|
-
var i = Array.isArray(
|
|
485
|
+
}, e.set = function(r, s, a) {
|
|
486
|
+
var i = Array.isArray(s) ? s : e.parse(s), n = i[0];
|
|
487
487
|
if (i.length === 0)
|
|
488
488
|
throw Error("Can not set the root object");
|
|
489
489
|
for (var o = 0; o < i.length - 1; ++o) {
|
|
490
490
|
var l = i[o];
|
|
491
491
|
typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length), n = i[o + 1], l in r || (n.match(/^(\d+|-)$/) ? r[l] = [] : r[l] = {}), r = r[l]);
|
|
492
492
|
}
|
|
493
|
-
return n === "-" && Array.isArray(r) && (n = r.length), r[n] =
|
|
494
|
-
}, e.remove = function(r,
|
|
495
|
-
var
|
|
493
|
+
return n === "-" && Array.isArray(r) && (n = r.length), r[n] = a, this;
|
|
494
|
+
}, e.remove = function(r, s) {
|
|
495
|
+
var a = Array.isArray(s) ? s : e.parse(s), i = a[a.length - 1];
|
|
496
496
|
if (i === void 0)
|
|
497
|
-
throw new Error('Invalid JSON pointer for remove: "' +
|
|
498
|
-
var n = e.get(r,
|
|
497
|
+
throw new Error('Invalid JSON pointer for remove: "' + s + '"');
|
|
498
|
+
var n = e.get(r, a.slice(0, -1));
|
|
499
499
|
if (Array.isArray(n)) {
|
|
500
500
|
var o = +i;
|
|
501
501
|
if (i === "" && isNaN(o))
|
|
@@ -503,24 +503,24 @@ function pe() {
|
|
|
503
503
|
Array.prototype.splice.call(n, o, 1);
|
|
504
504
|
} else
|
|
505
505
|
delete n[i];
|
|
506
|
-
}, e.dict = function(r,
|
|
507
|
-
var
|
|
506
|
+
}, e.dict = function(r, s) {
|
|
507
|
+
var a = {};
|
|
508
508
|
return e.walk(r, function(i, n) {
|
|
509
|
-
|
|
510
|
-
},
|
|
511
|
-
}, e.walk = function(r,
|
|
509
|
+
a[n] = i;
|
|
510
|
+
}, s), a;
|
|
511
|
+
}, e.walk = function(r, s, a) {
|
|
512
512
|
var i = [];
|
|
513
|
-
|
|
513
|
+
a = a || function(n) {
|
|
514
514
|
var o = Object.prototype.toString.call(n);
|
|
515
515
|
return o === "[object Object]" || o === "[object Array]";
|
|
516
516
|
}, (function n(o) {
|
|
517
517
|
t(o, function(l, c) {
|
|
518
|
-
i.push(String(c)),
|
|
518
|
+
i.push(String(c)), a(l) ? n(l) : s(l, e.compile(i)), i.pop();
|
|
519
519
|
});
|
|
520
520
|
})(r);
|
|
521
|
-
}, e.has = function(r,
|
|
521
|
+
}, e.has = function(r, s) {
|
|
522
522
|
try {
|
|
523
|
-
e.get(r,
|
|
523
|
+
e.get(r, s);
|
|
524
524
|
} catch {
|
|
525
525
|
return !1;
|
|
526
526
|
}
|
|
@@ -539,15 +539,15 @@ function pe() {
|
|
|
539
539
|
return r.length === 0 ? "" : "/" + r.map(e.escape).join("/");
|
|
540
540
|
}, B;
|
|
541
541
|
}
|
|
542
|
-
|
|
543
|
-
var v = { exports: {} },
|
|
544
|
-
function
|
|
545
|
-
return
|
|
546
|
-
e = t.exports = r, e.getSerialize =
|
|
547
|
-
function r(
|
|
548
|
-
return JSON.stringify(
|
|
542
|
+
he();
|
|
543
|
+
var v = { exports: {} }, st;
|
|
544
|
+
function pe() {
|
|
545
|
+
return st || (st = 1, (function(t, e) {
|
|
546
|
+
e = t.exports = r, e.getSerialize = s;
|
|
547
|
+
function r(a, i, n, o) {
|
|
548
|
+
return JSON.stringify(a, s(i, o), n);
|
|
549
549
|
}
|
|
550
|
-
function a
|
|
550
|
+
function s(a, i) {
|
|
551
551
|
var n = [], o = [];
|
|
552
552
|
return i == null && (i = function(l, c) {
|
|
553
553
|
return n[0] === c ? "[Circular ~]" : "[Circular ~." + o.slice(0, n.indexOf(c)).join(".") + "]";
|
|
@@ -556,12 +556,12 @@ function he() {
|
|
|
556
556
|
var u = n.indexOf(this);
|
|
557
557
|
~u ? n.splice(u + 1) : n.push(this), ~u ? o.splice(u, 1 / 0, l) : o.push(l), ~n.indexOf(c) && (c = i.call(this, l, c));
|
|
558
558
|
} else n.push(c);
|
|
559
|
-
return
|
|
559
|
+
return a == null ? c : a.call(this, l, c);
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
562
|
})(v, v.exports)), v.exports;
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
pe();
|
|
565
565
|
class m {
|
|
566
566
|
static _clientParams;
|
|
567
567
|
// static getter
|
|
@@ -577,13 +577,13 @@ class m {
|
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
static async graphqlQuery(e, r = {}) {
|
|
580
|
-
const { space:
|
|
581
|
-
`https://graphql.contentful.com/content/v1/spaces/${
|
|
580
|
+
const { space: s, accessToken: a, environment: i = "master" } = this.clientParams, n = await fetch(
|
|
581
|
+
`https://graphql.contentful.com/content/v1/spaces/${s}/environments/${i}`,
|
|
582
582
|
{
|
|
583
583
|
method: "POST",
|
|
584
584
|
headers: {
|
|
585
585
|
"Content-Type": "application/json",
|
|
586
|
-
Authorization: `Bearer ${
|
|
586
|
+
Authorization: `Bearer ${a}`
|
|
587
587
|
},
|
|
588
588
|
body: JSON.stringify({ query: e, variables: r })
|
|
589
589
|
}
|
|
@@ -611,10 +611,10 @@ class b {
|
|
|
611
611
|
constructor({
|
|
612
612
|
page: e,
|
|
613
613
|
total: r,
|
|
614
|
-
size:
|
|
615
|
-
items:
|
|
614
|
+
size: s,
|
|
615
|
+
items: a
|
|
616
616
|
}) {
|
|
617
|
-
this.page = e, this.total = r, this.size =
|
|
617
|
+
this.page = e, this.total = r, this.size = s, this.items = a;
|
|
618
618
|
}
|
|
619
619
|
get totalPages() {
|
|
620
620
|
return Math.ceil(this.total / this.size);
|
|
@@ -624,8 +624,8 @@ const ye = async ({
|
|
|
624
624
|
slot: t,
|
|
625
625
|
page: e = 1,
|
|
626
626
|
size: r = 20,
|
|
627
|
-
platform:
|
|
628
|
-
marketCode:
|
|
627
|
+
platform: s,
|
|
628
|
+
marketCode: a,
|
|
629
629
|
locale: i
|
|
630
630
|
}) => {
|
|
631
631
|
const n = Math.max(1, Math.floor(e)), o = Math.max(1, Math.floor(r)), l = [
|
|
@@ -637,7 +637,7 @@ const ye = async ({
|
|
|
637
637
|
limit: o,
|
|
638
638
|
skip: (n - 1) * o
|
|
639
639
|
}, u = ["{ slot: $slot }"];
|
|
640
|
-
|
|
640
|
+
s && (l.push("$platform: String!"), c.platform = s, u.push("{ platform_contains_some: [$platform] }")), a && (l.push("$marketCode: String!"), c.marketCode = a, u.push(
|
|
641
641
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
642
642
|
)), i && (l.push("$locale: String!"), c.locale = i, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
643
643
|
const f = `(${l.join(", ")})`, g = `(
|
|
@@ -686,14 +686,14 @@ query${f} {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
`, { bannerCollectionCollection:
|
|
689
|
+
`, { bannerCollectionCollection: h } = await m.graphqlQuery(y, {
|
|
690
690
|
...c
|
|
691
691
|
});
|
|
692
692
|
return new b({
|
|
693
693
|
page: n,
|
|
694
|
-
total:
|
|
694
|
+
total: h.total,
|
|
695
695
|
size: o,
|
|
696
|
-
items:
|
|
696
|
+
items: h.items
|
|
697
697
|
});
|
|
698
698
|
};
|
|
699
699
|
class w extends Response {
|
|
@@ -708,11 +708,11 @@ const me = async ({
|
|
|
708
708
|
marketCode: t,
|
|
709
709
|
locale: e,
|
|
710
710
|
collectionId: r,
|
|
711
|
-
categoryId:
|
|
712
|
-
page:
|
|
711
|
+
categoryId: s,
|
|
712
|
+
page: a = 1,
|
|
713
713
|
size: i = 20
|
|
714
714
|
} = {}) => {
|
|
715
|
-
const n = Math.max(1, Math.floor(
|
|
715
|
+
const n = Math.max(1, Math.floor(a)), o = Math.max(1, Math.floor(i));
|
|
716
716
|
if (r) {
|
|
717
717
|
const d = `
|
|
718
718
|
query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
@@ -772,7 +772,7 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
772
772
|
}, u = ["limit: $limit", "skip: $skip"], f = [];
|
|
773
773
|
t && (l.push("$marketCode: String!"), c.marketCode = t, f.push(
|
|
774
774
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
775
|
-
)), e && (l.push("$locale: String!"), c.locale = e, f.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),
|
|
775
|
+
)), e && (l.push("$locale: String!"), c.locale = e, f.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), s && (l.push("$categoryId: String!"), c.categoryId = s, f.push("{ categories: { sys: { id: $categoryId } } }")), f.length && u.push(`where: {
|
|
776
776
|
AND: [
|
|
777
777
|
${f.join(`
|
|
778
778
|
`)}
|
|
@@ -781,7 +781,7 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
781
781
|
const g = l.length ? `(${l.join(", ")})` : "", y = u.length ? `(
|
|
782
782
|
${u.join(`
|
|
783
783
|
`)}
|
|
784
|
-
)` : "",
|
|
784
|
+
)` : "", h = `
|
|
785
785
|
query${g} {
|
|
786
786
|
blogPostCollection${y} {
|
|
787
787
|
total
|
|
@@ -815,32 +815,32 @@ query${g} {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
`, { blogPostCollection:
|
|
818
|
+
`, { blogPostCollection: p } = await m.graphqlQuery(h, {
|
|
819
819
|
...c
|
|
820
820
|
});
|
|
821
821
|
return new b({
|
|
822
822
|
page: n,
|
|
823
|
-
total:
|
|
823
|
+
total: p.total,
|
|
824
824
|
size: o,
|
|
825
|
-
items:
|
|
825
|
+
items: p.items
|
|
826
826
|
});
|
|
827
827
|
}, de = async ({
|
|
828
828
|
id: t,
|
|
829
829
|
slug: e,
|
|
830
830
|
marketCode: r,
|
|
831
|
-
locale:
|
|
831
|
+
locale: s
|
|
832
832
|
}) => {
|
|
833
|
-
const
|
|
833
|
+
const a = [], i = {}, n = [];
|
|
834
834
|
if (t)
|
|
835
|
-
|
|
835
|
+
a.push("$id: String!"), i.id = t, n.push("{ sys: { id: $id } }");
|
|
836
836
|
else if (e)
|
|
837
|
-
|
|
837
|
+
a.push("$slug: String!"), i.slug = e, n.push("{ slug: $slug }");
|
|
838
838
|
else
|
|
839
839
|
throw new Error("Either id or slug is required.");
|
|
840
|
-
r && (
|
|
840
|
+
r && (a.push("$marketCode: String!"), i.marketCode = r, n.push(
|
|
841
841
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
842
|
-
)),
|
|
843
|
-
const o = `(${
|
|
842
|
+
)), s && (a.push("$locale: String!"), i.locale = s, n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
843
|
+
const o = `(${a.join(", ")})`, l = `(
|
|
844
844
|
limit: 1
|
|
845
845
|
where: {
|
|
846
846
|
AND: [
|
|
@@ -924,11 +924,11 @@ query${o} {
|
|
|
924
924
|
marketCode: t,
|
|
925
925
|
locale: e,
|
|
926
926
|
page: r = 1,
|
|
927
|
-
size:
|
|
927
|
+
size: s = 20
|
|
928
928
|
} = {}) => {
|
|
929
|
-
const
|
|
929
|
+
const a = Math.max(1, Math.floor(r)), i = Math.max(1, Math.floor(s)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
930
930
|
limit: i,
|
|
931
|
-
skip: (
|
|
931
|
+
skip: (a - 1) * i
|
|
932
932
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
933
933
|
t && (n.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
934
934
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
@@ -951,6 +951,12 @@ query${u} {
|
|
|
951
951
|
}
|
|
952
952
|
title
|
|
953
953
|
slug
|
|
954
|
+
featuredImage {
|
|
955
|
+
url
|
|
956
|
+
width
|
|
957
|
+
height
|
|
958
|
+
contentType
|
|
959
|
+
}
|
|
954
960
|
}
|
|
955
961
|
}
|
|
956
962
|
}
|
|
@@ -958,7 +964,7 @@ query${u} {
|
|
|
958
964
|
...o
|
|
959
965
|
});
|
|
960
966
|
return new b({
|
|
961
|
-
page:
|
|
967
|
+
page: a,
|
|
962
968
|
total: y.total,
|
|
963
969
|
size: i,
|
|
964
970
|
items: y.items
|
|
@@ -967,19 +973,19 @@ query${u} {
|
|
|
967
973
|
id: t,
|
|
968
974
|
slug: e,
|
|
969
975
|
marketCode: r,
|
|
970
|
-
locale:
|
|
976
|
+
locale: s
|
|
971
977
|
}) => {
|
|
972
|
-
const
|
|
978
|
+
const a = [], i = {}, n = [];
|
|
973
979
|
if (t)
|
|
974
|
-
|
|
980
|
+
a.push("$id: String!"), i.id = t, n.push("{ sys: { id: $id } }");
|
|
975
981
|
else if (e)
|
|
976
|
-
|
|
982
|
+
a.push("$slug: String!"), i.slug = e, n.push("{ slug: $slug }");
|
|
977
983
|
else
|
|
978
984
|
throw new Error("Either id or slug is required.");
|
|
979
|
-
r && (
|
|
985
|
+
r && (a.push("$marketCode: String!"), i.marketCode = r, n.push(
|
|
980
986
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
981
|
-
)),
|
|
982
|
-
const o = `(${
|
|
987
|
+
)), s && (a.push("$locale: String!"), i.locale = s, n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
988
|
+
const o = `(${a.join(", ")})`, l = `(
|
|
983
989
|
limit: 1
|
|
984
990
|
where: {
|
|
985
991
|
AND: [
|
|
@@ -996,23 +1002,12 @@ query${o} {
|
|
|
996
1002
|
}
|
|
997
1003
|
title
|
|
998
1004
|
slug
|
|
999
|
-
description
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
id
|
|
1006
|
-
}
|
|
1007
|
-
url
|
|
1008
|
-
width
|
|
1009
|
-
height
|
|
1010
|
-
contentType
|
|
1011
|
-
title
|
|
1012
|
-
description
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1005
|
+
description
|
|
1006
|
+
featuredImage {
|
|
1007
|
+
url
|
|
1008
|
+
width
|
|
1009
|
+
height
|
|
1010
|
+
contentType
|
|
1016
1011
|
}
|
|
1017
1012
|
}
|
|
1018
1013
|
}
|
|
@@ -1027,11 +1022,11 @@ query${o} {
|
|
|
1027
1022
|
marketCode: t,
|
|
1028
1023
|
locale: e,
|
|
1029
1024
|
page: r = 1,
|
|
1030
|
-
size:
|
|
1025
|
+
size: s = 20
|
|
1031
1026
|
} = {}) => {
|
|
1032
|
-
const
|
|
1027
|
+
const a = Math.max(1, Math.floor(r)), i = Math.max(1, Math.floor(s)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1033
1028
|
limit: i,
|
|
1034
|
-
skip: (
|
|
1029
|
+
skip: (a - 1) * i
|
|
1035
1030
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
1036
1031
|
t && (n.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
1037
1032
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
@@ -1077,29 +1072,29 @@ query${u} {
|
|
|
1077
1072
|
...o
|
|
1078
1073
|
});
|
|
1079
1074
|
return new b({
|
|
1080
|
-
page:
|
|
1075
|
+
page: a,
|
|
1081
1076
|
total: y.total,
|
|
1082
1077
|
size: i,
|
|
1083
|
-
items: y.items.map((
|
|
1084
|
-
...
|
|
1085
|
-
category:
|
|
1086
|
-
categoryId:
|
|
1087
|
-
collectionId:
|
|
1078
|
+
items: y.items.map((h) => ({
|
|
1079
|
+
...h,
|
|
1080
|
+
category: h.type === "category" ? h.category : null,
|
|
1081
|
+
categoryId: h.type === "category" ? h.category?.sys.id ?? null : null,
|
|
1082
|
+
collectionId: h.type === "manual" ? h.sys.id : null
|
|
1088
1083
|
}))
|
|
1089
1084
|
});
|
|
1090
1085
|
}, Ce = async ({
|
|
1091
1086
|
page: t = 1,
|
|
1092
1087
|
size: e = 20,
|
|
1093
1088
|
marketCode: r,
|
|
1094
|
-
locale:
|
|
1089
|
+
locale: s
|
|
1095
1090
|
} = {}) => {
|
|
1096
|
-
const
|
|
1091
|
+
const a = Math.max(1, Math.floor(t)), i = Math.max(1, Math.floor(e)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1097
1092
|
limit: i,
|
|
1098
|
-
skip: (
|
|
1093
|
+
skip: (a - 1) * i
|
|
1099
1094
|
}, l = [];
|
|
1100
1095
|
r && (n.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1101
1096
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1102
|
-
)),
|
|
1097
|
+
)), s && (n.push("$locale: String!"), o.locale = s, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1103
1098
|
const c = `(${n.join(", ")})`, u = l.length ? `(
|
|
1104
1099
|
limit: $limit
|
|
1105
1100
|
skip: $skip
|
|
@@ -1152,7 +1147,7 @@ query${c} {
|
|
|
1152
1147
|
...o
|
|
1153
1148
|
});
|
|
1154
1149
|
return new b({
|
|
1155
|
-
page:
|
|
1150
|
+
page: a,
|
|
1156
1151
|
total: g.total,
|
|
1157
1152
|
size: i,
|
|
1158
1153
|
items: g.items
|
|
@@ -1161,11 +1156,11 @@ query${c} {
|
|
|
1161
1156
|
marketCode: t,
|
|
1162
1157
|
locale: e,
|
|
1163
1158
|
page: r = 1,
|
|
1164
|
-
size:
|
|
1159
|
+
size: s = 20
|
|
1165
1160
|
} = {}) => {
|
|
1166
|
-
const
|
|
1161
|
+
const a = Math.max(1, Math.floor(r)), i = Math.max(1, Math.floor(s)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1167
1162
|
limit: i,
|
|
1168
|
-
skip: (
|
|
1163
|
+
skip: (a - 1) * i
|
|
1169
1164
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
1170
1165
|
t && (n.push("$marketCode: String!"), o.marketCode = t, c.push(
|
|
1171
1166
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
@@ -1207,7 +1202,7 @@ query${u} {
|
|
|
1207
1202
|
...o
|
|
1208
1203
|
});
|
|
1209
1204
|
return new b({
|
|
1210
|
-
page:
|
|
1205
|
+
page: a,
|
|
1211
1206
|
total: y.total,
|
|
1212
1207
|
size: i,
|
|
1213
1208
|
items: y.items
|
|
@@ -1216,21 +1211,21 @@ query${u} {
|
|
|
1216
1211
|
id: t,
|
|
1217
1212
|
slug: e,
|
|
1218
1213
|
marketCode: r,
|
|
1219
|
-
locale:
|
|
1214
|
+
locale: s
|
|
1220
1215
|
}) => {
|
|
1221
|
-
const
|
|
1216
|
+
const a = [], i = {}, n = [];
|
|
1222
1217
|
if (t)
|
|
1223
|
-
|
|
1218
|
+
a.push("$id: String!"), i.id = t, n.push("{ sys: { id: $id } }");
|
|
1224
1219
|
else if (e)
|
|
1225
|
-
|
|
1220
|
+
a.push("$slug: String!"), i.slug = e, n.push("{ slug: $slug }");
|
|
1226
1221
|
else
|
|
1227
1222
|
throw new Error("Either id or slug is required.");
|
|
1228
|
-
r && (
|
|
1223
|
+
r && (a.push("$marketCode: String!"), i.marketCode = r, n.push(
|
|
1229
1224
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1230
|
-
)),
|
|
1225
|
+
)), s && (a.push("$locale: String!"), i.locale = s, n.push(
|
|
1231
1226
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1232
1227
|
));
|
|
1233
|
-
const o = `(${
|
|
1228
|
+
const o = `(${a.join(", ")})`, l = `(
|
|
1234
1229
|
limit: 1
|
|
1235
1230
|
where: {
|
|
1236
1231
|
AND: [
|
|
@@ -1270,10 +1265,10 @@ query${o} {
|
|
|
1270
1265
|
marketCode: t,
|
|
1271
1266
|
locale: e,
|
|
1272
1267
|
categorySlug: r,
|
|
1273
|
-
page:
|
|
1274
|
-
size:
|
|
1268
|
+
page: s = 1,
|
|
1269
|
+
size: a = 20
|
|
1275
1270
|
} = {}) => {
|
|
1276
|
-
const i = Math.max(1, Math.floor(
|
|
1271
|
+
const i = Math.max(1, Math.floor(s)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], l = {
|
|
1277
1272
|
limit: n,
|
|
1278
1273
|
skip: (i - 1) * n
|
|
1279
1274
|
}, c = ["limit: $limit", "skip: $skip"], u = [];
|
|
@@ -1320,34 +1315,34 @@ query${f} {
|
|
|
1320
1315
|
}
|
|
1321
1316
|
}
|
|
1322
1317
|
}
|
|
1323
|
-
`, { documentationArticleCollection:
|
|
1318
|
+
`, { documentationArticleCollection: h } = await m.graphqlQuery(y, {
|
|
1324
1319
|
...l
|
|
1325
1320
|
});
|
|
1326
1321
|
return new b({
|
|
1327
1322
|
page: i,
|
|
1328
|
-
total:
|
|
1323
|
+
total: h.total,
|
|
1329
1324
|
size: n,
|
|
1330
|
-
items:
|
|
1325
|
+
items: h.items
|
|
1331
1326
|
});
|
|
1332
1327
|
}, Ae = async ({
|
|
1333
1328
|
id: t,
|
|
1334
1329
|
slug: e,
|
|
1335
1330
|
marketCode: r,
|
|
1336
|
-
locale:
|
|
1331
|
+
locale: s
|
|
1337
1332
|
}) => {
|
|
1338
|
-
const
|
|
1333
|
+
const a = [], i = {}, n = [];
|
|
1339
1334
|
if (t)
|
|
1340
|
-
|
|
1335
|
+
a.push("$id: String!"), i.id = t, n.push("{ sys: { id: $id } }");
|
|
1341
1336
|
else if (e)
|
|
1342
|
-
|
|
1337
|
+
a.push("$slug: String!"), i.slug = e, n.push("{ slug: $slug }");
|
|
1343
1338
|
else
|
|
1344
1339
|
throw new Error("Either id or slug is required.");
|
|
1345
|
-
r && (
|
|
1340
|
+
r && (a.push("$marketCode: String!"), i.marketCode = r, n.push(
|
|
1346
1341
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1347
|
-
)),
|
|
1342
|
+
)), s && (a.push("$locale: String!"), i.locale = s, n.push(
|
|
1348
1343
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1349
1344
|
));
|
|
1350
|
-
const o = `(${
|
|
1345
|
+
const o = `(${a.join(", ")})`, l = `(
|
|
1351
1346
|
limit: 1
|
|
1352
1347
|
where: {
|
|
1353
1348
|
AND: [
|
|
@@ -1418,15 +1413,15 @@ query${o} {
|
|
|
1418
1413
|
page: t = 1,
|
|
1419
1414
|
size: e = 20,
|
|
1420
1415
|
marketCode: r,
|
|
1421
|
-
locale:
|
|
1416
|
+
locale: s
|
|
1422
1417
|
} = {}) => {
|
|
1423
|
-
const
|
|
1418
|
+
const a = Math.max(1, Math.floor(t)), i = Math.max(1, Math.floor(e)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1424
1419
|
limit: i,
|
|
1425
|
-
skip: (
|
|
1420
|
+
skip: (a - 1) * i
|
|
1426
1421
|
}, l = [];
|
|
1427
1422
|
r && (n.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1428
1423
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1429
|
-
)),
|
|
1424
|
+
)), s && (n.push("$locale: String!"), o.locale = s, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1430
1425
|
const c = n.length ? `(${n.join(", ")})` : "", u = l.length ? `(
|
|
1431
1426
|
limit: $limit
|
|
1432
1427
|
skip: $skip
|
|
@@ -1473,7 +1468,7 @@ query${c} {
|
|
|
1473
1468
|
}
|
|
1474
1469
|
);
|
|
1475
1470
|
return new b({
|
|
1476
|
-
page:
|
|
1471
|
+
page: a,
|
|
1477
1472
|
total: g.total,
|
|
1478
1473
|
size: i,
|
|
1479
1474
|
items: g.items
|
|
@@ -1482,15 +1477,15 @@ query${c} {
|
|
|
1482
1477
|
page: t = 1,
|
|
1483
1478
|
size: e = 20,
|
|
1484
1479
|
marketCode: r,
|
|
1485
|
-
locale:
|
|
1480
|
+
locale: s
|
|
1486
1481
|
} = {}) => {
|
|
1487
|
-
const
|
|
1482
|
+
const a = Math.max(1, Math.floor(t)), i = Math.max(1, Math.floor(e)), n = ["$limit: Int!", "$skip: Int!"], o = {
|
|
1488
1483
|
limit: i,
|
|
1489
|
-
skip: (
|
|
1484
|
+
skip: (a - 1) * i
|
|
1490
1485
|
}, l = [];
|
|
1491
1486
|
r && (n.push("$marketCode: String!"), o.marketCode = r, l.push(
|
|
1492
1487
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1493
|
-
)),
|
|
1488
|
+
)), s && (n.push("$locale: String!"), o.locale = s, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1494
1489
|
const c = `(${n.join(", ")})`, u = l.length ? `(
|
|
1495
1490
|
limit: $limit
|
|
1496
1491
|
skip: $skip
|
|
@@ -1521,7 +1516,7 @@ query${c} {
|
|
|
1521
1516
|
...o
|
|
1522
1517
|
});
|
|
1523
1518
|
return new b({
|
|
1524
|
-
page:
|
|
1519
|
+
page: a,
|
|
1525
1520
|
total: g.total,
|
|
1526
1521
|
size: i,
|
|
1527
1522
|
items: g.items
|
|
@@ -26,8 +26,8 @@ export type TypeBannerCollection<Modifiers extends ChainModifiers, Locales exten
|
|
|
26
26
|
export interface TypeBlogCategoryFields {
|
|
27
27
|
title: EntryFieldTypes.Symbol;
|
|
28
28
|
slug: EntryFieldTypes.Symbol;
|
|
29
|
-
description?: EntryFieldTypes.
|
|
30
|
-
|
|
29
|
+
description?: EntryFieldTypes.Symbol;
|
|
30
|
+
featuredImage?: EntryFieldTypes.AssetLink;
|
|
31
31
|
locale?: EntryFieldTypes.Symbol;
|
|
32
32
|
seo?: EntryFieldTypes.EntryLink<TypeSeoSkeleton>;
|
|
33
33
|
markets?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeMarketSkeleton>>;
|