IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft
- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms); past CHANGELOG entries and the proposals in docs/dev are not rewritten - AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames - iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required - env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup - skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were - reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
425fac14fb
commit
b91984fbcd
+17
-17
@@ -40,7 +40,7 @@ configuration (see below) or extend the plugin. Do NOT hard-code your own form.
|
||||
## Config (payload.config.ts)
|
||||
|
||||
```ts
|
||||
ipalKit({
|
||||
iapl({
|
||||
forms: {
|
||||
redirectRelationships: ['pages'], // a form can redirect to a Page
|
||||
// fields: { date: false, … }, // default: text, textarea, email, number, date,
|
||||
@@ -55,7 +55,7 @@ ipalKit({
|
||||
|---|---|---|
|
||||
| `adminGroup` | `'Forms'` | group in the panel; `false` = Payload's default; `admin.group` in overrides wins |
|
||||
| `attachments` | `false` | files on forms: adds the **File** field; a file is checked, e-mailed to the company and dropped — never stored ("Files" below) |
|
||||
| `fields` | see below | builder field types; `false` turns a type off, an object (block) replaces it; `true` = the default ipal block |
|
||||
| `fields` | see below | builder field types; `false` turns a type off, an object (block) replaces it; `true` = the default IAPL block |
|
||||
| `redirectRelationships` | — | collections a form can redirect to |
|
||||
| `formOverrides` / `formSubmissionOverrides` | — | collection overrides (`fields` as a function + any collection settings) |
|
||||
| `emailLayout` | `false` | nice emails + the Site settings → E-mails tab |
|
||||
@@ -84,7 +84,7 @@ import { RenderForm } from '@intecion/ipal-kit/rsc'
|
||||
- `form` — the relation from the block (depth ≥ 1; an ID or null → nothing renders),
|
||||
- `action` — `sendForm` from `createSubmitAction` (below), `texts` — `getFormTexts(locale)` from `lib/content`
|
||||
(Form messages → Form messages),
|
||||
- `classNames` — the **only** place for looks (`src/components/forms/formClasses.ts`, template in ipal-form);
|
||||
- `classNames` — the **only** place for looks (`src/components/forms/formClasses.ts`, template in iapl-form);
|
||||
the plugin has no styles at all. Keys: `form, progress, step, stepTitle, stepDescription, fields,
|
||||
field, fieldHalf, fieldFull, label, input, textarea, select, checkbox, checkboxLabel, choices,
|
||||
legend, choice, choiceInput, choiceLabel, message, error, formError, turnstile, actions, back,
|
||||
@@ -177,7 +177,7 @@ pass the raw form document to the browser.
|
||||
`stepIndex`, `total`, `isFirst/isLast`, `next()`, `back()`, `goTo(i)`, `submit`, `values`,
|
||||
`errors`, `errorMessage`, `isSubmitting`, `isSuccess`, `resultMessage`, `isFixed`, `getFieldProps`,
|
||||
`getInputProps`, `getTextareaProps`, `getSelectProps`, `getOptionProps`, `fieldId`, `errorId`,
|
||||
`TurnstileWidget`; for a File field `getFileProps`, `getFiles`, `removeFile`, `helpId`. Example: `ipal-form/resources/CustomForm.example.tsx`.
|
||||
`TurnstileWidget`; for a File field `getFileProps`, `getFiles`, `removeFile`, `helpId`. Example: `iapl-form/resources/CustomForm.example.tsx`.
|
||||
3. Pure logic (also on the server / in tests): `splitSteps`, `initialBuilderValues`,
|
||||
`validateBuilderFields`, `stepOfField`, `inputFields`, `visibleFields`, `autoCompleteFor` (autocomplete hint from the field's type and name),
|
||||
`fileFieldRules`, `fileFieldError`, `formatFileSize` (File field).
|
||||
@@ -194,7 +194,7 @@ records only the file's name, type and size and whether the mail server took the
|
||||
|
||||
```ts
|
||||
// payload.config.ts
|
||||
ipalKit({ forms: { attachments: true } }) // adds the File field to the form builder
|
||||
iapl({ forms: { attachments: true } }) // adds the File field to the form builder
|
||||
```
|
||||
|
||||
1. Turn the option on (above). Postgres / SQLite projects: `pnpm payload migrate:create` (new block and submission
|
||||
@@ -410,7 +410,7 @@ const f = useForm({ initialValues, validate, submitAction: sendForm.bind(null, f
|
||||
`submitForm` result: `{ success: true, submissionId }` or `{ success: false, reason, … }`
|
||||
(codes below). Options: `payload`, `formId`, `data` (required), `files`, `attemptKey` ("Files" above), `ip`, `locale`, `turnstileToken`,
|
||||
`maxPerMinute` (default 5, `0` turns it off; without `ip` — the shared `unknown-ip` bucket, below),
|
||||
`consentFieldName` (default from `ipalKit({ forms })`, then `'consent'`), `turnstileOnConfigError`
|
||||
`consentFieldName` (default from `iapl({ forms })`, then `'consent'`), `turnstileOnConfigError`
|
||||
(`'allow'` | `'reject'`, default `'allow'`), `turnstileHostnames` (see [turnstile.md](./turnstile.md)).
|
||||
|
||||
Simpler: `createSubmitAction({ getCachedPayload, headers })` from `/server` (section 1.9.1 below) —
|
||||
@@ -421,24 +421,24 @@ extra options: `clientIp`, `honeypotField`, `consentFieldName`, `maxPerMinute`,
|
||||
|
||||
`clientIp(req | headers, { header?, trustedProxies? })` (from `@intecion/ipal-kit`):
|
||||
|
||||
- **Pinned header** — `header` or the env **`IPAL_IP_HEADER`**: only that header is read (missing → empty
|
||||
- **Pinned header** — `header` or the env **`IAPL_IP_HEADER`**: only that header is read (missing → empty
|
||||
string). For `x-forwarded-for` it takes the `trustedProxies`-th entry (default 1) from the right.
|
||||
- **Not pinned** (default): it trusts **any** of the headers, in this order: `cf-connecting-ip`,
|
||||
`x-real-ip`, then `X-Forwarded-For` counted **from the right** (the client writes the left part itself). A client
|
||||
that reaches the app bypassing the proxy can therefore inject `cf-connecting-ip` /
|
||||
`x-real-ip` and dodge the limit. In production without `IPAL_IP_HEADER` there is a one-time warning in the log.
|
||||
Set e.g. `IPAL_IP_HEADER=cf-connecting-ip` behind Cloudflare, `x-forwarded-for` only behind Traefik/nginx.
|
||||
`x-real-ip` and dodge the limit. In production without `IAPL_IP_HEADER` there is a one-time warning in the log.
|
||||
Set e.g. `IAPL_IP_HEADER=cf-connecting-ip` behind Cloudflare, `x-forwarded-for` only behind Traefik/nginx.
|
||||
- No recognised IP → the shared bucket (below). The same `clientIp` option exists in `createSearchRoute`
|
||||
and `createMcpRoute`.
|
||||
|
||||
A missing IP (the proxy strips the header, a wrong `IPAL_IP_HEADER`) does **not** bypass the limit: such requests
|
||||
A missing IP (the proxy strips the header, a wrong `IAPL_IP_HEADER`) does **not** bypass the limit: such requests
|
||||
share one `unknown-ip` bucket with a ×20 limit (`UNKNOWN_IP_FACTOR`) — real
|
||||
visitors get through, a flood without the header does not. `setUnknownIpFactor(n)` (root, once at startup)
|
||||
changes the multiplier; `setUnknownIpFactor(0)` = the old behaviour (no limit), when a limiter sits in front.
|
||||
Without a pinned header the order
|
||||
`cf-connecting-ip` → `x-real-ip` → XFF stays (switching to XFF-only, from the right, would put every visitor
|
||||
behind Cloudflare into the bucket of the edge node) — that is why `IPAL_IP_HEADER` is mandatory in production
|
||||
(`ipalEnvRules({ ipHeader: true })`).
|
||||
behind Cloudflare into the bucket of the edge node) — that is why `IAPL_IP_HEADER` is mandatory in production
|
||||
(`iaplEnvRules({ ipHeader: true })`).
|
||||
|
||||
Limits are kept in memory by default, separately for each instance. Several instances
|
||||
→ a shared store (e.g. Redis) once at startup: `setRateLimitStore({ hit })`
|
||||
@@ -495,7 +495,7 @@ forms: { emailLayout: true } // optional: beforeEmail: (emails, args)
|
||||
a form needs beyond its own fields:
|
||||
|
||||
```ts
|
||||
ipalKit({
|
||||
iapl({
|
||||
forms: {
|
||||
redirectRelationships: ['pages'],
|
||||
formOverrides: {
|
||||
@@ -521,7 +521,7 @@ remove and reorder. Besides `fields` it accepts any collection settings
|
||||
then does it store. A flood dies before it touches the network or the database.
|
||||
|
||||
**REST is closed.** By default the form-builder lets anyone create submissions through
|
||||
`POST /api/form-submissions` — skipping all the gates below. ipal-kit
|
||||
`POST /api/form-submissions` — skipping all the gates below. IAPL
|
||||
sets `access.create` of the `form-submissions` collection to "logged-in users only"; the front end
|
||||
submits through `submitForm` (server action → Local API), so this does not affect it.
|
||||
A deliberately public REST (e.g. an external app) →
|
||||
@@ -634,7 +634,7 @@ export const sendForm = createSubmitAction({ getCachedPayload, headers, consentF
|
||||
// or: submitForm({ …, consentFieldName: 'zgoda' })
|
||||
```
|
||||
|
||||
Or once for the whole site: `ipalKit({ forms: { consentFieldName: 'zgoda' } })` — `submitForm`
|
||||
Or once for the whole site: `iapl({ forms: { consentFieldName: 'zgoda' } })` — `submitForm`
|
||||
reads it from `payload.config.custom.ipal` when the call does not pass one.
|
||||
|
||||
## Messages — resolveFormMessage (recommended)
|
||||
@@ -770,7 +770,7 @@ the analytics fields to the Forms collection:
|
||||
```ts
|
||||
// payload.config.ts
|
||||
import { buildFormAnalyticsFields } from '@intecion/ipal-kit'
|
||||
ipalKit({
|
||||
iapl({
|
||||
forms: {
|
||||
formOverrides: {
|
||||
fields: ({ defaultFields }) => [...defaultFields, ...buildFormAnalyticsFields()],
|
||||
@@ -823,7 +823,7 @@ filter it out on the client.
|
||||
`export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`headers` from
|
||||
`next/headers`, injected). Honeypot → `clientIp` → `submitForm` → text from Notifications;
|
||||
result `{ success, message, reason?, field? }`.
|
||||
- **Form seed** (`ipal-form/resources/seed-form.template.ts`): fields, confirmation, an email to the company
|
||||
- **Form seed** (`iapl-form/resources/seed-form.template.ts`): fields, confirmation, an email to the company
|
||||
(address from the panel) and a confirmation to the customer (`{{email}}`), every language, idempotent. Mandatory.
|
||||
- **Validation by the field type from the panel:** email = one address (no `a@x, b@y`, no CR/LF), select/radio
|
||||
only values from the panel, numbers, checkbox `true/false`, objects and arrays rejected, control
|
||||
|
||||
Reference in New Issue
Block a user