CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

cds-numberrange-plugin

A CAP plugin that fills an annotated CDS element with the next number from a named range, optionally with prefix, suffix and padding, keeping the counter in a database entity it adds to the model.

The field in question is the one a business user reads as a document number: an integer that counts up, optionally carrying a prefix or a suffix and padded to a fixed width with a character you choose. A range is declared under cds in package.json with a name, a start value and an increment, and the @plugin.numberrange.rangeid annotation on an element names the range it draws from. The counter is a row in plugin.numberrange.Ranges, an entity the plugin adds to your model and exposes as a projection in its own NumberRangePluginService, so the current value is readable from the service. createOnDraft decides whether a draft entity takes its number while it is still a draft or on activation, and the README notes that key fields must be configured in draft mode. Samples cover SQLite in memory, persistent SQLite and SAP HANA; testing with PostgreSQL is still on the README's list of work to do, and the README asks that fields the plugin fills are never edited by hand.

Facts

Latestv1.0.2ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Data modellingCAPData modellingcapabilityDefining the shape of data before anything serves it: entities and their types, how they relate, and the projections and views that services and applications consume.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds≥ 8@sap/cdsartifactThe peer range, as published.

Who is behind it

Abdulbasıt GülşenAbdulbasıt GülşenPersonMaintains this
In the atlas: maintains 1, contributes to 1
@abdulbasitg
maintainer

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
Independently maintained
Runtime
Node.js

As a CDS plugin

Declared for
>=8
Distributed through
npm

Connections1

cds-numberrange-plugin connectionscds-numberrange-pluginPROVIDES→ provides1provides authoredData modelling

Install

npm add cds-numberrange-plugin

Derived from the package name. No recipe recorded; the README has the configuration.

Learn more1

Readings
  1. A CAP Plugin for Flexible Number Range Management: cds-numberrange-pluginabdulbasit, SAP Community

README

quoted from abdulbasitg/cds-numberrange-plugin under MIT, read
abdulbasitg/cds-numberrange-plugin/README.mdOn GitHub

cds-numberrange-plugin

This is a plugin for CAP framework to let you easily add database ranges into your applications.

Features

You can use this plugin to add auto-incremented fields into your database. There are different options to format the auto-incrementation:

  • Basic Configuration allows you configure integer fields starting from specific number and increment by configured number.
  • It is also possible to format the generated number with prefix, suffix characters and also pad the generated number with a 0 or any other characters.

Usage

Installing plugin with npm install

npm install cds-numberrange-plugin

In your package.json file, add the following part into the CDS node:

    "cds": {
      "cds-numberrange-plugin": {
        "ranges": [
          {
            "name": "<RANGE NAME>",
            "start": 1,
            "increment": 1,
            "createOnDraft": true,
            "additionalProperties": {
              "prefix": "P",
              "suffix": "S",
              "padCount": 10,
              "padValue": "0"
            }
          }
        ]
      }   
    }

Then, you can annotate your fields in your database schema with special @plugin.numberrange.rangeid annotation.

annotate <ENTITY> with {
  <FIELD> @plugin.numberrange.rangeid: '<RANGE NAME>';  
}

This annotation make this field automatically filled with range format configured in your package.json file.

Parameters:

  • name: (Required) Range Name created in the database.
  • start: (Required) Start index value for the range.
  • increment: (Required) Increment value every time new value is created.
  • createOnDraft: (Optional) true or false - Whether the next value is retrieved during draft creation or not.
  • additionalProperties: (Optional) This part can be used to have additional features to create string based formatted values.
    • prefix: You and add prefix characters into the generated range number.
    • suffix: You can add suffix characters into the generated range number.
    • padCount: You can pad generated range number with a special character.
    • padValue: This parameter specifies the character to be used for padding.

Samples

samples/sample-01-sqlite-in-memory

This samples demonstrates the plugin in sqlite-in-memory database with different configuration options.

samples/sample-02-sqlite-persistent

This samples demonstrates the plugin in sqlite persistent database with different configuration options.

samples/sample-03-hana

This samples demonstrates the plugin in SAP HANA database with different configuration options.

samples/sample-04-draft

This sample demonstrates the plugin with draft activated entities. You can configure your ranges to be created either in draft mode or after draft activation. Keep in mind that key fields must be configured in draft mode.

Remarks

  • Make sure you don't modify manually the field values that has been configured to use the plugin.

TODO

  • Test with PostgreSQL
MIT, read

History

Latest

v1.0.2

Fixes 1, Other 1

Notes
Fixed
  • Add db-level locking for sequence increment operations to prevent race conditions (#15)
Chore
  • Added GitHub spec-kit specifications (#14)
  1. v1.0.1

    Fixes 2

    Notes
    Fixed
    • Minor enhancements (#6)
    • Documentation updates and fixes (#5)
  2. v1.0.0

    Features 5

    Notes
    Added
    • Initial release of cds-numberrange-plugin
    • Database-agnostic number range management for CAP framework
    • Support for SQLite and SAP HANA databases
    • Configurable prefix, suffix, padding, and increment options
    • Draft and active creation modes
66downloads per week, npm
Weekly downloads for cds-numberrange-plugin26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 66.20 Apr – 26 Apr: 32027 Apr – 3 May: 5134 May – 10 May: 42811 May – 17 May: 37318 May – 24 May: 28725 May – 31 May: 2031 Jun – 7 Jun: 2078 Jun – 14 Jun: 29115 Jun – 21 Jun: 20122 Jun – 28 Jun: 22229 Jun – 5 Jul: 2516 Jul – 12 Jul: 22213 Jul – 19 Jul: 30920 Jul – 26 Jul: 15327 Jul – 2 Aug: 2073 Aug – 9 Aug: 19010 Aug – 16 Aug: 16517 Aug – 23 Aug: 21624 Aug – 30 Aug: 23131 Aug – 6 Sept: 1137 Sept – 13 Sept: 4314 Sept – 20 Sept: 16021 Sept – 27 Sept: 21128 Sept – 4 Oct: 955 Oct – 11 Oct: 17412 Oct – 18 Oct: 66
Data modelling
  1. com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
  2. @sap/cds-common-contentISO content for CAP's countries, languages, currencies and timezones
  3. @sap/cds-compilerCompiler from CDS models to CSN, EDMX and database schemas
  4. @sap/cdsCAP Node.js runtime
  5. cap-user-infoUser details and quickview links for createdBy and modifiedBy

Details

Sources4
SAP Communitydiscovered here, cap-tagchecked
npm registry, cds-numberrange-pluginversion, releases, installschecked
github.com/git+https://github.com/abdulbasitg/cds-numberrange-plugin.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
declared for>=8
latestv1.0.2
first release
releases and cadence3, ~315d median
discovered viaSAP Community · cap-tag
first seen in the atlas
ecosystem and domaincap, data-and-persistence
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:abdulbasitg-cds-numberrange-plugin
JSON
/artifacts/abdulbasitg-cds-numberrange-plugin.json
MCP
Connecting an agent