@janbox/contentful-marketplace-sdk 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entries/footer-menu.d.ts +7 -3
- package/dist/index.cjs +3 -2
- package/dist/index.js +11 -5
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Entry, EntrySys } from 'contentful';
|
|
2
2
|
import { TypeFooterMenuSkeleton } from '../types';
|
|
3
3
|
import { HyperlinkEntry } from './hyperlink';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type FooterMenuEntry = Entry<TypeFooterMenuSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
|
+
type FooterMenuGraphQLResponse = {
|
|
6
6
|
footerMenuCollection: {
|
|
7
7
|
items: Array<{
|
|
8
8
|
sys: EntrySys;
|
|
@@ -14,7 +14,11 @@ export type FooterMenuGraphQLResponse = {
|
|
|
14
14
|
} & Pick<FooterMenuEntry["fields"], "name" | "order">>;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
export type ListFooterMenuEntriesResponse = {
|
|
18
|
+
data: FooterMenuGraphQLResponse["footerMenuCollection"]["items"];
|
|
19
|
+
};
|
|
17
20
|
export declare const listFooterMenuEntries: ({ marketId, language, }: {
|
|
18
21
|
marketId: string;
|
|
19
22
|
language: string;
|
|
20
|
-
}) => Promise<
|
|
23
|
+
}) => Promise<ListFooterMenuEntriesResponse>;
|
|
24
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("contentful");class i{static _client;static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static get client(){return this._client||(this._client=g.createClient(this.clientParams)),this._client}static configure(e){this._clientParams={...e,environment:e.environment??"master"}}static async graphqlQuery(e,s={}){const{space:n,accessToken:r,environment:c="master"}=this.clientParams,a=await fetch(`https://graphql.contentful.com/content/v1/spaces/${n}/environments/${c}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({query:e,variables:s})});if(!a.ok){const d=await a.text();throw new Error(`GraphQL request failed: ${a.status} ${a.statusText}
|
|
2
|
-
${d}`)}const l=await a.json();if(l.errors)throw new Error(`GraphQL errors: ${JSON.stringify(l.errors,null,2)}`);return l.data}}const y=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"banner"});class o extends Response{constructor(...e){super(e[0]??"Not Found",{status:404,...e[1]})}}const u=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,select:["fields.title","fields.category","fields.slug","fields.featuredImage","fields.shortDescription"],content_type:"blogPost",...t}),f=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({select:["fields.title","fields.category","fields.slug","fields.featuredImage","fields.shortDescription","fields.author","fields.content","fields.seo","sys.updatedAt"],"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,content_type:"blogPost",limit:1,...t}).then(r=>r.items.at(0));if(!n)throw new o;return n},m=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationCategory"}),k=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationCategory",limit:1}).then(r=>r.items.at(0));if(!n)throw new o;return n},h=({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationArticle"}),p=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationArticle",limit:1}).then(r=>r.items.at(0));if(!n)throw new o;return n},w=async({marketId:t,language:e})=>
|
|
2
|
+
${d}`)}const l=await a.json();if(l.errors)throw new Error(`GraphQL errors: ${JSON.stringify(l.errors,null,2)}`);return l.data}}const y=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"banner"});class o extends Response{constructor(...e){super(e[0]??"Not Found",{status:404,...e[1]})}}const u=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,select:["fields.title","fields.category","fields.slug","fields.featuredImage","fields.shortDescription"],content_type:"blogPost",...t}),f=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({select:["fields.title","fields.category","fields.slug","fields.featuredImage","fields.shortDescription","fields.author","fields.content","fields.seo","sys.updatedAt"],"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,content_type:"blogPost",limit:1,...t}).then(r=>r.items.at(0));if(!n)throw new o;return n},m=async({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationCategory"}),k=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationCategory",limit:1}).then(r=>r.items.at(0));if(!n)throw new o;return n},h=({query:t,marketId:e,language:s})=>i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationArticle"}),p=async({query:t,marketId:e,language:s})=>{const n=await i.client.withoutUnresolvableLinks.getEntries({"fields.market.sys.contentType.sys.id":"market","fields.market.fields.marketId":e,"fields.language.sys.contentType.sys.id":"language","fields.language.fields.code":s,...t,content_type:"documentationArticle",limit:1}).then(r=>r.items.at(0));if(!n)throw new o;return n},w=async({marketId:t,language:e})=>{const s=`
|
|
3
3
|
query ($marketId: String!, $language: String!) {
|
|
4
4
|
footerMenuCollection(
|
|
5
5
|
where: {
|
|
@@ -14,6 +14,7 @@ query ($marketId: String!, $language: String!) {
|
|
|
14
14
|
id
|
|
15
15
|
}
|
|
16
16
|
name
|
|
17
|
+
order
|
|
17
18
|
childrenCollection {
|
|
18
19
|
items {
|
|
19
20
|
sys {
|
|
@@ -28,7 +29,7 @@ query ($marketId: String!, $language: String!) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
`,{marketId:t,language:e}),E=async({marketId:t,language:e})=>{const s=`
|
|
32
|
+
`,{footerMenuCollection:n}=await i.graphqlQuery(s,{marketId:t,language:e});return{data:n.items}},E=async({marketId:t,language:e})=>{const s=`
|
|
32
33
|
query ($marketId: String!, $language: String!) {
|
|
33
34
|
footerContentCollection(
|
|
34
35
|
where: {
|
package/dist/index.js
CHANGED
|
@@ -177,7 +177,8 @@ const f = async ({
|
|
|
177
177
|
}, E = async ({
|
|
178
178
|
marketId: t,
|
|
179
179
|
language: e
|
|
180
|
-
}) =>
|
|
180
|
+
}) => {
|
|
181
|
+
const s = `
|
|
181
182
|
query ($marketId: String!, $language: String!) {
|
|
182
183
|
footerMenuCollection(
|
|
183
184
|
where: {
|
|
@@ -192,6 +193,7 @@ query ($marketId: String!, $language: String!) {
|
|
|
192
193
|
id
|
|
193
194
|
}
|
|
194
195
|
name
|
|
196
|
+
order
|
|
195
197
|
childrenCollection {
|
|
196
198
|
items {
|
|
197
199
|
sys {
|
|
@@ -206,10 +208,14 @@ query ($marketId: String!, $language: String!) {
|
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
|
-
`, {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
})
|
|
211
|
+
`, { footerMenuCollection: n } = await i.graphqlQuery(s, {
|
|
212
|
+
marketId: t,
|
|
213
|
+
language: e
|
|
214
|
+
});
|
|
215
|
+
return {
|
|
216
|
+
data: n.items
|
|
217
|
+
};
|
|
218
|
+
}, T = async ({
|
|
213
219
|
marketId: t,
|
|
214
220
|
language: e
|
|
215
221
|
}) => {
|