@janbox/contentful-marketplace-sdk 3.0.0 → 3.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/dist/client/index.d.ts +9 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +317 -321
- package/dist/utils/query.d.ts +0 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ Configure the SDK once before calling entry methods.
|
|
|
60
60
|
| `url` | `string` | ✅ | Delivery API base URL, e.g. `https://headless-cms.ichiba.net/delivery/janbox` |
|
|
61
61
|
| `method` | `string` | — | Deprecated and ignored: requests are always `GET` |
|
|
62
62
|
| `headers` | `Record<string, string>` | — | Custom headers, usually `Authorization: Bearer cdel_...` |
|
|
63
|
+
| `timeout` | `number` | — | Timeout per attempt in ms. Default `30000`; `0` disables it |
|
|
64
|
+
| `retry` | `{ maxRetries?: number; maxDelay?: number } \| false` | — | Retry on HTTP 429. Default `{ maxRetries: 3, maxDelay: 10000 }`; `false` disables it |
|
|
63
65
|
|
|
64
66
|
```ts
|
|
65
67
|
ContentfulSDK.configure({
|
|
@@ -76,12 +78,20 @@ Notes:
|
|
|
76
78
|
- Keep the delivery key server-side: call the SDK from your server (route handler, BFF), never from browser JavaScript.
|
|
77
79
|
- Runtime requires `fetch` (Node.js 18+ recommended).
|
|
78
80
|
|
|
81
|
+
## Changes in 3.1.0
|
|
82
|
+
|
|
83
|
+
1. Requests go through [`@janbox/headless-cms-sdk`](https://www.npmjs.com/package/@janbox/headless-cms-sdk). The public API is unchanged.
|
|
84
|
+
2. A 30-second timeout per attempt and retries on HTTP 429 are on by default. Set `timeout: 0` or `retry: false` to turn them off.
|
|
85
|
+
3. Errors:
|
|
86
|
+
- A non-2xx response throws `Error("Request failed: {status} {id}\n{message}")`. The `Request failed: {status}` prefix is unchanged; the rest now comes from the CMS error. The original error, with `requestId` and `details`, is in `error.cause`.
|
|
87
|
+
- Network errors, timeouts and invalid responses throw an error with `name === "CmsError"` and `id` set to `NetworkError`, `Timeout` or `InvalidResponse`.
|
|
88
|
+
|
|
79
89
|
## Breaking changes in 3.0.0
|
|
80
90
|
|
|
81
91
|
1. `url` is now the Delivery API base URL of the internal CMS, and `headers` carries the delivery key (`Authorization: Bearer cdel_...`). `method` is still accepted but ignored.
|
|
82
92
|
2. The delivery key must stay on the server, so the SDK must be called server-side.
|
|
83
93
|
3. Types built on the `contentful` package are removed: `TypeXxxSkeleton`, the generic `TypeXxx<Modifiers, Locales>` types, and the `DocArticleEntry`, `DocCategoryEntry` and `HyperlinkEntry` aliases. `TypeXxxFields` are kept as plain interfaces.
|
|
84
|
-
4. Entry ids are the new CMS ids (GUIDs). Old Contentful ids must be migrated by the apps: the CMS rejects them with `400 InvalidQuery`, which the SDK throws as `Error("Request failed: 400 ...")`.
|
|
94
|
+
4. Entry ids are the new CMS ids (GUIDs). Old Contentful ids must be migrated by the apps: the CMS rejects them with `400 InvalidQuery`, which the SDK throws as `Error("Request failed: 400 InvalidQuery ...")`.
|
|
85
95
|
|
|
86
96
|
## API Methods
|
|
87
97
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -5,10 +5,19 @@ export interface ContentfulSDKConfig {
|
|
|
5
5
|
/** @deprecated Ignored: requests are always GET. Kept so existing configs still type-check. */
|
|
6
6
|
method?: string;
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
+
/** Timeout per attempt in ms. Defaults to 30000; 0 disables it. */
|
|
9
|
+
timeout?: number;
|
|
10
|
+
/** Retry on 429. Defaults to { maxRetries: 3, maxDelay: 10000 }; false disables it. */
|
|
11
|
+
retry?: {
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
maxDelay?: number;
|
|
14
|
+
} | false;
|
|
8
15
|
}
|
|
9
16
|
export declare class ContentfulSDK {
|
|
10
17
|
private static _config;
|
|
18
|
+
private static _client;
|
|
11
19
|
static get config(): ContentfulSDKConfig;
|
|
20
|
+
private static get client();
|
|
12
21
|
static configure(params: ContentfulSDKConfig): void;
|
|
13
22
|
static getEntries<T = CmsEntry>(params: QueryParams): Promise<CmsCollection<T>>;
|
|
14
23
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
${l}`)}return s.json()}}class h{page;total;size;items;totalPages;constructor({page:t,total:i,size:o,items:s}){this.page=t,this.total=i,this.size=o,this.items=s,this.totalPages=Math.ceil(this.total/this.size)}}const f=e=>{const t=new Map,i=new Map;for(const s of[...e.items,...e.includes?.Entry??[]])t.set(s.sys.id,s);for(const s of e.includes?.Asset??[])i.set(s.sys.id,s);const o=s=>(s&&t.get(s.sys.id))??null;return{entry:o,asset:s=>(s&&i.get(s.sys.id))??null,entries:s=>(s??[]).map(l=>o(l)).filter(l=>l!==null)}},n=e=>e??null,E=e=>{const t=e?.fields.file;return t?{url:t.url,width:t.details.image?.width??null,height:t.details.image?.height??null,contentType:t.contentType}:null},G=e=>({sys:{id:e.sys.id},url:e.fields.file?.url,width:e.fields.file?.details.image?.width??null,height:e.fields.file?.details.image?.height??null,contentType:e.fields.file?.contentType,title:n(e.fields.title),description:n(e.fields.description)}),R=(e,t)=>{if(!e||typeof e!="object")return t;const i=e;if(i.nodeType==="embedded-asset-block"){const o=i.data?.target?.sys?.id;o&&!t.includes(o)&&t.push(o)}for(const o of i.content??[])R(o,t);return t},b=(e,t)=>{if(!e)return null;const i=R(e,[]).map(o=>t.asset({sys:{type:"Link",linkType:"Asset",id:o}})).filter(o=>o!==null&&!!o.fields.file).map(G);return{json:e,links:{assets:{block:i}}}},z=e=>e?{metaTitle:n(e.fields.metaTitle),metaDescription:n(e.fields.metaDescription),metaKeywords:n(e.fields.metaKeywords),metaRobots:n(e.fields.metaRobots)}:null,B=e=>e?{sys:{id:e.sys.id},label:n(e.fields.label),url:n(e.fields.url),target:n(e.fields.target),marketHandling:n(e.fields.marketHandling)}:null,S=(e,t)=>e?{name:n(e.fields.name),avatar:E(t.asset(e.fields.avatar))}:null,q=async({slot:e,page:t=1,size:i=20,platform:o,marketCode:s,locale:l})=>{const d=w(t,i),a=await c.getEntries({content_type:"bannerCollection","fields.slot":e,"fields.platform":o||void 0,select:"sys.id,fields.name,fields.slot,fields.platform,fields.banners",include:2,order:m,...d.params,...g(s),...p(l)}),r=f(a);return new h({page:d.page,total:a.total,size:d.size,items:a.items.map(u=>({sys:{id:u.sys.id},name:n(u.fields.name),slot:n(u.fields.slot),platform:n(u.fields.platform),bannersCollection:{items:r.entries(u.fields.banners).map(C=>({sys:{id:C.sys.id},name:n(C.fields.name),hyperlink:B(r.entry(C.fields.hyperlink)),media:E(r.asset(C.fields.media))}))}}))})};class k extends Response{constructor(...t){super(t[0]??"Not Found",{status:404,...t[1]})}}const _="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage",I=(e,t)=>({sys:{id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt},title:n(e.fields.title),shortDescription:n(e.fields.shortDescription),slug:n(e.fields.slug),categoriesCollection:{items:t.entries(e.fields.categories).map(i=>({sys:{id:i.sys.id},title:n(i.fields.title),slug:n(i.fields.slug),featuredImage:E(t.asset(i.fields.featuredImage))}))},featuredImage:E(t.asset(e.fields.featuredImage))}),U=async({marketCode:e,locale:t,collectionId:i,categoryId:o,page:s=1,size:l=20,skip:d=0}={})=>{const a=w(s,l,d);if(i){const P=(await c.getEntries({content_type:"blogCollection","sys.id":i,select:"sys.id,fields.posts",include:0,limit:1})).items.at(0);if(!P)throw new k;const D=(P.fields.posts??[]).filter(y=>y.sys.linkType==="Entry").map(y=>y.sys.id),T=D.slice(a.params.skip,a.params.skip+a.size);if(!T.length)return new h({page:a.page,total:D.length,size:a.size,items:[]});const v=await c.getEntries({content_type:"blogPost","sys.id[in]":T.join(","),select:_,include:2,limit:a.size}),K=f(v),H=new Map(v.items.map(y=>[y.sys.id,y]));return new h({page:a.page,total:D.length,size:a.size,items:T.map(y=>H.get(y)).filter(y=>y!==void 0).map(y=>I(y,K))})}const r=await c.getEntries({content_type:"blogPost","fields.categories.sys.id":o||void 0,select:_,include:2,order:m,...a.params,...g(e),...p(t)}),u=f(r);return new h({page:a.page,total:r.total,size:a.size,items:r.items.map(C=>I(C,u))})},Y=async({id:e,slug:t,marketCode:i,locale:o})=>{const s=A({id:e,slug:t}),l=await c.getEntries({content_type:"blogPost",...s,select:`${_},fields.author,fields.content,fields.seo`,include:2,order:m,...g(i),...p(o)}),d=l.items.at(0);if(!d)throw new k;const a=f(l);return{...I(d,a),author:S(a.entry(d.fields.author),a),content:b(d.fields.content,a),seo:z(a.entry(d.fields.seo))}},x="sys.id,fields.title,fields.slug,fields.featuredImage",L=(e,t)=>({sys:{id:e.sys.id},title:n(e.fields.title),slug:n(e.fields.slug),featuredImage:E(t.asset(e.fields.featuredImage))}),J=async({marketCode:e,locale:t,page:i=1,size:o=20}={})=>{const s=w(i,o),l=await c.getEntries({content_type:"blogCategory",select:x,include:1,order:m,...s.params,...g(e),...p(t)}),d=f(l);return new h({page:s.page,total:l.total,size:s.size,items:l.items.map(a=>L(a,d))})},Q=async({id:e,slug:t,marketCode:i,locale:o})=>{const s=A({id:e,slug:t}),l=await c.getEntries({content_type:"blogCategory",...s,select:`${x},fields.description,fields.seo`,include:1,order:m,...g(i),...p(o)}),d=l.items.at(0);if(!d)throw new k;const a=f(l);return{...L(d,a),description:n(d.fields.description),seo:z(a.entry(d.fields.seo))}},V=async({marketCode:e,locale:t,page:i=1,size:o=20}={})=>{const s=w(i,o),l=await c.getEntries({content_type:"blogCollection",select:"sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",include:1,order:m,...s.params,...g(e),...p(t)}),d=f(l),a=l.items.map(r=>{const u=d.entry(r.fields.category);return{name:n(r.fields.name),type:n(r.fields.type),order:n(r.fields.order),sys:{id:r.sys.id},category:u?{sys:{id:u.sys.id},title:n(u.fields.title),slug:n(u.fields.slug)}:null,featuredImage:E(d.asset(r.fields.featuredImage))}});return new h({page:s.page,total:l.total,size:s.size,items:a.map(r=>({...r,category:r.type==="category"?r.category:null,categoryId:r.type==="category"?r.category?.sys.id??null:null,collectionId:r.type==="manual"?r.sys.id:null}))})},W=async({page:e=1,size:t=20,marketCode:i,locale:o}={})=>{const s=w(e,t),l=await c.getEntries({content_type:"brandCollection",select:"sys.id,fields.name,fields.slot,fields.brands",include:2,order:m,...s.params,...g(i),...p(o)}),d=f(l);return new h({page:s.page,total:l.total,size:s.size,items:l.items.map(a=>({sys:{id:a.sys.id},name:n(a.fields.name),slot:n(a.fields.slot),brandsCollection:{items:d.entries(a.fields.brands).map(r=>({sys:{id:r.sys.id},name:n(r.fields.name),logo:E(d.asset(r.fields.logo)),hyperlink:B(d.entry(r.fields.hyperlink))}))}}))})},M="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo",$="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category",O=e=>({id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt}),j=(e,t)=>({sys:O(e),title:n(e.fields.title),slug:n(e.fields.slug),description:n(e.fields.description),order:n(e.fields.order),seo:z(t.entry(e.fields.seo))}),F=(e,t)=>{const i=t.entry(e.fields.category);return{sys:O(e),title:n(e.fields.title),slug:n(e.fields.slug),author:S(t.entry(e.fields.author),t),category:i?{title:n(i.fields.title),slug:n(i.fields.slug),description:n(i.fields.description),order:n(i.fields.order)}:null}},X=async({marketCode:e,locale:t,page:i=1,size:o=20}={})=>{const s=w(i,o),l=await c.getEntries({content_type:"documentationCategory",select:M,include:1,order:m,...s.params,...g(e),...p(t)}),d=f(l);return new h({page:s.page,total:l.total,size:s.size,items:l.items.map(a=>j(a,d))})},Z=async({id:e,slug:t,marketCode:i,locale:o})=>{const s=A({id:e,slug:t}),l=await c.getEntries({content_type:"documentationCategory",...s,select:M,include:1,order:m,...g(i),...p(o)}),d=l.items.at(0);if(!d)throw new k;return j(d,f(l))},ee=async({marketCode:e,locale:t,categorySlug:i,page:o=1,size:s=20}={})=>{const l=w(o,s),d=await c.getEntries({content_type:"documentationArticle",...i?{"fields.category.sys.contentType.sys.id":"documentationCategory","fields.category.fields.slug":i}:{},select:$,include:2,order:m,...l.params,...g(e),...p(t)}),a=f(d);return new h({page:l.page,total:d.total,size:l.size,items:d.items.map(r=>F(r,a))})},te=async({id:e,slug:t,marketCode:i,locale:o})=>{const s=A({id:e,slug:t}),l=await c.getEntries({content_type:"documentationArticle",...s,select:`${$},fields.content,fields.seo`,include:2,order:m,...g(i),...p(o)}),d=l.items.at(0);if(!d)throw new k;const a=f(l);return{...F(d,a),content:b(d.fields.content,a),seo:z(a.entry(d.fields.seo))}},se=async({page:e=1,size:t=20,marketCode:i,locale:o}={})=>{const s=w(e,t),l=await c.getEntries({content_type:"hyperlinkCollection",select:"sys.id,fields.name,fields.slot,fields.order,fields.links",include:1,order:"fields.order",...s.params,...g(i),...p(o)}),d=f(l);return new h({page:s.page,total:l.total,size:s.size,items:l.items.map(a=>({sys:{id:a.sys.id},name:n(a.fields.name),slot:n(a.fields.slot),order:n(a.fields.order),linksCollection:{items:d.entries(a.fields.links).map(r=>B(r))}}))})},ie=async({page:e=1,size:t=20,marketCode:i,locale:o}={})=>{const s=w(e,t),l=await c.getEntries({content_type:"keywordCollection",select:"sys.id,fields.name,fields.slot,fields.keywords",include:0,order:m,...s.params,...g(i),...p(o)});return new h({page:s.page,total:l.total,size:s.size,items:l.items.map(d=>({sys:{id:d.sys.id},name:n(d.fields.name),slot:n(d.fields.slot),keywords:n(d.fields.keywords)}))})},oe=async({marketCode:e,locale:t}={})=>{const i=await c.getEntries({content_type:"policyAndTerms",select:"sys.id,fields.title,fields.locale,fields.content",include:1,order:m,limit:1,...g(e),...p(t)}),o=i.items.at(0);if(!o)throw new k;return{sys:{id:o.sys.id},title:n(o.fields.title),locale:n(o.fields.locale),content:b(o.fields.content,f(i))}};exports.ContentfulSDK=c;exports.PaginatedResponse=h;exports.getBannerCollections=q;exports.getBlogCategories=J;exports.getBlogCategoryDetail=Q;exports.getBlogCollections=V;exports.getBlogPostDetail=Y;exports.getBlogPosts=U;exports.getBrandCollections=W;exports.getDocArticleDetail=te;exports.getDocArticles=ee;exports.getDocCategories=X;exports.getDocCategoryDetail=Z;exports.getHyperlinkCollections=se;exports.getKeywordCollections=ie;exports.getPolicyAndTerms=oe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@janbox/headless-cms-sdk"),N=e=>k.isCmsError(e)&&e.status!==void 0&&(e.status<200||e.status>299)?new Error(`Request failed: ${e.status} ${e.id}
|
|
2
|
+
${e.message}`,{cause:e}):e;class r{static _config;static _client;static get config(){if(!this._config)throw new Error("Client is not configured");return this._config}static get client(){const{url:t,headers:i,timeout:l,retry:s}=this.config,o=this._client;if(o&&o.builtFrom.url===t&&o.builtFrom.headers===i&&o.builtFrom.timeout===l&&o.builtFrom.retry===s)return o.client;const n=k.createClient({baseUrl:t,headers:i,timeout:l,retry:s});return this._client={client:n,builtFrom:{url:t,headers:i,timeout:l,retry:s}},n}static configure(t){this._config=t}static async getEntries(t){const i=this.client;try{return await i.getEntries(t,{resolveLinks:!1})}catch(l){throw N(l)}}}class h{page;total;size;items;totalPages;constructor({page:t,total:i,size:l,items:s}){this.page=t,this.total=i,this.size=l,this.items=s,this.totalPages=Math.ceil(this.total/this.size)}}const p="-sys.updatedAt",g=e=>e?k.or("market",[{"fields.markets[exists]":"false"},{"fields.markets.sys.contentType.sys.id":"market","fields.markets.fields.code":e}]):{},u=e=>e?k.or("locale",[{"fields.locale[exists]":"false"},{"fields.locale":e}]):{},z=({id:e,slug:t})=>{if(e)return{"sys.id":e,limit:1};if(t)return{"fields.slug":t,limit:1};throw new Error("Either id or slug is required.")},w=(e,t,i=0)=>{const l=Math.max(1,Math.floor(e)),s=Math.max(1,Math.floor(t)),o=Math.max(0,Math.floor(i));return{page:l,size:s,params:{limit:s,skip:(l-1)*s+o}}},f=e=>{const t=new Map,i=new Map;for(const s of[...e.items,...e.includes?.Entry??[]])t.set(s.sys.id,s);for(const s of e.includes?.Asset??[])i.set(s.sys.id,s);const l=s=>(s&&t.get(s.sys.id))??null;return{entry:l,asset:s=>(s&&i.get(s.sys.id))??null,entries:s=>(s??[]).map(o=>l(o)).filter(o=>o!==null)}},a=e=>e??null,E=e=>{const t=e?.fields.file;return t?{url:t.url,width:t.details.image?.width??null,height:t.details.image?.height??null,contentType:t.contentType}:null},G=e=>({sys:{id:e.sys.id},url:e.fields.file?.url,width:e.fields.file?.details.image?.width??null,height:e.fields.file?.details.image?.height??null,contentType:e.fields.file?.contentType,title:a(e.fields.title),description:a(e.fields.description)}),S=(e,t)=>{if(!e||typeof e!="object")return t;const i=e;if(i.nodeType==="embedded-asset-block"){const l=i.data?.target?.sys?.id;l&&!t.includes(l)&&t.push(l)}for(const l of i.content??[])S(l,t);return t},B=(e,t)=>{if(!e)return null;const i=S(e,[]).map(l=>t.asset({sys:{type:"Link",linkType:"Asset",id:l}})).filter(l=>l!==null&&!!l.fields.file).map(G);return{json:e,links:{assets:{block:i}}}},_=e=>e?{metaTitle:a(e.fields.metaTitle),metaDescription:a(e.fields.metaDescription),metaKeywords:a(e.fields.metaKeywords),metaRobots:a(e.fields.metaRobots)}:null,v=e=>e?{sys:{id:e.sys.id},label:a(e.fields.label),url:a(e.fields.url),target:a(e.fields.target),marketHandling:a(e.fields.marketHandling)}:null,F=(e,t)=>e?{name:a(e.fields.name),avatar:E(t.asset(e.fields.avatar))}:null,U=async({slot:e,page:t=1,size:i=20,platform:l,marketCode:s,locale:o})=>{const n=w(t,i),c=await r.getEntries({content_type:"bannerCollection","fields.slot":e,"fields.platform":l||void 0,select:"sys.id,fields.name,fields.slot,fields.platform,fields.banners",include:2,order:p,...n.params,...g(s),...u(o)}),d=f(c);return new h({page:n.page,total:c.total,size:n.size,items:c.items.map(m=>({sys:{id:m.sys.id},name:a(m.fields.name),slot:a(m.fields.slot),platform:a(m.fields.platform),bannersCollection:{items:d.entries(m.fields.banners).map(C=>({sys:{id:C.sys.id},name:a(C.fields.name),hyperlink:v(d.entry(C.fields.hyperlink)),media:E(d.asset(C.fields.media))}))}}))})};class A extends Response{constructor(...t){super(t[0]??"Not Found",{status:404,...t[1]})}}const I="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage",T=(e,t)=>({sys:{id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt},title:a(e.fields.title),shortDescription:a(e.fields.shortDescription),slug:a(e.fields.slug),categoriesCollection:{items:t.entries(e.fields.categories).map(i=>({sys:{id:i.sys.id},title:a(i.fields.title),slug:a(i.fields.slug),featuredImage:E(t.asset(i.fields.featuredImage))}))},featuredImage:E(t.asset(e.fields.featuredImage))}),Y=async({marketCode:e,locale:t,collectionId:i,categoryId:l,page:s=1,size:o=20,skip:n=0}={})=>{const c=w(s,o,n);if(i){const P=(await r.getEntries({content_type:"blogCollection","sys.id":i,select:"sys.id,fields.posts",include:0,limit:1})).items.at(0);if(!P)throw new A;const D=(P.fields.posts??[]).filter(y=>y.sys.linkType==="Entry").map(y=>y.sys.id),b=D.slice(c.params.skip,c.params.skip+c.size);if(!b.length)return new h({page:c.page,total:D.length,size:c.size,items:[]});const R=await r.getEntries({content_type:"blogPost","sys.id[in]":b.join(","),select:I,include:2,limit:c.size}),j=f(R),q=new Map(R.items.map(y=>[y.sys.id,y]));return new h({page:c.page,total:D.length,size:c.size,items:b.map(y=>q.get(y)).filter(y=>y!==void 0).map(y=>T(y,j))})}const d=await r.getEntries({content_type:"blogPost","fields.categories.sys.id":l||void 0,select:I,include:2,order:p,...c.params,...g(e),...u(t)}),m=f(d);return new h({page:c.page,total:d.total,size:c.size,items:d.items.map(C=>T(C,m))})},J=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=z({id:e,slug:t}),o=await r.getEntries({content_type:"blogPost",...s,select:`${I},fields.author,fields.content,fields.seo`,include:2,order:p,...g(i),...u(l)}),n=o.items.at(0);if(!n)throw new A;const c=f(o);return{...T(n,c),author:F(c.entry(n.fields.author),c),content:B(n.fields.content,c),seo:_(c.entry(n.fields.seo))}},L="sys.id,fields.title,fields.slug,fields.featuredImage",M=(e,t)=>({sys:{id:e.sys.id},title:a(e.fields.title),slug:a(e.fields.slug),featuredImage:E(t.asset(e.fields.featuredImage))}),Q=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),o=await r.getEntries({content_type:"blogCategory",select:L,include:1,order:p,...s.params,...g(e),...u(t)}),n=f(o);return new h({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>M(c,n))})},V=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=z({id:e,slug:t}),o=await r.getEntries({content_type:"blogCategory",...s,select:`${L},fields.description,fields.seo`,include:1,order:p,...g(i),...u(l)}),n=o.items.at(0);if(!n)throw new A;const c=f(o);return{...M(n,c),description:a(n.fields.description),seo:_(c.entry(n.fields.seo))}},W=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),o=await r.getEntries({content_type:"blogCollection",select:"sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",include:1,order:p,...s.params,...g(e),...u(t)}),n=f(o),c=o.items.map(d=>{const m=n.entry(d.fields.category);return{name:a(d.fields.name),type:a(d.fields.type),order:a(d.fields.order),sys:{id:d.sys.id},category:m?{sys:{id:m.sys.id},title:a(m.fields.title),slug:a(m.fields.slug)}:null,featuredImage:E(n.asset(d.fields.featuredImage))}});return new h({page:s.page,total:o.total,size:s.size,items:c.map(d=>({...d,category:d.type==="category"?d.category:null,categoryId:d.type==="category"?d.category?.sys.id??null:null,collectionId:d.type==="manual"?d.sys.id:null}))})},X=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),o=await r.getEntries({content_type:"brandCollection",select:"sys.id,fields.name,fields.slot,fields.brands",include:2,order:p,...s.params,...g(i),...u(l)}),n=f(o);return new h({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>({sys:{id:c.sys.id},name:a(c.fields.name),slot:a(c.fields.slot),brandsCollection:{items:n.entries(c.fields.brands).map(d=>({sys:{id:d.sys.id},name:a(d.fields.name),logo:E(n.asset(d.fields.logo)),hyperlink:v(n.entry(d.fields.hyperlink))}))}}))})},x="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo",O="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category",K=e=>({id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt}),$=(e,t)=>({sys:K(e),title:a(e.fields.title),slug:a(e.fields.slug),description:a(e.fields.description),order:a(e.fields.order),seo:_(t.entry(e.fields.seo))}),H=(e,t)=>{const i=t.entry(e.fields.category);return{sys:K(e),title:a(e.fields.title),slug:a(e.fields.slug),author:F(t.entry(e.fields.author),t),category:i?{title:a(i.fields.title),slug:a(i.fields.slug),description:a(i.fields.description),order:a(i.fields.order)}:null}},Z=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),o=await r.getEntries({content_type:"documentationCategory",select:x,include:1,order:p,...s.params,...g(e),...u(t)}),n=f(o);return new h({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>$(c,n))})},ee=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=z({id:e,slug:t}),o=await r.getEntries({content_type:"documentationCategory",...s,select:x,include:1,order:p,...g(i),...u(l)}),n=o.items.at(0);if(!n)throw new A;return $(n,f(o))},te=async({marketCode:e,locale:t,categorySlug:i,page:l=1,size:s=20}={})=>{const o=w(l,s),n=await r.getEntries({content_type:"documentationArticle",...i?{"fields.category.sys.contentType.sys.id":"documentationCategory","fields.category.fields.slug":i}:{},select:O,include:2,order:p,...o.params,...g(e),...u(t)}),c=f(n);return new h({page:o.page,total:n.total,size:o.size,items:n.items.map(d=>H(d,c))})},se=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=z({id:e,slug:t}),o=await r.getEntries({content_type:"documentationArticle",...s,select:`${O},fields.content,fields.seo`,include:2,order:p,...g(i),...u(l)}),n=o.items.at(0);if(!n)throw new A;const c=f(o);return{...H(n,c),content:B(n.fields.content,c),seo:_(c.entry(n.fields.seo))}},ie=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),o=await r.getEntries({content_type:"hyperlinkCollection",select:"sys.id,fields.name,fields.slot,fields.order,fields.links",include:1,order:"fields.order",...s.params,...g(i),...u(l)}),n=f(o);return new h({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>({sys:{id:c.sys.id},name:a(c.fields.name),slot:a(c.fields.slot),order:a(c.fields.order),linksCollection:{items:n.entries(c.fields.links).map(d=>v(d))}}))})},le=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),o=await r.getEntries({content_type:"keywordCollection",select:"sys.id,fields.name,fields.slot,fields.keywords",include:0,order:p,...s.params,...g(i),...u(l)});return new h({page:s.page,total:o.total,size:s.size,items:o.items.map(n=>({sys:{id:n.sys.id},name:a(n.fields.name),slot:a(n.fields.slot),keywords:a(n.fields.keywords)}))})},oe=async({marketCode:e,locale:t}={})=>{const i=await r.getEntries({content_type:"policyAndTerms",select:"sys.id,fields.title,fields.locale,fields.content",include:1,order:p,limit:1,...g(e),...u(t)}),l=i.items.at(0);if(!l)throw new A;return{sys:{id:l.sys.id},title:a(l.fields.title),locale:a(l.fields.locale),content:B(l.fields.content,f(i))}};exports.ContentfulSDK=r;exports.PaginatedResponse=h;exports.getBannerCollections=U;exports.getBlogCategories=Q;exports.getBlogCategoryDetail=V;exports.getBlogCollections=W;exports.getBlogPostDetail=J;exports.getBlogPosts=Y;exports.getBrandCollections=X;exports.getDocArticleDetail=se;exports.getDocArticles=te;exports.getDocCategories=Z;exports.getDocCategoryDetail=ee;exports.getHyperlinkCollections=ie;exports.getKeywordCollections=le;exports.getPolicyAndTerms=oe;
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} : {}, p = (e) => e ? {
|
|
6
|
-
"or.locale.0.fields.locale[exists]": "false",
|
|
7
|
-
"or.locale.1.fields.locale": e
|
|
8
|
-
} : {}, z = ({ id: e, slug: t }) => {
|
|
9
|
-
if (e)
|
|
10
|
-
return { "sys.id": e, limit: 1 };
|
|
11
|
-
if (t)
|
|
12
|
-
return { "fields.slug": t, limit: 1 };
|
|
13
|
-
throw new Error("Either id or slug is required.");
|
|
14
|
-
}, w = (e, t, i = 0) => {
|
|
15
|
-
const o = Math.max(1, Math.floor(e)), s = Math.max(1, Math.floor(t)), l = Math.max(0, Math.floor(i));
|
|
16
|
-
return {
|
|
17
|
-
page: o,
|
|
18
|
-
size: s,
|
|
19
|
-
params: {
|
|
20
|
-
limit: s,
|
|
21
|
-
skip: (o - 1) * s + l
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}, N = (e) => {
|
|
25
|
-
const t = new URLSearchParams();
|
|
26
|
-
for (const [i, o] of Object.entries(e))
|
|
27
|
-
o !== void 0 && t.append(i, String(o));
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
class c {
|
|
1
|
+
import { createClient as q, isCmsError as G, or as P } from "@janbox/headless-cms-sdk";
|
|
2
|
+
const U = (e) => G(e) && e.status !== void 0 && (e.status < 200 || e.status > 299) ? new Error(`Request failed: ${e.status} ${e.id}
|
|
3
|
+
${e.message}`, { cause: e }) : e;
|
|
4
|
+
class r {
|
|
31
5
|
static _config;
|
|
6
|
+
static _client;
|
|
32
7
|
static get config() {
|
|
33
8
|
if (!this._config)
|
|
34
9
|
throw new Error("Client is not configured");
|
|
35
10
|
return this._config;
|
|
36
11
|
}
|
|
12
|
+
// 3.0.0 read the config on every request, so rebuild whenever a field the client uses changed.
|
|
13
|
+
static get client() {
|
|
14
|
+
const { url: t, headers: i, timeout: l, retry: s } = this.config, o = this._client;
|
|
15
|
+
if (o && o.builtFrom.url === t && o.builtFrom.headers === i && o.builtFrom.timeout === l && o.builtFrom.retry === s)
|
|
16
|
+
return o.client;
|
|
17
|
+
const n = q({ baseUrl: t, headers: i, timeout: l, retry: s });
|
|
18
|
+
return this._client = { client: n, builtFrom: { url: t, headers: i, timeout: l, retry: s } }, n;
|
|
19
|
+
}
|
|
37
20
|
static configure(t) {
|
|
38
21
|
this._config = t;
|
|
39
22
|
}
|
|
40
23
|
static async getEntries(t) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Accept: "application/json",
|
|
47
|
-
...o
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
if (!s.ok) {
|
|
52
|
-
const l = await s.text();
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Request failed: ${s.status} ${s.statusText}
|
|
55
|
-
${l}`
|
|
56
|
-
);
|
|
24
|
+
const i = this.client;
|
|
25
|
+
try {
|
|
26
|
+
return await i.getEntries(t, { resolveLinks: !1 });
|
|
27
|
+
} catch (l) {
|
|
28
|
+
throw U(l);
|
|
57
29
|
}
|
|
58
|
-
return s.json();
|
|
59
30
|
}
|
|
60
31
|
}
|
|
61
32
|
class h {
|
|
@@ -67,25 +38,50 @@ class h {
|
|
|
67
38
|
constructor({
|
|
68
39
|
page: t,
|
|
69
40
|
total: i,
|
|
70
|
-
size:
|
|
41
|
+
size: l,
|
|
71
42
|
items: s
|
|
72
43
|
}) {
|
|
73
|
-
this.page = t, this.total = i, this.size =
|
|
44
|
+
this.page = t, this.total = i, this.size = l, this.items = s, this.totalPages = Math.ceil(this.total / this.size);
|
|
74
45
|
}
|
|
75
46
|
}
|
|
76
|
-
const
|
|
47
|
+
const p = "-sys.updatedAt", g = (e) => e ? P("market", [
|
|
48
|
+
{ "fields.markets[exists]": "false" },
|
|
49
|
+
{
|
|
50
|
+
"fields.markets.sys.contentType.sys.id": "market",
|
|
51
|
+
"fields.markets.fields.code": e
|
|
52
|
+
}
|
|
53
|
+
]) : {}, u = (e) => e ? P("locale", [
|
|
54
|
+
{ "fields.locale[exists]": "false" },
|
|
55
|
+
{ "fields.locale": e }
|
|
56
|
+
]) : {}, k = ({ id: e, slug: t }) => {
|
|
57
|
+
if (e)
|
|
58
|
+
return { "sys.id": e, limit: 1 };
|
|
59
|
+
if (t)
|
|
60
|
+
return { "fields.slug": t, limit: 1 };
|
|
61
|
+
throw new Error("Either id or slug is required.");
|
|
62
|
+
}, w = (e, t, i = 0) => {
|
|
63
|
+
const l = Math.max(1, Math.floor(e)), s = Math.max(1, Math.floor(t)), o = Math.max(0, Math.floor(i));
|
|
64
|
+
return {
|
|
65
|
+
page: l,
|
|
66
|
+
size: s,
|
|
67
|
+
params: {
|
|
68
|
+
limit: s,
|
|
69
|
+
skip: (l - 1) * s + o
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, f = (e) => {
|
|
77
73
|
const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
78
74
|
for (const s of [...e.items, ...e.includes?.Entry ?? []])
|
|
79
75
|
t.set(s.sys.id, s);
|
|
80
76
|
for (const s of e.includes?.Asset ?? [])
|
|
81
77
|
i.set(s.sys.id, s);
|
|
82
|
-
const
|
|
78
|
+
const l = (s) => (s && t.get(s.sys.id)) ?? null;
|
|
83
79
|
return {
|
|
84
|
-
entry:
|
|
80
|
+
entry: l,
|
|
85
81
|
asset: (s) => (s && i.get(s.sys.id)) ?? null,
|
|
86
|
-
entries: (s) => (s ?? []).map((
|
|
82
|
+
entries: (s) => (s ?? []).map((o) => l(o)).filter((o) => o !== null)
|
|
87
83
|
};
|
|
88
|
-
},
|
|
84
|
+
}, a = (e) => e ?? null, C = (e) => {
|
|
89
85
|
const t = e?.fields.file;
|
|
90
86
|
return t ? {
|
|
91
87
|
url: t.url,
|
|
@@ -93,88 +89,88 @@ const f = (e) => {
|
|
|
93
89
|
height: t.details.image?.height ?? null,
|
|
94
90
|
contentType: t.contentType
|
|
95
91
|
} : null;
|
|
96
|
-
},
|
|
92
|
+
}, Y = (e) => ({
|
|
97
93
|
sys: { id: e.sys.id },
|
|
98
94
|
url: e.fields.file?.url,
|
|
99
95
|
width: e.fields.file?.details.image?.width ?? null,
|
|
100
96
|
height: e.fields.file?.details.image?.height ?? null,
|
|
101
97
|
contentType: e.fields.file?.contentType,
|
|
102
|
-
title:
|
|
103
|
-
description:
|
|
104
|
-
}),
|
|
98
|
+
title: a(e.fields.title),
|
|
99
|
+
description: a(e.fields.description)
|
|
100
|
+
}), F = (e, t) => {
|
|
105
101
|
if (!e || typeof e != "object")
|
|
106
102
|
return t;
|
|
107
103
|
const i = e;
|
|
108
104
|
if (i.nodeType === "embedded-asset-block") {
|
|
109
|
-
const
|
|
110
|
-
|
|
105
|
+
const l = i.data?.target?.sys?.id;
|
|
106
|
+
l && !t.includes(l) && t.push(l);
|
|
111
107
|
}
|
|
112
|
-
for (const
|
|
113
|
-
|
|
108
|
+
for (const l of i.content ?? [])
|
|
109
|
+
F(l, t);
|
|
114
110
|
return t;
|
|
115
111
|
}, D = (e, t) => {
|
|
116
112
|
if (!e)
|
|
117
113
|
return null;
|
|
118
|
-
const i =
|
|
114
|
+
const i = F(e, []).map((l) => t.asset({ sys: { type: "Link", linkType: "Asset", id: l } })).filter((l) => l !== null && !!l.fields.file).map(Y);
|
|
119
115
|
return { json: e, links: { assets: { block: i } } };
|
|
120
116
|
}, A = (e) => e ? {
|
|
121
|
-
metaTitle:
|
|
122
|
-
metaDescription:
|
|
123
|
-
metaKeywords:
|
|
124
|
-
metaRobots:
|
|
117
|
+
metaTitle: a(e.fields.metaTitle),
|
|
118
|
+
metaDescription: a(e.fields.metaDescription),
|
|
119
|
+
metaKeywords: a(e.fields.metaKeywords),
|
|
120
|
+
metaRobots: a(e.fields.metaRobots)
|
|
125
121
|
} : null, v = (e) => e ? {
|
|
126
122
|
sys: { id: e.sys.id },
|
|
127
|
-
label:
|
|
128
|
-
url:
|
|
129
|
-
target:
|
|
130
|
-
marketHandling:
|
|
131
|
-
} : null,
|
|
132
|
-
name:
|
|
123
|
+
label: a(e.fields.label),
|
|
124
|
+
url: a(e.fields.url),
|
|
125
|
+
target: a(e.fields.target),
|
|
126
|
+
marketHandling: a(e.fields.marketHandling)
|
|
127
|
+
} : null, L = (e, t) => e ? {
|
|
128
|
+
name: a(e.fields.name),
|
|
133
129
|
avatar: C(t.asset(e.fields.avatar))
|
|
134
|
-
} : null,
|
|
130
|
+
} : null, Q = async ({
|
|
135
131
|
slot: e,
|
|
136
132
|
page: t = 1,
|
|
137
133
|
size: i = 20,
|
|
138
|
-
platform:
|
|
134
|
+
platform: l,
|
|
139
135
|
marketCode: s,
|
|
140
|
-
locale:
|
|
136
|
+
locale: o
|
|
141
137
|
}) => {
|
|
142
|
-
const
|
|
138
|
+
const n = w(t, i), d = await r.getEntries({
|
|
143
139
|
content_type: "bannerCollection",
|
|
144
140
|
"fields.slot": e,
|
|
145
|
-
"fields.platform":
|
|
141
|
+
"fields.platform": l || void 0,
|
|
146
142
|
select: "sys.id,fields.name,fields.slot,fields.platform,fields.banners",
|
|
147
143
|
include: 2,
|
|
148
|
-
order:
|
|
149
|
-
...
|
|
144
|
+
order: p,
|
|
145
|
+
...n.params,
|
|
150
146
|
...g(s),
|
|
151
|
-
...
|
|
152
|
-
}),
|
|
147
|
+
...u(o)
|
|
148
|
+
}), c = f(d);
|
|
153
149
|
return new h({
|
|
154
|
-
page:
|
|
155
|
-
total:
|
|
156
|
-
size:
|
|
157
|
-
items:
|
|
158
|
-
(
|
|
159
|
-
sys: { id:
|
|
160
|
-
name:
|
|
161
|
-
slot:
|
|
162
|
-
platform:
|
|
150
|
+
page: n.page,
|
|
151
|
+
total: d.total,
|
|
152
|
+
size: n.size,
|
|
153
|
+
items: d.items.map(
|
|
154
|
+
(m) => ({
|
|
155
|
+
sys: { id: m.sys.id },
|
|
156
|
+
name: a(m.fields.name),
|
|
157
|
+
slot: a(m.fields.slot),
|
|
158
|
+
platform: a(m.fields.platform),
|
|
163
159
|
bannersCollection: {
|
|
164
|
-
items:
|
|
160
|
+
items: c.entries(m.fields.banners).map((E) => ({
|
|
165
161
|
sys: { id: E.sys.id },
|
|
166
|
-
name:
|
|
162
|
+
name: a(E.fields.name),
|
|
167
163
|
hyperlink: v(
|
|
168
|
-
|
|
164
|
+
c.entry(E.fields.hyperlink)
|
|
169
165
|
),
|
|
170
|
-
media: C(
|
|
166
|
+
media: C(c.asset(E.fields.media))
|
|
171
167
|
}))
|
|
172
168
|
}
|
|
173
169
|
})
|
|
174
170
|
)
|
|
175
171
|
});
|
|
176
172
|
};
|
|
177
|
-
class
|
|
173
|
+
class z extends Response {
|
|
178
174
|
constructor(...t) {
|
|
179
175
|
super(t[0] ?? "Not Found", {
|
|
180
176
|
status: 404,
|
|
@@ -182,36 +178,36 @@ class k extends Response {
|
|
|
182
178
|
});
|
|
183
179
|
}
|
|
184
180
|
}
|
|
185
|
-
const
|
|
181
|
+
const b = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage", T = (e, t) => ({
|
|
186
182
|
sys: {
|
|
187
183
|
id: e.sys.id,
|
|
188
184
|
createdAt: e.sys.createdAt,
|
|
189
185
|
updatedAt: e.sys.updatedAt
|
|
190
186
|
},
|
|
191
|
-
title:
|
|
192
|
-
shortDescription:
|
|
193
|
-
slug:
|
|
187
|
+
title: a(e.fields.title),
|
|
188
|
+
shortDescription: a(e.fields.shortDescription),
|
|
189
|
+
slug: a(e.fields.slug),
|
|
194
190
|
categoriesCollection: {
|
|
195
191
|
items: t.entries(e.fields.categories).map((i) => ({
|
|
196
192
|
sys: { id: i.sys.id },
|
|
197
|
-
title:
|
|
198
|
-
slug:
|
|
193
|
+
title: a(i.fields.title),
|
|
194
|
+
slug: a(i.fields.slug),
|
|
199
195
|
featuredImage: C(t.asset(i.fields.featuredImage))
|
|
200
196
|
}))
|
|
201
197
|
},
|
|
202
198
|
featuredImage: C(t.asset(e.fields.featuredImage))
|
|
203
|
-
}),
|
|
199
|
+
}), V = async ({
|
|
204
200
|
marketCode: e,
|
|
205
201
|
locale: t,
|
|
206
202
|
collectionId: i,
|
|
207
|
-
categoryId:
|
|
203
|
+
categoryId: l,
|
|
208
204
|
page: s = 1,
|
|
209
|
-
size:
|
|
210
|
-
skip:
|
|
205
|
+
size: o = 20,
|
|
206
|
+
skip: n = 0
|
|
211
207
|
} = {}) => {
|
|
212
|
-
const
|
|
208
|
+
const d = w(s, o, n);
|
|
213
209
|
if (i) {
|
|
214
|
-
const R = (await
|
|
210
|
+
const R = (await r.getEntries({
|
|
215
211
|
content_type: "blogCollection",
|
|
216
212
|
"sys.id": i,
|
|
217
213
|
select: "sys.id,fields.posts",
|
|
@@ -219,404 +215,404 @@ const I = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescripti
|
|
|
219
215
|
limit: 1
|
|
220
216
|
})).items.at(0);
|
|
221
217
|
if (!R)
|
|
222
|
-
throw new
|
|
223
|
-
const _ = (R.fields.posts ?? []).filter((y) => y.sys.linkType === "Entry").map((y) => y.sys.id),
|
|
224
|
-
if (!
|
|
218
|
+
throw new z();
|
|
219
|
+
const _ = (R.fields.posts ?? []).filter((y) => y.sys.linkType === "Entry").map((y) => y.sys.id), I = _.slice(d.params.skip, d.params.skip + d.size);
|
|
220
|
+
if (!I.length)
|
|
225
221
|
return new h({
|
|
226
|
-
page:
|
|
222
|
+
page: d.page,
|
|
227
223
|
total: _.length,
|
|
228
|
-
size:
|
|
224
|
+
size: d.size,
|
|
229
225
|
items: []
|
|
230
226
|
});
|
|
231
|
-
const
|
|
227
|
+
const B = await r.getEntries({
|
|
232
228
|
content_type: "blogPost",
|
|
233
|
-
"sys.id[in]":
|
|
234
|
-
select:
|
|
229
|
+
"sys.id[in]": I.join(","),
|
|
230
|
+
select: b,
|
|
235
231
|
include: 2,
|
|
236
|
-
limit:
|
|
237
|
-
}),
|
|
232
|
+
limit: d.size
|
|
233
|
+
}), N = f(B), j = new Map(B.items.map((y) => [y.sys.id, y]));
|
|
238
234
|
return new h({
|
|
239
|
-
page:
|
|
235
|
+
page: d.page,
|
|
240
236
|
total: _.length,
|
|
241
|
-
size:
|
|
242
|
-
items:
|
|
237
|
+
size: d.size,
|
|
238
|
+
items: I.map((y) => j.get(y)).filter((y) => y !== void 0).map((y) => T(y, N))
|
|
243
239
|
});
|
|
244
240
|
}
|
|
245
|
-
const
|
|
241
|
+
const c = await r.getEntries({
|
|
246
242
|
content_type: "blogPost",
|
|
247
|
-
"fields.categories.sys.id":
|
|
248
|
-
select:
|
|
243
|
+
"fields.categories.sys.id": l || void 0,
|
|
244
|
+
select: b,
|
|
249
245
|
include: 2,
|
|
250
|
-
order:
|
|
251
|
-
...
|
|
246
|
+
order: p,
|
|
247
|
+
...d.params,
|
|
252
248
|
...g(e),
|
|
253
|
-
...
|
|
254
|
-
}),
|
|
249
|
+
...u(t)
|
|
250
|
+
}), m = f(c);
|
|
255
251
|
return new h({
|
|
256
|
-
page:
|
|
257
|
-
total:
|
|
258
|
-
size:
|
|
259
|
-
items:
|
|
252
|
+
page: d.page,
|
|
253
|
+
total: c.total,
|
|
254
|
+
size: d.size,
|
|
255
|
+
items: c.items.map((E) => T(E, m))
|
|
260
256
|
});
|
|
261
|
-
},
|
|
257
|
+
}, W = async ({
|
|
262
258
|
id: e,
|
|
263
259
|
slug: t,
|
|
264
260
|
marketCode: i,
|
|
265
|
-
locale:
|
|
261
|
+
locale: l
|
|
266
262
|
}) => {
|
|
267
|
-
const s =
|
|
263
|
+
const s = k({ id: e, slug: t }), o = await r.getEntries({
|
|
268
264
|
content_type: "blogPost",
|
|
269
265
|
...s,
|
|
270
|
-
select: `${
|
|
266
|
+
select: `${b},fields.author,fields.content,fields.seo`,
|
|
271
267
|
include: 2,
|
|
272
|
-
order:
|
|
268
|
+
order: p,
|
|
273
269
|
...g(i),
|
|
274
|
-
...
|
|
275
|
-
}),
|
|
276
|
-
if (!
|
|
277
|
-
throw new
|
|
278
|
-
const
|
|
270
|
+
...u(l)
|
|
271
|
+
}), n = o.items.at(0);
|
|
272
|
+
if (!n)
|
|
273
|
+
throw new z();
|
|
274
|
+
const d = f(o);
|
|
279
275
|
return {
|
|
280
|
-
...
|
|
281
|
-
author:
|
|
282
|
-
content: D(
|
|
283
|
-
seo: A(
|
|
276
|
+
...T(n, d),
|
|
277
|
+
author: L(d.entry(n.fields.author), d),
|
|
278
|
+
content: D(n.fields.content, d),
|
|
279
|
+
seo: A(d.entry(n.fields.seo))
|
|
284
280
|
};
|
|
285
|
-
},
|
|
281
|
+
}, x = "sys.id,fields.title,fields.slug,fields.featuredImage", M = (e, t) => ({
|
|
286
282
|
sys: { id: e.sys.id },
|
|
287
|
-
title:
|
|
288
|
-
slug:
|
|
283
|
+
title: a(e.fields.title),
|
|
284
|
+
slug: a(e.fields.slug),
|
|
289
285
|
featuredImage: C(t.asset(e.fields.featuredImage))
|
|
290
|
-
}),
|
|
286
|
+
}), X = async ({
|
|
291
287
|
marketCode: e,
|
|
292
288
|
locale: t,
|
|
293
289
|
page: i = 1,
|
|
294
|
-
size:
|
|
290
|
+
size: l = 20
|
|
295
291
|
} = {}) => {
|
|
296
|
-
const s = w(i,
|
|
292
|
+
const s = w(i, l), o = await r.getEntries({
|
|
297
293
|
content_type: "blogCategory",
|
|
298
|
-
select:
|
|
294
|
+
select: x,
|
|
299
295
|
include: 1,
|
|
300
|
-
order:
|
|
296
|
+
order: p,
|
|
301
297
|
...s.params,
|
|
302
298
|
...g(e),
|
|
303
|
-
...
|
|
304
|
-
}),
|
|
299
|
+
...u(t)
|
|
300
|
+
}), n = f(o);
|
|
305
301
|
return new h({
|
|
306
302
|
page: s.page,
|
|
307
|
-
total:
|
|
303
|
+
total: o.total,
|
|
308
304
|
size: s.size,
|
|
309
|
-
items:
|
|
305
|
+
items: o.items.map((d) => M(d, n))
|
|
310
306
|
});
|
|
311
|
-
},
|
|
307
|
+
}, Z = async ({
|
|
312
308
|
id: e,
|
|
313
309
|
slug: t,
|
|
314
310
|
marketCode: i,
|
|
315
|
-
locale:
|
|
311
|
+
locale: l
|
|
316
312
|
}) => {
|
|
317
|
-
const s =
|
|
313
|
+
const s = k({ id: e, slug: t }), o = await r.getEntries({
|
|
318
314
|
content_type: "blogCategory",
|
|
319
315
|
...s,
|
|
320
|
-
select: `${
|
|
316
|
+
select: `${x},fields.description,fields.seo`,
|
|
321
317
|
include: 1,
|
|
322
|
-
order:
|
|
318
|
+
order: p,
|
|
323
319
|
...g(i),
|
|
324
|
-
...
|
|
325
|
-
}),
|
|
326
|
-
if (!
|
|
327
|
-
throw new
|
|
328
|
-
const
|
|
320
|
+
...u(l)
|
|
321
|
+
}), n = o.items.at(0);
|
|
322
|
+
if (!n)
|
|
323
|
+
throw new z();
|
|
324
|
+
const d = f(o);
|
|
329
325
|
return {
|
|
330
|
-
...
|
|
331
|
-
description: n
|
|
332
|
-
seo: A(
|
|
326
|
+
...M(n, d),
|
|
327
|
+
description: a(n.fields.description),
|
|
328
|
+
seo: A(d.entry(n.fields.seo))
|
|
333
329
|
};
|
|
334
|
-
},
|
|
330
|
+
}, ee = async ({
|
|
335
331
|
marketCode: e,
|
|
336
332
|
locale: t,
|
|
337
333
|
page: i = 1,
|
|
338
|
-
size:
|
|
334
|
+
size: l = 20
|
|
339
335
|
} = {}) => {
|
|
340
|
-
const s = w(i,
|
|
336
|
+
const s = w(i, l), o = await r.getEntries({
|
|
341
337
|
content_type: "blogCollection",
|
|
342
338
|
select: "sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",
|
|
343
339
|
include: 1,
|
|
344
|
-
order:
|
|
340
|
+
order: p,
|
|
345
341
|
...s.params,
|
|
346
342
|
...g(e),
|
|
347
|
-
...
|
|
348
|
-
}),
|
|
349
|
-
const
|
|
343
|
+
...u(t)
|
|
344
|
+
}), n = f(o), d = o.items.map((c) => {
|
|
345
|
+
const m = n.entry(c.fields.category);
|
|
350
346
|
return {
|
|
351
|
-
name:
|
|
352
|
-
type:
|
|
353
|
-
order:
|
|
354
|
-
sys: { id:
|
|
355
|
-
category:
|
|
356
|
-
sys: { id:
|
|
357
|
-
title:
|
|
358
|
-
slug:
|
|
347
|
+
name: a(c.fields.name),
|
|
348
|
+
type: a(c.fields.type),
|
|
349
|
+
order: a(c.fields.order),
|
|
350
|
+
sys: { id: c.sys.id },
|
|
351
|
+
category: m ? {
|
|
352
|
+
sys: { id: m.sys.id },
|
|
353
|
+
title: a(m.fields.title),
|
|
354
|
+
slug: a(m.fields.slug)
|
|
359
355
|
} : null,
|
|
360
|
-
featuredImage: C(
|
|
356
|
+
featuredImage: C(n.asset(c.fields.featuredImage))
|
|
361
357
|
};
|
|
362
358
|
});
|
|
363
359
|
return new h({
|
|
364
360
|
page: s.page,
|
|
365
|
-
total:
|
|
361
|
+
total: o.total,
|
|
366
362
|
size: s.size,
|
|
367
|
-
items:
|
|
368
|
-
...
|
|
369
|
-
category:
|
|
370
|
-
categoryId:
|
|
371
|
-
collectionId:
|
|
363
|
+
items: d.map((c) => ({
|
|
364
|
+
...c,
|
|
365
|
+
category: c.type === "category" ? c.category : null,
|
|
366
|
+
categoryId: c.type === "category" ? c.category?.sys.id ?? null : null,
|
|
367
|
+
collectionId: c.type === "manual" ? c.sys.id : null
|
|
372
368
|
}))
|
|
373
369
|
});
|
|
374
|
-
},
|
|
370
|
+
}, te = async ({
|
|
375
371
|
page: e = 1,
|
|
376
372
|
size: t = 20,
|
|
377
373
|
marketCode: i,
|
|
378
|
-
locale:
|
|
374
|
+
locale: l
|
|
379
375
|
} = {}) => {
|
|
380
|
-
const s = w(e, t),
|
|
376
|
+
const s = w(e, t), o = await r.getEntries({
|
|
381
377
|
content_type: "brandCollection",
|
|
382
378
|
select: "sys.id,fields.name,fields.slot,fields.brands",
|
|
383
379
|
include: 2,
|
|
384
|
-
order:
|
|
380
|
+
order: p,
|
|
385
381
|
...s.params,
|
|
386
382
|
...g(i),
|
|
387
|
-
...
|
|
388
|
-
}),
|
|
383
|
+
...u(l)
|
|
384
|
+
}), n = f(o);
|
|
389
385
|
return new h({
|
|
390
386
|
page: s.page,
|
|
391
|
-
total:
|
|
387
|
+
total: o.total,
|
|
392
388
|
size: s.size,
|
|
393
|
-
items:
|
|
394
|
-
(
|
|
395
|
-
sys: { id:
|
|
396
|
-
name:
|
|
397
|
-
slot:
|
|
389
|
+
items: o.items.map(
|
|
390
|
+
(d) => ({
|
|
391
|
+
sys: { id: d.sys.id },
|
|
392
|
+
name: a(d.fields.name),
|
|
393
|
+
slot: a(d.fields.slot),
|
|
398
394
|
brandsCollection: {
|
|
399
|
-
items:
|
|
400
|
-
sys: { id:
|
|
401
|
-
name:
|
|
402
|
-
logo: C(
|
|
395
|
+
items: n.entries(d.fields.brands).map((c) => ({
|
|
396
|
+
sys: { id: c.sys.id },
|
|
397
|
+
name: a(c.fields.name),
|
|
398
|
+
logo: C(n.asset(c.fields.logo)),
|
|
403
399
|
hyperlink: v(
|
|
404
|
-
|
|
400
|
+
n.entry(c.fields.hyperlink)
|
|
405
401
|
)
|
|
406
402
|
}))
|
|
407
403
|
}
|
|
408
404
|
})
|
|
409
405
|
)
|
|
410
406
|
});
|
|
411
|
-
},
|
|
407
|
+
}, S = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo", O = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category", $ = (e) => ({
|
|
412
408
|
id: e.sys.id,
|
|
413
409
|
createdAt: e.sys.createdAt,
|
|
414
410
|
updatedAt: e.sys.updatedAt
|
|
415
|
-
}),
|
|
416
|
-
sys:
|
|
417
|
-
title:
|
|
418
|
-
slug:
|
|
419
|
-
description:
|
|
420
|
-
order:
|
|
411
|
+
}), H = (e, t) => ({
|
|
412
|
+
sys: $(e),
|
|
413
|
+
title: a(e.fields.title),
|
|
414
|
+
slug: a(e.fields.slug),
|
|
415
|
+
description: a(e.fields.description),
|
|
416
|
+
order: a(e.fields.order),
|
|
421
417
|
seo: A(t.entry(e.fields.seo))
|
|
422
|
-
}),
|
|
418
|
+
}), K = (e, t) => {
|
|
423
419
|
const i = t.entry(e.fields.category);
|
|
424
420
|
return {
|
|
425
|
-
sys:
|
|
426
|
-
title:
|
|
427
|
-
slug:
|
|
428
|
-
author:
|
|
421
|
+
sys: $(e),
|
|
422
|
+
title: a(e.fields.title),
|
|
423
|
+
slug: a(e.fields.slug),
|
|
424
|
+
author: L(t.entry(e.fields.author), t),
|
|
429
425
|
category: i ? {
|
|
430
|
-
title:
|
|
431
|
-
slug:
|
|
432
|
-
description:
|
|
433
|
-
order:
|
|
426
|
+
title: a(i.fields.title),
|
|
427
|
+
slug: a(i.fields.slug),
|
|
428
|
+
description: a(i.fields.description),
|
|
429
|
+
order: a(i.fields.order)
|
|
434
430
|
} : null
|
|
435
431
|
};
|
|
436
|
-
},
|
|
432
|
+
}, se = async ({
|
|
437
433
|
marketCode: e,
|
|
438
434
|
locale: t,
|
|
439
435
|
page: i = 1,
|
|
440
|
-
size:
|
|
436
|
+
size: l = 20
|
|
441
437
|
} = {}) => {
|
|
442
|
-
const s = w(i,
|
|
438
|
+
const s = w(i, l), o = await r.getEntries({
|
|
443
439
|
content_type: "documentationCategory",
|
|
444
|
-
select:
|
|
440
|
+
select: S,
|
|
445
441
|
include: 1,
|
|
446
|
-
order:
|
|
442
|
+
order: p,
|
|
447
443
|
...s.params,
|
|
448
444
|
...g(e),
|
|
449
|
-
...
|
|
450
|
-
}),
|
|
445
|
+
...u(t)
|
|
446
|
+
}), n = f(o);
|
|
451
447
|
return new h({
|
|
452
448
|
page: s.page,
|
|
453
|
-
total:
|
|
449
|
+
total: o.total,
|
|
454
450
|
size: s.size,
|
|
455
|
-
items:
|
|
451
|
+
items: o.items.map((d) => H(d, n))
|
|
456
452
|
});
|
|
457
|
-
},
|
|
453
|
+
}, ie = async ({
|
|
458
454
|
id: e,
|
|
459
455
|
slug: t,
|
|
460
456
|
marketCode: i,
|
|
461
|
-
locale:
|
|
457
|
+
locale: l
|
|
462
458
|
}) => {
|
|
463
|
-
const s =
|
|
459
|
+
const s = k({ id: e, slug: t }), o = await r.getEntries({
|
|
464
460
|
content_type: "documentationCategory",
|
|
465
461
|
...s,
|
|
466
|
-
select:
|
|
462
|
+
select: S,
|
|
467
463
|
include: 1,
|
|
468
|
-
order:
|
|
464
|
+
order: p,
|
|
469
465
|
...g(i),
|
|
470
|
-
...
|
|
471
|
-
}),
|
|
472
|
-
if (!
|
|
473
|
-
throw new
|
|
474
|
-
return
|
|
475
|
-
},
|
|
466
|
+
...u(l)
|
|
467
|
+
}), n = o.items.at(0);
|
|
468
|
+
if (!n)
|
|
469
|
+
throw new z();
|
|
470
|
+
return H(n, f(o));
|
|
471
|
+
}, le = async ({
|
|
476
472
|
marketCode: e,
|
|
477
473
|
locale: t,
|
|
478
474
|
categorySlug: i,
|
|
479
|
-
page:
|
|
475
|
+
page: l = 1,
|
|
480
476
|
size: s = 20
|
|
481
477
|
} = {}) => {
|
|
482
|
-
const
|
|
478
|
+
const o = w(l, s), n = await r.getEntries({
|
|
483
479
|
content_type: "documentationArticle",
|
|
484
480
|
...i ? {
|
|
485
481
|
"fields.category.sys.contentType.sys.id": "documentationCategory",
|
|
486
482
|
"fields.category.fields.slug": i
|
|
487
483
|
} : {},
|
|
488
|
-
select:
|
|
484
|
+
select: O,
|
|
489
485
|
include: 2,
|
|
490
|
-
order:
|
|
491
|
-
...
|
|
486
|
+
order: p,
|
|
487
|
+
...o.params,
|
|
492
488
|
...g(e),
|
|
493
|
-
...
|
|
494
|
-
}),
|
|
489
|
+
...u(t)
|
|
490
|
+
}), d = f(n);
|
|
495
491
|
return new h({
|
|
496
|
-
page:
|
|
497
|
-
total:
|
|
498
|
-
size:
|
|
499
|
-
items:
|
|
492
|
+
page: o.page,
|
|
493
|
+
total: n.total,
|
|
494
|
+
size: o.size,
|
|
495
|
+
items: n.items.map((c) => K(c, d))
|
|
500
496
|
});
|
|
501
|
-
},
|
|
497
|
+
}, oe = async ({
|
|
502
498
|
id: e,
|
|
503
499
|
slug: t,
|
|
504
500
|
marketCode: i,
|
|
505
|
-
locale:
|
|
501
|
+
locale: l
|
|
506
502
|
}) => {
|
|
507
|
-
const s =
|
|
503
|
+
const s = k({ id: e, slug: t }), o = await r.getEntries({
|
|
508
504
|
content_type: "documentationArticle",
|
|
509
505
|
...s,
|
|
510
|
-
select: `${
|
|
506
|
+
select: `${O},fields.content,fields.seo`,
|
|
511
507
|
include: 2,
|
|
512
|
-
order:
|
|
508
|
+
order: p,
|
|
513
509
|
...g(i),
|
|
514
|
-
...
|
|
515
|
-
}),
|
|
516
|
-
if (!
|
|
517
|
-
throw new
|
|
518
|
-
const
|
|
510
|
+
...u(l)
|
|
511
|
+
}), n = o.items.at(0);
|
|
512
|
+
if (!n)
|
|
513
|
+
throw new z();
|
|
514
|
+
const d = f(o);
|
|
519
515
|
return {
|
|
520
|
-
...
|
|
521
|
-
content: D(
|
|
522
|
-
seo: A(
|
|
516
|
+
...K(n, d),
|
|
517
|
+
content: D(n.fields.content, d),
|
|
518
|
+
seo: A(d.entry(n.fields.seo))
|
|
523
519
|
};
|
|
524
|
-
},
|
|
520
|
+
}, ne = async ({
|
|
525
521
|
page: e = 1,
|
|
526
522
|
size: t = 20,
|
|
527
523
|
marketCode: i,
|
|
528
|
-
locale:
|
|
524
|
+
locale: l
|
|
529
525
|
} = {}) => {
|
|
530
|
-
const s = w(e, t),
|
|
526
|
+
const s = w(e, t), o = await r.getEntries({
|
|
531
527
|
content_type: "hyperlinkCollection",
|
|
532
528
|
select: "sys.id,fields.name,fields.slot,fields.order,fields.links",
|
|
533
529
|
include: 1,
|
|
534
530
|
order: "fields.order",
|
|
535
531
|
...s.params,
|
|
536
532
|
...g(i),
|
|
537
|
-
...
|
|
538
|
-
}),
|
|
533
|
+
...u(l)
|
|
534
|
+
}), n = f(o);
|
|
539
535
|
return new h({
|
|
540
536
|
page: s.page,
|
|
541
|
-
total:
|
|
537
|
+
total: o.total,
|
|
542
538
|
size: s.size,
|
|
543
|
-
items:
|
|
544
|
-
(
|
|
545
|
-
sys: { id:
|
|
546
|
-
name:
|
|
547
|
-
slot:
|
|
548
|
-
order:
|
|
539
|
+
items: o.items.map(
|
|
540
|
+
(d) => ({
|
|
541
|
+
sys: { id: d.sys.id },
|
|
542
|
+
name: a(d.fields.name),
|
|
543
|
+
slot: a(d.fields.slot),
|
|
544
|
+
order: a(d.fields.order),
|
|
549
545
|
linksCollection: {
|
|
550
|
-
items:
|
|
546
|
+
items: n.entries(d.fields.links).map((c) => v(c))
|
|
551
547
|
}
|
|
552
548
|
})
|
|
553
549
|
)
|
|
554
550
|
});
|
|
555
|
-
},
|
|
551
|
+
}, ae = async ({
|
|
556
552
|
page: e = 1,
|
|
557
553
|
size: t = 20,
|
|
558
554
|
marketCode: i,
|
|
559
|
-
locale:
|
|
555
|
+
locale: l
|
|
560
556
|
} = {}) => {
|
|
561
|
-
const s = w(e, t),
|
|
557
|
+
const s = w(e, t), o = await r.getEntries({
|
|
562
558
|
content_type: "keywordCollection",
|
|
563
559
|
select: "sys.id,fields.name,fields.slot,fields.keywords",
|
|
564
560
|
include: 0,
|
|
565
|
-
order:
|
|
561
|
+
order: p,
|
|
566
562
|
...s.params,
|
|
567
563
|
...g(i),
|
|
568
|
-
...
|
|
564
|
+
...u(l)
|
|
569
565
|
});
|
|
570
566
|
return new h({
|
|
571
567
|
page: s.page,
|
|
572
|
-
total:
|
|
568
|
+
total: o.total,
|
|
573
569
|
size: s.size,
|
|
574
|
-
items:
|
|
575
|
-
(
|
|
576
|
-
sys: { id:
|
|
577
|
-
name: n
|
|
578
|
-
slot: n
|
|
579
|
-
keywords: n
|
|
570
|
+
items: o.items.map(
|
|
571
|
+
(n) => ({
|
|
572
|
+
sys: { id: n.sys.id },
|
|
573
|
+
name: a(n.fields.name),
|
|
574
|
+
slot: a(n.fields.slot),
|
|
575
|
+
keywords: a(n.fields.keywords)
|
|
580
576
|
})
|
|
581
577
|
)
|
|
582
578
|
});
|
|
583
|
-
},
|
|
579
|
+
}, de = async ({
|
|
584
580
|
marketCode: e,
|
|
585
581
|
locale: t
|
|
586
582
|
} = {}) => {
|
|
587
|
-
const i = await
|
|
583
|
+
const i = await r.getEntries({
|
|
588
584
|
content_type: "policyAndTerms",
|
|
589
585
|
select: "sys.id,fields.title,fields.locale,fields.content",
|
|
590
586
|
include: 1,
|
|
591
|
-
order:
|
|
587
|
+
order: p,
|
|
592
588
|
limit: 1,
|
|
593
589
|
...g(e),
|
|
594
|
-
...
|
|
595
|
-
}),
|
|
596
|
-
if (!
|
|
597
|
-
throw new
|
|
590
|
+
...u(t)
|
|
591
|
+
}), l = i.items.at(0);
|
|
592
|
+
if (!l)
|
|
593
|
+
throw new z();
|
|
598
594
|
return {
|
|
599
|
-
sys: { id:
|
|
600
|
-
title:
|
|
601
|
-
locale:
|
|
602
|
-
content: D(
|
|
595
|
+
sys: { id: l.sys.id },
|
|
596
|
+
title: a(l.fields.title),
|
|
597
|
+
locale: a(l.fields.locale),
|
|
598
|
+
content: D(l.fields.content, f(i))
|
|
603
599
|
};
|
|
604
600
|
};
|
|
605
601
|
export {
|
|
606
|
-
|
|
602
|
+
r as ContentfulSDK,
|
|
607
603
|
h as PaginatedResponse,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
604
|
+
Q as getBannerCollections,
|
|
605
|
+
X as getBlogCategories,
|
|
606
|
+
Z as getBlogCategoryDetail,
|
|
607
|
+
ee as getBlogCollections,
|
|
608
|
+
W as getBlogPostDetail,
|
|
609
|
+
V as getBlogPosts,
|
|
610
|
+
te as getBrandCollections,
|
|
611
|
+
oe as getDocArticleDetail,
|
|
612
|
+
le as getDocArticles,
|
|
613
|
+
se as getDocCategories,
|
|
614
|
+
ie as getDocCategoryDetail,
|
|
615
|
+
ne as getHyperlinkCollections,
|
|
616
|
+
ae as getKeywordCollections,
|
|
617
|
+
de as getPolicyAndTerms
|
|
622
618
|
};
|
package/dist/utils/query.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janbox/contentful-marketplace-sdk",
|
|
3
|
-
"version": "3.0.0",
|
|
3
|
+
"version": "3.1.0-alpha.0",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@contentful/rich-text-types": "^16.8.5"
|
|
20
|
+
"@contentful/rich-text-types": "^16.8.5",
|
|
21
|
+
"@janbox/headless-cms-sdk": "^0.1.0"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
24
|
"dev": "vite",
|