Comparing version 0.2.1 to 0.2.2
@@ -78,3 +78,5 @@ "use strict"; | ||
console.error(e); | ||
throw new Error(`Error fetching CMS data for the given tags ${tagsString} and visibility ${visibilityString}`); | ||
throw new Error( | ||
`Error fetching CMS data for the given tags ${tagsString} and visibility ${visibilityString}` | ||
); | ||
} | ||
@@ -86,3 +88,3 @@ } | ||
* As it happens, the tags for child components within this editable area are | ||
* dynamically generated. Consequently, the following steps are undertaken: | ||
* dynamically generated. Consequently, the following steps are undertaken: | ||
* - Extract data from the editable area. | ||
@@ -97,5 +99,14 @@ * - Obtain the respective tags. | ||
}) { | ||
const editableAreaCmsData = await this.getCmsData(editableAreaTag, visibilities); | ||
const dynamicTags = this.getTagsOfEditableArea(editableAreaTag, editableAreaCmsData); | ||
const restOfCmsData = await this.getCmsData([...dynamicTags, ...tags], visibilities); | ||
const editableAreaCmsData = await this.getCmsData( | ||
editableAreaTag, | ||
visibilities | ||
); | ||
const dynamicTags = this.getTagsOfEditableArea( | ||
editableAreaTag, | ||
editableAreaCmsData | ||
); | ||
const restOfCmsData = await this.getCmsData( | ||
[...dynamicTags, ...tags], | ||
visibilities | ||
); | ||
return { | ||
@@ -102,0 +113,0 @@ ...restOfCmsData, |
@@ -63,3 +63,3 @@ import { Locale, Visibility } from '@m3cms/common'; | ||
baseUrl: string; | ||
constructor({ baseUrl, projectName, workspaceName, locale }: M3CmsConfig); | ||
constructor({ baseUrl, projectName, workspaceName, locale, }: M3CmsConfig); | ||
getCmsData<T extends Record<string, Record<string, any>> = Record<string, Record<string, unknown>>>(tags: string[] | string, visibilities?: Visibility[]): Promise<T>; | ||
@@ -75,3 +75,3 @@ /** | ||
*/ | ||
fetchCmsDataWithEditableArea<T extends Record<string, Record<string, any>> = Record<string, Record<string, unknown>>>({ tags, editableAreaTag, visibilities }: FetchCmsDataWithEditableAreaConfig): Promise<T & Record<string, Record<string, unknown>>>; | ||
fetchCmsDataWithEditableArea<T extends Record<string, Record<string, any>> = Record<string, Record<string, unknown>>>({ tags, editableAreaTag, visibilities, }: FetchCmsDataWithEditableAreaConfig): Promise<T & Record<string, Record<string, unknown>>>; | ||
private getTagsOfEditableArea; | ||
@@ -78,0 +78,0 @@ } |
@@ -78,3 +78,5 @@ "use strict"; | ||
console.error(e); | ||
throw new Error(`Error fetching CMS data for the given tags ${tagsString} and visibility ${visibilityString}`); | ||
throw new Error( | ||
`Error fetching CMS data for the given tags ${tagsString} and visibility ${visibilityString}` | ||
); | ||
} | ||
@@ -86,3 +88,3 @@ } | ||
* As it happens, the tags for child components within this editable area are | ||
* dynamically generated. Consequently, the following steps are undertaken: | ||
* dynamically generated. Consequently, the following steps are undertaken: | ||
* - Extract data from the editable area. | ||
@@ -97,5 +99,14 @@ * - Obtain the respective tags. | ||
}) { | ||
const editableAreaCmsData = await this.getCmsData(editableAreaTag, visibilities); | ||
const dynamicTags = this.getTagsOfEditableArea(editableAreaTag, editableAreaCmsData); | ||
const restOfCmsData = await this.getCmsData([...dynamicTags, ...tags], visibilities); | ||
const editableAreaCmsData = await this.getCmsData( | ||
editableAreaTag, | ||
visibilities | ||
); | ||
const dynamicTags = this.getTagsOfEditableArea( | ||
editableAreaTag, | ||
editableAreaCmsData | ||
); | ||
const restOfCmsData = await this.getCmsData( | ||
[...dynamicTags, ...tags], | ||
visibilities | ||
); | ||
return { | ||
@@ -102,0 +113,0 @@ ...restOfCmsData, |
{ | ||
"name": "@m3cms/api", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "./dist/index.js", | ||
@@ -13,3 +13,3 @@ "module": "./dist/index.mjs", | ||
"dependencies": { | ||
"@m3cms/common": "0.2.0" | ||
"@m3cms/common": "0.3.0" | ||
}, | ||
@@ -16,0 +16,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20929
550
+ Added@m3cms/common@0.3.0(transitive)
- Removed@m3cms/common@0.2.0(transitive)
Updated@m3cms/common@0.3.0