Adds parentage tracking to a Payload collection, in three modes: managed collections, standard fields added to yours, or mapping to your own fields. Writes are checked for self-parents, duplicates and cycles, and reads respect access control by hiding private relatives. It exposes pedigree, relatives and validate endpoints and adds an Admin pedigree panel. Requires Payload 3.92 to 3.94 and React 19 or later, and is licensed for noncommercial use.
OnePedigree for Payload: parentage fields, cycle-safe parentage writes, deletion policies, permission-aware pedigree endpoints for all 13 views, and Admin previews.
Installation
npm i @extantape/payload-plugin-onepedigree0
Stars
0
Forks
4
Open Issues
Yesterday
Last Updated
915
Weekly Downloads
v0.1.0-alpha.27
npm Version
227.3 KB
Unpacked Size
2
Dependencies
00 since Oct 25
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
Shared by 2 plugins in ExtantApe/OnePedigree.
961+961 since Nov 2
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 961 |
| Dec 4, 2026 | 1,284 |
| Dec 3, 2026 | 1,303 |
| Dec 2, 2026 | 1,289 |
| Dec 1, 2026 | 827 |
| Nov 30, 2026 | 691 |
| Nov 29, 2026 | 758 |
| Nov 28, 2026 | 698 |
| Nov 27, 2026 | 325 |
| Nov 26, 2026 | 271 |
| Nov 25, 2026 | 232 |
| Nov 24, 2026 | 189 |
| Nov 23, 2026 | 319 |
| Nov 22, 2026 | 212 |
| Nov 21, 2026 | 208 |
| Nov 20, 2026 | 205 |
| Nov 19, 2026 | 200 |
| Nov 18, 2026 | 194 |
| Nov 17, 2026 | 180 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 926 |
| Nov 14, 2026 | 1,063 |
| Nov 13, 2026 | 1,064 |
| Nov 12, 2026 | 1,470 |
| Nov 11, 2026 | 993 |
| Nov 10, 2026 | 1,132 |
| Nov 9, 2026 | 1,693 |
| Nov 8, 2026 | 1,614 |
| Nov 7, 2026 | 1,431 |
| Nov 6, 2026 | 1,389 |
| Nov 5, 2026 | 865 |
| Nov 4, 2026 | 796 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1440463679-payload)<a href="https://payloaddirectory.dev/plugins/1440463679-payload"><img src="https://payloaddirectory.dev/badge/1440463679-payload.svg" alt="Payload Directory"></a>README
OnePedigree for Payload CMS 3: parentage on your own collection, cycle-safe writes, deletion policies, permission-aware pedigree endpoints for all 13 views, and Admin components (pedigree preview, relatives, color theme settings).
import { onePedigree } from '@extantape/payload-plugin-onepedigree'
export default buildConfig({
collections: [Animals, Clutches],
plugins: [
onePedigree({
collection: 'animals',
mode: 'standard-fields', // or 'managed' (creates the collections) or 'mapped' (your fields)
cohorts: { collection: 'clutches' },
hiddenRecords: 'placeholder', // a private relative shows as an anonymous "private record"
navigation: { individualUrl: '/animals/{id}' },
}),
],
})
fields.identifier shows a host identifier after each name in every view, relatives list and
spoken name, e.g. "Mead (REG-AQCR6T)". Give a field path, or a function of the requester so each
person can choose, for example a registry ID or their own studbook number:
fields: { identifier: ({ user }) => (user?.showStudbook ? 'studbookNo' : 'coId') }
A record the requester can't read never shows its identifier: its placeholder carries none.
React's Terminology.identifierFormat (default {label} ({id})) changes how the two are joined.
managed: creates individuals-style and cohort collections from the factories
(createIndividualsCollection, createCohortsCollection).standard-fields (default): adds the parentage group (parents[{ individual, role, kind }],
reproductiveMode, cohort) to your existing collection.mapped: uses your fields, e.g. { kind: 'role-fields', roles: { mother: 'dam', father: 'sire' }, cohort: 'clutch' }
or { kind: 'parent-array', path: 'lineage', individualField: 'animal', roleField: 'role' }.
A row's kind is read from kindField (default kind); without one, every link is biological.Each parents row has an optional kind: empty means biological, or donor (a gamete donor, also genetic), surrogate, legal, adoptive or social (add your own
with kinds). Only biological links count for siblings, relatedness and genetics; the others, such as a foster dam,
are shown dotted and labelled. The Mother/Father pickers edit only the biological rows.
The plugin never creates collections for parents, roles, modes, graph edges or occurrences.
Stored roles stay mother / father; only the words change. terminology.parents sets the
default ('mother-father' (default), 'dam-sire', 'female-male-parent', or custom
{ maternal, paternal }). Add createParentTermsPreferenceField() to your users collection
and pass its path as terminology.userPreference: each user then sees their own choice in the
Mother/Father pickers and in relatives.
A cohort is one birthing event (a clutch, a litter, twins): one mother, fathers may differ per
member. With cohorts.birthParentField (the cohort's field naming the mother), a member whose
recorded mother differs is refused, and so is changing the cohort's mother while members disagree.
These checks compare only records the requester can read. Server code with access overridden is
checked against all records. A save by an editor with limited read access can therefore leave a
member's mother and the cohort's birthing parent different; if your data must always agree, check
it in trusted server code, or with cohorts.confirmWrite (below). A birthing parent the requester can't read comes back from cohort reads
as { "private": true } (null in GraphQL; with hiddenRecords: 'omit' it is left out of the record) and is kept as stored
when they save the cohort. They can't change or remove it, and a cohort can't be saved with a new
birthing parent the editor can't read.
cohorts.confirmWrite is an optional hook for that last check, on writes the plugin could only
check against what the requester can read. With birthParentField set and access control on, the
plugin calls it after its own checks pass, for:
Drafts, bulk updates, duplicates and version restores are included. When it is asked never depends
on a stored value the requester can't read, and neither do its arguments: id and cohort name
only records the requester can read, and are null otherwise. Its answer must not depend on what
they can read either.
For an individual, the hook is asked once for each cohort the requester can read that the record
will be in, in any locale. A locale: 'all' write can put a record in a different cohort per
locale, and a duplicate copies the cohorts of every locale, so one write can mean several calls,
each with one cohort. Every call must answer true. cohort is null only when the record will
be in no cohort the requester can read, and in that case the hook is asked once. A write naming
more than 32 readable cohorts, a value nested too deep to read, or a value the database can't look
up as a cohort ID, is refused without asking. A cohort that doesn't exist is left out the same way
as one the requester can't read. Treat
cohort: null as "no cohort this requester can see", never as permission to join any cohort. Only a return value of exactly true lets the write go ahead. Anything else, a throw, a
rejected promise or no answer within cohorts.confirmWriteTimeout milliseconds (default 10000)
refuses it with one message, This change to a birthing event (cohort) was not confirmed, so it can’t be saved., and the error itself isn't shown. The time limit only stops the write waiting;
the plugin can't stop the hook itself. A hook that answers after the time limit and then writes on
req still commits that write, even though the request it was asked about was refused. It gets
the write's own req (same user and transaction), so it can read with overrideAccess: true on
that req. It should only read. In a bulk update,
anything it writes on that req stays written even when the document it was asked about is
refused, so don't rely on rollback.
cohorts: {
collection: 'clutches',
birthParentField: 'mother',
confirmWriteTimeout: 5000,
// kind: 'member' | 'birthParent'; operation: 'create' | 'update' | 'validate'
// id: the individual or the cohort; cohort: the cohort. Null when new, none, or not readable.
confirmWrite: async ({ req, kind, operation, id, cohort }) => myBirthingRules(req, { kind, operation, id, cohort }),
},
Trusted operations (overrideAccess: true) never call it, and without it nothing changes. It isn't
called for deletes, for an update that changes none of the fields above (a rename, say), for a
cohort created without a birthing parent, or when the plugin's own checks already refused the
write.
A member's cohort follows the same rules with access control on. A new or different cohort must be
one the editor can read; one they can't read gets the same message as one that doesn't exist
(UNRESOLVED_COHORT). The cohort already stored on the record is kept on save. A cohort the
requester can't read comes back from individual reads, version
reads included, as { "private": true } (null in GraphQL; with hiddenRecords: 'omit' it is left out of the record).
Relatives and pedigree responses show no cohort for that member, and the cohort view treats a
cohortId they can't read as no cohort. When that editor saves the member, the stored cohort is
kept; they can't change or remove it. If the cohorts collection's read access throws, the cohort
counts as unreadable. Imports that run with access control on can only link cohorts the importer
can read. Server code that needs the stored ID should read with trusted access or
withStoredParents.
With hiddenRecords: 'omit', a cohort the editor can't read is left out of the record, like no cohort at all,
but it is still stored and kept. Setting a different cohort on that member, or restoring a version
that would change it, is refused for that editor. Give them read access to the cohort, make the
change in trusted server code, or use hiddenRecords: 'placeholder' so they can see a cohort is
set.
With access control on, every parent field, parent row, picker, cohort and cohort birthing parent
in a create or update takes one of these: an ID, a populated document with an id, null, or the
{ "private": true } placeholder. Any other shape (an array, { id: [...] }, an object without an
id, a value nested more than 16 levels deep) is refused with the same message as a record that
doesn't exist. Each new reference must name a record the editor can read. This covers every way
in: create, update, bulk update, duplicate, drafts, autosave, REST, GraphQL and the Admin, and
with locale: 'all' each locale's value is checked on its own. A reference already stored on the
record is kept at its own field and locale. An editor who can't read it can't move it to another
field, picker or locale; that gets the same answer as a record that doesn't exist. Parent rows can
still be reordered or removed.
To keep a stored reference the editor can't read, leave it out of the write or send the
placeholder or an empty value. A parent row that names no parent but keeps its stored row id
also keeps that row as stored. Sending the stored ID itself back is refused. A parent row naming
it is refused. The validate endpoint answers the same way for the cohort already stored on the
record.
Your own beforeValidate hooks on these collections run before the plugin's. When an editor who
can't read a stored reference leaves it out of a write, the plugin still checks the write after
your hooks have run: if a hook cleared or removed that reference it is put back as stored, if a
hook replaced it the write is refused, and a parent row a hook changed or removed is kept as stored
alongside whatever the hook wrote. Parent rows the editor left out stay as stored in the locale
being written, including when a hook removes the parentage group, sets it to null or removes its
rows. To change such a reference from a hook, make that change in trusted server code instead.
Have your hooks edit parent rows and parent fields only when they need to. A hook that rewrites them on every write will have some saves refused, for records that store a parent the editor can't read.
A version restore (restoreVersion or the Admin) is checked in every locale against what its
user can read, with access control on or off. A value that user can't read comes back only where
it is still stored, at the same field and locale; otherwise the restore is refused with the same
answer as a record that doesn't exist. A restoreVersion call with overrideAccess: true and no
user can read nothing, so it is checked the same way and can bring back only references still
stored.
Give each restore its own req. If two restores of the same record run at once on one shared
req, both may be refused, or one may be refused because its version couldn't be checked while
the other goes through after the full check. A restore whose version couldn't be checked is always
refused. After a restore fails, a later restore of that record on the same req may be refused
too, so try again with a fresh request.
To restore such a version anyway, do it in trusted code: read the version with locale: 'all' and
write its values back:
const { parent, version } = await payload.findVersionByID({ collection: 'animals', id: versionId, locale: 'all', depth: 0 })
await payload.update({
collection: 'animals',
id: parent,
data: { dam: version.dam, sire: version.sire, clutch: version.clutch },
locale: 'all',
overrideAccess: true,
})
Duplicating a record with access control on copies only the parents, parent rows, cohort and birthing parent the requester can read. Trusted duplicates copy everything.
The plugin's request markers live under private keys. Values a caller puts in context under the
plugin's names (onepedigreeOverrideAccess, onepedigreeRawParents and the cache names) are
ignored; trusted code passes overrideAccess: true or uses withStoredParents.
onepedigreeInternal skips the parentage checks only on a trusted operation (overrideAccess: true). With access control on it switches nothing off.
These rules apply whenever access control is on (REST, GraphQL, the Admin, and the Local API with
overrideAccess: false). Trusted Local API calls are unaffected. They cover every collection in
the host, including paths that reach a parent field through relationships (animal.dam,
animal.clutch.mother) and joins, on find, count, versions, distinct values, and bulk update and
delete. A refused query gets a 400.
dam.name, clutch.name,
clutch.mother). This holds for every requester with access control on, including one who can
read that parent. To find individuals by birthing parent, query the cohorts first
(where[mother][in]=<ids>), then the individuals by those cohort IDs (where[clutch][in]=<ids>).equals, in, not_equals and not_in work when the requester can read every ID given (every
parent, or every cohort). Other operators are refused, in counts and version queries too.exists and empty values work only with hiddenRecords: 'placeholder'.parents rows array and every field in a
row, including role and id.where nested
deeper than 32 levels, an unknown join name, and an object under a relationship other than
Payload's nested contains or a plain { relationTo, value } reference.Only relationship paths are covered. If you also store a parent ID in a text or JSON field, restrict it in your own access rules.
A global that refers to individuals or cohorts (directly, or through relationship, upload or join
fields) allows version reads only to requesters who can read every individual. This includes the
version history in the Admin. If others need it, read the versions in your own server code and
return what they may see. Other globals keep your readVersions rule.
~3.92.1 || ~3.93.0 || ~3.94.2), and the same range of @payloadcms/ui
if you use it. The range widens one minor version at a time, after the tests pass on it. On
3.94.2, Payload itself needs Next.js 16.4.5 or later on the 16 line.allowAdditionalKeys unset (or false) in mongooseAdapter(). With it on,
Payload refuses to start or to answer queries.cohorts.managed.beforeOperation and afterOperation hooks on those two collections in their order. Without them, writes and
restores are refused where they should go through.afterRead hooks you add to those two collections on the requester's access. Don't read the
record again with overrideAccess: true and return that result.The plugin wraps the database adapter, the key-value store (kv; Payload's default one if you set
none) and your email adapter if you have one, so it can check the running config. No database
change is needed. If the check fails, Payload refuses to start or refuses queries; the error or
your plugin order shows what to fix. If a later plugin replaces the adapter and you start with
onInit off, the first query or Admin permissions request may be refused once; retry it.
On every write (Admin, REST, GraphQL, Local API, imports):
PARENT_IS_DESCENDANT);rules (e.g. taxonomy) run on the proposed record;The pedigree endpoint's revision is a fingerprint of what that requester received. It changes
when their view changes and only then, so use it as a cache key and compare it for equality only.
Deleting a recorded parent is refused (onReferencedIndividualDelete: 'restrict', default) or
removes the references ('detach').
| Route | |
|---|---|
GET /api/<collection>/:id/pedigree?view=… | Projection + layout; ancestorDepth, descendantDepth, relatedId, cohortId, occurrenceMode, includeSiblings, orientation, maxNodes, layout=false |
GET /api/<collection>/:id/relatives | Parents, offspring, siblings (full / partial / unresolved), cohort mates |
POST /api/<collection>/:id/pedigree/validate | Check { parents, reproductiveMode, cohort } without saving (needs update access) |
GET /api/<cohorts>/:id/members | Members the requester may see |
Every read runs as the requester (access control applies), is bounded by limits
(maxDepth, maxNodes) and returns display projections, not documents. A parent the requester
cannot read is left out or shown as an anonymous placeholder.
The same holds for plain collection reads (REST, GraphQL, the Admin, and the Local API with
overrideAccess: false), single or list, at any depth. A parent the reader can't read comes back as
{ "private": true } with hiddenRecords: 'placeholder', or is left out of the record (the key is
absent) with 'omit'. In a locale: 'all' read of a localized field with 'omit', a hidden locale is
left out of the locale map, and a value hidden in every locale leaves no key. GraphQL returns null
for it. Trusted Local API reads (the default overrideAccess: true) are unchanged.
When someone saves a record that showed them a private parent, that parent is kept as stored: a
placeholder, an empty picker or a missing row means "unchanged", and replacing it with another
parent is refused. An update that carries the parentage group as something other than an object
(an array, a string, a number) is refused with a 400 for every record. The kept parent also passes the parent field's validation, which would
otherwise look it up with the editor's access whenever the field has filterOptions (as the
multi-tenant plugin adds); other values are validated as usual.
Add an index on the parent path (parentage.parents.individual, or your
role fields) in production; the standard fields declare it.
On its own: the plugin needs only Payload. It doesn't need OnePhylogeny, OneTaxonomy or any EXTANT APE Payload plugin.
Needs: Payload ~3.92.1 || ~3.93.0 || ~3.94.2 and React >=19 as peer dependencies, with @payloadcms/ui optional on the same Payload range. That covers Payload 3.92 and 3.93, and 3.94.2 or a later 3.94 release. A site on 3.95 or later can't install this version. No other EXTANT APE plugin is required.
Works with: no other plugin is wired to it yet.
Color Theory: no link yet. The Pedigree settings global keeps its own color presets for the pedigree view, set apart from Color Theory.
PolyForm Noncommercial 1.0.0. Free for noncommercial use, with attribution; commercial use needs a separate license from EXTANT APE. Versions published before this change remain under MIT.
studbook
Studbook numbering, kinship, inbreeding and gene diversity analysis with PMx export for managed animal populations
68947/wk0v3
payload plugin analytics
GA4-backed analytics dashboard in the Payload admin with a client-side tracking layer for Next.js front ends
70821/wk37v3
content freeze
Block create, update and delete on chosen collections and globals while a content freeze is active
85207/wk115v4
payload ai
AI text, image and voice generation for Payload fields and the Lexical editor with configurable providers
833.5k/wk568v3
payload media
Search stock images and videos from Unsplash, Pexels, Pixabay and Openverse inside the Payload admin
83900/wk8v4
payload plugin presets
Save and apply reusable block configurations as presets from the Payload admin blocks drawer
786.7k/wk37v3