Import instead of code: panel forms (steps, choice lists, dates), layout, page route, GEO routes, links, section fields

- Forms: step and checkboxGroup field types (radio, date on), server validation for them,
  useBuilderForm (logic) + BuilderForm (unstyled default) + RenderForm (/rsc: rich text,
  bound action, public part of the form only — the Emails tab never reaches the browser)
- Notifications: next / back / stepOf texts
- createContentHelpers: getSiteShell, getFormTexts, getLinkOptions, resolveLink, resolveNav,
  resolvePageRedirect, one-line route handlers (llms, llms-full, md, mcp, health, indexnow, manifest)
- /rsc: SiteProviders, createPageRoute, createNotFoundPage
- resolveLink / resolveNav / homeSlugFrom, buildSectionHeaderField / buildSectionSettingsField
- Dev sandbox frontend built on these imports; tests (unit + real Payload)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-16 11:32:46 +02:00
co-authored by Claude Opus 5.5
parent 0cfd846dd1
commit 412bf953a8
44 changed files with 2015 additions and 20 deletions
+35
View File
@@ -65,3 +65,38 @@ describe('form validation — injection and abuse', () => {
expect(await check({ count: ' 42 ' })).toMatchObject({ cleaned: { count: 42 }, ok: true })
})
})
describe('form validation — choice lists and dates', () => {
const { payload: p } = fakePayload({
forms: {
g: {
fields: [
{ name: 'services', blockType: 'checkboxGroup', maxSelected: 2, minSelected: 1, options: [{ value: 'www' }, { value: 'seo' }, { value: 'ads' }] },
{ name: 'size', blockType: 'radio', options: [{ value: 's' }, { value: 'l' }] },
{ name: 'deadline', blockType: 'date' },
{ blockType: 'step' },
],
},
},
})
const v = (data: Record<string, unknown>) => validateSubmission(p, 'g', data)
test('checkbox group: only configured values, deduplicated, within min/max', async () => {
expect(await v({ services: ['www', 'seo', 'www'] })).toMatchObject({ cleaned: { services: ['www', 'seo'] }, ok: true })
expect(await v({ services: ['www', '<b>x</b>'] })).toMatchObject({ field: 'services', kind: 'invalid_format' })
expect(await v({ services: ['www', 'seo', 'ads'] })).toMatchObject({ field: 'services', kind: 'invalid_format' })
expect(await v({ services: 'www' })).toMatchObject({ field: 'services', kind: 'invalid_format' })
expect(await v({ services: [{ $ne: 1 }] })).toMatchObject({ field: 'services', kind: 'invalid_format' })
})
test('radio accepts only its options; date must be a real date', async () => {
expect(await v({ deadline: '2026-11-30', size: 'l' })).toMatchObject({ cleaned: { deadline: '2026-11-30', size: 'l' }, ok: true })
expect(await v({ size: 'xl' })).toMatchObject({ field: 'size', kind: 'invalid_format' })
expect(await v({ deadline: 'jutro' })).toMatchObject({ field: 'deadline', kind: 'invalid_format' })
expect(await v({ deadline: '2026-13-45' })).toMatchObject({ field: 'deadline', kind: 'invalid_format' })
})
test('a Step block carries no value and is not an unknown field', async () => {
expect(await v({})).toMatchObject({ ok: true })
})
})