Fix /api/graphql 500: Site settings title separator values are GraphQL enum names

The titleSeparator select stored '|', '–', '-', '·', '/'. Select values become
GraphQL enum names; '|', '–', '·' are invalid and '-' and '/' collide on '_', so
every project's /api/graphql answered 500 since 1.0.1 (admin/REST unaffected).

- Values are now pipe/endash/hyphen/middot/slash (same labels); TITLE_SEPARATORS
  and titleSeparatorChar map them to the character; titles accept old characters
  and custom project values literally
- Field afterRead/beforeChange turn an old stored character into its name
- MongoDB: rewritten at start (migrateTitleSeparator); Postgres: titleSeparatorSql()
  for the generated migration (verified up/down/up against Postgres 16)
- Test builds the full plugin GraphQL schema and fails on invalid or duplicate
  enum names; unit tests for the mapping, hooks, SQL and Mongo rewrite
- CHANGELOG Unreleased (Fixed + upgrade step 5), seo.md, ipal-upgrade, api.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 12:06:55 +01:00
co-authored by Claude Opus 5.5
parent f57d089f55
commit bb10fb10fd
13 changed files with 385 additions and 9 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import type { TitleOrder } from './composeTitle.js'
import type { VerificationMetadata } from './searchSettings.js'
import { verificationFrom } from './searchSettings.js'
import { titleSeparatorChar } from './titleSeparator.js'
type SettingsShape = {
[key: string]: unknown
@@ -116,6 +117,6 @@ export async function readSiteMetaConfig({
// The panel stores '|'; titles need it padded.
homeSlug,
order: settings.titleOrder ?? undefined,
separator: settings.titleSeparator ? ` ${settings.titleSeparator} ` : undefined,
separator: titleSeparatorChar(settings.titleSeparator) ? ` ${titleSeparatorChar(settings.titleSeparator)} ` : undefined,
}
}