@janbox/contentful-marketplace-sdk 1.0.2 → 1.0.3
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/README.md +21 -10
- package/dist/entries/banner-collection.d.ts +7 -3
- package/dist/entries/blog.d.ts +8 -7
- package/dist/entries/brand-collection.d.ts +7 -3
- package/dist/entries/documentation.d.ts +16 -14
- package/dist/entries/hyperlink-collection.d.ts +7 -2
- package/dist/entries/keyword-collection.d.ts +7 -3
- package/dist/index.cjs +69 -52
- package/dist/index.js +442 -386
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,10 +46,11 @@ const result = await listBannerCollections({
|
|
|
46
46
|
marketCode: "vn",
|
|
47
47
|
language: "en",
|
|
48
48
|
platform: "WEB",
|
|
49
|
-
|
|
49
|
+
page: 1,
|
|
50
|
+
size: 10,
|
|
50
51
|
});
|
|
51
52
|
|
|
52
|
-
console.log(result.
|
|
53
|
+
console.log(result.items);
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
## Configuration
|
|
@@ -74,7 +75,8 @@ Notes:
|
|
|
74
75
|
|
|
75
76
|
## API Methods
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
List methods return `{ page, total, size, items }`.
|
|
79
|
+
Detail methods return the entry object directly.
|
|
78
80
|
|
|
79
81
|
### Banner Collection
|
|
80
82
|
|
|
@@ -83,7 +85,8 @@ All methods return `{ data: ... }`.
|
|
|
83
85
|
```ts
|
|
84
86
|
await listBannerCollections({
|
|
85
87
|
slot: "home_hero",
|
|
86
|
-
|
|
88
|
+
page: 1,
|
|
89
|
+
size: 20,
|
|
87
90
|
platform: "WEB",
|
|
88
91
|
marketCode: "vn",
|
|
89
92
|
language: "en",
|
|
@@ -99,9 +102,10 @@ await listBannerCollections({
|
|
|
99
102
|
const posts = await listBlogPosts({
|
|
100
103
|
marketCode: "vn",
|
|
101
104
|
language: "en",
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
page: 1,
|
|
106
|
+
size: 10,
|
|
104
107
|
});
|
|
108
|
+
// paging response shape: { page, total, size, items }
|
|
105
109
|
|
|
106
110
|
const post = await getBlogPostDetail({
|
|
107
111
|
slug: "how-to-shop-online",
|
|
@@ -127,8 +131,10 @@ const postById = await getBlogPostDetail({
|
|
|
127
131
|
const categories = await listDocCategories({
|
|
128
132
|
marketCode: "vn",
|
|
129
133
|
language: "en",
|
|
130
|
-
|
|
134
|
+
page: 1,
|
|
135
|
+
size: 10,
|
|
131
136
|
});
|
|
137
|
+
// paging response shape: { page, total, size, items }
|
|
132
138
|
|
|
133
139
|
const category = await getDocCategoryDetail({
|
|
134
140
|
slug: "getting-started",
|
|
@@ -146,7 +152,8 @@ const articles = await listDocArticles({
|
|
|
146
152
|
categorySlug: "getting-started",
|
|
147
153
|
marketCode: "vn",
|
|
148
154
|
language: "en",
|
|
149
|
-
|
|
155
|
+
page: 1,
|
|
156
|
+
size: 10,
|
|
150
157
|
});
|
|
151
158
|
// listDocArticles returns summary fields only (no content, no seo)
|
|
152
159
|
|
|
@@ -173,10 +180,13 @@ const articleById = await getDocArticleDetail({
|
|
|
173
180
|
const brands = await listBrandCollections({
|
|
174
181
|
marketCode: "vn",
|
|
175
182
|
language: "en",
|
|
176
|
-
|
|
183
|
+
page: 1,
|
|
184
|
+
size: 20,
|
|
177
185
|
});
|
|
178
186
|
|
|
179
187
|
const links = await listHyperlinkCollections({
|
|
188
|
+
page: 1,
|
|
189
|
+
size: 20,
|
|
180
190
|
marketCode: "vn",
|
|
181
191
|
language: "en",
|
|
182
192
|
});
|
|
@@ -184,7 +194,8 @@ const links = await listHyperlinkCollections({
|
|
|
184
194
|
const keywords = await listKeywordCollections({
|
|
185
195
|
marketCode: "vn",
|
|
186
196
|
language: "en",
|
|
187
|
-
|
|
197
|
+
page: 1,
|
|
198
|
+
size: 20,
|
|
188
199
|
});
|
|
189
200
|
```
|
|
190
201
|
|
|
@@ -22,11 +22,15 @@ export type BannerCollectionGraphQLItem = {
|
|
|
22
22
|
};
|
|
23
23
|
} & Pick<BannerCollectionEntry["fields"], "name" | "slot" | "platform">;
|
|
24
24
|
export type ListBannerCollectionsResponse = {
|
|
25
|
-
|
|
25
|
+
page: number;
|
|
26
|
+
total: number;
|
|
27
|
+
size: number;
|
|
28
|
+
items: BannerCollectionGraphQLItem[];
|
|
26
29
|
};
|
|
27
|
-
export declare const listBannerCollections: ({ slot,
|
|
30
|
+
export declare const listBannerCollections: ({ slot, page, size, platform, marketCode, language, }: {
|
|
28
31
|
slot: BannerCollectionEntry["fields"]["slot"];
|
|
29
|
-
|
|
32
|
+
page?: number;
|
|
33
|
+
size?: number;
|
|
30
34
|
platform?: BannerCollectionEntry["fields"]["platform"][number];
|
|
31
35
|
marketCode?: string;
|
|
32
36
|
language?: string;
|
package/dist/entries/blog.d.ts
CHANGED
|
@@ -34,16 +34,17 @@ export interface BlogPostDetailGraphQLItem extends BlogPostGraphQLItem {
|
|
|
34
34
|
seo: GraphQLSeo | null;
|
|
35
35
|
}
|
|
36
36
|
export type ListBlogPostsResponse = {
|
|
37
|
-
|
|
37
|
+
page: number;
|
|
38
|
+
total: number;
|
|
39
|
+
size: number;
|
|
40
|
+
items: BlogPostGraphQLItem[];
|
|
38
41
|
};
|
|
39
|
-
export type GetBlogPostDetailResponse =
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
export declare const listBlogPosts: ({ marketCode, language, limit, skip, }?: {
|
|
42
|
+
export type GetBlogPostDetailResponse = BlogPostDetailGraphQLItem;
|
|
43
|
+
export declare const listBlogPosts: ({ marketCode, language, page, size, }?: {
|
|
43
44
|
marketCode?: string;
|
|
44
45
|
language?: string;
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
page?: number;
|
|
47
|
+
size?: number;
|
|
47
48
|
}) => Promise<ListBlogPostsResponse>;
|
|
48
49
|
export declare const getBlogPostDetail: ({ id, slug, marketCode, language, }: {
|
|
49
50
|
id?: string;
|
|
@@ -12,10 +12,14 @@ export type BrandCollectionGraphQLItem = {
|
|
|
12
12
|
};
|
|
13
13
|
} & Pick<BrandCollectionEntry["fields"], "name" | "slot">;
|
|
14
14
|
export type ListBrandCollectionsResponse = {
|
|
15
|
-
|
|
15
|
+
page: number;
|
|
16
|
+
total: number;
|
|
17
|
+
size: number;
|
|
18
|
+
items: BrandCollectionGraphQLItem[];
|
|
16
19
|
};
|
|
17
|
-
export declare const listBrandCollections: ({
|
|
18
|
-
|
|
20
|
+
export declare const listBrandCollections: ({ page, size, marketCode, language, }?: {
|
|
21
|
+
page?: number;
|
|
22
|
+
size?: number;
|
|
19
23
|
marketCode?: string;
|
|
20
24
|
language?: string;
|
|
21
25
|
}) => Promise<ListBrandCollectionsResponse>;
|
|
@@ -35,22 +35,24 @@ export interface DocArticleDetailGraphQLItem extends DocArticleGraphQLItem {
|
|
|
35
35
|
seo: GraphQLSeo | null;
|
|
36
36
|
}
|
|
37
37
|
export type ListDocCategoriesResponse = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
page: number;
|
|
39
|
+
total: number;
|
|
40
|
+
size: number;
|
|
41
|
+
items: DocCategoryGraphQLItem[];
|
|
42
42
|
};
|
|
43
|
+
export type GetDocCategoryDetailResponse = DocCategoryGraphQLItem;
|
|
43
44
|
export type ListDocArticlesResponse = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
page: number;
|
|
46
|
+
total: number;
|
|
47
|
+
size: number;
|
|
48
|
+
items: DocArticleGraphQLItem[];
|
|
48
49
|
};
|
|
49
|
-
export
|
|
50
|
+
export type GetDocArticleDetailResponse = DocArticleDetailGraphQLItem;
|
|
51
|
+
export declare const listDocCategories: ({ marketCode, language, page, size, }?: {
|
|
50
52
|
marketCode?: string;
|
|
51
53
|
language?: string;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
page?: number;
|
|
55
|
+
size?: number;
|
|
54
56
|
}) => Promise<ListDocCategoriesResponse>;
|
|
55
57
|
export declare const getDocCategoryDetail: ({ id, slug, marketCode, language, }: {
|
|
56
58
|
id?: string;
|
|
@@ -58,12 +60,12 @@ export declare const getDocCategoryDetail: ({ id, slug, marketCode, language, }:
|
|
|
58
60
|
marketCode?: string;
|
|
59
61
|
language?: string;
|
|
60
62
|
}) => Promise<GetDocCategoryDetailResponse>;
|
|
61
|
-
export declare const listDocArticles: ({ marketCode, language, categorySlug,
|
|
63
|
+
export declare const listDocArticles: ({ marketCode, language, categorySlug, page, size, }?: {
|
|
62
64
|
marketCode?: string;
|
|
63
65
|
language?: string;
|
|
64
66
|
categorySlug?: string;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
page?: number;
|
|
68
|
+
size?: number;
|
|
67
69
|
}) => Promise<ListDocArticlesResponse>;
|
|
68
70
|
export declare const getDocArticleDetail: ({ id, slug, marketCode, language, }: {
|
|
69
71
|
id?: string;
|
|
@@ -12,9 +12,14 @@ export type HyperlinkCollectionGraphQLItem = {
|
|
|
12
12
|
};
|
|
13
13
|
} & Pick<HyperlinkCollectionEntry["fields"], "name" | "slot" | "order">;
|
|
14
14
|
export type ListHyperlinkCollectionsResponse = {
|
|
15
|
-
|
|
15
|
+
page: number;
|
|
16
|
+
total: number;
|
|
17
|
+
size: number;
|
|
18
|
+
items: HyperlinkCollectionGraphQLItem[];
|
|
16
19
|
};
|
|
17
|
-
export declare const listHyperlinkCollections: ({ marketCode, language, }?: {
|
|
20
|
+
export declare const listHyperlinkCollections: ({ page, size, marketCode, language, }?: {
|
|
21
|
+
page?: number;
|
|
22
|
+
size?: number;
|
|
18
23
|
marketCode?: string;
|
|
19
24
|
language?: string;
|
|
20
25
|
}) => Promise<ListHyperlinkCollectionsResponse>;
|
|
@@ -6,10 +6,14 @@ export type KeywordCollectionGraphQLItem = {
|
|
|
6
6
|
sys: GraphQLEntrySys;
|
|
7
7
|
} & Pick<KeywordCollectionEntry["fields"], "name" | "slot" | "keywords">;
|
|
8
8
|
export type ListKeywordCollectionsResponse = {
|
|
9
|
-
|
|
9
|
+
page: number;
|
|
10
|
+
total: number;
|
|
11
|
+
size: number;
|
|
12
|
+
items: KeywordCollectionGraphQLItem[];
|
|
10
13
|
};
|
|
11
|
-
export declare const listKeywordCollections: ({
|
|
12
|
-
|
|
14
|
+
export declare const listKeywordCollections: ({ page, size, marketCode, language, }?: {
|
|
15
|
+
page?: number;
|
|
16
|
+
size?: number;
|
|
13
17
|
marketCode?: string;
|
|
14
18
|
language?: string;
|
|
15
19
|
}) => Promise<ListKeywordCollectionsResponse>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var $e=Function.prototype.toString,C=Object.create,Ce=Object.prototype.toString,Oe=(function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(t){return!!~this._keys.indexOf(t)},e.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},e.prototype.set=function(t,r){this._keys.push(t),this._values.push(r)},e})();function Se(){return new Oe}function je(){return new WeakMap}var Ae=typeof WeakMap<"u"?je:Se;function N(e){if(!e)return C(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:C(e);if(t&&~$e.call(t).indexOf("[native code]"))try{return new t}catch{}return C(e)}function Te(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}function _e(e){return e.flags}var ke=/test/g.flags==="g"?_e:Te;function ae(e){var t=Ce.call(e);return t.substring(8,t.length-1)}function qe(e){return e[Symbol.toStringTag]||ae(e)}var Pe=typeof Symbol<"u"?qe:ae,De=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,ce=Object.prototype,ue=ce.hasOwnProperty,xe=ce.propertyIsEnumerable,le=typeof V=="function";function Ie(e){return se(e).concat(V(e))}var Ee=le?Ie:se;function $(e,t,r){for(var s=Ee(e),a=0,i=s.length,n=void 0,o=void 0;a<i;++a)if(n=s[a],!(n==="callee"||n==="caller")){if(o=Re(e,n),!o){t[n]=r.copier(e[n],r);continue}!o.get&&!o.set&&(o.value=r.copier(o.value,r));try{De(t,n,o)}catch{t[n]=o.value}}return t}function Le(e,t){var r=new t.Constructor;t.cache.set(e,r);for(var s=0,a=e.length;s<a;++s)r[s]=t.copier(e[s],t);return r}function Be(e,t){var r=new t.Constructor;return t.cache.set(e,r),$(e,r,t)}function fe(e,t){return e.slice(0)}function Ne(e,t){return e.slice(0,e.size,e.type)}function Ve(e,t){return new t.Constructor(fe(e.buffer))}function Qe(e,t){return new t.Constructor(e.getTime())}function ge(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s,a){r.set(a,t.copier(s,t))}),r}function Me(e,t){return $(e,ge(e,t),t)}function Fe(e,t){var r=N(t.prototype);t.cache.set(e,r);for(var s in e)ue.call(e,s)&&(r[s]=t.copier(e[s],t));return r}function Ge(e,t){var r=N(t.prototype);t.cache.set(e,r);for(var s in e)ue.call(e,s)&&(r[s]=t.copier(e[s],t));for(var a=V(e),i=0,n=a.length,o=void 0;i<n;++i)o=a[i],xe.call(e,o)&&(r[o]=t.copier(e[o],t));return r}var Ue=le?Ge:Fe;function Ke(e,t){var r=N(t.prototype);return t.cache.set(e,r),$(e,r,t)}function O(e,t){return new t.Constructor(e.valueOf())}function We(e,t){var r=new t.Constructor(e.source,ke(e));return r.lastIndex=e.lastIndex,r}function w(e,t){return e}function pe(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s){r.add(t.copier(s,t))}),r}function ze(e,t){return $(e,pe(e,t),t)}var Je=Array.isArray,Q=Object.assign,He=Object.getPrototypeOf||(function(e){return e.__proto__}),ye={array:Le,arrayBuffer:fe,blob:Ne,dataView:Ve,date:Qe,error:w,map:ge,object:Ue,regExp:We,set:pe},Ye=Q({},ye,{array:Be,map:Me,object:Ke,set:ze});function Xe(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,Blob:e.blob,Boolean:O,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:O,Object:e.object,Promise:w,RegExp:e.regExp,Set:e.set,String:O,WeakMap:w,WeakSet:w,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer,Uint64Array:e.arrayBuffer}}function he(e){var t=Q({},ye,e),r=Xe(t),s=r.Array,a=r.Object;function i(n,o){if(o.prototype=o.Constructor=void 0,!n||typeof n!="object")return n;if(o.cache.has(n))return o.cache.get(n);if(o.prototype=He(n),o.Constructor=o.prototype&&o.prototype.constructor,!o.Constructor||o.Constructor===Object)return a(n,o);if(Je(n))return s(n,o);var c=r[Pe(n)];return c?c(n,o):typeof n.then=="function"?n:a(n,o)}return function(o){return i(o,{Constructor:void 0,cache:Ae(),copier:i,prototype:void 0})}}function Ze(e){return he(Q({},Ye,e))}Ze({});he({});var b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S={exports:{}},G;function et(){if(G)return S.exports;G=1;var e=S.exports={},t,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"?t=setTimeout:t=s}catch{t=s}try{typeof clearTimeout=="function"?r=clearTimeout:r=a}catch{r=a}})();function i(g){if(t===setTimeout)return setTimeout(g,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(g,0);try{return t(g,0)}catch{try{return t.call(null,g,0)}catch{return t.call(this,g,0)}}}function n(g){if(r===clearTimeout)return clearTimeout(g);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(g);try{return r(g)}catch{try{return r.call(null,g)}catch{return r.call(this,g)}}}var o=[],c=!1,u,l=-1;function f(){!c||!u||(c=!1,u.length?o=u.concat(o):l=-1,o.length&&h())}function h(){if(!c){var g=i(f);c=!0;for(var y=o.length;y;){for(u=o,o=[];++l<y;)u&&u[l].run();l=-1,y=o.length}u=null,c=!1,n(g)}}e.nextTick=function(g){var y=new Array(arguments.length-1);if(arguments.length>1)for(var m=1;m<arguments.length;m++)y[m-1]=arguments[m];o.push(new F(g,y)),o.length===1&&!c&&i(h)};function F(g,y){this.fun=g,this.array=y}F.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function d(){}return e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.prependListener=d,e.prependOnceListener=d,e.listeners=function(g){return[]},e.binding=function(g){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(g){throw new Error("process.chdir is not supported")},e.umask=function(){return 0},S.exports}et();var j,U;function tt(){if(U)return j;U=1;var e=typeof b=="object"&&b&&b.Object===Object&&b;return j=e,j}var A,K;function rt(){if(K)return A;K=1;var e=tt(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return A=r,A}var T,W;function de(){if(W)return T;W=1;var e=rt(),t=e.Symbol;return T=t,T}var _,z;function nt(){if(z)return _;z=1;var e=de(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(n){var o=r.call(n,a),c=n[a];try{n[a]=void 0;var u=!0}catch{}var l=s.call(n);return u&&(o?n[a]=c:delete n[a]),l}return _=i,_}var k,J;function it(){if(J)return k;J=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return k=r,k}var q,H;function me(){if(H)return q;H=1;var e=de(),t=nt(),r=it(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function n(o){return o==null?o===void 0?a:s:i&&i in Object(o)?t(o):r(o)}return q=n,q}var P,Y;function ot(){if(Y)return P;Y=1;var e=Array.isArray;return P=e,P}var D,X;function be(){if(X)return D;X=1;function e(t){return t!=null&&typeof t=="object"}return D=e,D}var R,Z;function at(){if(Z)return R;Z=1;var e=me(),t=ot(),r=be(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&r(i)&&e(i)==s}return R=a,R}at();var x,ee;function st(){if(ee)return x;ee=1;function e(t,r){return function(s){return t(r(s))}}return x=e,x}var I,te;function ct(){if(te)return I;te=1;var e=st(),t=e(Object.getPrototypeOf,Object);return I=t,I}var E,re;function ut(){if(re)return E;re=1;var e=me(),t=ct(),r=be(),s="[object Object]",a=Function.prototype,i=Object.prototype,n=a.toString,o=i.hasOwnProperty,c=n.call(Object);function u(l){if(!r(l)||e(l)!=s)return!1;var f=t(l);if(f===null)return!0;var h=o.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&n.call(h)==c}return E=u,E}ut();var ve={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},we={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(we[0])).join("");Object.fromEntries(Object.entries(we).map(e=>e.reverse()));Object.fromEntries(Object.entries(ve).map(e=>e.reverse()));`${Object.values(ve).map(e=>`\\u{${e.toString(16)}}`).join("")}`;var L,ne;function lt(){if(ne)return L;ne=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;return L=function(r,s,a){if(t.call(s)!=="[object Function]")throw new TypeError("iterator must be a function");var i=r.length;if(i===+i)for(var n=0;n<i;n++)s.call(a,r[n],n,r);else for(var o in r)e.call(r,o)&&s.call(a,r[o],o,r)},L}var B,ie;function ft(){if(ie)return B;ie=1;var e=lt();B=t;function t(r,s,a){if(arguments.length===3)return t.set(r,s,a);if(arguments.length===2)return t.get(r,s);var i=t.bind(t,r);for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n].bind(i,r));return i}return t.get=function(r,s){for(var a=Array.isArray(s)?s:t.parse(s),i=0;i<a.length;++i){var n=a[i];if(!(typeof r=="object"&&n in r))throw new Error("Invalid reference token: "+n);r=r[n]}return r},t.set=function(r,s,a){var i=Array.isArray(s)?s:t.parse(s),n=i[0];if(i.length===0)throw Error("Can not set the root object");for(var o=0;o<i.length-1;++o){var c=i[o];typeof c!="string"&&typeof c!="number"&&(c=String(c)),!(c==="__proto__"||c==="constructor"||c==="prototype")&&(c==="-"&&Array.isArray(r)&&(c=r.length),n=i[o+1],c in r||(n.match(/^(\d+|-)$/)?r[c]=[]:r[c]={}),r=r[c])}return n==="-"&&Array.isArray(r)&&(n=r.length),r[n]=a,this},t.remove=function(r,s){var a=Array.isArray(s)?s:t.parse(s),i=a[a.length-1];if(i===void 0)throw new Error('Invalid JSON pointer for remove: "'+s+'"');var n=t.get(r,a.slice(0,-1));if(Array.isArray(n)){var o=+i;if(i===""&&isNaN(o))throw new Error('Invalid array index: "'+i+'"');Array.prototype.splice.call(n,o,1)}else delete n[i]},t.dict=function(r,s){var a={};return t.walk(r,function(i,n){a[n]=i},s),a},t.walk=function(r,s,a){var i=[];a=a||function(n){var o=Object.prototype.toString.call(n);return o==="[object Object]"||o==="[object Array]"},(function n(o){e(o,function(c,u){i.push(String(u)),a(c)?n(c):s(c,t.compile(i)),i.pop()})})(r)},t.has=function(r,s){try{t.get(r,s)}catch{return!1}return!0},t.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},t.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},t.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(t.unescape)},t.compile=function(r){return r.length===0?"":"/"+r.map(t.escape).join("/")},B}ft();var v={exports:{}},oe;function gt(){return oe||(oe=1,(function(e,t){t=e.exports=r,t.getSerialize=s;function r(a,i,n,o){return JSON.stringify(a,s(i,o),n)}function s(a,i){var n=[],o=[];return i==null&&(i=function(c,u){return n[0]===u?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(u)).join(".")+"]"}),function(c,u){if(n.length>0){var l=n.indexOf(this);~l?n.splice(l+1):n.push(this),~l?o.splice(l,1/0,c):o.push(c),~n.indexOf(u)&&(u=i.call(this,c,u))}else n.push(u);return a==null?u:a.call(this,c,u)}}})(v,v.exports)),v.exports}gt();class p{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(t){this._clientParams={...t,environment:t.environment??"master"}}static async graphqlQuery(t,r={}){const{space:s,accessToken:a,environment:i="master"}=this.clientParams,n=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:t,variables:r})});if(!n.ok){const c=await n.text();throw new Error(`GraphQL request failed: ${n.status} ${n.statusText}
|
|
2
|
-
${c}`)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var we=Function.prototype.toString,C=Object.create,Se=Object.prototype.toString,Ce=(function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(t){return!!~this._keys.indexOf(t)},e.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},e.prototype.set=function(t,r){this._keys.push(t),this._values.push(r)},e})();function Oe(){return new Ce}function je(){return new WeakMap}var ke=typeof WeakMap<"u"?je:Oe;function B(e){if(!e)return C(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:C(e);if(t&&~we.call(t).indexOf("[native code]"))try{return new t}catch{}return C(e)}function Ae(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}function Te(e){return e.flags}var _e=/test/g.flags==="g"?Te:Ae;function ae(e){var t=Se.call(e);return t.substring(8,t.length-1)}function qe(e){return e[Symbol.toStringTag]||ae(e)}var Pe=typeof Symbol<"u"?qe:ae,xe=Object.defineProperty,De=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,ce=Object.prototype,le=ce.hasOwnProperty,Re=ce.propertyIsEnumerable,ue=typeof N=="function";function Me(e){return se(e).concat(N(e))}var Ie=ue?Me:se;function S(e,t,r){for(var s=Ie(e),a=0,o=s.length,n=void 0,i=void 0;a<o;++a)if(n=s[a],!(n==="callee"||n==="caller")){if(i=De(e,n),!i){t[n]=r.copier(e[n],r);continue}!i.get&&!i.set&&(i.value=r.copier(i.value,r));try{xe(t,n,i)}catch{t[n]=i.value}}return t}function ze(e,t){var r=new t.Constructor;t.cache.set(e,r);for(var s=0,a=e.length;s<a;++s)r[s]=t.copier(e[s],t);return r}function Ee(e,t){var r=new t.Constructor;return t.cache.set(e,r),S(e,r,t)}function ge(e,t){return e.slice(0)}function Le(e,t){return e.slice(0,e.size,e.type)}function Be(e,t){return new t.Constructor(ge(e.buffer))}function Ne(e,t){return new t.Constructor(e.getTime())}function fe(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s,a){r.set(a,t.copier(s,t))}),r}function Ve(e,t){return S(e,fe(e,t),t)}function Qe(e,t){var r=B(t.prototype);t.cache.set(e,r);for(var s in e)le.call(e,s)&&(r[s]=t.copier(e[s],t));return r}function Fe(e,t){var r=B(t.prototype);t.cache.set(e,r);for(var s in e)le.call(e,s)&&(r[s]=t.copier(e[s],t));for(var a=N(e),o=0,n=a.length,i=void 0;o<n;++o)i=a[o],Re.call(e,i)&&(r[i]=t.copier(e[i],t));return r}var Ge=ue?Fe:Qe;function Ue(e,t){var r=B(t.prototype);return t.cache.set(e,r),S(e,r,t)}function O(e,t){return new t.Constructor(e.valueOf())}function Ke(e,t){var r=new t.Constructor(e.source,_e(e));return r.lastIndex=e.lastIndex,r}function w(e,t){return e}function pe(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s){r.add(t.copier(s,t))}),r}function We(e,t){return S(e,pe(e,t),t)}var Je=Array.isArray,V=Object.assign,He=Object.getPrototypeOf||(function(e){return e.__proto__}),he={array:ze,arrayBuffer:ge,blob:Le,dataView:Be,date:Ne,error:w,map:fe,object:Ge,regExp:Ke,set:pe},Ye=V({},he,{array:Ee,map:Ve,object:Ue,set:We});function Xe(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,Blob:e.blob,Boolean:O,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:O,Object:e.object,Promise:w,RegExp:e.regExp,Set:e.set,String:O,WeakMap:w,WeakSet:w,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer,Uint64Array:e.arrayBuffer}}function ye(e){var t=V({},he,e),r=Xe(t),s=r.Array,a=r.Object;function o(n,i){if(i.prototype=i.Constructor=void 0,!n||typeof n!="object")return n;if(i.cache.has(n))return i.cache.get(n);if(i.prototype=He(n),i.Constructor=i.prototype&&i.prototype.constructor,!i.Constructor||i.Constructor===Object)return a(n,i);if(Je(n))return s(n,i);var c=r[Pe(n)];return c?c(n,i):typeof n.then=="function"?n:a(n,i)}return function(i){return o(i,{Constructor:void 0,cache:ke(),copier:o,prototype:void 0})}}function Ze(e){return ye(V({},Ye,e))}Ze({});ye({});var v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j={exports:{}},F;function et(){if(F)return j.exports;F=1;var e=j.exports={},t,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"?t=setTimeout:t=s}catch{t=s}try{typeof clearTimeout=="function"?r=clearTimeout:r=a}catch{r=a}})();function o(p){if(t===setTimeout)return setTimeout(p,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(p,0);try{return t(p,0)}catch{try{return t.call(null,p,0)}catch{return t.call(this,p,0)}}}function n(p){if(r===clearTimeout)return clearTimeout(p);if((r===a||!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=[],c=!1,l,u=-1;function g(){!c||!l||(c=!1,l.length?i=l.concat(i):u=-1,i.length&&f())}function f(){if(!c){var p=o(g);c=!0;for(var d=i.length;d;){for(l=i,i=[];++u<d;)l&&l[u].run();u=-1,d=i.length}l=null,c=!1,n(p)}}e.nextTick=function(p){var d=new Array(arguments.length-1);if(arguments.length>1)for(var b=1;b<arguments.length;b++)d[b-1]=arguments[b];i.push(new y(p,d)),i.length===1&&!c&&o(f)};function y(p,d){this.fun=p,this.array=d}y.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function h(){}return e.on=h,e.addListener=h,e.once=h,e.off=h,e.removeListener=h,e.removeAllListeners=h,e.emit=h,e.prependListener=h,e.prependOnceListener=h,e.listeners=function(p){return[]},e.binding=function(p){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(p){throw new Error("process.chdir is not supported")},e.umask=function(){return 0},j.exports}et();var k,G;function tt(){if(G)return k;G=1;var e=typeof v=="object"&&v&&v.Object===Object&&v;return k=e,k}var A,U;function rt(){if(U)return A;U=1;var e=tt(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return A=r,A}var T,K;function me(){if(K)return T;K=1;var e=rt(),t=e.Symbol;return T=t,T}var _,W;function nt(){if(W)return _;W=1;var e=me(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function o(n){var i=r.call(n,a),c=n[a];try{n[a]=void 0;var l=!0}catch{}var u=s.call(n);return l&&(i?n[a]=c:delete n[a]),u}return _=o,_}var q,J;function it(){if(J)return q;J=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return q=r,q}var P,H;function de(){if(H)return P;H=1;var e=me(),t=nt(),r=it(),s="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function n(i){return i==null?i===void 0?a:s:o&&o in Object(i)?t(i):r(i)}return P=n,P}var x,Y;function ot(){if(Y)return x;Y=1;var e=Array.isArray;return x=e,x}var D,X;function be(){if(X)return D;X=1;function e(t){return t!=null&&typeof t=="object"}return D=e,D}var R,Z;function at(){if(Z)return R;Z=1;var e=de(),t=ot(),r=be(),s="[object String]";function a(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==s}return R=a,R}at();var M,ee;function st(){if(ee)return M;ee=1;function e(t,r){return function(s){return t(r(s))}}return M=e,M}var I,te;function ct(){if(te)return I;te=1;var e=st(),t=e(Object.getPrototypeOf,Object);return I=t,I}var z,re;function lt(){if(re)return z;re=1;var e=de(),t=ct(),r=be(),s="[object Object]",a=Function.prototype,o=Object.prototype,n=a.toString,i=o.hasOwnProperty,c=n.call(Object);function l(u){if(!r(u)||e(u)!=s)return!1;var g=t(u);if(g===null)return!0;var f=i.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&n.call(f)==c}return z=l,z}lt();var ve={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},$e={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint($e[0])).join("");Object.fromEntries(Object.entries($e).map(e=>e.reverse()));Object.fromEntries(Object.entries(ve).map(e=>e.reverse()));`${Object.values(ve).map(e=>`\\u{${e.toString(16)}}`).join("")}`;var E,ne;function ut(){if(ne)return E;ne=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;return E=function(r,s,a){if(t.call(s)!=="[object Function]")throw new TypeError("iterator must be a function");var o=r.length;if(o===+o)for(var n=0;n<o;n++)s.call(a,r[n],n,r);else for(var i in r)e.call(r,i)&&s.call(a,r[i],i,r)},E}var L,ie;function gt(){if(ie)return L;ie=1;var e=ut();L=t;function t(r,s,a){if(arguments.length===3)return t.set(r,s,a);if(arguments.length===2)return t.get(r,s);var o=t.bind(t,r);for(var n in t)t.hasOwnProperty(n)&&(o[n]=t[n].bind(o,r));return o}return t.get=function(r,s){for(var a=Array.isArray(s)?s:t.parse(s),o=0;o<a.length;++o){var n=a[o];if(!(typeof r=="object"&&n in r))throw new Error("Invalid reference token: "+n);r=r[n]}return r},t.set=function(r,s,a){var o=Array.isArray(s)?s:t.parse(s),n=o[0];if(o.length===0)throw Error("Can not set the root object");for(var i=0;i<o.length-1;++i){var c=o[i];typeof c!="string"&&typeof c!="number"&&(c=String(c)),!(c==="__proto__"||c==="constructor"||c==="prototype")&&(c==="-"&&Array.isArray(r)&&(c=r.length),n=o[i+1],c in r||(n.match(/^(\d+|-)$/)?r[c]=[]:r[c]={}),r=r[c])}return n==="-"&&Array.isArray(r)&&(n=r.length),r[n]=a,this},t.remove=function(r,s){var a=Array.isArray(s)?s:t.parse(s),o=a[a.length-1];if(o===void 0)throw new Error('Invalid JSON pointer for remove: "'+s+'"');var n=t.get(r,a.slice(0,-1));if(Array.isArray(n)){var i=+o;if(o===""&&isNaN(i))throw new Error('Invalid array index: "'+o+'"');Array.prototype.splice.call(n,i,1)}else delete n[o]},t.dict=function(r,s){var a={};return t.walk(r,function(o,n){a[n]=o},s),a},t.walk=function(r,s,a){var o=[];a=a||function(n){var i=Object.prototype.toString.call(n);return i==="[object Object]"||i==="[object Array]"},(function n(i){e(i,function(c,l){o.push(String(l)),a(c)?n(c):s(c,t.compile(o)),o.pop()})})(r)},t.has=function(r,s){try{t.get(r,s)}catch{return!1}return!0},t.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},t.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},t.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(t.unescape)},t.compile=function(r){return r.length===0?"":"/"+r.map(t.escape).join("/")},L}gt();var $={exports:{}},oe;function ft(){return oe||(oe=1,(function(e,t){t=e.exports=r,t.getSerialize=s;function r(a,o,n,i){return JSON.stringify(a,s(o,i),n)}function s(a,o){var n=[],i=[];return o==null&&(o=function(c,l){return n[0]===l?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(l)).join(".")+"]"}),function(c,l){if(n.length>0){var u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?i.splice(u,1/0,c):i.push(c),~n.indexOf(l)&&(l=o.call(this,c,l))}else n.push(l);return a==null?l:a.call(this,c,l)}}})($,$.exports)),$.exports}ft();class m{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(t){this._clientParams={...t,environment:t.environment??"master"}}static async graphqlQuery(t,r={}){const{space:s,accessToken:a,environment:o="master"}=this.clientParams,n=await fetch(`https://graphql.contentful.com/content/v1/spaces/${s}/environments/${o}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({query:t,variables:r})});if(!n.ok){const c=await n.text();throw new Error(`GraphQL request failed: ${n.status} ${n.statusText}
|
|
2
|
+
${c}`)}const i=await n.json();if(i.errors)throw new Error(`GraphQL errors: ${JSON.stringify(i.errors,null,2)}`);return i.data}}const pt=async({slot:e,page:t=1,size:r=20,platform:s,marketCode:a,language:o})=>{const n=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(r)),c=["$slot: String!","$limit: Int!","$skip: Int!"],l={slot:e,limit:i,skip:(n-1)*i},u=["{ slot: $slot }"];s&&(c.push("$platform: String!"),l.platform=s,u.push("{ platform_contains_some: [$platform] }")),a&&(c.push("$marketCode: String!"),l.marketCode=a,u.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),o&&(c.push("$language: String!"),l.language=o,u.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const g=`(${c.join(", ")})`,f=`(
|
|
3
3
|
limit: $limit
|
|
4
|
+
skip: $skip
|
|
4
5
|
where: {
|
|
5
6
|
AND: [
|
|
6
|
-
${
|
|
7
|
+
${u.join(`
|
|
7
8
|
`)}
|
|
8
9
|
]
|
|
9
10
|
}
|
|
10
|
-
)`,
|
|
11
|
-
query${
|
|
12
|
-
bannerCollectionCollection${
|
|
11
|
+
)`,y=`
|
|
12
|
+
query${g} {
|
|
13
|
+
bannerCollectionCollection${f} {
|
|
14
|
+
total
|
|
13
15
|
items {
|
|
14
16
|
sys {
|
|
15
17
|
id
|
|
@@ -43,17 +45,18 @@ query${c} {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
`,{bannerCollectionCollection:
|
|
48
|
+
`,{bannerCollectionCollection:h}=await m.graphqlQuery(y,{...l});return{page:n,total:h.total,size:i,items:h.items}};class Q extends Response{constructor(...t){super(t[0]??"Not Found",{status:404,...t[1]})}}const ht=async({marketCode:e,language:t,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(s)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=["limit: $limit","skip: $skip"],l=[];e&&(n.push("$marketCode: String!"),i.marketCode=e,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(n.push("$language: String!"),i.language=t,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
47
49
|
AND: [
|
|
48
|
-
${
|
|
50
|
+
${l.join(`
|
|
49
51
|
`)}
|
|
50
52
|
]
|
|
51
|
-
}`);const
|
|
52
|
-
${
|
|
53
|
+
}`);const u=n.length?`(${n.join(", ")})`:"",g=c.length?`(
|
|
54
|
+
${c.join(`
|
|
53
55
|
`)}
|
|
54
|
-
)`:"",
|
|
55
|
-
query${
|
|
56
|
-
blogPostCollection${
|
|
56
|
+
)`:"",f=`
|
|
57
|
+
query${u} {
|
|
58
|
+
blogPostCollection${g} {
|
|
59
|
+
total
|
|
57
60
|
items {
|
|
58
61
|
sys {
|
|
59
62
|
id
|
|
@@ -76,7 +79,7 @@ query${c} {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
`,{blogPostCollection:
|
|
82
|
+
`,{blogPostCollection:y}=await m.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},yt=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
80
83
|
limit: 1
|
|
81
84
|
where: {
|
|
82
85
|
AND: [
|
|
@@ -84,8 +87,8 @@ query${c} {
|
|
|
84
87
|
`)}
|
|
85
88
|
]
|
|
86
89
|
}
|
|
87
|
-
)`,
|
|
88
|
-
query${
|
|
90
|
+
)`,l=`
|
|
91
|
+
query${i} {
|
|
89
92
|
blogPostCollection${c} {
|
|
90
93
|
items {
|
|
91
94
|
sys {
|
|
@@ -127,19 +130,22 @@ query${o} {
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
`,{blogPostCollection:
|
|
133
|
+
`,{blogPostCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},mt=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=`(${n.join(", ")})`,u=c.length?`(
|
|
131
134
|
limit: $limit
|
|
135
|
+
skip: $skip
|
|
132
136
|
where: {
|
|
133
137
|
AND: [
|
|
134
|
-
${
|
|
138
|
+
${c.join(`
|
|
135
139
|
`)}
|
|
136
140
|
]
|
|
137
141
|
}
|
|
138
142
|
)`:`(
|
|
139
143
|
limit: $limit
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
skip: $skip
|
|
145
|
+
)`,g=`
|
|
146
|
+
query${l} {
|
|
147
|
+
brandCollectionCollection${u} {
|
|
148
|
+
total
|
|
143
149
|
items {
|
|
144
150
|
sys {
|
|
145
151
|
id
|
|
@@ -158,17 +164,18 @@ query${n} {
|
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
|
-
`,{brandCollectionCollection:
|
|
167
|
+
`,{brandCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},dt=async({marketCode:e,language:t,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(s)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=["limit: $limit","skip: $skip"],l=[];e&&(n.push("$marketCode: String!"),i.marketCode=e,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(n.push("$language: String!"),i.language=t,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
162
168
|
AND: [
|
|
163
|
-
${
|
|
169
|
+
${l.join(`
|
|
164
170
|
`)}
|
|
165
171
|
]
|
|
166
|
-
}`);const
|
|
167
|
-
${
|
|
172
|
+
}`);const u=n.length?`(${n.join(", ")})`:"",g=c.length?`(
|
|
173
|
+
${c.join(`
|
|
168
174
|
`)}
|
|
169
|
-
)`:"",
|
|
170
|
-
query${
|
|
171
|
-
documentationCategoryCollection${
|
|
175
|
+
)`:"",f=`
|
|
176
|
+
query${u} {
|
|
177
|
+
documentationCategoryCollection${g} {
|
|
178
|
+
total
|
|
172
179
|
items {
|
|
173
180
|
sys {
|
|
174
181
|
id
|
|
@@ -188,7 +195,7 @@ query${c} {
|
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
197
|
}
|
|
191
|
-
`,{documentationCategoryCollection:
|
|
198
|
+
`,{documentationCategoryCollection:y}=await m.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},bt=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
192
199
|
limit: 1
|
|
193
200
|
where: {
|
|
194
201
|
AND: [
|
|
@@ -196,8 +203,8 @@ query${c} {
|
|
|
196
203
|
`)}
|
|
197
204
|
]
|
|
198
205
|
}
|
|
199
|
-
)`,
|
|
200
|
-
query${
|
|
206
|
+
)`,l=`
|
|
207
|
+
query${i} {
|
|
201
208
|
documentationCategoryCollection${c} {
|
|
202
209
|
items {
|
|
203
210
|
sys {
|
|
@@ -218,17 +225,18 @@ query${o} {
|
|
|
218
225
|
}
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
|
-
`,{documentationCategoryCollection:
|
|
228
|
+
`,{documentationCategoryCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},vt=async({marketCode:e,language:t,categorySlug:r,page:s=1,size:a=20}={})=>{const o=Math.max(1,Math.floor(s)),n=Math.max(1,Math.floor(a)),i=["$limit: Int!","$skip: Int!"],c={limit:n,skip:(o-1)*n},l=["limit: $limit","skip: $skip"],u=[];e&&(i.push("$marketCode: String!"),c.marketCode=e,u.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(i.push("$language: String!"),c.language=t,u.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),r&&(i.push("$categorySlug: String!"),c.categorySlug=r,u.push("{ category: { slug: $categorySlug } }")),u.length&&l.push(`where: {
|
|
222
229
|
AND: [
|
|
223
|
-
${
|
|
230
|
+
${u.join(`
|
|
224
231
|
`)}
|
|
225
232
|
]
|
|
226
|
-
}`);const
|
|
227
|
-
${
|
|
233
|
+
}`);const g=i.length?`(${i.join(", ")})`:"",f=l.length?`(
|
|
234
|
+
${l.join(`
|
|
228
235
|
`)}
|
|
229
|
-
)`:"",
|
|
230
|
-
query${
|
|
231
|
-
documentationArticleCollection${
|
|
236
|
+
)`:"",y=`
|
|
237
|
+
query${g} {
|
|
238
|
+
documentationArticleCollection${f} {
|
|
239
|
+
total
|
|
232
240
|
items {
|
|
233
241
|
sys {
|
|
234
242
|
id
|
|
@@ -255,7 +263,7 @@ query${u} {
|
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
265
|
}
|
|
258
|
-
`,{documentationArticleCollection:h}=await
|
|
266
|
+
`,{documentationArticleCollection:h}=await m.graphqlQuery(y,{...c});return{page:o,total:h.total,size:n,items:h.items}},$t=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
259
267
|
limit: 1
|
|
260
268
|
where: {
|
|
261
269
|
AND: [
|
|
@@ -263,8 +271,8 @@ query${u} {
|
|
|
263
271
|
`)}
|
|
264
272
|
]
|
|
265
273
|
}
|
|
266
|
-
)`,
|
|
267
|
-
query${
|
|
274
|
+
)`,l=`
|
|
275
|
+
query${i} {
|
|
268
276
|
documentationArticleCollection${c} {
|
|
269
277
|
items {
|
|
270
278
|
sys {
|
|
@@ -301,16 +309,22 @@ query${o} {
|
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
|
-
`,{documentationArticleCollection:
|
|
312
|
+
`,{documentationArticleCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},wt=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=n.length?`(${n.join(", ")})`:"",u=c.length?`(
|
|
313
|
+
limit: $limit
|
|
314
|
+
skip: $skip
|
|
305
315
|
where: {
|
|
306
316
|
AND: [
|
|
307
|
-
${
|
|
317
|
+
${c.join(`
|
|
308
318
|
`)}
|
|
309
319
|
]
|
|
310
320
|
}
|
|
311
|
-
)
|
|
312
|
-
|
|
313
|
-
|
|
321
|
+
)`:`(
|
|
322
|
+
limit: $limit
|
|
323
|
+
skip: $skip
|
|
324
|
+
)`,g=`
|
|
325
|
+
query${l} {
|
|
326
|
+
hyperlinkCollectionCollection${u} {
|
|
327
|
+
total
|
|
314
328
|
items {
|
|
315
329
|
sys {
|
|
316
330
|
id
|
|
@@ -332,19 +346,22 @@ query${i} {
|
|
|
332
346
|
}
|
|
333
347
|
}
|
|
334
348
|
}
|
|
335
|
-
`,{hyperlinkCollectionCollection:
|
|
349
|
+
`,{hyperlinkCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},St=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=`(${n.join(", ")})`,u=c.length?`(
|
|
336
350
|
limit: $limit
|
|
351
|
+
skip: $skip
|
|
337
352
|
where: {
|
|
338
353
|
AND: [
|
|
339
|
-
${
|
|
354
|
+
${c.join(`
|
|
340
355
|
`)}
|
|
341
356
|
]
|
|
342
357
|
}
|
|
343
358
|
)`:`(
|
|
344
359
|
limit: $limit
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
360
|
+
skip: $skip
|
|
361
|
+
)`,g=`
|
|
362
|
+
query${l} {
|
|
363
|
+
keywordCollectionCollection${u} {
|
|
364
|
+
total
|
|
348
365
|
items {
|
|
349
366
|
sys {
|
|
350
367
|
id
|
|
@@ -355,4 +372,4 @@ query${n} {
|
|
|
355
372
|
}
|
|
356
373
|
}
|
|
357
374
|
}
|
|
358
|
-
`,{keywordCollectionCollection:
|
|
375
|
+
`,{keywordCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}};exports.ContentfulSDK=m;exports.getBlogPostDetail=yt;exports.getDocArticleDetail=$t;exports.getDocCategoryDetail=bt;exports.listBannerCollections=pt;exports.listBlogPosts=ht;exports.listBrandCollections=mt;exports.listDocArticles=vt;exports.listDocCategories=dt;exports.listHyperlinkCollections=wt;exports.listKeywordCollections=St;
|