Migration
Payload Operations 0.1.0 is the initial release. This page describes migration from project-owned custom endpoints; use the package changelog for later version-specific changes.
Incremental migration
Section titled “Incremental migration”- Select one POST workflow with JSON input and output.
- Write Zod input, output, and declared business-error schemas.
- Place the contract in a module shared by server and client.
- Move endpoint logic into the matching handler leaf.
- Express public or special access as the narrowest override.
- Register generated endpoints while retaining the old route.
- Switch one consumer to
cms.operations. - Compare status, wire JSON, access, CORS, and failure behavior before removing the old route.
// Beforeawait fetch("/api/custom/reserve", { method: "POST", body: JSON.stringify(input),});
// Afterawait cms.operations.inventory.reserve(input);Compatibility cautions
Section titled “Compatibility cautions”Do not copy transformed Zod output into handler return types. The handler owns the wire input shape; the client owns final output parsing. Preserve request-scoped Local API calls with req and overrideAccess: false.
If an old endpoint uses uploads, streaming, non-POST methods, custom serialization, or transaction middleware, it is outside this package’s contract. Keep that endpoint native.
Rollback
Section titled “Rollback”Keep the previous route available until all consumers use the generated operation. Rollback means restoring the old client call and endpoint registration; this package performs no database migration or stored-data rewrite.