@paroicms/anywhere-lib
Advanced tools
Comparing version 1.8.0 to 1.9.0
export interface ParsedSectionId { | ||
leafId: string; | ||
lang: string; | ||
language: string; | ||
} | ||
export declare function parseSectionId(sectionId: string): ParsedSectionId; | ||
export declare function encodeSectionId(id: ParsedSectionId): string; |
@@ -9,12 +9,12 @@ "use strict"; | ||
throw new Error(`[ANYWHERE-LIB]: invalid section id '${sectionId}'`); | ||
const [leafId, lang] = arr; | ||
if (!lang || lang.length !== 2 || !leafId || !(0, data_formatters_lib_1.isNumeric)(leafId)) | ||
const [leafId, language] = arr; | ||
if (!language || language.length !== 2 || !leafId || !(0, data_formatters_lib_1.isNumeric)(leafId)) | ||
throw new Error(`[ANYWHERE-LIB]: invalid section id '${sectionId}'`); | ||
return { leafId, lang }; | ||
return { leafId, language }; | ||
} | ||
exports.parseSectionId = parseSectionId; | ||
function encodeSectionId(id) { | ||
return `${id.leafId}:${id.lang}`; | ||
return `${id.leafId}:${id.language}`; | ||
} | ||
exports.encodeSectionId = encodeSectionId; | ||
//# sourceMappingURL=section.helpers.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
if (!documentType) | ||
throw new Error(`Not found documentType for leafType: '${leafType}'`); | ||
throw new Error(`Unknown documentType for leafType '${leafType}'`); | ||
return documentType; | ||
@@ -15,3 +15,3 @@ } | ||
if (!partType) | ||
throw new Error(`Not found partType for leafType: '${leafType}'`); | ||
throw new Error(`Unknown partType for leafType '${leafType}'`); | ||
return partType; | ||
@@ -31,3 +31,3 @@ } | ||
if (!part) | ||
throw new Error(`Not found part for listName: '${leafType}'`); | ||
throw new Error(`Unknown part for listName '${leafType}'`); | ||
return part; | ||
@@ -64,3 +64,3 @@ } | ||
if (!foundDocumentType) | ||
throw new Error(`Not found parent documentType of leafType:'${leafType}'`); | ||
throw new Error(`Unknown parent documentType of leafType:'${leafType}'`); | ||
return foundDocumentType; | ||
@@ -67,0 +67,0 @@ } |
export interface ParsedSectionId { | ||
leafId: string; | ||
lang: string; | ||
language: string; | ||
} | ||
export declare function parseSectionId(sectionId: string): ParsedSectionId; | ||
export declare function encodeSectionId(id: ParsedSectionId): string; |
@@ -6,10 +6,10 @@ import { isNumeric } from "@paroi/data-formatters-lib"; | ||
throw new Error(`[ANYWHERE-LIB]: invalid section id '${sectionId}'`); | ||
const [leafId, lang] = arr; | ||
if (!lang || lang.length !== 2 || !leafId || !isNumeric(leafId)) | ||
const [leafId, language] = arr; | ||
if (!language || language.length !== 2 || !leafId || !isNumeric(leafId)) | ||
throw new Error(`[ANYWHERE-LIB]: invalid section id '${sectionId}'`); | ||
return { leafId, lang }; | ||
return { leafId, language }; | ||
} | ||
export function encodeSectionId(id) { | ||
return `${id.leafId}:${id.lang}`; | ||
return `${id.leafId}:${id.language}`; | ||
} | ||
//# sourceMappingURL=section.helpers.js.map |
export function getDocumentTypeByLeafType(siteSchema, leafType) { | ||
const documentType = siteSchema.documentTypes[leafType]; | ||
if (!documentType) | ||
throw new Error(`Not found documentType for leafType: '${leafType}'`); | ||
throw new Error(`Unknown documentType for leafType '${leafType}'`); | ||
return documentType; | ||
@@ -10,3 +10,3 @@ } | ||
if (!partType) | ||
throw new Error(`Not found partType for leafType: '${leafType}'`); | ||
throw new Error(`Unknown partType for leafType '${leafType}'`); | ||
return partType; | ||
@@ -23,3 +23,3 @@ } | ||
if (!part) | ||
throw new Error(`Not found part for listName: '${leafType}'`); | ||
throw new Error(`Unknown part for listName '${leafType}'`); | ||
return part; | ||
@@ -52,3 +52,3 @@ } | ||
if (!foundDocumentType) | ||
throw new Error(`Not found parent documentType of leafType:'${leafType}'`); | ||
throw new Error(`Unknown parent documentType of leafType:'${leafType}'`); | ||
return foundDocumentType; | ||
@@ -55,0 +55,0 @@ } |
{ | ||
"name": "@paroicms/anywhere-lib", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Front lib for Paroi CMS.", | ||
@@ -5,0 +5,0 @@ "author": "Paroi Team", |
export interface SiteSchema { | ||
langs: string[]; | ||
langLabels: { [lang: string]: string }; | ||
defaultLang: string; | ||
languages: string[]; | ||
languageLabels: { [language: string]: string }; | ||
defaultLanguage: string; | ||
site: SiteDataSchema; | ||
@@ -60,3 +60,3 @@ documentTypes: { | ||
*/ | ||
urlPaths?: { [lang: string]: string }; | ||
urlPaths?: { [language: string]: string }; | ||
} | ||
@@ -90,6 +90,6 @@ | ||
export interface SchemaLocales { | ||
[lang: string]: LangSchemaLocales; | ||
[language: string]: LanguageSchemaLocales; | ||
} | ||
export interface LangSchemaLocales { | ||
export interface LanguageSchemaLocales { | ||
site: { | ||
@@ -96,0 +96,0 @@ fields: { [fieldName: string]: LabelLocales }; |
@@ -7,15 +7,15 @@ export interface ThemeConf { | ||
export interface FTextImage { | ||
displaySize: VariantName; | ||
realSize: VariantName; | ||
displaySize: ImageSize; | ||
realSize: ImageSize; | ||
} | ||
export type VariantName = | ||
| CompleteVariantName | ||
| AutoWidthVariantName | ||
| AutoHeightVariantName | ||
| AutoWidthOrHeightVariantName; | ||
export type ImageSize = | ||
| VariantName | ||
| AutoWidthImageSize | ||
| AutoHeightImageSize | ||
| AutoWidthOrHeightImageSize; | ||
export type CompleteVariantName = `${number}x${number}`; | ||
export type AutoWidthVariantName = `x${number}`; | ||
export type AutoHeightVariantName = `${number}x`; | ||
export type AutoWidthOrHeightVariantName = `x${number}x`; | ||
export type VariantName = `${number}x${number}`; | ||
export type AutoWidthImageSize = `x${number}`; | ||
export type AutoHeightImageSize = `${number}x`; | ||
export type AutoWidthOrHeightImageSize = `x${number}x`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45338