@strapi/core 5.54.0 → 5.55.0
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/configuration/get-dirs.d.ts.map +1 -1
- package/dist/configuration/get-dirs.js +4 -2
- package/dist/configuration/get-dirs.js.map +1 -1
- package/dist/configuration/get-dirs.mjs +4 -2
- package/dist/configuration/get-dirs.mjs.map +1 -1
- package/dist/core-api/routes/validation/component.d.ts +1 -1
- package/dist/core-api/routes/validation/component.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/package.json.js +13 -13
- package/dist/package.json.mjs +13 -13
- package/dist/providers/content-structure.d.ts +3 -0
- package/dist/providers/content-structure.d.ts.map +1 -0
- package/dist/providers/content-structure.js +22 -0
- package/dist/providers/content-structure.js.map +1 -0
- package/dist/providers/content-structure.mjs +20 -0
- package/dist/providers/content-structure.mjs.map +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +2 -0
- package/dist/providers/index.mjs.map +1 -1
- package/dist/services/content-structure/index.d.ts +37 -0
- package/dist/services/content-structure/index.d.ts.map +1 -0
- package/dist/services/content-structure/index.js +304 -0
- package/dist/services/content-structure/index.js.map +1 -0
- package/dist/services/content-structure/index.mjs +296 -0
- package/dist/services/content-structure/index.mjs.map +1 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.d.ts +7 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.d.ts.map +1 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.js +19 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.js.map +1 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.mjs +17 -0
- package/dist/services/content-structure/utils/isGroupExpressionValid.mjs.map +1 -0
- package/dist/services/content-structure/validation.d.ts +35 -0
- package/dist/services/content-structure/validation.d.ts.map +1 -0
- package/dist/services/content-structure/validation.js +163 -0
- package/dist/services/content-structure/validation.js.map +1 -0
- package/dist/services/content-structure/validation.mjs +161 -0
- package/dist/services/content-structure/validation.mjs.map +1 -0
- package/dist/services/server/koa-methods.d.ts +0 -6
- package/dist/services/server/koa-methods.d.ts.map +1 -1
- package/dist/services/server/koa-methods.js.map +1 -1
- package/dist/services/server/koa-methods.mjs.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/services/content-structure/index.ts"],"sourcesContent":["import { join } from 'path';\nimport fse from 'fs-extra';\n\nimport type { Core, Modules, UID } from '@strapi/types';\nimport { isGroupExpressionValid } from './utils/isGroupExpressionValid';\nimport { contentStructureFileSchema } from './validation';\n\nexport const CONTENT_STRUCTURE_FILE_NAME = 'groups.json';\n\nexport const MAX_FOLDER_DEPTH = 3;\n\nexport interface ContentStructureService {\n /**\n * Reads the contents of groups.json directly with minimal sanitization.\n */\n read(): Promise<Modules.ContentStructure.ContentStructureFile | null>;\n\n /**\n * Yields an extremely tolerant version of the groups configuration file. Invalid references are repaired or ignored. Warnings fire for each repair/omission.\n */\n getCleanedFile(): Promise<Modules.ContentStructure.ContentStructureFile | null>;\n\n /**\n * Returns the groups configuration transformed into nested trees.\n */\n resolve(): Promise<Modules.ContentStructure.ResolvedContentStructure>;\n\n /**\n * Writes a new config and invalidates the cache. Does NOT perform validation - this is\n * left to the caller. The Save that triggers the write restarts the server via the\n * standard update-schema flow, which reloads the file; this method only persists it.\n */\n write(structure: Modules.ContentStructure.ContentStructureFile): Promise<void>;\n\n /**\n * Strictly validates an unknown value against the canonical groups.json schema; throws if invalid.\n */\n validate(value: unknown): Modules.ContentStructure.ContentStructureFile;\n\n /**\n * Invalidates the cached parsed groups.json file.\n */\n invalidate(): void;\n\n /**\n * Total number of groups across both sections of the cleaned file.\n */\n countGroups(): Promise<number>;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\ntype ContentStructureCache = Promise<{\n cleaned: Modules.ContentStructure.ContentStructureFile | null;\n resolved: Modules.ContentStructure.ResolvedContentStructure;\n}>;\n\nexport function createContentStructureService(strapi: Core.Strapi): ContentStructureService {\n /**\n * This cache exists to ensure all consumers recieve the same cleaned+resolved data, regardless of call order / invocation relative to the strapi reload.\n */\n let cache: ContentStructureCache | undefined;\n\n const warn = (message: string) => {\n strapi.log.warn(`[content-structure] ${message}`);\n };\n\n const cleanSection = (\n rawSection: unknown,\n sectionKey: Modules.ContentStructure.ContentStructureSectionKey\n ): Modules.ContentStructure.ContentStructureSection => {\n const rawGroups = (() => {\n if (rawSection === undefined || rawSection === null) {\n return [];\n }\n\n if (!isRecord(rawSection) || !Array.isArray(rawSection.groups)) {\n warn(`Section \"${sectionKey}\" is malformed; ignoring it`);\n return [];\n }\n\n return rawSection.groups;\n })();\n\n const seenGroupIds = new Map<string, Modules.ContentStructure.ContentStructureGroup>();\n const groups: Modules.ContentStructure.ContentStructureGroup[] = [];\n\n for (const raw of rawGroups) {\n if (!isGroupExpressionValid(raw)) {\n warn(`Dropping a malformed group entry in section \"${sectionKey}\"`);\n continue;\n }\n\n if (raw.name.trim() === '') {\n warn(`Dropping group \"${raw.id}\" in section \"${sectionKey}\": empty name`);\n continue;\n }\n\n if (seenGroupIds.has(raw.id)) {\n warn(`Dropping duplicate group id \"${raw.id}\" in section \"${sectionKey}\"`);\n continue;\n }\n\n const group: Modules.ContentStructure.ContentStructureGroup = {\n children: raw.children as Modules.ContentStructure.ContentStructureChild[],\n parent: raw.parent,\n name: raw.name,\n id: raw.id,\n };\n\n seenGroupIds.set(group.id, group);\n groups.push(group);\n }\n\n const reparentToRoot = (\n group: Modules.ContentStructure.ContentStructureGroup,\n reason: string\n ) => {\n group.parent = null;\n\n groups.splice(groups.indexOf(group), 1);\n groups.push(group);\n\n warn(`Reparenting group \"${group.id}\" in section \"${sectionKey}\" to root: ${reason}`);\n };\n\n // oxlint-disable-next-line - Duplicating is necessary because the original array is mutated inside the iterator.\n for (const group of [...groups]) {\n if (group.parent !== null && !seenGroupIds.has(group.parent)) {\n reparentToRoot(group, `parent \"${group.parent}\" does not exist`);\n }\n }\n\n // oxlint-disable-next-line - Duplicating is necessary because the original array is mutated inside the iterator.\n for (const group of [...groups]) {\n const chain = new Set([group.id]);\n let current = group;\n\n while (current.parent !== null) {\n if (chain.has(current.parent)) {\n reparentToRoot(group, 'its parent chain contains a cycle');\n break;\n }\n\n chain.add(current.parent);\n current = seenGroupIds.get(current.parent)!;\n }\n }\n\n // oxlint-disable-next-line - Duplicating is necessary because the original array is mutated inside the iterator.\n for (const group of [...groups]) {\n let current = group;\n let depth = 1;\n\n while (current.parent !== null) {\n current = seenGroupIds.get(current.parent)!;\n depth += 1;\n }\n\n if (depth > MAX_FOLDER_DEPTH) {\n reparentToRoot(group, `it exceeds the maximum nesting depth of ${MAX_FOLDER_DEPTH}`);\n }\n }\n\n const expectedKind = sectionKey === 'collectionTypes' ? 'collectionType' : 'singleType';\n const seenGroupChildren = new Set<string>();\n const seenUids = new Set<string>();\n\n for (const group of groups) {\n const cleanedChildren: Modules.ContentStructure.ContentStructureChild[] = [];\n\n for (const entry of group.children) {\n if (!isRecord(entry)) {\n warn(`Dropping a malformed child entry of group \"${group.id}\"`);\n continue;\n }\n\n if (entry.type === 'contentType') {\n const { uid } = entry;\n\n if (typeof uid !== 'string') {\n warn(`Dropping a contentType child of group \"${group.id}\": invalid uid`);\n continue;\n }\n\n const schema: { kind?: string } | undefined = strapi.contentTypes[uid as UID.ContentType];\n\n if (!schema) {\n warn(`Dropping unknown content type \"${uid}\" from group \"${group.id}\"`);\n continue;\n }\n\n // kind is optional on schemas; absent means collectionType.\n const kind = schema.kind ?? 'collectionType';\n\n if (kind !== expectedKind) {\n warn(\n `Dropping content type \"${uid}\" from group \"${group.id}\": its kind \"${kind}\" does not belong in section \"${sectionKey}\"`\n );\n continue;\n }\n\n if (seenUids.has(uid)) {\n warn(`Dropping duplicate reference to content type \"${uid}\" from group \"${group.id}\"`);\n continue;\n }\n\n cleanedChildren.push({ type: 'contentType', uid: uid as UID.ContentType });\n seenUids.add(uid);\n continue;\n }\n\n if (entry.type === 'group') {\n const { id } = entry;\n\n if (typeof id !== 'string') {\n warn(`Dropping a group child of group \"${group.id}\": invalid id`);\n continue;\n }\n\n const target = seenGroupIds.get(id);\n\n if (!target || target.parent !== group.id) {\n warn(`Dropping group child \"${id}\" from group \"${group.id}\": inconsistent reference`);\n continue;\n }\n\n if (seenGroupChildren.has(id)) {\n warn(`Dropping duplicate group child \"${id}\" from group \"${group.id}\"`);\n continue;\n }\n\n cleanedChildren.push({ type: 'group', id });\n seenGroupChildren.add(id);\n continue;\n }\n\n warn(`Dropping a child entry of group \"${group.id}\" with an unknown type`);\n }\n\n group.children = cleanedChildren;\n }\n\n for (const group of groups) {\n if (group.parent !== null && !seenGroupChildren.has(group.id)) {\n const parent = seenGroupIds.get(group.parent)!;\n\n parent.children.push({ type: 'group', id: group.id });\n seenGroupChildren.add(group.id);\n\n warn(\n `Group \"${group.id}\" was missing from the children of its parent \"${parent.id}\"; appended it`\n );\n }\n }\n\n return { groups };\n };\n\n const resolveSection = (\n section: Modules.ContentStructure.ContentStructureSection\n ): Modules.ContentStructure.ResolvedGroupNode[] => {\n const byId = new Map(section.groups.map((group) => [group.id, group]));\n\n const toNode = (\n group: Modules.ContentStructure.ContentStructureGroup\n ): Modules.ContentStructure.ResolvedGroupNode => {\n const cleanedChildren = group.children.map(\n (entry): Modules.ContentStructure.ResolvedStructureChild => {\n if (entry.type === 'contentType') {\n return { type: 'contentType', uid: entry.uid };\n }\n\n return toNode(byId.get(entry.id)!);\n }\n );\n\n return {\n children: cleanedChildren,\n name: group.name,\n type: 'group',\n id: group.id,\n };\n };\n\n return section.groups.filter((group) => group.parent === null).map(toNode);\n };\n\n async function read(): Promise<Modules.ContentStructure.ContentStructureFile | null> {\n const filePath = join(strapi.dirs.dist.contentStructure, CONTENT_STRUCTURE_FILE_NAME);\n\n if (!(await fse.pathExists(filePath))) {\n return null;\n }\n\n let parsed: unknown;\n try {\n parsed = await fse.readJSON(filePath);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n strapi.log.error(\n `[content-structure] Could not parse ${filePath} (${message}); continuing without content-type folders`\n );\n\n return null;\n }\n\n if (!isRecord(parsed) || !isRecord(parsed.sections)) {\n strapi.log.error(\n `[content-structure] ${filePath} is not an object with a \"sections\" property; continuing without content-type folders`\n );\n return null;\n }\n\n if (parsed.version !== 1) {\n strapi.log.error(\n `[content-structure] Unknown version \"${parsed.version}\" in ${filePath} (expected 1); continuing without content-type folders`\n );\n return null;\n }\n\n return parsed as unknown as Modules.ContentStructure.ContentStructureFile;\n }\n\n const load = () => {\n if (!cache) {\n cache = (async () => {\n const file = await read();\n\n if (!file) {\n return { cleaned: null, resolved: { collectionTypes: [], singleTypes: [] } };\n }\n\n const cleaned: Modules.ContentStructure.ContentStructureFile = {\n version: 1,\n sections: {\n collectionTypes: cleanSection(file.sections.collectionTypes, 'collectionTypes'),\n singleTypes: cleanSection(file.sections.singleTypes, 'singleTypes'),\n },\n };\n\n return {\n cleaned,\n resolved: {\n collectionTypes: resolveSection(cleaned.sections.collectionTypes),\n singleTypes: resolveSection(cleaned.sections.singleTypes),\n },\n };\n })();\n }\n\n return cache;\n };\n\n function invalidate() {\n cache = undefined;\n }\n\n async function getCleanedFile() {\n return (await load()).cleaned;\n }\n\n async function resolve() {\n return (await load()).resolved;\n }\n\n async function write(structure: Modules.ContentStructure.ContentStructureFile) {\n const dir = strapi.dirs.app.contentStructure;\n\n await fse.ensureDir(dir);\n await fse.writeJSON(join(dir, CONTENT_STRUCTURE_FILE_NAME), structure, { spaces: 2 });\n\n invalidate();\n }\n\n function validate(value: unknown): Modules.ContentStructure.ContentStructureFile {\n return contentStructureFileSchema.parse(value) as Modules.ContentStructure.ContentStructureFile;\n }\n\n async function countGroups() {\n const { cleaned } = await load();\n\n if (!cleaned) {\n return 0;\n }\n\n const collectionTypesCount = cleaned.sections.collectionTypes.groups.length;\n const singleTypesCount = cleaned.sections.singleTypes.groups.length;\n\n return collectionTypesCount + singleTypesCount;\n }\n\n return {\n getCleanedFile,\n countGroups,\n invalidate,\n validate,\n resolve,\n write,\n read,\n };\n}\n"],"names":["CONTENT_STRUCTURE_FILE_NAME","MAX_FOLDER_DEPTH","isRecord","value","Array","isArray","createContentStructureService","strapi","cache","warn","message","log","cleanSection","rawSection","sectionKey","rawGroups","undefined","groups","seenGroupIds","Map","raw","isGroupExpressionValid","name","trim","id","has","group","children","parent","set","push","reparentToRoot","reason","splice","indexOf","chain","Set","current","add","get","depth","expectedKind","seenGroupChildren","seenUids","cleanedChildren","entry","type","uid","schema","contentTypes","kind","target","resolveSection","section","byId","map","toNode","filter","read","filePath","join","dirs","dist","contentStructure","fse","pathExists","parsed","readJSON","error","Error","String","sections","version","load","file","cleaned","resolved","collectionTypes","singleTypes","invalidate","getCleanedFile","resolve","write","structure","dir","app","ensureDir","writeJSON","spaces","validate","contentStructureFileSchema","parse","countGroups","collectionTypesCount","length","singleTypesCount"],"mappings":";;;;;AAOO,MAAMA,8BAA8B;AAEpC,MAAMC,mBAAmB;AAyChC,MAAMC,WAAW,CAACC,KAAAA,GAAAA;IAChB,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA;AACvE,CAAA;AAOO,SAASG,8BAA8BC,MAAmB,EAAA;AAC/D;;AAEC,MACD,IAAIC,KAAAA;AAEJ,IAAA,MAAMC,OAAO,CAACC,OAAAA,GAAAA;AACZH,QAAAA,MAAAA,CAAOI,GAAG,CAACF,IAAI,CAAC,CAAC,oBAAoB,EAAEC,OAAAA,CAAAA,CAAS,CAAA;AAClD,IAAA,CAAA;IAEA,MAAME,YAAAA,GAAe,CACnBC,UAAAA,EACAC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,OAAOD,oBAAAA,GAAuBE,gBAAAA;AAChC,IAAA;IAEA,OAAO;AACLf,QAAAA,cAAAA;AACAY,QAAAA,WAAAA;AACAb,QAAAA,UAAAA;AACAU,QAAAA,QAAAA;AACAR,QAAAA,OAAAA;AACAC,QAAAA,KAAAA;AACAxB,QAAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGroupExpressionValid.d.ts","sourceRoot":"","sources":["../../../../src/services/content-structure/utils/isGroupExpressionValid.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,GACjC,oBAAoB,OAAO,KAC1B,kBAAkB,IAAI;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CAgBZ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isRecord = (value)=>{
|
|
4
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
|
+
};
|
|
6
|
+
const isGroupExpressionValid = (rawGroupExpression)=>{
|
|
7
|
+
if (!isRecord(rawGroupExpression)) return false;
|
|
8
|
+
if (typeof rawGroupExpression.id !== 'string') return false;
|
|
9
|
+
if (rawGroupExpression.id === '') return false;
|
|
10
|
+
if (typeof rawGroupExpression.name !== 'string') return false;
|
|
11
|
+
if (rawGroupExpression.parent !== null && typeof rawGroupExpression.parent !== 'string') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (!Array.isArray(rawGroupExpression.children)) return false;
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.isGroupExpressionValid = isGroupExpressionValid;
|
|
19
|
+
//# sourceMappingURL=isGroupExpressionValid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGroupExpressionValid.js","sources":["../../../../src/services/content-structure/utils/isGroupExpressionValid.ts"],"sourcesContent":["const isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\nexport const isGroupExpressionValid = (\n rawGroupExpression: unknown\n): rawGroupExpression is {\n parent: string | null;\n children: unknown[];\n name: string;\n id: string;\n} => {\n if (!isRecord(rawGroupExpression)) return false;\n\n if (typeof rawGroupExpression.id !== 'string') return false;\n if (rawGroupExpression.id === '') return false;\n\n if (typeof rawGroupExpression.name !== 'string') return false;\n\n if (rawGroupExpression.parent !== null && typeof rawGroupExpression.parent !== 'string') {\n return false;\n }\n\n if (!Array.isArray(rawGroupExpression.children)) return false;\n\n return true;\n};\n"],"names":["isRecord","value","Array","isArray","isGroupExpressionValid","rawGroupExpression","id","name","parent","children"],"mappings":";;AAAA,MAAMA,WAAW,CAACC,KAAAA,GAAAA;IAChB,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA;AACvE,CAAA;AAEO,MAAMG,yBAAyB,CACpCC,kBAAAA,GAAAA;IAOA,IAAI,CAACL,QAAAA,CAASK,kBAAAA,CAAAA,EAAqB,OAAO,KAAA;AAE1C,IAAA,IAAI,OAAOA,kBAAAA,CAAmBC,EAAE,KAAK,UAAU,OAAO,KAAA;AACtD,IAAA,IAAID,kBAAAA,CAAmBC,EAAE,KAAK,EAAA,EAAI,OAAO,KAAA;AAEzC,IAAA,IAAI,OAAOD,kBAAAA,CAAmBE,IAAI,KAAK,UAAU,OAAO,KAAA;IAExD,IAAIF,kBAAAA,CAAmBG,MAAM,KAAK,IAAA,IAAQ,OAAOH,kBAAAA,CAAmBG,MAAM,KAAK,QAAA,EAAU;QACvF,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,IAAI,CAACN,KAAAA,CAAMC,OAAO,CAACE,kBAAAA,CAAmBI,QAAQ,GAAG,OAAO,KAAA;IAExD,OAAO,IAAA;AACT;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const isRecord = (value)=>{
|
|
2
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
3
|
+
};
|
|
4
|
+
const isGroupExpressionValid = (rawGroupExpression)=>{
|
|
5
|
+
if (!isRecord(rawGroupExpression)) return false;
|
|
6
|
+
if (typeof rawGroupExpression.id !== 'string') return false;
|
|
7
|
+
if (rawGroupExpression.id === '') return false;
|
|
8
|
+
if (typeof rawGroupExpression.name !== 'string') return false;
|
|
9
|
+
if (rawGroupExpression.parent !== null && typeof rawGroupExpression.parent !== 'string') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (!Array.isArray(rawGroupExpression.children)) return false;
|
|
13
|
+
return true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { isGroupExpressionValid };
|
|
17
|
+
//# sourceMappingURL=isGroupExpressionValid.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGroupExpressionValid.mjs","sources":["../../../../src/services/content-structure/utils/isGroupExpressionValid.ts"],"sourcesContent":["const isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\nexport const isGroupExpressionValid = (\n rawGroupExpression: unknown\n): rawGroupExpression is {\n parent: string | null;\n children: unknown[];\n name: string;\n id: string;\n} => {\n if (!isRecord(rawGroupExpression)) return false;\n\n if (typeof rawGroupExpression.id !== 'string') return false;\n if (rawGroupExpression.id === '') return false;\n\n if (typeof rawGroupExpression.name !== 'string') return false;\n\n if (rawGroupExpression.parent !== null && typeof rawGroupExpression.parent !== 'string') {\n return false;\n }\n\n if (!Array.isArray(rawGroupExpression.children)) return false;\n\n return true;\n};\n"],"names":["isRecord","value","Array","isArray","isGroupExpressionValid","rawGroupExpression","id","name","parent","children"],"mappings":"AAAA,MAAMA,WAAW,CAACC,KAAAA,GAAAA;IAChB,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA;AACvE,CAAA;AAEO,MAAMG,yBAAyB,CACpCC,kBAAAA,GAAAA;IAOA,IAAI,CAACL,QAAAA,CAASK,kBAAAA,CAAAA,EAAqB,OAAO,KAAA;AAE1C,IAAA,IAAI,OAAOA,kBAAAA,CAAmBC,EAAE,KAAK,UAAU,OAAO,KAAA;AACtD,IAAA,IAAID,kBAAAA,CAAmBC,EAAE,KAAK,EAAA,EAAI,OAAO,KAAA;AAEzC,IAAA,IAAI,OAAOD,kBAAAA,CAAmBE,IAAI,KAAK,UAAU,OAAO,KAAA;IAExD,IAAIF,kBAAAA,CAAmBG,MAAM,KAAK,IAAA,IAAQ,OAAOH,kBAAAA,CAAmBG,MAAM,KAAK,QAAA,EAAU;QACvF,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,IAAI,CAACN,KAAAA,CAAMC,OAAO,CAACE,kBAAAA,CAAmBI,QAAQ,GAAG,OAAO,KAAA;IAExD,OAAO,IAAA;AACT;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const contentStructureFileSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodLiteral<1>;
|
|
4
|
+
sections: z.ZodObject<{
|
|
5
|
+
collectionTypes: z.ZodObject<{
|
|
6
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
7
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
+
uid: z.ZodString;
|
|
9
|
+
type: z.ZodLiteral<"contentType">;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
type: z.ZodLiteral<"group">;
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
}, z.core.$strip>], "type">>;
|
|
14
|
+
parent: z.ZodNullable<z.ZodString>;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
singleTypes: z.ZodObject<{
|
|
20
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
21
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
uid: z.ZodString;
|
|
23
|
+
type: z.ZodLiteral<"contentType">;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"group">;
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
}, z.core.$strip>], "type">>;
|
|
28
|
+
parent: z.ZodNullable<z.ZodString>;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/services/content-structure/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuNxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEL,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
const CONTENT_TYPE_UID_REGEX = /^((strapi|admin)::[\w-]+|(api|plugin)::[\w-]+\.[\w-]+)$/;
|
|
6
|
+
// eslint-disable-next-line no-control-regex
|
|
7
|
+
const CONTROL_CHARS_REGEX = /[\x00-\x1F\x7F-\x9F]/;
|
|
8
|
+
// eslint-disable-next-line no-control-regex
|
|
9
|
+
const ANSI_ESCAPE_REGEX = /\x1B\[[0-9;]*[A-Za-z]/;
|
|
10
|
+
const GROUP_NAME_MAX_LENGTH = 255;
|
|
11
|
+
const MAX_FOLDER_DEPTH = 3;
|
|
12
|
+
const groupIdSchema = zod.z.string().min(1, 'Group id must not be empty');
|
|
13
|
+
const groupNameSchema = zod.z.string().min(1, 'Group name must not be empty').max(GROUP_NAME_MAX_LENGTH, `Group name must be at most ${GROUP_NAME_MAX_LENGTH} characters`).refine((value)=>value.trim().length > 0, 'Group name must not be empty').refine((value)=>value === value.trim(), 'Group name must not have leading or trailing whitespace').refine((value)=>!CONTROL_CHARS_REGEX.test(value), 'Group name must not contain control characters').refine((value)=>!ANSI_ESCAPE_REGEX.test(value), 'Group name must not contain ANSI escape characters');
|
|
14
|
+
const contentStructureChildSchema = zod.z.discriminatedUnion('type', [
|
|
15
|
+
zod.z.object({
|
|
16
|
+
uid: zod.z.string().regex(CONTENT_TYPE_UID_REGEX, 'Invalid content type uid'),
|
|
17
|
+
type: zod.z.literal('contentType')
|
|
18
|
+
}),
|
|
19
|
+
zod.z.object({
|
|
20
|
+
type: zod.z.literal('group'),
|
|
21
|
+
id: groupIdSchema
|
|
22
|
+
})
|
|
23
|
+
]);
|
|
24
|
+
const contentStructureGroupSchema = zod.z.object({
|
|
25
|
+
children: zod.z.array(contentStructureChildSchema),
|
|
26
|
+
parent: groupIdSchema.nullable(),
|
|
27
|
+
name: groupNameSchema,
|
|
28
|
+
id: groupIdSchema
|
|
29
|
+
});
|
|
30
|
+
const contentStructureSectionSchema = zod.z.object({
|
|
31
|
+
groups: zod.z.array(contentStructureGroupSchema)
|
|
32
|
+
});
|
|
33
|
+
const contentStructureFileObjectSchema = zod.z.object({
|
|
34
|
+
version: zod.z.literal(1),
|
|
35
|
+
sections: zod.z.object({
|
|
36
|
+
collectionTypes: contentStructureSectionSchema,
|
|
37
|
+
singleTypes: contentStructureSectionSchema
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
const uniqueGroupIdsAcrossFile = (file, ctx)=>{
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
for (const section of [
|
|
43
|
+
file.sections.collectionTypes,
|
|
44
|
+
file.sections.singleTypes
|
|
45
|
+
]){
|
|
46
|
+
for (const group of section.groups){
|
|
47
|
+
if (seen.has(group.id)) {
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
message: `Duplicate group id "${group.id}"`,
|
|
50
|
+
code: zod.z.ZodIssueCode.custom,
|
|
51
|
+
path: [
|
|
52
|
+
'sections'
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
seen.add(group.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const validateSectionGraph = (groups, sectionKey, ctx)=>{
|
|
61
|
+
const path = [
|
|
62
|
+
'sections',
|
|
63
|
+
sectionKey,
|
|
64
|
+
'groups'
|
|
65
|
+
];
|
|
66
|
+
const byId = new Map(groups.map((group)=>[
|
|
67
|
+
group.id,
|
|
68
|
+
group
|
|
69
|
+
]));
|
|
70
|
+
const report = (message)=>{
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: zod.z.ZodIssueCode.custom,
|
|
73
|
+
path,
|
|
74
|
+
message
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const siblingNames = new Map();
|
|
78
|
+
for (const group of groups){
|
|
79
|
+
const name = group.name.trim().toLowerCase();
|
|
80
|
+
const seen = siblingNames.get(group.parent) ?? new Set();
|
|
81
|
+
if (seen.has(name)) {
|
|
82
|
+
const where = group.parent ? `group "${group.parent}"` : 'the section root';
|
|
83
|
+
report(`Sibling groups under ${where} in section "${sectionKey}" share the name "${group.name.trim()}"`);
|
|
84
|
+
}
|
|
85
|
+
seen.add(name);
|
|
86
|
+
siblingNames.set(group.parent, seen);
|
|
87
|
+
}
|
|
88
|
+
for (const group of groups){
|
|
89
|
+
if (group.parent !== null && !byId.has(group.parent)) {
|
|
90
|
+
report(`Group "${group.id}" references parent "${group.parent}" which is not a group in section "${sectionKey}"`);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const chain = new Set([
|
|
94
|
+
group.id
|
|
95
|
+
]);
|
|
96
|
+
let current = group;
|
|
97
|
+
let depth = 1;
|
|
98
|
+
let broken = false;
|
|
99
|
+
while(current && current.parent !== null){
|
|
100
|
+
if (chain.has(current.parent)) {
|
|
101
|
+
report(`Group "${group.id}" is part of a parent cycle`);
|
|
102
|
+
broken = true;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
const parent = byId.get(current.parent);
|
|
106
|
+
if (!parent) {
|
|
107
|
+
broken = true;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
chain.add(current.parent);
|
|
111
|
+
current = parent;
|
|
112
|
+
depth += 1;
|
|
113
|
+
}
|
|
114
|
+
if (!broken && depth > MAX_FOLDER_DEPTH) {
|
|
115
|
+
report(`Group "${group.id}" exceeds the maximum nesting depth of ${MAX_FOLDER_DEPTH} in section "${sectionKey}"`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const groupChildCount = new Map();
|
|
119
|
+
const seenUids = new Set();
|
|
120
|
+
for (const group of groups){
|
|
121
|
+
for (const child of group.children){
|
|
122
|
+
if (child.type === 'group') {
|
|
123
|
+
const target = byId.get(child.id);
|
|
124
|
+
if (!target) {
|
|
125
|
+
report(`Group "${group.id}" has a group child "${child.id}" that does not exist in section "${sectionKey}"`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (target.parent !== group.id) {
|
|
129
|
+
report(`Group child "${child.id}" of "${group.id}" does not list "${group.id}" as its parent`);
|
|
130
|
+
}
|
|
131
|
+
groupChildCount.set(child.id, (groupChildCount.get(child.id) ?? 0) + 1);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (seenUids.has(child.uid)) {
|
|
135
|
+
report(`Content type "${child.uid}" appears in more than one group in section "${sectionKey}"`);
|
|
136
|
+
} else {
|
|
137
|
+
seenUids.add(child.uid);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
for (const group of groups){
|
|
142
|
+
const count = groupChildCount.get(group.id) ?? 0;
|
|
143
|
+
if (group.parent === null) {
|
|
144
|
+
if (count > 0) {
|
|
145
|
+
report(`Root group "${group.id}" is listed as a group child of another group in section "${sectionKey}"`);
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (count === 0) {
|
|
150
|
+
report(`Group "${group.id}" is not listed in the children of its parent "${group.parent}"`);
|
|
151
|
+
} else if (count > 1) {
|
|
152
|
+
report(`Group "${group.id}" is listed ${count} times as a group child in section "${sectionKey}"`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const validateGraphRules = (file, ctx)=>{
|
|
157
|
+
validateSectionGraph(file.sections.collectionTypes.groups, 'collectionTypes', ctx);
|
|
158
|
+
validateSectionGraph(file.sections.singleTypes.groups, 'singleTypes', ctx);
|
|
159
|
+
};
|
|
160
|
+
const contentStructureFileSchema = contentStructureFileObjectSchema.superRefine(uniqueGroupIdsAcrossFile).superRefine(validateGraphRules);
|
|
161
|
+
|
|
162
|
+
exports.contentStructureFileSchema = contentStructureFileSchema;
|
|
163
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../../src/services/content-structure/validation.ts"],"sourcesContent":["import { z } from 'zod';\n\nconst CONTENT_TYPE_UID_REGEX = /^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$/;\n\n// eslint-disable-next-line no-control-regex\nconst CONTROL_CHARS_REGEX = /[\\x00-\\x1F\\x7F-\\x9F]/;\n// eslint-disable-next-line no-control-regex\nconst ANSI_ESCAPE_REGEX = /\\x1B\\[[0-9;]*[A-Za-z]/;\n\nconst GROUP_NAME_MAX_LENGTH = 255;\nconst MAX_FOLDER_DEPTH = 3;\n\nconst groupIdSchema = z.string().min(1, 'Group id must not be empty');\n\nconst groupNameSchema = z\n .string()\n .min(1, 'Group name must not be empty')\n .max(GROUP_NAME_MAX_LENGTH, `Group name must be at most ${GROUP_NAME_MAX_LENGTH} characters`)\n .refine((value) => value.trim().length > 0, 'Group name must not be empty')\n .refine(\n (value) => value === value.trim(),\n 'Group name must not have leading or trailing whitespace'\n )\n .refine(\n (value) => !CONTROL_CHARS_REGEX.test(value),\n 'Group name must not contain control characters'\n )\n .refine(\n (value) => !ANSI_ESCAPE_REGEX.test(value),\n 'Group name must not contain ANSI escape characters'\n );\n\nconst contentStructureChildSchema = z.discriminatedUnion('type', [\n z.object({\n uid: z.string().regex(CONTENT_TYPE_UID_REGEX, 'Invalid content type uid'),\n type: z.literal('contentType'),\n }),\n z.object({\n type: z.literal('group'),\n id: groupIdSchema,\n }),\n]);\n\nconst contentStructureGroupSchema = z.object({\n children: z.array(contentStructureChildSchema),\n parent: groupIdSchema.nullable(),\n name: groupNameSchema,\n id: groupIdSchema,\n});\n\nconst contentStructureSectionSchema = z.object({\n groups: z.array(contentStructureGroupSchema),\n});\n\nconst contentStructureFileObjectSchema = z.object({\n version: z.literal(1),\n sections: z.object({\n collectionTypes: contentStructureSectionSchema,\n singleTypes: contentStructureSectionSchema,\n }),\n});\n\ntype ContentStructureFileObject = z.infer<typeof contentStructureFileObjectSchema>;\ntype ContentStructureGroupInput = z.infer<typeof contentStructureGroupSchema>;\ntype SuperRefinement<T> = (value: T, ctx: z.RefinementCtx) => void | Promise<void>;\n\nconst uniqueGroupIdsAcrossFile: SuperRefinement<ContentStructureFileObject> = (file, ctx) => {\n const seen = new Set<string>();\n\n for (const section of [file.sections.collectionTypes, file.sections.singleTypes]) {\n for (const group of section.groups) {\n if (seen.has(group.id)) {\n ctx.addIssue({\n message: `Duplicate group id \"${group.id}\"`,\n code: z.ZodIssueCode.custom,\n path: ['sections'],\n });\n }\n\n seen.add(group.id);\n }\n }\n};\n\nconst validateSectionGraph = (\n groups: ContentStructureGroupInput[],\n sectionKey: 'collectionTypes' | 'singleTypes',\n ctx: z.RefinementCtx\n) => {\n const path: (string | number)[] = ['sections', sectionKey, 'groups'];\n const byId = new Map(groups.map((group) => [group.id, group]));\n\n const report = (message: string) => {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path, message });\n };\n\n const siblingNames = new Map<string | null, Set<string>>();\n\n for (const group of groups) {\n const name = group.name.trim().toLowerCase();\n const seen = siblingNames.get(group.parent) ?? new Set<string>();\n\n if (seen.has(name)) {\n const where = group.parent ? `group \"${group.parent}\"` : 'the section root';\n report(\n `Sibling groups under ${where} in section \"${sectionKey}\" share the name \"${group.name.trim()}\"`\n );\n }\n\n seen.add(name);\n siblingNames.set(group.parent, seen);\n }\n\n for (const group of groups) {\n if (group.parent !== null && !byId.has(group.parent)) {\n report(\n `Group \"${group.id}\" references parent \"${group.parent}\" which is not a group in section \"${sectionKey}\"`\n );\n continue;\n }\n\n const chain = new Set<string>([group.id]);\n\n let current: ContentStructureGroupInput | undefined = group;\n let depth = 1;\n let broken = false;\n\n while (current && current.parent !== null) {\n if (chain.has(current.parent)) {\n report(`Group \"${group.id}\" is part of a parent cycle`);\n broken = true;\n break;\n }\n\n const parent = byId.get(current.parent);\n\n if (!parent) {\n broken = true;\n break;\n }\n\n chain.add(current.parent);\n current = parent;\n depth += 1;\n }\n\n if (!broken && depth > MAX_FOLDER_DEPTH) {\n report(\n `Group \"${group.id}\" exceeds the maximum nesting depth of ${MAX_FOLDER_DEPTH} in section \"${sectionKey}\"`\n );\n }\n }\n\n const groupChildCount = new Map<string, number>();\n const seenUids = new Set<string>();\n\n for (const group of groups) {\n for (const child of group.children) {\n if (child.type === 'group') {\n const target = byId.get(child.id);\n\n if (!target) {\n report(\n `Group \"${group.id}\" has a group child \"${child.id}\" that does not exist in section \"${sectionKey}\"`\n );\n continue;\n }\n\n if (target.parent !== group.id) {\n report(\n `Group child \"${child.id}\" of \"${group.id}\" does not list \"${group.id}\" as its parent`\n );\n }\n\n groupChildCount.set(child.id, (groupChildCount.get(child.id) ?? 0) + 1);\n continue;\n }\n\n if (seenUids.has(child.uid)) {\n report(\n `Content type \"${child.uid}\" appears in more than one group in section \"${sectionKey}\"`\n );\n } else {\n seenUids.add(child.uid);\n }\n }\n }\n\n for (const group of groups) {\n const count = groupChildCount.get(group.id) ?? 0;\n\n if (group.parent === null) {\n if (count > 0) {\n report(\n `Root group \"${group.id}\" is listed as a group child of another group in section \"${sectionKey}\"`\n );\n }\n continue;\n }\n\n if (count === 0) {\n report(`Group \"${group.id}\" is not listed in the children of its parent \"${group.parent}\"`);\n } else if (count > 1) {\n report(\n `Group \"${group.id}\" is listed ${count} times as a group child in section \"${sectionKey}\"`\n );\n }\n }\n};\n\nconst validateGraphRules: SuperRefinement<ContentStructureFileObject> = (file, ctx) => {\n validateSectionGraph(file.sections.collectionTypes.groups, 'collectionTypes', ctx);\n validateSectionGraph(file.sections.singleTypes.groups, 'singleTypes', ctx);\n};\n\nexport const contentStructureFileSchema = contentStructureFileObjectSchema\n .superRefine(uniqueGroupIdsAcrossFile)\n .superRefine(validateGraphRules);\n"],"names":["CONTENT_TYPE_UID_REGEX","CONTROL_CHARS_REGEX","ANSI_ESCAPE_REGEX","GROUP_NAME_MAX_LENGTH","MAX_FOLDER_DEPTH","groupIdSchema","z","string","min","groupNameSchema","max","refine","value","trim","length","test","contentStructureChildSchema","discriminatedUnion","object","uid","regex","type","literal","id","contentStructureGroupSchema","children","array","parent","nullable","name","contentStructureSectionSchema","groups","contentStructureFileObjectSchema","version","sections","collectionTypes","singleTypes","uniqueGroupIdsAcrossFile","file","ctx","seen","Set","section","group","has","addIssue","message","code","ZodIssueCode","custom","path","add","validateSectionGraph","sectionKey","byId","Map","map","report","siblingNames","toLowerCase","get","where","set","chain","current","depth","broken","groupChildCount","seenUids","child","target","count","validateGraphRules","contentStructureFileSchema","superRefine"],"mappings":";;;;AAEA,MAAMA,sBAAAA,GAAyB,yDAAA;AAE/B;AACA,MAAMC,mBAAAA,GAAsB,sBAAA;AAC5B;AACA,MAAMC,iBA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d,KAAAA,CAAMpB,EAAE,CAAC,YAAY,EAAEgD,KAAAA,CAAM,oCAAoC,EAAElB,UAAAA,CAAW,CAAC,CAAC,CAAA;AAE9F,QAAA;AACF,IAAA;AACF,CAAA;AAEA,MAAMmB,kBAAAA,GAAkE,CAAClC,IAAAA,EAAMC,GAAAA,GAAAA;AAC7Ea,IAAAA,oBAAAA,CAAqBd,KAAKJ,QAAQ,CAACC,eAAe,CAACJ,MAAM,EAAE,iBAAA,EAAmBQ,GAAAA,CAAAA;AAC9Ea,IAAAA,oBAAAA,CAAqBd,KAAKJ,QAAQ,CAACE,WAAW,CAACL,MAAM,EAAE,aAAA,EAAeQ,GAAAA,CAAAA;AACxE,CAAA;AAEO,MAAMkC,6BAA6BzC,gCAAAA,CACvC0C,WAAW,CAACrC,wBAAAA,CAAAA,CACZqC,WAAW,CAACF,kBAAAA;;;;"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const CONTENT_TYPE_UID_REGEX = /^((strapi|admin)::[\w-]+|(api|plugin)::[\w-]+\.[\w-]+)$/;
|
|
4
|
+
// eslint-disable-next-line no-control-regex
|
|
5
|
+
const CONTROL_CHARS_REGEX = /[\x00-\x1F\x7F-\x9F]/;
|
|
6
|
+
// eslint-disable-next-line no-control-regex
|
|
7
|
+
const ANSI_ESCAPE_REGEX = /\x1B\[[0-9;]*[A-Za-z]/;
|
|
8
|
+
const GROUP_NAME_MAX_LENGTH = 255;
|
|
9
|
+
const MAX_FOLDER_DEPTH = 3;
|
|
10
|
+
const groupIdSchema = z.string().min(1, 'Group id must not be empty');
|
|
11
|
+
const groupNameSchema = z.string().min(1, 'Group name must not be empty').max(GROUP_NAME_MAX_LENGTH, `Group name must be at most ${GROUP_NAME_MAX_LENGTH} characters`).refine((value)=>value.trim().length > 0, 'Group name must not be empty').refine((value)=>value === value.trim(), 'Group name must not have leading or trailing whitespace').refine((value)=>!CONTROL_CHARS_REGEX.test(value), 'Group name must not contain control characters').refine((value)=>!ANSI_ESCAPE_REGEX.test(value), 'Group name must not contain ANSI escape characters');
|
|
12
|
+
const contentStructureChildSchema = z.discriminatedUnion('type', [
|
|
13
|
+
z.object({
|
|
14
|
+
uid: z.string().regex(CONTENT_TYPE_UID_REGEX, 'Invalid content type uid'),
|
|
15
|
+
type: z.literal('contentType')
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
type: z.literal('group'),
|
|
19
|
+
id: groupIdSchema
|
|
20
|
+
})
|
|
21
|
+
]);
|
|
22
|
+
const contentStructureGroupSchema = z.object({
|
|
23
|
+
children: z.array(contentStructureChildSchema),
|
|
24
|
+
parent: groupIdSchema.nullable(),
|
|
25
|
+
name: groupNameSchema,
|
|
26
|
+
id: groupIdSchema
|
|
27
|
+
});
|
|
28
|
+
const contentStructureSectionSchema = z.object({
|
|
29
|
+
groups: z.array(contentStructureGroupSchema)
|
|
30
|
+
});
|
|
31
|
+
const contentStructureFileObjectSchema = z.object({
|
|
32
|
+
version: z.literal(1),
|
|
33
|
+
sections: z.object({
|
|
34
|
+
collectionTypes: contentStructureSectionSchema,
|
|
35
|
+
singleTypes: contentStructureSectionSchema
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
const uniqueGroupIdsAcrossFile = (file, ctx)=>{
|
|
39
|
+
const seen = new Set();
|
|
40
|
+
for (const section of [
|
|
41
|
+
file.sections.collectionTypes,
|
|
42
|
+
file.sections.singleTypes
|
|
43
|
+
]){
|
|
44
|
+
for (const group of section.groups){
|
|
45
|
+
if (seen.has(group.id)) {
|
|
46
|
+
ctx.addIssue({
|
|
47
|
+
message: `Duplicate group id "${group.id}"`,
|
|
48
|
+
code: z.ZodIssueCode.custom,
|
|
49
|
+
path: [
|
|
50
|
+
'sections'
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
seen.add(group.id);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const validateSectionGraph = (groups, sectionKey, ctx)=>{
|
|
59
|
+
const path = [
|
|
60
|
+
'sections',
|
|
61
|
+
sectionKey,
|
|
62
|
+
'groups'
|
|
63
|
+
];
|
|
64
|
+
const byId = new Map(groups.map((group)=>[
|
|
65
|
+
group.id,
|
|
66
|
+
group
|
|
67
|
+
]));
|
|
68
|
+
const report = (message)=>{
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
code: z.ZodIssueCode.custom,
|
|
71
|
+
path,
|
|
72
|
+
message
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const siblingNames = new Map();
|
|
76
|
+
for (const group of groups){
|
|
77
|
+
const name = group.name.trim().toLowerCase();
|
|
78
|
+
const seen = siblingNames.get(group.parent) ?? new Set();
|
|
79
|
+
if (seen.has(name)) {
|
|
80
|
+
const where = group.parent ? `group "${group.parent}"` : 'the section root';
|
|
81
|
+
report(`Sibling groups under ${where} in section "${sectionKey}" share the name "${group.name.trim()}"`);
|
|
82
|
+
}
|
|
83
|
+
seen.add(name);
|
|
84
|
+
siblingNames.set(group.parent, seen);
|
|
85
|
+
}
|
|
86
|
+
for (const group of groups){
|
|
87
|
+
if (group.parent !== null && !byId.has(group.parent)) {
|
|
88
|
+
report(`Group "${group.id}" references parent "${group.parent}" which is not a group in section "${sectionKey}"`);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const chain = new Set([
|
|
92
|
+
group.id
|
|
93
|
+
]);
|
|
94
|
+
let current = group;
|
|
95
|
+
let depth = 1;
|
|
96
|
+
let broken = false;
|
|
97
|
+
while(current && current.parent !== null){
|
|
98
|
+
if (chain.has(current.parent)) {
|
|
99
|
+
report(`Group "${group.id}" is part of a parent cycle`);
|
|
100
|
+
broken = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
const parent = byId.get(current.parent);
|
|
104
|
+
if (!parent) {
|
|
105
|
+
broken = true;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
chain.add(current.parent);
|
|
109
|
+
current = parent;
|
|
110
|
+
depth += 1;
|
|
111
|
+
}
|
|
112
|
+
if (!broken && depth > MAX_FOLDER_DEPTH) {
|
|
113
|
+
report(`Group "${group.id}" exceeds the maximum nesting depth of ${MAX_FOLDER_DEPTH} in section "${sectionKey}"`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const groupChildCount = new Map();
|
|
117
|
+
const seenUids = new Set();
|
|
118
|
+
for (const group of groups){
|
|
119
|
+
for (const child of group.children){
|
|
120
|
+
if (child.type === 'group') {
|
|
121
|
+
const target = byId.get(child.id);
|
|
122
|
+
if (!target) {
|
|
123
|
+
report(`Group "${group.id}" has a group child "${child.id}" that does not exist in section "${sectionKey}"`);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (target.parent !== group.id) {
|
|
127
|
+
report(`Group child "${child.id}" of "${group.id}" does not list "${group.id}" as its parent`);
|
|
128
|
+
}
|
|
129
|
+
groupChildCount.set(child.id, (groupChildCount.get(child.id) ?? 0) + 1);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (seenUids.has(child.uid)) {
|
|
133
|
+
report(`Content type "${child.uid}" appears in more than one group in section "${sectionKey}"`);
|
|
134
|
+
} else {
|
|
135
|
+
seenUids.add(child.uid);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
for (const group of groups){
|
|
140
|
+
const count = groupChildCount.get(group.id) ?? 0;
|
|
141
|
+
if (group.parent === null) {
|
|
142
|
+
if (count > 0) {
|
|
143
|
+
report(`Root group "${group.id}" is listed as a group child of another group in section "${sectionKey}"`);
|
|
144
|
+
}
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (count === 0) {
|
|
148
|
+
report(`Group "${group.id}" is not listed in the children of its parent "${group.parent}"`);
|
|
149
|
+
} else if (count > 1) {
|
|
150
|
+
report(`Group "${group.id}" is listed ${count} times as a group child in section "${sectionKey}"`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const validateGraphRules = (file, ctx)=>{
|
|
155
|
+
validateSectionGraph(file.sections.collectionTypes.groups, 'collectionTypes', ctx);
|
|
156
|
+
validateSectionGraph(file.sections.singleTypes.groups, 'singleTypes', ctx);
|
|
157
|
+
};
|
|
158
|
+
const contentStructureFileSchema = contentStructureFileObjectSchema.superRefine(uniqueGroupIdsAcrossFile).superRefine(validateGraphRules);
|
|
159
|
+
|
|
160
|
+
export { contentStructureFileSchema };
|
|
161
|
+
//# sourceMappingURL=validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.mjs","sources":["../../../src/services/content-structure/validation.ts"],"sourcesContent":["import { z } from 'zod';\n\nconst CONTENT_TYPE_UID_REGEX = /^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$/;\n\n// eslint-disable-next-line no-control-regex\nconst CONTROL_CHARS_REGEX = /[\\x00-\\x1F\\x7F-\\x9F]/;\n// eslint-disable-next-line no-control-regex\nconst ANSI_ESCAPE_REGEX = /\\x1B\\[[0-9;]*[A-Za-z]/;\n\nconst GROUP_NAME_MAX_LENGTH = 255;\nconst MAX_FOLDER_DEPTH = 3;\n\nconst groupIdSchema = z.string().min(1, 'Group id must not be empty');\n\nconst groupNameSchema = z\n .string()\n .min(1, 'Group name must not be empty')\n .max(GROUP_NAME_MAX_LENGTH, `Group name must be at most ${GROUP_NAME_MAX_LENGTH} characters`)\n .refine((value) => value.trim().length > 0, 'Group name must not be empty')\n .refine(\n (value) => value === value.trim(),\n 'Group name must not have leading or trailing whitespace'\n )\n .refine(\n (value) => !CONTROL_CHARS_REGEX.test(value),\n 'Group name must not contain control characters'\n )\n .refine(\n (value) => !ANSI_ESCAPE_REGEX.test(value),\n 'Group name must not contain ANSI escape characters'\n );\n\nconst contentStructureChildSchema = z.discriminatedUnion('type', [\n z.object({\n uid: z.string().regex(CONTENT_TYPE_UID_REGEX, 'Invalid content type uid'),\n type: z.literal('contentType'),\n }),\n z.object({\n type: z.literal('group'),\n id: groupIdSchema,\n }),\n]);\n\nconst contentStructureGroupSchema = z.object({\n children: z.array(contentStructureChildSchema),\n parent: groupIdSchema.nullable(),\n name: groupNameSchema,\n id: groupIdSchema,\n});\n\nconst contentStructureSectionSchema = z.object({\n groups: z.array(contentStructureGroupSchema),\n});\n\nconst contentStructureFileObjectSchema = z.object({\n version: z.literal(1),\n sections: z.object({\n collectionTypes: contentStructureSectionSchema,\n singleTypes: contentStructureSectionSchema,\n }),\n});\n\ntype ContentStructureFileObject = z.infer<typeof contentStructureFileObjectSchema>;\ntype ContentStructureGroupInput = z.infer<typeof contentStructureGroupSchema>;\ntype SuperRefinement<T> = (value: T, ctx: z.RefinementCtx) => void | Promise<void>;\n\nconst uniqueGroupIdsAcrossFile: SuperRefinement<ContentStructureFileObject> = (file, ctx) => {\n const seen = new Set<string>();\n\n for (const section of [file.sections.collectionTypes, file.sections.singleTypes]) {\n for (const group of section.groups) {\n if (seen.has(group.id)) {\n ctx.addIssue({\n message: `Duplicate group id \"${group.id}\"`,\n code: z.ZodIssueCode.custom,\n path: ['sections'],\n });\n }\n\n seen.add(group.id);\n }\n }\n};\n\nconst validateSectionGraph = (\n groups: ContentStructureGroupInput[],\n sectionKey: 'collectionTypes' | 'singleTypes',\n ctx: z.RefinementCtx\n) => {\n const path: (string | number)[] = ['sections', sectionKey, 'groups'];\n const byId = new Map(groups.map((group) => [group.id, group]));\n\n const report = (message: string) => {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path, message });\n };\n\n const siblingNames = new Map<string | null, Set<string>>();\n\n for (const group of groups) {\n const name = group.name.trim().toLowerCase();\n const seen = siblingNames.get(group.parent) ?? new Set<string>();\n\n if (seen.has(name)) {\n const where = group.parent ? `group \"${group.parent}\"` : 'the section root';\n report(\n `Sibling groups under ${where} in section \"${sectionKey}\" share the name \"${group.name.trim()}\"`\n );\n }\n\n seen.add(name);\n siblingNames.set(group.parent, seen);\n }\n\n for (const group of groups) {\n if (group.parent !== null && !byId.has(group.parent)) {\n report(\n `Group \"${group.id}\" references parent \"${group.parent}\" which is not a group in section \"${sectionKey}\"`\n );\n continue;\n }\n\n const chain = new Set<string>([group.id]);\n\n let current: ContentStructureGroupInput | undefined = group;\n let depth = 1;\n let broken = false;\n\n while (current && current.parent !== null) {\n if (chain.has(current.parent)) {\n report(`Group \"${group.id}\" is part of a parent cycle`);\n broken = true;\n break;\n }\n\n const parent = byId.get(current.parent);\n\n if (!parent) {\n broken = true;\n break;\n }\n\n chain.add(current.parent);\n current = parent;\n depth += 1;\n }\n\n if (!broken && depth > MAX_FOLDER_DEPTH) {\n report(\n `Group \"${group.id}\" exceeds the maximum nesting depth of ${MAX_FOLDER_DEPTH} in section \"${sectionKey}\"`\n );\n }\n }\n\n const groupChildCount = new Map<string, number>();\n const seenUids = new Set<string>();\n\n for (const group of groups) {\n for (const child of group.children) {\n if (child.type === 'group') {\n const target = byId.get(child.id);\n\n if (!target) {\n report(\n `Group \"${group.id}\" has a group child \"${child.id}\" that does not exist in section \"${sectionKey}\"`\n );\n continue;\n }\n\n if (target.parent !== group.id) {\n report(\n `Group child \"${child.id}\" of \"${group.id}\" does not list \"${group.id}\" as its parent`\n );\n }\n\n groupChildCount.set(child.id, (groupChildCount.get(child.id) ?? 0) + 1);\n continue;\n }\n\n if (seenUids.has(child.uid)) {\n report(\n `Content type \"${child.uid}\" appears in more than one group in section \"${sectionKey}\"`\n );\n } else {\n seenUids.add(child.uid);\n }\n }\n }\n\n for (const group of groups) {\n const count = groupChildCount.get(group.id) ?? 0;\n\n if (group.parent === null) {\n if (count > 0) {\n report(\n `Root group \"${group.id}\" is listed as a group child of another group in section \"${sectionKey}\"`\n );\n }\n continue;\n }\n\n if (count === 0) {\n report(`Group \"${group.id}\" is not listed in the children of its parent \"${group.parent}\"`);\n } else if (count > 1) {\n report(\n `Group \"${group.id}\" is listed ${count} times as a group child in section \"${sectionKey}\"`\n );\n }\n }\n};\n\nconst validateGraphRules: SuperRefinement<ContentStructureFileObject> = (file, ctx) => {\n validateSectionGraph(file.sections.collectionTypes.groups, 'collectionTypes', ctx);\n validateSectionGraph(file.sections.singleTypes.groups, 'singleTypes', ctx);\n};\n\nexport const contentStructureFileSchema = contentStructureFileObjectSchema\n .superRefine(uniqueGroupIdsAcrossFile)\n .superRefine(validateGraphRules);\n"],"names":["CONTENT_TYPE_UID_REGEX","CONTROL_CHARS_REGEX","ANSI_ESCAPE_REGEX","GROUP_NAME_MAX_LENGTH","MAX_FOLDER_DEPTH","groupIdSchema","z","string","min","groupNameSchema","max","refine","value","trim","length","test","contentStructureChildSchema","discriminatedUnion","object","uid","regex","type","literal","id","contentStructureGroupSchema","children","array","parent","nullable","name","contentStructureSectionSchema","groups","contentStructureFileObjectSchema","version","sections","collectionTypes","singleTypes","uniqueGroupIdsAcrossFile","file","ctx","seen","Set","section","group","has","addIssue","message","code","ZodIssueCode","custom","path","add","validateSectionGraph","sectionKey","byId","Map","map","report","siblingNames","toLowerCase","get","where","set","chain","current","depth","broken","groupChildCount","seenUids","child","target","count","validateGraphRules","contentStructureFileSchema","superRefine"],"mappings":";;AAEA,MAAMA,sBAAAA,GAAyB,yDAAA;AAE/B;AACA,MAAMC,mBAAAA,GAAsB,sBAAA;AAC5B;AACA,MAAMC,iBAAAA,GAAoB,uBAAA;AAE1B,MAAMC,qBAAAA,GAAwB,GAAA;AAC9B,MAAMC,gBAAAA,GAAmB,CAAA;AAEzB,MAAMC,gBAAgBC,CAAAA,CAAEC,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,EAAG,4BAAA,CAAA;AAExC,MAAMC,eAAAA,GAAkBH,CAAAA,CACrBC,MAAM,EAAA,CACNC,GAAG,CAAC,CAAA,EAAG,8BAAA,CAAA,CACPE,GAAG,CAACP,qBAAAA,EAAuB,CAAC,2BAA2B,EAAEA,qBAAAA,CAAsB,WAAW,CAAC,CAAA,CAC3FQ,MAAM,CAAC,CAACC,KAAAA,G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,GAAAA,CAAAA;AACxE,CAAA;AAEO,MAAMkC,6BAA6BzC,gCAAAA,CACvC0C,WAAW,CAACrC,wBAAAA,CAAAA,CACZqC,WAAW,CAACF,kBAAAA;;;;"}
|
|
@@ -104,10 +104,4 @@ export interface ContextDelegatedResponseSuccessMethods {
|
|
|
104
104
|
/** 204 | 200 */
|
|
105
105
|
deleted(response?: unknown): void;
|
|
106
106
|
}
|
|
107
|
-
declare module 'koa' {
|
|
108
|
-
interface DefaultContextDelegatedResponse extends ContextDelegatedResponseErrorMethods, ContextDelegatedResponseSuccessMethods {
|
|
109
|
-
}
|
|
110
|
-
interface BaseResponse extends ContextDelegatedResponseErrorMethods, ContextDelegatedResponseSuccessMethods {
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
107
|
//# sourceMappingURL=koa-methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koa-methods.d.ts","sourceRoot":"","sources":["../../../src/services/server/koa-methods.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,UAAU,EAAE,MAAM,oCAAoC,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAiB,kBAAkB,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAYjE;AAED,MAAM,WAAW,oCAAoC;IACnD,sBAAsB;IACtB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,uBAAuB;IACvB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,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