@ewizardjs/pages-api
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -7,7 +7,12 @@ "use strict"; | ||
exports.makePages = exports.getNestedPages = exports.getFlatPages = exports.getPages = void 0; | ||
const content_types_1 = require("@ewizardjs/content-types"); | ||
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); | ||
const interfaces_1 = require("./interfaces"); | ||
const utils_1 = require("./utils"); | ||
const makePagesUtils_1 = require("./utils/makePagesUtils"); | ||
const interfaces_1 = require("./interfaces"); | ||
const getPages = (pages, callback, settings) => { | ||
const { subtype = content_types_1.SiteSubtypes.MULTIPAGE } = settings?.content ?? {}; | ||
if (subtype === content_types_1.SiteSubtypes.EMPTY) { | ||
return {}; | ||
} | ||
const pagesCopy = (0, lodash_clonedeep_1.default)(pages); | ||
@@ -18,2 +23,5 @@ const options = { pagesJson: pages, callback, settings }; | ||
} | ||
if (subtype === content_types_1.SiteSubtypes.LANDING) { | ||
return { root: pagesCopy.root }; | ||
} | ||
pagesCopy.pages = (0, utils_1.getNormalizedPages)(options, pagesCopy.pages, interfaces_1.PageType.PAGE); | ||
@@ -20,0 +28,0 @@ pagesCopy.errors = (0, utils_1.getNormalizedErrorsPages)(options, pagesCopy.errors); |
@@ -1,2 +0,2 @@ | ||
import { getFlatPages, getPages, getNestedPages, makePages } from './interfaces/api'; | ||
import { getFlatPages, getNestedPages, getPages, makePages } from './interfaces/api'; | ||
declare const getPages: getPages; | ||
@@ -3,0 +3,0 @@ declare const getFlatPages: getFlatPages; |
@@ -0,1 +1,2 @@ | ||
import { SiteSubtypes } from '@ewizardjs/content-types'; | ||
export interface RootPage { | ||
@@ -28,2 +29,5 @@ [key: string]: unknown; | ||
export interface SettingRecordsFragment { | ||
content: { | ||
subtype: SiteSubtypes | string; | ||
}; | ||
path: { | ||
@@ -30,0 +34,0 @@ pages: string; |
@@ -1,2 +0,2 @@ | ||
import { Page, NormalizeOptions, NormalizePageOptions, PageType } from '../interfaces'; | ||
import { NormalizeOptions, NormalizePageOptions, Page, PageType } from '../interfaces'; | ||
export declare function getFlatPage(page: Page): Page[]; | ||
@@ -3,0 +3,0 @@ export declare function normalizePage(options: NormalizeOptions, type?: PageType): Page; |
@@ -1,4 +0,4 @@ | ||
import { Pages, Page } from '../interfaces'; | ||
import { Page, Pages } from '../interfaces'; | ||
export declare function makePagesFromObject({ root, pages, errors }: Pages): Pages; | ||
export declare function makePagesFromNestedPage(nestedPage: Page): Pages; | ||
export declare function makePagesFromFlatPagesArray(pagesData: Page[]): Pages; |
{ | ||
"name": "@ewizardjs/pages-api", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.js", | ||
"watch": "tsc -w && npm run eslint", | ||
"eslint": "npx eslint . --ext .js,.jsx,.ts,.tsx", | ||
"eslint": "eslint .", | ||
"test:unit": "jest --coverage --color --ci", | ||
@@ -25,13 +25,12 @@ "test": "npm run test:unit", | ||
"devDependencies": { | ||
"@types/jest": "^29.5.3", | ||
"@types/lodash.clonedeep": "^4.5.7", | ||
"@typescript-eslint/eslint-plugin": "^6.3.0", | ||
"@typescript-eslint/parser": "^6.3.0", | ||
"eslint": "^8.46.0", | ||
"jest": "^29.6.2", | ||
"@ewizardjs/eslint-config": "^0.0.1", | ||
"@types/jest": "^29.5.6", | ||
"@types/lodash.clonedeep": "^4.5.8", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-json-schema-generator": "^1.2.0", | ||
"typescript": "^5.1.6" | ||
"ts-json-schema-generator": "^1.4.0", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"@ewizardjs/content-types": "^2.1.0", | ||
"@ewizardjs/upath": "^3.0.0", | ||
@@ -38,0 +37,0 @@ "lodash.clonedeep": "^4.5.0" |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29040
7
577
3
+ Added@ewizardjs/content-types@2.4.0(transitive)