readVersions: readPublished(), as access.md showed, answered every version read with 500 on MongoDB, Postgres and SQLite: the rule returns the document's `_status` path, a version query runs on the versions collection where the status is `version._status` (SQL: "Cannot find field for path at _status"; MongoDB: TypeError in sanitizeQueryValue). Reported by a client project upgrading to 1.17.1. - readPublishedVersions(minimum): the version form, for readVersions. - readPublished() carries a symbol mark (READ_PUBLISHED); iapl() swaps it on readVersions of the collections and globals it sees (withVersionReadRules, exported for plugins listed after it). - Tests on the three adapters: the version list (REST, depth 0/2, Local API, GraphQL), one version by id, the count, a global, an explicit role; the 1.17.1 HTTP test now checks the status too. - access.md says where each rule goes; AGENT.md, iapl-collection and iapl-audit skills. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4.6 KiB
name, description
| name | description |
|---|---|
| iapl-collection | Decides whether something should be a Payload collection, a global, or a block, and builds a content collection the IAPL way (title, buildSlugField, SEO tab, buildNoindexField, trackSlugHistoryHook, revalidate hook, archive page from System pages, sitemap and routing via content option). Use when the user asks for a blog, news, products, portfolio, testimonials, authors, categories, or any new collection — and whenever you are about to create a file in src/collections. |
iapl-collection
IAPL first (hard rule, AGENT.md "IAPL first"): anything the plugin covers is built with the plugin's feature. It does not work or is not enough → report it with iapl-plugin-gap and wait for the owner's decision on that part; no hand-built replacement, no silent workaround. Code rules: AGENT.md "Code rules" (one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour).
Sources: node_modules/@intecion/ipal-kit/docs/agent/AGENT.md §5,
docs/content.md, docs/hooks.md, docs/seo.md.
1. Test (always, before any code)
Answer these 4 questions for the user — all must be YES:
- Is it a list of many records of the same type?
- Does each record have its own URL?
- Does the client explicitly require it?
- Does Payload not have it built in?
Any NO → it is not a collection:
- one set of data (company, menu, footer, settings) → global,
- part of a page (FAQ, hero, testimonials in a section) → block (iapl-block skill),
users→ the plugin injects it when the project has none; create your own collection with that slug only to add fields (it wins over the injected one; roles and 2FA attach to it).
Exception: a list without its own URLs managed separately (e.g. testimonials used in many
blocks) — a collection without wiring into content. Justify it in the plan.
2. Plan (write it, then go straight to code — AGENT.md §0a)
slug (camelCase, plural), fields, relations, whether it has URLs (archive), JSON-LD.
Record the "collection vs global vs block" decision in AGENTS.md → "Project decisions".
Ask only when the brief leaves a business question open (e.g. "do posts have authors?").
3. Code
src/collections/<Name>.ts:title(localized),buildSlugField({ from: 'title' }), SEO tab (plugin-seo),buildNoindexField(),trackSlugHistoryHook,buildRevalidateHook,setPublishedAtHook(dated entries), uploads viamedia, links viabuildLinkField(). Field names per AGENT.md §6.5. Panel (AGENT.md §6.5a):admin.useAsTitle,defaultColumns(3–4),admin.group: 'Content',labelsand every fieldlabelas{ en, pl }(rules:docs/dev/admin-ux.mdin the package), arrays withlabels+rowLabel(), settings in the sidebar.- With URLs: add it to
content.config.ts→{ slug, perPage }. No URL prefix in code — the editor assigns the archive page in Site settings (<slug>Archive). The plugin handles routing, sitemap, generateStaticParams, hreflang. With drafts (versions: { drafts: true }):access: { read: readPublished(), readVersions: readPublishedVersions() }(readPublishedis forread,readPublishedVersionsforreadVersions— the version list asks forversion._status) — Payload's openread: () => trueanswers?draft=truewith the draft over REST and GraphQL. Check:curl -i <site>/api/<slug>/<draft id>?draft=truewithout a session →404; the same with an editor's token → the draft;curl -s -o /dev/null -w '%{http_code}' <site>/api/<slug>/versions?limit=10without a session →200, never500. - Entry list = a block (EntriesList) with
getEntries; the entry page usesresolveRoute(typeentry); JSON-LD per seo.md (e.g. Article). - An auth collection for visitors (
auth: true: customers, members) only when the client requires it (AGENT.md §5 "A second auth collection"):admin: { user: 'users' }inbuildConfig,accesswithadminOrSelfIn('<slug>')for read / update and an explicitcreate, never inaccess.staffCollections. Its accounts pass none of the plugin's staff checks, and 2FA (setup required included) does not apply to them. Check: its token →403from/api/globals/site-integrationsand/api/form-submissions. pnpm generate:types,pnpm payload generate:importmap.- Postgres with migrations →
pnpm payload migrate:create.
4. Check
The iapl-audit skill. By hand: an entry in the panel → visible at /<locale>/<archive>/<slug>,
in the sitemap; changing the slug → 308 from the old address.