@janbox/contentful-marketplace-sdk 1.0.19 → 1.0.20
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 +7 -0
- package/dist/index.cjs +7 -1
- package/dist/index.js +237 -231
- package/package.json +1 -1
|
@@ -2,6 +2,12 @@ import { PaginatedResponse } from '../utils';
|
|
|
2
2
|
import { GraphQLAsset, TypeBlogCategorySkeleton } from '../types';
|
|
3
3
|
import { Entry } from 'contentful';
|
|
4
4
|
type BlogCategoryEntry = Entry<TypeBlogCategorySkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
|
+
type GraphQLSeo = {
|
|
6
|
+
metaTitle: string;
|
|
7
|
+
metaDescription: string | null;
|
|
8
|
+
metaKeywords: string[] | null;
|
|
9
|
+
metaRobots: string[] | null;
|
|
10
|
+
};
|
|
5
11
|
export type BlogCategoryGraphQLItem = {
|
|
6
12
|
sys: {
|
|
7
13
|
id: string;
|
|
@@ -10,6 +16,7 @@ export type BlogCategoryGraphQLItem = {
|
|
|
10
16
|
} & Pick<BlogCategoryEntry["fields"], "title" | "slug">;
|
|
11
17
|
export interface BlogCategoryDetailGraphQLItem extends BlogCategoryGraphQLItem {
|
|
12
18
|
description: string | null;
|
|
19
|
+
seo: GraphQLSeo | null;
|
|
13
20
|
}
|
|
14
21
|
export type GetBlogCategoriesResponse = PaginatedResponse<BlogCategoryGraphQLItem>;
|
|
15
22
|
export type GetBlogCategoryDetailResponse = BlogCategoryDetailGraphQLItem;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var At=Function.prototype.toString,O=Object.create,Ot=Object.prototype.toString,jt=(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 Tt(){return new jt}function qt(){return new WeakMap}var _t=typeof WeakMap<"u"?qt:Tt;function Q(t){if(!t)return O(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:O(t);if(e&&~At.call(e).indexOf("[native code]"))try{return new e}catch{}return O(t)}function Pt(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 xt(t){return t.flags}var It=/test/g.flags==="g"?xt:Pt;function lt(t){var e=Ot.call(t);return e.substring(8,e.length-1)}function Dt(t){return t[Symbol.toStringTag]||lt(t)}var Rt=typeof Symbol<"u"?Dt:lt,Mt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,ut=Object.prototype,gt=ut.hasOwnProperty,Bt=ut.propertyIsEnumerable,ft=typeof F=="function";function Et(t){return ct(t).concat(F(t))}var Lt=ft?Et:ct;function k(t,e,r){for(var a=Lt(t),s=0,n=a.length,o=void 0,i=void 0;s<n;++s)if(o=a[s],!(o==="callee"||o==="caller")){if(i=zt(t,o),!i){e[o]=r.copier(t[o],r);continue}!i.get&&!i.set&&(i.value=r.copier(i.value,r));try{Mt(e,o,i)}catch{e[o]=i.value}}return e}function Vt(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 Nt(t,e){var r=new e.Constructor;return e.cache.set(t,r),k(t,r,e)}function ht(t,e){return t.slice(0)}function Qt(t,e){return t.slice(0,t.size,t.type)}function Ft(t,e){return new e.Constructor(ht(t.buffer))}function Gt(t,e){return new e.Constructor(t.getTime())}function pt(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 Ut(t,e){return k(t,pt(t,e),e)}function Kt(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 Wt(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),n=0,o=s.length,i=void 0;n<o;++n)i=s[n],Bt.call(t,i)&&(r[i]=e.copier(t[i],e));return r}var Ht=ft?Wt:Kt;function Jt(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 Yt(t,e){var r=new e.Constructor(t.source,It(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 Xt(t,e){return k(t,yt(t,e),e)}var Zt=Array.isArray,G=Object.assign,te=Object.getPrototypeOf||(function(t){return t.__proto__}),mt={array:Vt,arrayBuffer:ht,blob:Qt,dataView:Ft,date:Gt,error:S,map:pt,object:Ht,regExp:Yt,set:yt},ee=G({},mt,{array:Nt,map:Ut,object:Jt,set:Xt});function re(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=re(e),a=r.Array,s=r.Object;function n(o,i){if(i.prototype=i.Constructor=void 0,!o||typeof o!="object")return o;if(i.cache.has(o))return i.cache.get(o);if(i.prototype=te(o),i.Constructor=i.prototype&&i.prototype.constructor,!i.Constructor||i.Constructor===Object)return s(o,i);if(Zt(o))return a(o,i);var l=r[Rt(o)];return l?l(o,i):typeof o.then=="function"?o:s(o,i)}return function(i){return n(i,{Constructor:void 0,cache:_t(),copier:n,prototype:void 0})}}function oe(t){return dt(G({},ee,t))}oe({});dt({});var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T={exports:{}},U;function ie(){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 n(p){if(e===setTimeout)return setTimeout(p,0);if((e===a||!e)&&setTimeout)return e=setTimeout,setTimeout(p,0);try{return e(p,0)}catch{try{return e.call(null,p,0)}catch{return e.call(this,p,0)}}}function o(p){if(r===clearTimeout)return clearTimeout(p);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(p);try{return r(p)}catch{try{return r.call(null,p)}catch{return r.call(this,p)}}}var i=[],l=!1,c,u=-1;function g(){!l||!c||(l=!1,c.length?i=c.concat(i):u=-1,i.length&&f())}function f(){if(!l){var p=n(g);l=!0;for(var d=i.length;d;){for(c=i,i=[];++u<d;)c&&c[u].run();u=-1,d=i.length}c=null,l=!1,o(p)}}t.nextTick=function(p){var d=new Array(arguments.length-1);if(arguments.length>1)for(var $=1;$<arguments.length;$++)d[$-1]=arguments[$];i.push(new y(p,d)),i.length===1&&!l&&n(f)};function y(p,d){this.fun=p,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 h(){}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){return[]},t.binding=function(p){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(p){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},T.exports}ie();var q,K;function ne(){if(K)return q;K=1;var t=typeof C=="object"&&C&&C.Object===Object&&C;return q=t,q}var _,W;function se(){if(W)return _;W=1;var t=ne(),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=se(),e=t.Symbol;return P=e,P}var x,J;function ae(){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 n(o){var i=r.call(o,s),l=o[s];try{o[s]=void 0;var c=!0}catch{}var u=a.call(o);return c&&(i?o[s]=l:delete o[s]),u}return x=n,x}var I,Y;function le(){if(Y)return I;Y=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return I=r,I}var D,X;function $t(){if(X)return D;X=1;var t=bt(),e=ae(),r=le(),a="[object Null]",s="[object Undefined]",n=t?t.toStringTag:void 0;function o(i){return i==null?i===void 0?s:a:n&&n in Object(i)?e(i):r(i)}return D=o,D}var R,Z;function ce(){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 ue(){if(et)return z;et=1;var t=$t(),e=ce(),r=wt(),a="[object String]";function s(n){return typeof n=="string"||!e(n)&&r(n)&&t(n)==a}return z=s,z}ue();var B,rt;function ge(){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 fe(){if(ot)return E;ot=1;var t=ge(),e=t(Object.getPrototypeOf,Object);return E=e,E}var L,it;function he(){if(it)return L;it=1;var t=$t(),e=fe(),r=wt(),a="[object Object]",s=Function.prototype,n=Object.prototype,o=s.toString,i=n.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=i.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&o.call(f)==l}return L=c,L}he();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,nt;function pe(){if(nt)return V;nt=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 n=r.length;if(n===+n)for(var o=0;o<n;o++)a.call(s,r[o],o,r);else for(var i in r)t.call(r,i)&&a.call(s,r[i],i,r)},V}var N,st;function ye(){if(st)return N;st=1;var t=pe();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 n=e.bind(e,r);for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o].bind(n,r));return n}return e.get=function(r,a){for(var s=Array.isArray(a)?a:e.parse(a),n=0;n<s.length;++n){var o=s[n];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 n=Array.isArray(a)?a:e.parse(a),o=n[0];if(n.length===0)throw Error("Can not set the root object");for(var i=0;i<n.length-1;++i){var l=n[i];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(r)&&(l=r.length),o=n[i+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),n=s[s.length-1];if(n===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 i=+n;if(n===""&&isNaN(i))throw new Error('Invalid array index: "'+n+'"');Array.prototype.splice.call(o,i,1)}else delete o[n]},e.dict=function(r,a){var s={};return e.walk(r,function(n,o){s[o]=n},a),s},e.walk=function(r,a,s){var n=[];s=s||function(o){var i=Object.prototype.toString.call(o);return i==="[object Object]"||i==="[object Array]"},(function o(i){t(i,function(l,c){n.push(String(c)),s(l)?o(l):a(l,e.compile(n)),n.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}ye();var v={exports:{}},at;function me(){return at||(at=1,(function(t,e){e=t.exports=r,e.getSerialize=a;function r(s,n,o,i){return JSON.stringify(s,a(n,i),o)}function a(s,n){var o=[],i=[];return n==null&&(n=function(l,c){return o[0]===c?"[Circular ~]":"[Circular ~."+i.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?i.splice(u,1/0,l):i.push(l),~o.indexOf(c)&&(c=n.call(this,l,c))}else o.push(c);return s==null?c:s.call(this,l,c)}}})(v,v.exports)),v.exports}me();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:n="master"}=this.clientParams,o=await fetch(`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${n}`,{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}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var At=Function.prototype.toString,O=Object.create,Ot=Object.prototype.toString,jt=(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 Tt(){return new jt}function qt(){return new WeakMap}var _t=typeof WeakMap<"u"?qt:Tt;function Q(t){if(!t)return O(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:O(t);if(e&&~At.call(e).indexOf("[native code]"))try{return new e}catch{}return O(t)}function Pt(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 xt(t){return t.flags}var Dt=/test/g.flags==="g"?xt:Pt;function lt(t){var e=Ot.call(t);return e.substring(8,e.length-1)}function It(t){return t[Symbol.toStringTag]||lt(t)}var Rt=typeof Symbol<"u"?It:lt,Mt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,ut=Object.prototype,gt=ut.hasOwnProperty,Bt=ut.propertyIsEnumerable,ft=typeof F=="function";function Et(t){return ct(t).concat(F(t))}var Lt=ft?Et:ct;function k(t,e,r){for(var a=Lt(t),s=0,n=a.length,o=void 0,i=void 0;s<n;++s)if(o=a[s],!(o==="callee"||o==="caller")){if(i=zt(t,o),!i){e[o]=r.copier(t[o],r);continue}!i.get&&!i.set&&(i.value=r.copier(i.value,r));try{Mt(e,o,i)}catch{e[o]=i.value}}return e}function Vt(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 Nt(t,e){var r=new e.Constructor;return e.cache.set(t,r),k(t,r,e)}function ht(t,e){return t.slice(0)}function Qt(t,e){return t.slice(0,t.size,t.type)}function Ft(t,e){return new e.Constructor(ht(t.buffer))}function Gt(t,e){return new e.Constructor(t.getTime())}function pt(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 Ut(t,e){return k(t,pt(t,e),e)}function Kt(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 Wt(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),n=0,o=s.length,i=void 0;n<o;++n)i=s[n],Bt.call(t,i)&&(r[i]=e.copier(t[i],e));return r}var Ht=ft?Wt:Kt;function Jt(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 Yt(t,e){var r=new e.Constructor(t.source,Dt(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 Xt(t,e){return k(t,yt(t,e),e)}var Zt=Array.isArray,G=Object.assign,te=Object.getPrototypeOf||(function(t){return t.__proto__}),mt={array:Vt,arrayBuffer:ht,blob:Qt,dataView:Ft,date:Gt,error:S,map:pt,object:Ht,regExp:Yt,set:yt},ee=G({},mt,{array:Nt,map:Ut,object:Jt,set:Xt});function re(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=re(e),a=r.Array,s=r.Object;function n(o,i){if(i.prototype=i.Constructor=void 0,!o||typeof o!="object")return o;if(i.cache.has(o))return i.cache.get(o);if(i.prototype=te(o),i.Constructor=i.prototype&&i.prototype.constructor,!i.Constructor||i.Constructor===Object)return s(o,i);if(Zt(o))return a(o,i);var l=r[Rt(o)];return l?l(o,i):typeof o.then=="function"?o:s(o,i)}return function(i){return n(i,{Constructor:void 0,cache:_t(),copier:n,prototype:void 0})}}function oe(t){return dt(G({},ee,t))}oe({});dt({});var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T={exports:{}},U;function ie(){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 n(p){if(e===setTimeout)return setTimeout(p,0);if((e===a||!e)&&setTimeout)return e=setTimeout,setTimeout(p,0);try{return e(p,0)}catch{try{return e.call(null,p,0)}catch{return e.call(this,p,0)}}}function o(p){if(r===clearTimeout)return clearTimeout(p);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(p);try{return r(p)}catch{try{return r.call(null,p)}catch{return r.call(this,p)}}}var i=[],l=!1,c,u=-1;function g(){!l||!c||(l=!1,c.length?i=c.concat(i):u=-1,i.length&&f())}function f(){if(!l){var p=n(g);l=!0;for(var d=i.length;d;){for(c=i,i=[];++u<d;)c&&c[u].run();u=-1,d=i.length}c=null,l=!1,o(p)}}t.nextTick=function(p){var d=new Array(arguments.length-1);if(arguments.length>1)for(var $=1;$<arguments.length;$++)d[$-1]=arguments[$];i.push(new y(p,d)),i.length===1&&!l&&n(f)};function y(p,d){this.fun=p,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 h(){}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){return[]},t.binding=function(p){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(p){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},T.exports}ie();var q,K;function ne(){if(K)return q;K=1;var t=typeof C=="object"&&C&&C.Object===Object&&C;return q=t,q}var _,W;function se(){if(W)return _;W=1;var t=ne(),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=se(),e=t.Symbol;return P=e,P}var x,J;function ae(){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 n(o){var i=r.call(o,s),l=o[s];try{o[s]=void 0;var c=!0}catch{}var u=a.call(o);return c&&(i?o[s]=l:delete o[s]),u}return x=n,x}var D,Y;function le(){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=ae(),r=le(),a="[object Null]",s="[object Undefined]",n=t?t.toStringTag:void 0;function o(i){return i==null?i===void 0?s:a:n&&n in Object(i)?e(i):r(i)}return I=o,I}var R,Z;function ce(){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 ue(){if(et)return z;et=1;var t=$t(),e=ce(),r=wt(),a="[object String]";function s(n){return typeof n=="string"||!e(n)&&r(n)&&t(n)==a}return z=s,z}ue();var B,rt;function ge(){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 fe(){if(ot)return E;ot=1;var t=ge(),e=t(Object.getPrototypeOf,Object);return E=e,E}var L,it;function he(){if(it)return L;it=1;var t=$t(),e=fe(),r=wt(),a="[object Object]",s=Function.prototype,n=Object.prototype,o=s.toString,i=n.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=i.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&o.call(f)==l}return L=c,L}he();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,nt;function pe(){if(nt)return V;nt=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 n=r.length;if(n===+n)for(var o=0;o<n;o++)a.call(s,r[o],o,r);else for(var i in r)t.call(r,i)&&a.call(s,r[i],i,r)},V}var N,st;function ye(){if(st)return N;st=1;var t=pe();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 n=e.bind(e,r);for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o].bind(n,r));return n}return e.get=function(r,a){for(var s=Array.isArray(a)?a:e.parse(a),n=0;n<s.length;++n){var o=s[n];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 n=Array.isArray(a)?a:e.parse(a),o=n[0];if(n.length===0)throw Error("Can not set the root object");for(var i=0;i<n.length-1;++i){var l=n[i];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(r)&&(l=r.length),o=n[i+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),n=s[s.length-1];if(n===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 i=+n;if(n===""&&isNaN(i))throw new Error('Invalid array index: "'+n+'"');Array.prototype.splice.call(o,i,1)}else delete o[n]},e.dict=function(r,a){var s={};return e.walk(r,function(n,o){s[o]=n},a),s},e.walk=function(r,a,s){var n=[];s=s||function(o){var i=Object.prototype.toString.call(o);return i==="[object Object]"||i==="[object Array]"},(function o(i){t(i,function(l,c){n.push(String(c)),s(l)?o(l):a(l,e.compile(n)),n.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}ye();var v={exports:{}},at;function me(){return at||(at=1,(function(t,e){e=t.exports=r,e.getSerialize=a;function r(s,n,o,i){return JSON.stringify(s,a(n,i),o)}function a(s,n){var o=[],i=[];return n==null&&(n=function(l,c){return o[0]===c?"[Circular ~]":"[Circular ~."+i.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?i.splice(u,1/0,l):i.push(l),~o.indexOf(c)&&(c=n.call(this,l,c))}else o.push(c);return s==null?c:s.call(this,l,c)}}})(v,v.exports)),v.exports}me();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:n="master"}=this.clientParams,o=await fetch(`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${n}`,{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
2
|
${l}`)}const i=await o.json();if(i.errors)throw new Error(`GraphQL errors: ${JSON.stringify(i.errors,null,2)}`);return i.data}}class b{page;total;size;items;totalPages;constructor({page:e,total:r,size:a,items:s}){this.page=e,this.total=r,this.size=a,this.items=s,this.totalPages=Math.ceil(this.total/this.size)}}const de=async({slot:t,page:e=1,size:r=20,platform:a,marketCode:s,locale:n})=>{const o=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(r)),l=["$slot: String!","$limit: Int!","$skip: Int!"],c={slot:t,limit:i,skip:(o-1)*i},u=["{ slot: $slot }"];a&&(l.push("$platform: String!"),c.platform=a,u.push("{ platform_contains_some: [$platform] }")),s&&(l.push("$marketCode: String!"),c.marketCode=s,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),n&&(l.push("$locale: String!"),c.locale=n,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const g=`(${l.join(", ")})`,f=`(
|
|
3
3
|
limit: $limit
|
|
4
4
|
skip: $skip
|
|
@@ -259,6 +259,12 @@ query${i} {
|
|
|
259
259
|
height
|
|
260
260
|
contentType
|
|
261
261
|
}
|
|
262
|
+
seo {
|
|
263
|
+
metaTitle
|
|
264
|
+
metaDescription
|
|
265
|
+
metaKeywords
|
|
266
|
+
metaRobots
|
|
267
|
+
}
|
|
262
268
|
}
|
|
263
269
|
}
|
|
264
270
|
}
|
package/dist/index.js
CHANGED
|
@@ -48,23 +48,23 @@ function lt(t) {
|
|
|
48
48
|
function Rt(t) {
|
|
49
49
|
return t[Symbol.toStringTag] || lt(t);
|
|
50
50
|
}
|
|
51
|
-
var
|
|
51
|
+
var Dt = typeof Symbol < "u" ? Rt : lt, Mt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, ct = Object.getOwnPropertyNames, F = Object.getOwnPropertySymbols, ut = Object.prototype, ft = ut.hasOwnProperty, Et = ut.propertyIsEnumerable, gt = typeof F == "function";
|
|
52
52
|
function Lt(t) {
|
|
53
53
|
return ct(t).concat(F(t));
|
|
54
54
|
}
|
|
55
55
|
var Vt = gt ? Lt : ct;
|
|
56
56
|
function k(t, e, r) {
|
|
57
|
-
for (var a = Vt(t), s = 0,
|
|
57
|
+
for (var a = Vt(t), s = 0, n = a.length, o = void 0, i = void 0; s < n; ++s)
|
|
58
58
|
if (o = a[s], !(o === "callee" || o === "caller")) {
|
|
59
|
-
if (
|
|
59
|
+
if (i = zt(t, o), !i) {
|
|
60
60
|
e[o] = r.copier(t[o], r);
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
|
-
!
|
|
63
|
+
!i.get && !i.set && (i.value = r.copier(i.value, r));
|
|
64
64
|
try {
|
|
65
|
-
|
|
65
|
+
Mt(e, o, i);
|
|
66
66
|
} catch {
|
|
67
|
-
e[o] =
|
|
67
|
+
e[o] = i.value;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return e;
|
|
@@ -113,8 +113,8 @@ function Wt(t, e) {
|
|
|
113
113
|
e.cache.set(t, r);
|
|
114
114
|
for (var a in t)
|
|
115
115
|
ft.call(t, a) && (r[a] = e.copier(t[a], e));
|
|
116
|
-
for (var s = F(t),
|
|
117
|
-
|
|
116
|
+
for (var s = F(t), n = 0, o = s.length, i = void 0; n < o; ++n)
|
|
117
|
+
i = s[n], Et.call(t, i) && (r[i] = e.copier(t[i], e));
|
|
118
118
|
return r;
|
|
119
119
|
}
|
|
120
120
|
var Jt = gt ? Wt : Kt;
|
|
@@ -132,18 +132,18 @@ function Yt(t, e) {
|
|
|
132
132
|
function S(t, e) {
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function mt(t, e) {
|
|
136
136
|
var r = new e.Constructor();
|
|
137
137
|
return e.cache.set(t, r), t.forEach(function(a) {
|
|
138
138
|
r.add(e.copier(a, e));
|
|
139
139
|
}), r;
|
|
140
140
|
}
|
|
141
141
|
function Xt(t, e) {
|
|
142
|
-
return k(t,
|
|
142
|
+
return k(t, mt(t, e), e);
|
|
143
143
|
}
|
|
144
144
|
var Zt = Array.isArray, G = Object.assign, te = Object.getPrototypeOf || (function(t) {
|
|
145
145
|
return t.__proto__;
|
|
146
|
-
}),
|
|
146
|
+
}), yt = {
|
|
147
147
|
array: Nt,
|
|
148
148
|
arrayBuffer: ht,
|
|
149
149
|
blob: Qt,
|
|
@@ -153,8 +153,8 @@ var Zt = Array.isArray, G = Object.assign, te = Object.getPrototypeOf || (functi
|
|
|
153
153
|
map: pt,
|
|
154
154
|
object: Jt,
|
|
155
155
|
regExp: Yt,
|
|
156
|
-
set:
|
|
157
|
-
}, ee = G({},
|
|
156
|
+
set: mt
|
|
157
|
+
}, ee = G({}, yt, {
|
|
158
158
|
array: Bt,
|
|
159
159
|
map: Ut,
|
|
160
160
|
object: Ht,
|
|
@@ -192,24 +192,24 @@ function re(t) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
function dt(t) {
|
|
195
|
-
var e = G({},
|
|
196
|
-
function
|
|
197
|
-
if (
|
|
195
|
+
var e = G({}, yt, t), r = re(e), a = r.Array, s = r.Object;
|
|
196
|
+
function n(o, i) {
|
|
197
|
+
if (i.prototype = i.Constructor = void 0, !o || typeof o != "object")
|
|
198
198
|
return o;
|
|
199
|
-
if (
|
|
200
|
-
return
|
|
201
|
-
if (
|
|
202
|
-
return s(o,
|
|
199
|
+
if (i.cache.has(o))
|
|
200
|
+
return i.cache.get(o);
|
|
201
|
+
if (i.prototype = te(o), i.Constructor = i.prototype && i.prototype.constructor, !i.Constructor || i.Constructor === Object)
|
|
202
|
+
return s(o, i);
|
|
203
203
|
if (Zt(o))
|
|
204
|
-
return a(o,
|
|
205
|
-
var l = r[
|
|
206
|
-
return l ? l(o,
|
|
204
|
+
return a(o, i);
|
|
205
|
+
var l = r[Dt(o)];
|
|
206
|
+
return l ? l(o, i) : typeof o.then == "function" ? o : s(o, i);
|
|
207
207
|
}
|
|
208
|
-
return function(
|
|
209
|
-
return i
|
|
208
|
+
return function(i) {
|
|
209
|
+
return n(i, {
|
|
210
210
|
Constructor: void 0,
|
|
211
211
|
cache: _t(),
|
|
212
|
-
copier:
|
|
212
|
+
copier: n,
|
|
213
213
|
prototype: void 0
|
|
214
214
|
});
|
|
215
215
|
};
|
|
@@ -220,7 +220,7 @@ function oe(t) {
|
|
|
220
220
|
oe({});
|
|
221
221
|
dt({});
|
|
222
222
|
var C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, T = { exports: {} }, U;
|
|
223
|
-
function
|
|
223
|
+
function ie() {
|
|
224
224
|
if (U) return T.exports;
|
|
225
225
|
U = 1;
|
|
226
226
|
var t = T.exports = {}, e, r;
|
|
@@ -242,7 +242,7 @@ function ne() {
|
|
|
242
242
|
r = s;
|
|
243
243
|
}
|
|
244
244
|
})();
|
|
245
|
-
function
|
|
245
|
+
function n(p) {
|
|
246
246
|
if (e === setTimeout)
|
|
247
247
|
return setTimeout(p, 0);
|
|
248
248
|
if ((e === a || !e) && setTimeout)
|
|
@@ -272,18 +272,18 @@ function ne() {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
var
|
|
275
|
+
var i = [], l = !1, c, u = -1;
|
|
276
276
|
function f() {
|
|
277
|
-
!l || !c || (l = !1, c.length ?
|
|
277
|
+
!l || !c || (l = !1, c.length ? i = c.concat(i) : u = -1, i.length && g());
|
|
278
278
|
}
|
|
279
279
|
function g() {
|
|
280
280
|
if (!l) {
|
|
281
|
-
var p =
|
|
281
|
+
var p = n(f);
|
|
282
282
|
l = !0;
|
|
283
|
-
for (var d =
|
|
284
|
-
for (c =
|
|
283
|
+
for (var d = i.length; d; ) {
|
|
284
|
+
for (c = i, i = []; ++u < d; )
|
|
285
285
|
c && c[u].run();
|
|
286
|
-
u = -1, d =
|
|
286
|
+
u = -1, d = i.length;
|
|
287
287
|
}
|
|
288
288
|
c = null, l = !1, o(p);
|
|
289
289
|
}
|
|
@@ -293,12 +293,12 @@ function ne() {
|
|
|
293
293
|
if (arguments.length > 1)
|
|
294
294
|
for (var $ = 1; $ < arguments.length; $++)
|
|
295
295
|
d[$ - 1] = arguments[$];
|
|
296
|
-
|
|
296
|
+
i.push(new m(p, d)), i.length === 1 && !l && n(g);
|
|
297
297
|
};
|
|
298
|
-
function
|
|
298
|
+
function m(p, d) {
|
|
299
299
|
this.fun = p, this.array = d;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
m.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
304
|
function h() {
|
|
@@ -315,9 +315,9 @@ function ne() {
|
|
|
315
315
|
return 0;
|
|
316
316
|
}, T.exports;
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
ie();
|
|
319
319
|
var q, K;
|
|
320
|
-
function
|
|
320
|
+
function ne() {
|
|
321
321
|
if (K) return q;
|
|
322
322
|
K = 1;
|
|
323
323
|
var t = typeof C == "object" && C && C.Object === Object && C;
|
|
@@ -327,7 +327,7 @@ var _, W;
|
|
|
327
327
|
function se() {
|
|
328
328
|
if (W) return _;
|
|
329
329
|
W = 1;
|
|
330
|
-
var t =
|
|
330
|
+
var t = ne(), e = typeof self == "object" && self && self.Object === Object && self, r = t || e || Function("return this")();
|
|
331
331
|
return _ = r, _;
|
|
332
332
|
}
|
|
333
333
|
var P, J;
|
|
@@ -342,17 +342,17 @@ function ae() {
|
|
|
342
342
|
if (H) return x;
|
|
343
343
|
H = 1;
|
|
344
344
|
var t = bt(), e = Object.prototype, r = e.hasOwnProperty, a = e.toString, s = t ? t.toStringTag : void 0;
|
|
345
|
-
function
|
|
346
|
-
var
|
|
345
|
+
function n(o) {
|
|
346
|
+
var i = r.call(o, s), l = o[s];
|
|
347
347
|
try {
|
|
348
348
|
o[s] = void 0;
|
|
349
349
|
var c = !0;
|
|
350
350
|
} catch {
|
|
351
351
|
}
|
|
352
352
|
var u = a.call(o);
|
|
353
|
-
return c && (
|
|
353
|
+
return c && (i ? o[s] = l : delete o[s]), u;
|
|
354
354
|
}
|
|
355
|
-
return x =
|
|
355
|
+
return x = n, x;
|
|
356
356
|
}
|
|
357
357
|
var I, Y;
|
|
358
358
|
function le() {
|
|
@@ -368,35 +368,35 @@ var R, X;
|
|
|
368
368
|
function $t() {
|
|
369
369
|
if (X) return R;
|
|
370
370
|
X = 1;
|
|
371
|
-
var t = bt(), e = ae(), r = le(), a = "[object Null]", s = "[object Undefined]",
|
|
372
|
-
function o(
|
|
373
|
-
return
|
|
371
|
+
var t = bt(), e = ae(), r = le(), a = "[object Null]", s = "[object Undefined]", n = t ? t.toStringTag : void 0;
|
|
372
|
+
function o(i) {
|
|
373
|
+
return i == null ? i === void 0 ? s : a : n && n in Object(i) ? e(i) : r(i);
|
|
374
374
|
}
|
|
375
375
|
return R = o, R;
|
|
376
376
|
}
|
|
377
|
-
var
|
|
377
|
+
var D, Z;
|
|
378
378
|
function ce() {
|
|
379
|
-
if (Z) return
|
|
379
|
+
if (Z) return D;
|
|
380
380
|
Z = 1;
|
|
381
381
|
var t = Array.isArray;
|
|
382
|
-
return
|
|
382
|
+
return D = t, D;
|
|
383
383
|
}
|
|
384
|
-
var
|
|
384
|
+
var M, tt;
|
|
385
385
|
function wt() {
|
|
386
|
-
if (tt) return
|
|
386
|
+
if (tt) return M;
|
|
387
387
|
tt = 1;
|
|
388
388
|
function t(e) {
|
|
389
389
|
return e != null && typeof e == "object";
|
|
390
390
|
}
|
|
391
|
-
return
|
|
391
|
+
return M = t, M;
|
|
392
392
|
}
|
|
393
393
|
var z, et;
|
|
394
394
|
function ue() {
|
|
395
395
|
if (et) return z;
|
|
396
396
|
et = 1;
|
|
397
397
|
var t = $t(), e = ce(), r = wt(), a = "[object String]";
|
|
398
|
-
function s(
|
|
399
|
-
return typeof
|
|
398
|
+
function s(n) {
|
|
399
|
+
return typeof n == "string" || !e(n) && r(n) && t(n) == a;
|
|
400
400
|
}
|
|
401
401
|
return z = s, z;
|
|
402
402
|
}
|
|
@@ -419,18 +419,18 @@ function ge() {
|
|
|
419
419
|
var t = fe(), e = t(Object.getPrototypeOf, Object);
|
|
420
420
|
return L = e, L;
|
|
421
421
|
}
|
|
422
|
-
var V,
|
|
422
|
+
var V, it;
|
|
423
423
|
function he() {
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
var t = $t(), e = ge(), r = wt(), a = "[object Object]", s = Function.prototype,
|
|
424
|
+
if (it) return V;
|
|
425
|
+
it = 1;
|
|
426
|
+
var t = $t(), e = ge(), r = wt(), a = "[object Object]", s = Function.prototype, n = Object.prototype, o = s.toString, i = n.hasOwnProperty, l = o.call(Object);
|
|
427
427
|
function c(u) {
|
|
428
428
|
if (!r(u) || t(u) != a)
|
|
429
429
|
return !1;
|
|
430
430
|
var f = e(u);
|
|
431
431
|
if (f === null)
|
|
432
432
|
return !0;
|
|
433
|
-
var g =
|
|
433
|
+
var g = i.call(f, "constructor") && f.constructor;
|
|
434
434
|
return typeof g == "function" && g instanceof g && o.call(g) == l;
|
|
435
435
|
}
|
|
436
436
|
return V = c, V;
|
|
@@ -441,25 +441,25 @@ new Array(4).fill(String.fromCodePoint(vt[0])).join("");
|
|
|
441
441
|
Object.fromEntries(Object.entries(vt).map((t) => t.reverse()));
|
|
442
442
|
Object.fromEntries(Object.entries(Ct).map((t) => t.reverse()));
|
|
443
443
|
`${Object.values(Ct).map((t) => `\\u{${t.toString(16)}}`).join("")}`;
|
|
444
|
-
var N,
|
|
444
|
+
var N, nt;
|
|
445
445
|
function pe() {
|
|
446
|
-
if (
|
|
447
|
-
|
|
446
|
+
if (nt) return N;
|
|
447
|
+
nt = 1;
|
|
448
448
|
var t = Object.prototype.hasOwnProperty, e = Object.prototype.toString;
|
|
449
449
|
return N = function(r, a, s) {
|
|
450
450
|
if (e.call(a) !== "[object Function]")
|
|
451
451
|
throw new TypeError("iterator must be a function");
|
|
452
|
-
var
|
|
453
|
-
if (
|
|
454
|
-
for (var o = 0; o <
|
|
452
|
+
var n = r.length;
|
|
453
|
+
if (n === +n)
|
|
454
|
+
for (var o = 0; o < n; o++)
|
|
455
455
|
a.call(s, r[o], o, r);
|
|
456
456
|
else
|
|
457
|
-
for (var
|
|
458
|
-
t.call(r,
|
|
457
|
+
for (var i in r)
|
|
458
|
+
t.call(r, i) && a.call(s, r[i], i, r);
|
|
459
459
|
}, N;
|
|
460
460
|
}
|
|
461
461
|
var B, st;
|
|
462
|
-
function
|
|
462
|
+
function me() {
|
|
463
463
|
if (st) return B;
|
|
464
464
|
st = 1;
|
|
465
465
|
var t = pe();
|
|
@@ -469,53 +469,53 @@ function ye() {
|
|
|
469
469
|
return e.set(r, a, s);
|
|
470
470
|
if (arguments.length === 2)
|
|
471
471
|
return e.get(r, a);
|
|
472
|
-
var
|
|
472
|
+
var n = e.bind(e, r);
|
|
473
473
|
for (var o in e)
|
|
474
|
-
e.hasOwnProperty(o) && (
|
|
475
|
-
return
|
|
474
|
+
e.hasOwnProperty(o) && (n[o] = e[o].bind(n, r));
|
|
475
|
+
return n;
|
|
476
476
|
}
|
|
477
477
|
return e.get = function(r, a) {
|
|
478
|
-
for (var s = Array.isArray(a) ? a : e.parse(a),
|
|
479
|
-
var o = s[
|
|
478
|
+
for (var s = Array.isArray(a) ? a : e.parse(a), n = 0; n < s.length; ++n) {
|
|
479
|
+
var o = s[n];
|
|
480
480
|
if (!(typeof r == "object" && o in r))
|
|
481
481
|
throw new Error("Invalid reference token: " + o);
|
|
482
482
|
r = r[o];
|
|
483
483
|
}
|
|
484
484
|
return r;
|
|
485
485
|
}, e.set = function(r, a, s) {
|
|
486
|
-
var
|
|
487
|
-
if (
|
|
486
|
+
var n = Array.isArray(a) ? a : e.parse(a), o = n[0];
|
|
487
|
+
if (n.length === 0)
|
|
488
488
|
throw Error("Can not set the root object");
|
|
489
|
-
for (var
|
|
490
|
-
var l = i
|
|
491
|
-
typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length), o = i
|
|
489
|
+
for (var i = 0; i < n.length - 1; ++i) {
|
|
490
|
+
var l = n[i];
|
|
491
|
+
typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length), o = n[i + 1], l in r || (o.match(/^(\d+|-)$/) ? r[l] = [] : r[l] = {}), r = r[l]);
|
|
492
492
|
}
|
|
493
493
|
return o === "-" && Array.isArray(r) && (o = r.length), r[o] = s, this;
|
|
494
494
|
}, e.remove = function(r, a) {
|
|
495
|
-
var s = Array.isArray(a) ? a : e.parse(a),
|
|
496
|
-
if (
|
|
495
|
+
var s = Array.isArray(a) ? a : e.parse(a), n = s[s.length - 1];
|
|
496
|
+
if (n === void 0)
|
|
497
497
|
throw new Error('Invalid JSON pointer for remove: "' + a + '"');
|
|
498
498
|
var o = e.get(r, s.slice(0, -1));
|
|
499
499
|
if (Array.isArray(o)) {
|
|
500
|
-
var
|
|
501
|
-
if (
|
|
502
|
-
throw new Error('Invalid array index: "' +
|
|
503
|
-
Array.prototype.splice.call(o,
|
|
500
|
+
var i = +n;
|
|
501
|
+
if (n === "" && isNaN(i))
|
|
502
|
+
throw new Error('Invalid array index: "' + n + '"');
|
|
503
|
+
Array.prototype.splice.call(o, i, 1);
|
|
504
504
|
} else
|
|
505
|
-
delete o[
|
|
505
|
+
delete o[n];
|
|
506
506
|
}, e.dict = function(r, a) {
|
|
507
507
|
var s = {};
|
|
508
|
-
return e.walk(r, function(
|
|
509
|
-
s[o] =
|
|
508
|
+
return e.walk(r, function(n, o) {
|
|
509
|
+
s[o] = n;
|
|
510
510
|
}, a), s;
|
|
511
511
|
}, e.walk = function(r, a, s) {
|
|
512
|
-
var
|
|
512
|
+
var n = [];
|
|
513
513
|
s = s || function(o) {
|
|
514
|
-
var
|
|
515
|
-
return
|
|
516
|
-
}, (function o(
|
|
517
|
-
t(
|
|
518
|
-
|
|
514
|
+
var i = Object.prototype.toString.call(o);
|
|
515
|
+
return i === "[object Object]" || i === "[object Array]";
|
|
516
|
+
}, (function o(i) {
|
|
517
|
+
t(i, function(l, c) {
|
|
518
|
+
n.push(String(c)), s(l) ? o(l) : a(l, e.compile(n)), n.pop();
|
|
519
519
|
});
|
|
520
520
|
})(r);
|
|
521
521
|
}, e.has = function(r, a) {
|
|
@@ -539,30 +539,30 @@ function ye() {
|
|
|
539
539
|
return r.length === 0 ? "" : "/" + r.map(e.escape).join("/");
|
|
540
540
|
}, B;
|
|
541
541
|
}
|
|
542
|
-
|
|
542
|
+
me();
|
|
543
543
|
var v = { exports: {} }, at;
|
|
544
|
-
function
|
|
544
|
+
function ye() {
|
|
545
545
|
return at || (at = 1, (function(t, e) {
|
|
546
546
|
e = t.exports = r, e.getSerialize = a;
|
|
547
|
-
function r(s,
|
|
548
|
-
return JSON.stringify(s, a(
|
|
547
|
+
function r(s, n, o, i) {
|
|
548
|
+
return JSON.stringify(s, a(n, i), o);
|
|
549
549
|
}
|
|
550
|
-
function a(s,
|
|
551
|
-
var o = [],
|
|
552
|
-
return
|
|
553
|
-
return o[0] === c ? "[Circular ~]" : "[Circular ~." +
|
|
550
|
+
function a(s, n) {
|
|
551
|
+
var o = [], i = [];
|
|
552
|
+
return n == null && (n = function(l, c) {
|
|
553
|
+
return o[0] === c ? "[Circular ~]" : "[Circular ~." + i.slice(0, o.indexOf(c)).join(".") + "]";
|
|
554
554
|
}), function(l, c) {
|
|
555
555
|
if (o.length > 0) {
|
|
556
556
|
var u = o.indexOf(this);
|
|
557
|
-
~u ? o.splice(u + 1) : o.push(this), ~u ?
|
|
557
|
+
~u ? o.splice(u + 1) : o.push(this), ~u ? i.splice(u, 1 / 0, l) : i.push(l), ~o.indexOf(c) && (c = n.call(this, l, c));
|
|
558
558
|
} else o.push(c);
|
|
559
559
|
return s == null ? c : s.call(this, l, c);
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
562
|
})(v, v.exports)), v.exports;
|
|
563
563
|
}
|
|
564
|
-
|
|
565
|
-
class
|
|
564
|
+
ye();
|
|
565
|
+
class y {
|
|
566
566
|
static _clientParams;
|
|
567
567
|
// static getter
|
|
568
568
|
static get clientParams() {
|
|
@@ -577,8 +577,8 @@ class m {
|
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
static async graphqlQuery(e, r = {}) {
|
|
580
|
-
const { space: a, accessToken: s, environment:
|
|
581
|
-
`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${
|
|
580
|
+
const { space: a, accessToken: s, environment: n = "master" } = this.clientParams, o = await fetch(
|
|
581
|
+
`https://graphql.contentful.com/content/v1/spaces/${a}/environments/${n}`,
|
|
582
582
|
{
|
|
583
583
|
method: "POST",
|
|
584
584
|
headers: {
|
|
@@ -595,12 +595,12 @@ class m {
|
|
|
595
595
|
${l}`
|
|
596
596
|
);
|
|
597
597
|
}
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
598
|
+
const i = await o.json();
|
|
599
|
+
if (i.errors)
|
|
600
600
|
throw new Error(
|
|
601
|
-
`GraphQL errors: ${JSON.stringify(
|
|
601
|
+
`GraphQL errors: ${JSON.stringify(i.errors, null, 2)}`
|
|
602
602
|
);
|
|
603
|
-
return
|
|
603
|
+
return i.data;
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
class b {
|
|
@@ -624,20 +624,20 @@ const de = async ({
|
|
|
624
624
|
size: r = 20,
|
|
625
625
|
platform: a,
|
|
626
626
|
marketCode: s,
|
|
627
|
-
locale:
|
|
627
|
+
locale: n
|
|
628
628
|
}) => {
|
|
629
|
-
const o = Math.max(1, Math.floor(e)),
|
|
629
|
+
const o = Math.max(1, Math.floor(e)), i = Math.max(1, Math.floor(r)), l = [
|
|
630
630
|
"$slot: String!",
|
|
631
631
|
"$limit: Int!",
|
|
632
632
|
"$skip: Int!"
|
|
633
633
|
], c = {
|
|
634
634
|
slot: t,
|
|
635
|
-
limit:
|
|
636
|
-
skip: (o - 1) *
|
|
635
|
+
limit: i,
|
|
636
|
+
skip: (o - 1) * i
|
|
637
637
|
}, u = ["{ slot: $slot }"];
|
|
638
638
|
a && (l.push("$platform: String!"), c.platform = a, u.push("{ platform_contains_some: [$platform] }")), s && (l.push("$marketCode: String!"), c.marketCode = s, u.push(
|
|
639
639
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
640
|
-
)),
|
|
640
|
+
)), n && (l.push("$locale: String!"), c.locale = n, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
641
641
|
const f = `(${l.join(", ")})`, g = `(
|
|
642
642
|
limit: $limit
|
|
643
643
|
skip: $skip
|
|
@@ -647,7 +647,7 @@ const de = async ({
|
|
|
647
647
|
`)}
|
|
648
648
|
]
|
|
649
649
|
}
|
|
650
|
-
)`,
|
|
650
|
+
)`, m = `
|
|
651
651
|
query${f} {
|
|
652
652
|
bannerCollectionCollection${g} {
|
|
653
653
|
total
|
|
@@ -684,13 +684,13 @@ query${f} {
|
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
`, { bannerCollectionCollection: h } = await
|
|
687
|
+
`, { bannerCollectionCollection: h } = await y.graphqlQuery(m, {
|
|
688
688
|
...c
|
|
689
689
|
});
|
|
690
690
|
return new b({
|
|
691
691
|
page: o,
|
|
692
692
|
total: h.total,
|
|
693
|
-
size:
|
|
693
|
+
size: i,
|
|
694
694
|
items: h.items
|
|
695
695
|
});
|
|
696
696
|
};
|
|
@@ -708,10 +708,10 @@ const be = async ({
|
|
|
708
708
|
collectionId: r,
|
|
709
709
|
categoryId: a,
|
|
710
710
|
page: s = 1,
|
|
711
|
-
size:
|
|
711
|
+
size: n = 20,
|
|
712
712
|
skip: o = 0
|
|
713
713
|
} = {}) => {
|
|
714
|
-
const
|
|
714
|
+
const i = Math.max(1, Math.floor(s)), l = Math.max(1, Math.floor(n)), c = Math.max(0, Math.floor(o));
|
|
715
715
|
if (r) {
|
|
716
716
|
const St = `
|
|
717
717
|
query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
@@ -754,15 +754,15 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
`, { blogCollectionCollection: kt } = await
|
|
757
|
+
`, { blogCollectionCollection: kt } = await y.graphqlQuery(St, {
|
|
758
758
|
collectionId: r,
|
|
759
759
|
limit: l,
|
|
760
|
-
skip: (
|
|
760
|
+
skip: (i - 1) * l + c
|
|
761
761
|
}), A = kt.items.at(0);
|
|
762
762
|
if (!A)
|
|
763
763
|
throw new w();
|
|
764
764
|
return new b({
|
|
765
|
-
page:
|
|
765
|
+
page: i,
|
|
766
766
|
total: A.postsCollection?.total ?? 0,
|
|
767
767
|
size: l,
|
|
768
768
|
items: A.postsCollection?.items ?? []
|
|
@@ -770,13 +770,13 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
|
|
|
770
770
|
}
|
|
771
771
|
const u = ["$limit: Int!", "$skip: Int!"], f = {
|
|
772
772
|
limit: l,
|
|
773
|
-
skip: (
|
|
774
|
-
}, g = ["limit: $limit", "skip: $skip"],
|
|
775
|
-
t && (u.push("$marketCode: String!"), f.marketCode = t,
|
|
773
|
+
skip: (i - 1) * l + c
|
|
774
|
+
}, g = ["limit: $limit", "skip: $skip"], m = [];
|
|
775
|
+
t && (u.push("$marketCode: String!"), f.marketCode = t, m.push(
|
|
776
776
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
777
|
-
)), e && (u.push("$locale: String!"), f.locale = e,
|
|
777
|
+
)), e && (u.push("$locale: String!"), f.locale = e, m.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), a && (u.push("$categoryId: String!"), f.categoryId = a, m.push("{ categories: { sys: { id: $categoryId } } }")), m.length && g.push(`where: {
|
|
778
778
|
AND: [
|
|
779
|
-
${
|
|
779
|
+
${m.join(`
|
|
780
780
|
`)}
|
|
781
781
|
]
|
|
782
782
|
}`);
|
|
@@ -820,11 +820,11 @@ query${h} {
|
|
|
820
820
|
}
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
`, { blogPostCollection: $ } = await
|
|
823
|
+
`, { blogPostCollection: $ } = await y.graphqlQuery(d, {
|
|
824
824
|
...f
|
|
825
825
|
});
|
|
826
826
|
return new b({
|
|
827
|
-
page:
|
|
827
|
+
page: i,
|
|
828
828
|
total: $.total,
|
|
829
829
|
size: l,
|
|
830
830
|
items: $.items
|
|
@@ -835,17 +835,17 @@ query${h} {
|
|
|
835
835
|
marketCode: r,
|
|
836
836
|
locale: a
|
|
837
837
|
}) => {
|
|
838
|
-
const s = [],
|
|
838
|
+
const s = [], n = {}, o = [];
|
|
839
839
|
if (t)
|
|
840
|
-
s.push("$id: String!"),
|
|
840
|
+
s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
|
|
841
841
|
else if (e)
|
|
842
|
-
s.push("$slug: String!"),
|
|
842
|
+
s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
|
|
843
843
|
else
|
|
844
844
|
throw new Error("Either id or slug is required.");
|
|
845
|
-
r && (s.push("$marketCode: String!"),
|
|
845
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
|
|
846
846
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
847
|
-
)), a && (s.push("$locale: String!"),
|
|
848
|
-
const
|
|
847
|
+
)), a && (s.push("$locale: String!"), n.locale = a, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
848
|
+
const i = `(${s.join(", ")})`, l = `(
|
|
849
849
|
limit: 1
|
|
850
850
|
where: {
|
|
851
851
|
AND: [
|
|
@@ -854,7 +854,7 @@ query${h} {
|
|
|
854
854
|
]
|
|
855
855
|
}
|
|
856
856
|
)`, c = `
|
|
857
|
-
query${
|
|
857
|
+
query${i} {
|
|
858
858
|
blogPostCollection${l} {
|
|
859
859
|
items {
|
|
860
860
|
sys {
|
|
@@ -922,8 +922,8 @@ query${n} {
|
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
`, { blogPostCollection: u } = await
|
|
926
|
-
...
|
|
925
|
+
`, { blogPostCollection: u } = await y.graphqlQuery(c, {
|
|
926
|
+
...n
|
|
927
927
|
}), f = u.items.at(0);
|
|
928
928
|
if (!f)
|
|
929
929
|
throw new w();
|
|
@@ -934,13 +934,13 @@ query${n} {
|
|
|
934
934
|
page: r = 1,
|
|
935
935
|
size: a = 20
|
|
936
936
|
} = {}) => {
|
|
937
|
-
const s = Math.max(1, Math.floor(r)),
|
|
938
|
-
limit:
|
|
939
|
-
skip: (s - 1) *
|
|
937
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
938
|
+
limit: n,
|
|
939
|
+
skip: (s - 1) * n
|
|
940
940
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
941
|
-
t && (o.push("$marketCode: String!"),
|
|
941
|
+
t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
|
|
942
942
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
943
|
-
)), e && (o.push("$locale: String!"),
|
|
943
|
+
)), e && (o.push("$locale: String!"), i.locale = e, c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), c.length && l.push(`where: {
|
|
944
944
|
AND: [
|
|
945
945
|
${c.join(`
|
|
946
946
|
`)}
|
|
@@ -968,14 +968,14 @@ query${u} {
|
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
`, { blogCategoryCollection:
|
|
972
|
-
...
|
|
971
|
+
`, { blogCategoryCollection: m } = await y.graphqlQuery(g, {
|
|
972
|
+
...i
|
|
973
973
|
});
|
|
974
974
|
return new b({
|
|
975
975
|
page: s,
|
|
976
|
-
total:
|
|
977
|
-
size:
|
|
978
|
-
items:
|
|
976
|
+
total: m.total,
|
|
977
|
+
size: n,
|
|
978
|
+
items: m.items
|
|
979
979
|
});
|
|
980
980
|
}, Ce = async ({
|
|
981
981
|
id: t,
|
|
@@ -983,17 +983,17 @@ query${u} {
|
|
|
983
983
|
marketCode: r,
|
|
984
984
|
locale: a
|
|
985
985
|
}) => {
|
|
986
|
-
const s = [],
|
|
986
|
+
const s = [], n = {}, o = [];
|
|
987
987
|
if (t)
|
|
988
|
-
s.push("$id: String!"),
|
|
988
|
+
s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
|
|
989
989
|
else if (e)
|
|
990
|
-
s.push("$slug: String!"),
|
|
990
|
+
s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
|
|
991
991
|
else
|
|
992
992
|
throw new Error("Either id or slug is required.");
|
|
993
|
-
r && (s.push("$marketCode: String!"),
|
|
993
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
|
|
994
994
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
995
|
-
)), a && (s.push("$locale: String!"),
|
|
996
|
-
const
|
|
995
|
+
)), a && (s.push("$locale: String!"), n.locale = a, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
996
|
+
const i = `(${s.join(", ")})`, l = `(
|
|
997
997
|
limit: 1
|
|
998
998
|
where: {
|
|
999
999
|
AND: [
|
|
@@ -1002,7 +1002,7 @@ query${u} {
|
|
|
1002
1002
|
]
|
|
1003
1003
|
}
|
|
1004
1004
|
)`, c = `
|
|
1005
|
-
query${
|
|
1005
|
+
query${i} {
|
|
1006
1006
|
blogCategoryCollection${l} {
|
|
1007
1007
|
items {
|
|
1008
1008
|
sys {
|
|
@@ -1017,11 +1017,17 @@ query${n} {
|
|
|
1017
1017
|
height
|
|
1018
1018
|
contentType
|
|
1019
1019
|
}
|
|
1020
|
+
seo {
|
|
1021
|
+
metaTitle
|
|
1022
|
+
metaDescription
|
|
1023
|
+
metaKeywords
|
|
1024
|
+
metaRobots
|
|
1025
|
+
}
|
|
1020
1026
|
}
|
|
1021
1027
|
}
|
|
1022
1028
|
}
|
|
1023
|
-
`, { blogCategoryCollection: u } = await
|
|
1024
|
-
...
|
|
1029
|
+
`, { blogCategoryCollection: u } = await y.graphqlQuery(c, {
|
|
1030
|
+
...n
|
|
1025
1031
|
}), f = u.items.at(0);
|
|
1026
1032
|
if (!f)
|
|
1027
1033
|
throw new w();
|
|
@@ -1032,13 +1038,13 @@ query${n} {
|
|
|
1032
1038
|
page: r = 1,
|
|
1033
1039
|
size: a = 20
|
|
1034
1040
|
} = {}) => {
|
|
1035
|
-
const s = Math.max(1, Math.floor(r)),
|
|
1036
|
-
limit:
|
|
1037
|
-
skip: (s - 1) *
|
|
1041
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
1042
|
+
limit: n,
|
|
1043
|
+
skip: (s - 1) * n
|
|
1038
1044
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
1039
|
-
t && (o.push("$marketCode: String!"),
|
|
1045
|
+
t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
|
|
1040
1046
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1041
|
-
)), e && (o.push("$locale: String!"),
|
|
1047
|
+
)), e && (o.push("$locale: String!"), i.locale = e, c.push(
|
|
1042
1048
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1043
1049
|
)), c.length && l.push(`where: {
|
|
1044
1050
|
AND: [
|
|
@@ -1076,14 +1082,14 @@ query${u} {
|
|
|
1076
1082
|
}
|
|
1077
1083
|
}
|
|
1078
1084
|
}
|
|
1079
|
-
`, { blogCollectionCollection:
|
|
1080
|
-
...
|
|
1085
|
+
`, { blogCollectionCollection: m } = await y.graphqlQuery(g, {
|
|
1086
|
+
...i
|
|
1081
1087
|
});
|
|
1082
1088
|
return new b({
|
|
1083
1089
|
page: s,
|
|
1084
|
-
total:
|
|
1085
|
-
size:
|
|
1086
|
-
items:
|
|
1090
|
+
total: m.total,
|
|
1091
|
+
size: n,
|
|
1092
|
+
items: m.items.map((h) => ({
|
|
1087
1093
|
...h,
|
|
1088
1094
|
category: h.type === "category" ? h.category : null,
|
|
1089
1095
|
categoryId: h.type === "category" ? h.category?.sys.id ?? null : null,
|
|
@@ -1096,13 +1102,13 @@ query${u} {
|
|
|
1096
1102
|
marketCode: r,
|
|
1097
1103
|
locale: a
|
|
1098
1104
|
} = {}) => {
|
|
1099
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1100
|
-
limit:
|
|
1101
|
-
skip: (s - 1) *
|
|
1105
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
1106
|
+
limit: n,
|
|
1107
|
+
skip: (s - 1) * n
|
|
1102
1108
|
}, l = [];
|
|
1103
|
-
r && (o.push("$marketCode: String!"),
|
|
1109
|
+
r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
|
|
1104
1110
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1105
|
-
)), a && (o.push("$locale: String!"),
|
|
1111
|
+
)), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1106
1112
|
const c = `(${o.join(", ")})`, u = l.length ? `(
|
|
1107
1113
|
limit: $limit
|
|
1108
1114
|
skip: $skip
|
|
@@ -1151,13 +1157,13 @@ query${c} {
|
|
|
1151
1157
|
}
|
|
1152
1158
|
}
|
|
1153
1159
|
}
|
|
1154
|
-
`, { brandCollectionCollection: g } = await
|
|
1155
|
-
...
|
|
1160
|
+
`, { brandCollectionCollection: g } = await y.graphqlQuery(f, {
|
|
1161
|
+
...i
|
|
1156
1162
|
});
|
|
1157
1163
|
return new b({
|
|
1158
1164
|
page: s,
|
|
1159
1165
|
total: g.total,
|
|
1160
|
-
size:
|
|
1166
|
+
size: n,
|
|
1161
1167
|
items: g.items
|
|
1162
1168
|
});
|
|
1163
1169
|
}, ke = async ({
|
|
@@ -1166,13 +1172,13 @@ query${c} {
|
|
|
1166
1172
|
page: r = 1,
|
|
1167
1173
|
size: a = 20
|
|
1168
1174
|
} = {}) => {
|
|
1169
|
-
const s = Math.max(1, Math.floor(r)),
|
|
1170
|
-
limit:
|
|
1171
|
-
skip: (s - 1) *
|
|
1175
|
+
const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
1176
|
+
limit: n,
|
|
1177
|
+
skip: (s - 1) * n
|
|
1172
1178
|
}, l = ["limit: $limit", "skip: $skip"], c = [];
|
|
1173
|
-
t && (o.push("$marketCode: String!"),
|
|
1179
|
+
t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
|
|
1174
1180
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1175
|
-
)), e && (o.push("$locale: String!"),
|
|
1181
|
+
)), e && (o.push("$locale: String!"), i.locale = e, c.push(
|
|
1176
1182
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1177
1183
|
)), c.length && l.push(`where: {
|
|
1178
1184
|
AND: [
|
|
@@ -1206,14 +1212,14 @@ query${u} {
|
|
|
1206
1212
|
}
|
|
1207
1213
|
}
|
|
1208
1214
|
}
|
|
1209
|
-
`, { documentationCategoryCollection:
|
|
1210
|
-
...
|
|
1215
|
+
`, { documentationCategoryCollection: m } = await y.graphqlQuery(g, {
|
|
1216
|
+
...i
|
|
1211
1217
|
});
|
|
1212
1218
|
return new b({
|
|
1213
1219
|
page: s,
|
|
1214
|
-
total:
|
|
1215
|
-
size:
|
|
1216
|
-
items:
|
|
1220
|
+
total: m.total,
|
|
1221
|
+
size: n,
|
|
1222
|
+
items: m.items
|
|
1217
1223
|
});
|
|
1218
1224
|
}, Ae = async ({
|
|
1219
1225
|
id: t,
|
|
@@ -1221,19 +1227,19 @@ query${u} {
|
|
|
1221
1227
|
marketCode: r,
|
|
1222
1228
|
locale: a
|
|
1223
1229
|
}) => {
|
|
1224
|
-
const s = [],
|
|
1230
|
+
const s = [], n = {}, o = [];
|
|
1225
1231
|
if (t)
|
|
1226
|
-
s.push("$id: String!"),
|
|
1232
|
+
s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
|
|
1227
1233
|
else if (e)
|
|
1228
|
-
s.push("$slug: String!"),
|
|
1234
|
+
s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
|
|
1229
1235
|
else
|
|
1230
1236
|
throw new Error("Either id or slug is required.");
|
|
1231
|
-
r && (s.push("$marketCode: String!"),
|
|
1237
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
|
|
1232
1238
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1233
|
-
)), a && (s.push("$locale: String!"),
|
|
1239
|
+
)), a && (s.push("$locale: String!"), n.locale = a, o.push(
|
|
1234
1240
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1235
1241
|
));
|
|
1236
|
-
const
|
|
1242
|
+
const i = `(${s.join(", ")})`, l = `(
|
|
1237
1243
|
limit: 1
|
|
1238
1244
|
where: {
|
|
1239
1245
|
AND: [
|
|
@@ -1242,7 +1248,7 @@ query${u} {
|
|
|
1242
1248
|
]
|
|
1243
1249
|
}
|
|
1244
1250
|
)`, c = `
|
|
1245
|
-
query${
|
|
1251
|
+
query${i} {
|
|
1246
1252
|
documentationCategoryCollection${l} {
|
|
1247
1253
|
items {
|
|
1248
1254
|
sys {
|
|
@@ -1263,8 +1269,8 @@ query${n} {
|
|
|
1263
1269
|
}
|
|
1264
1270
|
}
|
|
1265
1271
|
}
|
|
1266
|
-
`, { documentationCategoryCollection: u } = await
|
|
1267
|
-
...
|
|
1272
|
+
`, { documentationCategoryCollection: u } = await y.graphqlQuery(c, {
|
|
1273
|
+
...n
|
|
1268
1274
|
}), f = u.items.at(0);
|
|
1269
1275
|
if (!f)
|
|
1270
1276
|
throw new w();
|
|
@@ -1276,24 +1282,24 @@ query${n} {
|
|
|
1276
1282
|
page: a = 1,
|
|
1277
1283
|
size: s = 20
|
|
1278
1284
|
} = {}) => {
|
|
1279
|
-
const
|
|
1285
|
+
const n = Math.max(1, Math.floor(a)), o = Math.max(1, Math.floor(s)), i = ["$limit: Int!", "$skip: Int!"], l = {
|
|
1280
1286
|
limit: o,
|
|
1281
|
-
skip: (
|
|
1287
|
+
skip: (n - 1) * o
|
|
1282
1288
|
}, c = ["limit: $limit", "skip: $skip"], u = [];
|
|
1283
|
-
t && (
|
|
1289
|
+
t && (i.push("$marketCode: String!"), l.marketCode = t, u.push(
|
|
1284
1290
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1285
|
-
)), e && (
|
|
1291
|
+
)), e && (i.push("$locale: String!"), l.locale = e, u.push(
|
|
1286
1292
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1287
|
-
)), r && (
|
|
1293
|
+
)), r && (i.push("$categorySlug: String!"), l.categorySlug = r, u.push("{ category: { slug: $categorySlug } }")), u.length && c.push(`where: {
|
|
1288
1294
|
AND: [
|
|
1289
1295
|
${u.join(`
|
|
1290
1296
|
`)}
|
|
1291
1297
|
]
|
|
1292
1298
|
}`);
|
|
1293
|
-
const f =
|
|
1299
|
+
const f = i.length ? `(${i.join(", ")})` : "", g = c.length ? `(
|
|
1294
1300
|
${c.join(`
|
|
1295
1301
|
`)}
|
|
1296
|
-
)` : "",
|
|
1302
|
+
)` : "", m = `
|
|
1297
1303
|
query${f} {
|
|
1298
1304
|
documentationArticleCollection${g} {
|
|
1299
1305
|
total
|
|
@@ -1323,11 +1329,11 @@ query${f} {
|
|
|
1323
1329
|
}
|
|
1324
1330
|
}
|
|
1325
1331
|
}
|
|
1326
|
-
`, { documentationArticleCollection: h } = await
|
|
1332
|
+
`, { documentationArticleCollection: h } = await y.graphqlQuery(m, {
|
|
1327
1333
|
...l
|
|
1328
1334
|
});
|
|
1329
1335
|
return new b({
|
|
1330
|
-
page:
|
|
1336
|
+
page: n,
|
|
1331
1337
|
total: h.total,
|
|
1332
1338
|
size: o,
|
|
1333
1339
|
items: h.items
|
|
@@ -1338,19 +1344,19 @@ query${f} {
|
|
|
1338
1344
|
marketCode: r,
|
|
1339
1345
|
locale: a
|
|
1340
1346
|
}) => {
|
|
1341
|
-
const s = [],
|
|
1347
|
+
const s = [], n = {}, o = [];
|
|
1342
1348
|
if (t)
|
|
1343
|
-
s.push("$id: String!"),
|
|
1349
|
+
s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
|
|
1344
1350
|
else if (e)
|
|
1345
|
-
s.push("$slug: String!"),
|
|
1351
|
+
s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
|
|
1346
1352
|
else
|
|
1347
1353
|
throw new Error("Either id or slug is required.");
|
|
1348
|
-
r && (s.push("$marketCode: String!"),
|
|
1354
|
+
r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
|
|
1349
1355
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1350
|
-
)), a && (s.push("$locale: String!"),
|
|
1356
|
+
)), a && (s.push("$locale: String!"), n.locale = a, o.push(
|
|
1351
1357
|
"{ OR: [{ locale_exists: false }, { locale: $locale }] }"
|
|
1352
1358
|
));
|
|
1353
|
-
const
|
|
1359
|
+
const i = `(${s.join(", ")})`, l = `(
|
|
1354
1360
|
limit: 1
|
|
1355
1361
|
where: {
|
|
1356
1362
|
AND: [
|
|
@@ -1359,7 +1365,7 @@ query${f} {
|
|
|
1359
1365
|
]
|
|
1360
1366
|
}
|
|
1361
1367
|
)`, c = `
|
|
1362
|
-
query${
|
|
1368
|
+
query${i} {
|
|
1363
1369
|
documentationArticleCollection${l} {
|
|
1364
1370
|
items {
|
|
1365
1371
|
sys {
|
|
@@ -1411,8 +1417,8 @@ query${n} {
|
|
|
1411
1417
|
}
|
|
1412
1418
|
}
|
|
1413
1419
|
}
|
|
1414
|
-
`, { documentationArticleCollection: u } = await
|
|
1415
|
-
...
|
|
1420
|
+
`, { documentationArticleCollection: u } = await y.graphqlQuery(c, {
|
|
1421
|
+
...n
|
|
1416
1422
|
}), f = u.items.at(0);
|
|
1417
1423
|
if (!f)
|
|
1418
1424
|
throw new w();
|
|
@@ -1423,13 +1429,13 @@ query${n} {
|
|
|
1423
1429
|
marketCode: r,
|
|
1424
1430
|
locale: a
|
|
1425
1431
|
} = {}) => {
|
|
1426
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1427
|
-
limit:
|
|
1428
|
-
skip: (s - 1) *
|
|
1432
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
1433
|
+
limit: n,
|
|
1434
|
+
skip: (s - 1) * n
|
|
1429
1435
|
}, l = [];
|
|
1430
|
-
r && (o.push("$marketCode: String!"),
|
|
1436
|
+
r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
|
|
1431
1437
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1432
|
-
)), a && (o.push("$locale: String!"),
|
|
1438
|
+
)), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1433
1439
|
const c = o.length ? `(${o.join(", ")})` : "", u = l.length ? `(
|
|
1434
1440
|
limit: $limit
|
|
1435
1441
|
skip: $skip
|
|
@@ -1469,16 +1475,16 @@ query${c} {
|
|
|
1469
1475
|
}
|
|
1470
1476
|
}
|
|
1471
1477
|
}
|
|
1472
|
-
`, { hyperlinkCollectionCollection: g } = await
|
|
1478
|
+
`, { hyperlinkCollectionCollection: g } = await y.graphqlQuery(
|
|
1473
1479
|
f,
|
|
1474
1480
|
{
|
|
1475
|
-
...
|
|
1481
|
+
...i
|
|
1476
1482
|
}
|
|
1477
1483
|
);
|
|
1478
1484
|
return new b({
|
|
1479
1485
|
page: s,
|
|
1480
1486
|
total: g.total,
|
|
1481
|
-
size:
|
|
1487
|
+
size: n,
|
|
1482
1488
|
items: g.items
|
|
1483
1489
|
});
|
|
1484
1490
|
}, qe = async ({
|
|
@@ -1487,13 +1493,13 @@ query${c} {
|
|
|
1487
1493
|
marketCode: r,
|
|
1488
1494
|
locale: a
|
|
1489
1495
|
} = {}) => {
|
|
1490
|
-
const s = Math.max(1, Math.floor(t)),
|
|
1491
|
-
limit:
|
|
1492
|
-
skip: (s - 1) *
|
|
1496
|
+
const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
|
|
1497
|
+
limit: n,
|
|
1498
|
+
skip: (s - 1) * n
|
|
1493
1499
|
}, l = [];
|
|
1494
|
-
r && (o.push("$marketCode: String!"),
|
|
1500
|
+
r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
|
|
1495
1501
|
"{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
|
|
1496
|
-
)), a && (o.push("$locale: String!"),
|
|
1502
|
+
)), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
|
|
1497
1503
|
const c = `(${o.join(", ")})`, u = l.length ? `(
|
|
1498
1504
|
limit: $limit
|
|
1499
1505
|
skip: $skip
|
|
@@ -1520,18 +1526,18 @@ query${c} {
|
|
|
1520
1526
|
}
|
|
1521
1527
|
}
|
|
1522
1528
|
}
|
|
1523
|
-
`, { keywordCollectionCollection: g } = await
|
|
1524
|
-
...
|
|
1529
|
+
`, { keywordCollectionCollection: g } = await y.graphqlQuery(f, {
|
|
1530
|
+
...i
|
|
1525
1531
|
});
|
|
1526
1532
|
return new b({
|
|
1527
1533
|
page: s,
|
|
1528
1534
|
total: g.total,
|
|
1529
|
-
size:
|
|
1535
|
+
size: n,
|
|
1530
1536
|
items: g.items
|
|
1531
1537
|
});
|
|
1532
1538
|
};
|
|
1533
1539
|
export {
|
|
1534
|
-
|
|
1540
|
+
y as ContentfulSDK,
|
|
1535
1541
|
b as PaginatedResponse,
|
|
1536
1542
|
de as getBannerCollections,
|
|
1537
1543
|
we as getBlogCategories,
|