kfiross

payload default value gen

by kfiross
Databases & data
v3
^3.37.0
MIT

Overview

Summary generated from the README

Adds a plugin that lets you assign a custom default-value function to the ID of specific collections. Configure it in the plugins array with a map of collection slugs to generator functions, such as a UUID v7 generator or an auto-increment function. Requires Payload 3.37 or newer.

Features

  • Per-collection map of collection slug to default function
  • Use any custom generator, for example UUID v7
  • Auto-increment helper for numeric IDs
  • Registered through the Payload config plugins array

Use cases

  • Generate UUID v7 identifiers for documents in selected collections
  • Auto-increment numeric IDs when the Postgres adapter is set to use a different ID type

From the author

Generating default-value function (like uuid) plugin for Payload CMS

Installation

npm i payload-default-value-gen

3

Stars

0

Forks

0

Open Issues

1 years ago

Last Updated

30

Weekly Downloads

v2.0.1

npm Version

425.7 KB

Unpacked Size

0

Dependencies

GitHub stars

30 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20263
Dec 5, 20263
Dec 4, 20263
Dec 3, 20263
Dec 2, 20263
Dec 1, 20263
Nov 30, 20263
Nov 29, 20263
Nov 28, 20263
Nov 27, 20263
Nov 26, 20263
Nov 25, 20263
Nov 24, 20263
Nov 23, 20263
Nov 22, 20263
Nov 21, 20263
Nov 20, 20263
Nov 19, 20263
Nov 18, 20263
Nov 17, 20263
Nov 16, 20263
Nov 15, 20263
Nov 14, 20263
Nov 13, 20263
Nov 12, 20263
Nov 11, 20263
Nov 10, 20263
Nov 9, 20263
Nov 8, 20263
Nov 7, 20263
Nov 6, 20263
Nov 5, 20263
Nov 4, 20263
Nov 3, 20263
Nov 2, 20263
Nov 1, 20263
Oct 31, 20263
Oct 30, 20263
Oct 29, 20263
Oct 28, 20263
Oct 27, 20263
Oct 26, 20263
Oct 25, 20263
Oct 24, 20263
Oct 23, 20263
Oct 22, 20263
Oct 21, 20263
Oct 20, 20263
Oct 19, 20263
Oct 18, 20263
Oct 17, 20263
Oct 16, 20263
Oct 15, 20263
Oct 14, 20263
Oct 13, 20263
Oct 12, 20263
Oct 11, 20263
Oct 10, 20263
Oct 9, 20263
Oct 8, 20263
Oct 7, 20263
Oct 6, 20263
Oct 5, 20263
Oct 4, 20263
Oct 3, 20263
Oct 2, 20263
Oct 1, 20263
Sep 30, 20263
Sep 29, 20263
Sep 28, 20263
Sep 27, 20263
Sep 26, 20263
Sep 25, 20263
Sep 24, 20263
Sep 23, 20263
Sep 22, 20263
Sep 21, 20263
Sep 20, 20263
Sep 19, 20263
Sep 18, 20263
Sep 17, 20263
Sep 16, 20263
Sep 15, 20263
Sep 14, 20263
Sep 13, 20263
Sep 12, 20263
Sep 11, 20263
Sep 10, 20263
Sep 9, 20263
Sep 8, 20263
Sep 7, 20263
npm weekly downloads

32−7 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202632
Dec 5, 20268
Dec 4, 20268
Dec 3, 20267
Dec 2, 20265
Dec 1, 20268
Nov 30, 202622
Nov 29, 202620
Nov 28, 202620
Nov 27, 202621
Nov 26, 202623
Nov 25, 202623
Nov 24, 202621
Nov 23, 20267
Nov 22, 20269
Nov 21, 202610
Nov 20, 202611
Nov 19, 202611
Nov 18, 202626
Nov 17, 202632
Nov 16, 202633
Nov 15, 202631
Nov 14, 202635
Nov 13, 202635
Nov 12, 202642
Nov 11, 202628
Nov 10, 202626
Nov 9, 202625
Nov 8, 202626
Nov 7, 202621
Nov 6, 202619
Nov 5, 202611
Nov 4, 20269
Nov 3, 20267
Nov 2, 202611
Nov 1, 202611
Oct 31, 202612
Oct 30, 202611
Oct 29, 202610
Oct 28, 202610
Oct 27, 202614
Oct 26, 202612
Oct 25, 202611
Oct 24, 202610
Oct 23, 202610
Oct 22, 202613
Oct 21, 202613
Oct 20, 20266
Oct 19, 20264
Oct 18, 20264
Oct 17, 20264
Oct 16, 20264
Oct 15, 20263
Oct 14, 20263
Oct 13, 20264
Oct 12, 20264
Oct 11, 20265
Oct 10, 20265
Oct 9, 20265
Oct 8, 20263
Oct 7, 20263
Oct 6, 20262
Oct 5, 20262
Oct 4, 20261
Oct 3, 20263
Oct 2, 20267
Oct 1, 20267
Sep 30, 20269
Sep 29, 202617
Sep 28, 202618
Sep 27, 202619
Sep 26, 202620
Sep 25, 202624
Sep 24, 202624
Sep 23, 202622
Sep 22, 202624
Sep 21, 202634
Sep 20, 202634
Sep 19, 202632
Sep 18, 202624
Sep 17, 202625
Sep 16, 202626
Sep 15, 202617
Sep 14, 20269
Sep 13, 20268
Sep 12, 20266
Sep 11, 202615
Sep 10, 202619
Sep 9, 202627
Sep 8, 202632
Sep 7, 202639

Each point is npm's rolling 7-day download count.

Health Score

35/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/954992946-root.svg)](https://payloaddirectory.dev/plugins/954992946-root)
HTML
<a href="https://payloaddirectory.dev/plugins/954992946-root"><img src="https://payloaddirectory.dev/badge/954992946-root.svg" alt="Payload Directory"></a>
Updated Nov 8, 2025Created Mar 25, 2025Published Nov 8, 2025

README

Generating default-value function Plugin

Plugin for Payload CMS, which enables generating custom default-value function (like uuid) for colletions

Usage

Under payload.config.ts:

export default buildConfig({
  // ..other payload configs
  plugins: [
    // ..other plugins
    genDefaultValueForIdPlugin({
      // collections is map colletion by CollectionSlug as keys, each one has it own defaultFunc
      collections: {
        municipalities: {
          // If collection's Id is numeric, you can use this as autoIncrement after new row created
          // especially good if you defined pgAdapter with `idType: uuid`
          defaultFunc: autoIncrementFunc,
        },
        items: {
          // You can use your custom generator, for exapmle
          defaultFunc: () => uuidv7(),
        }
    })
  ],
})

Similar plugins