@janbox/contentful-marketplace-sdk 0.0.5 → 0.0.7

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.
@@ -1,21 +1,17 @@
1
+ import { Entry, EntrySys } from 'contentful';
2
+ import { TypeFooterMenuSkeleton } from '../types';
3
+ import { HyperlinkEntry } from './hyperlink';
4
+ export type FooterMenuEntry = Entry<TypeFooterMenuSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
1
5
  export type FooterMenuGraphQLResponse = {
2
6
  footerMenuCollection: {
3
7
  items: Array<{
4
- sys: {
5
- id: string;
6
- };
7
- name: string;
8
+ sys: EntrySys;
8
9
  childrenCollection: {
9
10
  items: Array<{
10
- sys: {
11
- id: string;
12
- };
13
- label: string;
14
- url: string;
15
- target: string;
16
- }>;
11
+ sys: EntrySys;
12
+ } & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "basePath">>;
17
13
  };
18
- }>;
14
+ } & Pick<FooterMenuEntry["fields"], "name">>;
19
15
  };
20
16
  };
21
17
  export declare const listFooterMenuEntries: ({ marketId, language, }: {
@@ -0,0 +1,3 @@
1
+ import { TypeHyperlinkSkeleton } from '../types';
2
+ import { Entry } from 'contentful';
3
+ export type HyperlinkEntry = Entry<TypeHyperlinkSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
@@ -2,3 +2,4 @@ export * from './banner';
2
2
  export * from './blog';
3
3
  export * from './documentation';
4
4
  export * from './footer-menu';
5
+ export * from './hyperlink';
package/dist/index.cjs CHANGED
@@ -2,15 +2,16 @@
2
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 g=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 f=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}),u=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})=>i.graphqlQuery(`
3
3
  query ($marketId: String!, $language: String!) {
4
4
  footerMenuCollection(where: {
5
- market: {
6
- OR: [
7
- {
8
- marketId_exists: false
9
- }, {
10
- marketId: $marketId
11
- }
12
- ]
13
- },
5
+ OR: [
6
+ {
7
+ market_exists: false
8
+ },
9
+ {
10
+ market: {
11
+ marketId: $marketId
12
+ }
13
+ }
14
+ ],
14
15
  language: {
15
16
  code: $language
16
17
  }
@@ -24,6 +25,7 @@ query ($marketId: String!, $language: String!) {
24
25
  label
25
26
  url
26
27
  target
28
+ basePath
27
29
  }
28
30
  }
29
31
  }
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ const u = async ({
127
127
  ...t,
128
128
  content_type: "documentationCategory"
129
129
  }
130
- ), p = async ({
130
+ ), h = async ({
131
131
  query: t,
132
132
  marketId: e,
133
133
  language: s
@@ -144,7 +144,7 @@ const u = async ({
144
144
  if (!n)
145
145
  throw new o();
146
146
  return n;
147
- }, h = ({
147
+ }, p = ({
148
148
  query: t,
149
149
  marketId: e,
150
150
  language: s
@@ -180,15 +180,16 @@ const u = async ({
180
180
  }) => i.graphqlQuery(`
181
181
  query ($marketId: String!, $language: String!) {
182
182
  footerMenuCollection(where: {
183
- market: {
184
- OR: [
185
- {
186
- marketId_exists: false
187
- }, {
188
- marketId: $marketId
189
- }
190
- ]
191
- },
183
+ OR: [
184
+ {
185
+ market_exists: false
186
+ },
187
+ {
188
+ market: {
189
+ marketId: $marketId
190
+ }
191
+ }
192
+ ],
192
193
  language: {
193
194
  code: $language
194
195
  }
@@ -202,6 +203,7 @@ query ($marketId: String!, $language: String!) {
202
203
  label
203
204
  url
204
205
  target
206
+ basePath
205
207
  }
206
208
  }
207
209
  }
@@ -215,10 +217,10 @@ export {
215
217
  i as ContentfulSDK,
216
218
  m as findBlogPostEntry,
217
219
  w as findDocArticleEntry,
218
- p as findDocCategoryEntry,
220
+ h as findDocCategoryEntry,
219
221
  f as listBannerEntries,
220
222
  u as listBlogPostEntries,
221
- h as listDocArticleEntries,
223
+ p as listDocArticleEntries,
222
224
  k as listDocCategoryEntries,
223
225
  T as listFooterMenuEntries
224
226
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/contentful-marketplace-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",