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 →

@neoimpulse/cap-js-trim

A CAP plugin that strips whitespace from string elements on write, driven by a @cds.trim annotation on an entity or on single elements.

Facts

Latestv1.2.4ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
Value normalisationCAPValue normalisationcapabilityMaking stored values consistent regardless of how they were typed — trimming the padding, fixing the case — declared on the model rather than repeated in every handler that writes.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds≥ 9@sap/cdsartifactThe peer range, as published.

Who is behind it

neoimpulse GmbHneoimpulse GmbHOrganisationMaintains this
In the atlas: maintains 7
@neoimpulseGmbH
maintainerpatimwepneoPersonContributes to this
In the atlas: contributes to 1
@patimwepneo
1 contributor

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
>=9
Distributed through
npm

Connections1

@neoimpulse/cap-js-trim connections@neoimpulse/cap-js-trimPROVIDES→ provides1provides authoredValue normalisation

Install

npm add @neoimpulse/cap-js-trim

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

README

quoted from neoimpulseGmbH/cap-js-trim under Apache-2.0, read
neoimpulseGmbH/cap-js-trim/README.mdOn GitHub

CDS Trim Plugin

This plugin for the SAP Cloud Application Programming Model (CAP) automatically trims string attributes. The trim logic is applied based on annotations either on the entire entity or specific attributes.

Features

  • Automatically trims all string attributes for entities annotated with @cds.trim.
  • Trims specific string attributes annotated with @cds.trim.

Installation

To install the plugin, add it to your CAP project.

npm install cds-trim-plugin

Usage

  1. Annotate Your Model

    Add the @cds.trim annotation to your entities or specific attributes that should be trimmed.

    namespace my.bookshop;
    
    entity Books {
        key ID : Integer;
        title  : String @cds.trim;
        author : String @cds.trim;
    }
    
    entity Authors @cds.trim {
        key ID : Integer;
        name  : String;
    }
    

How It Works

The plugin scans all services and entities for the @cds.trim annotation. If an entity or its attributes are annotated, the plugin will automatically trim whitespace from string attributes before CREATE, UPDATE, and PATCH operations.

const cds = require("@sap/cds");

cds.once("served", () => {
    for (let srv of cds.services) {
        if (!(srv instanceof cds.ApplicationService)) continue;
        for (let entity of srv.entities) {
            if (entity["@cds.trim"]) {
                srv.before(["CREATE", "UPDATE", "PATCH"], entity, (req) => {
                    for (const key in req.data) {
                        if (
                            req.data[key] &&
                            req.data[key] !== null &&
                            typeof req.data[key] === "string" &&
                            req.data[key] !== ""
                        ) {
                            req.data[key] = req.data[key].trim();
                        }
                    }
                });
            } else {
                for (const key in entity.elements) {
                    const element = entity.elements[key];
                    if (element.type === "cds.String" && element["@cds.trim"]) {
                        srv.before(["CREATE", "UPDATE", "PATCH"], entity, (req) => {
                            if (req.data[key] && typeof req.data[key] === "string" && req.data[key] !== "") {
                                req.data[key] = req.data[key].trim();
                            }
                        });
                    }
                }
            }
        }
    }
});

License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Thanks to the SAP CAP community for their support and contributions.

Apache-2.0, read

History

Latest

v1.2.4

Notes
Bug Fixes
  1. v1.2.3

    Notes
    Bug Fixes
  2. v1.2.2

    Notes
    Bug Fixes
    • missing draft entity condition (97fd7f4)
  3. v1.2.1

    Notes
    Bug Fixes
    • missing draft entity condition (ebde614)
  4. v1.2.0

    Notes
    Bug Fixes
    Features
  5. v1.1.0

    Notes
    Features
    • downgrade cap version to 7 (add10eb)
    • downgrade cap version to 7 (dab7c0c)
  6. v1.0.2

  7. v1.0.0

    Notes
    Features
64downloads per week, npm
Weekly downloads for @neoimpulse/cap-js-trim26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 64.27 Apr – 3 May: 2284 May – 10 May: 8811 May – 17 May: 10418 May – 24 May: 8325 May – 31 May: 821 Jun – 7 Jun: 358 Jun – 14 Jun: 4715 Jun – 21 Jun: 8822 Jun – 28 Jun: 9529 Jun – 5 Jul: 756 Jul – 12 Jul: 7813 Jul – 19 Jul: 6520 Jul – 26 Jul: 10927 Jul – 2 Aug: 533 Aug – 9 Aug: 6810 Aug – 16 Aug: 7017 Aug – 23 Aug: 5724 Aug – 30 Aug: 5231 Aug – 6 Sept: 627 Sept – 13 Sept: 6414 Sept – 20 Sept: 3721 Sept – 27 Sept: 10428 Sept – 4 Oct: 655 Oct – 11 Oct: 9012 Oct – 18 Oct: 10119 Oct – 25 Oct: 64
Value normalisation
  1. @neoimpulse/cap-js-uppercaseCAP plugin uppercasing strings on write via @cds.uppercasefrom CAP

Details

Sources5
npm registrydiscovered here, cds-pluginchecked
npm registrydiscovered here, @cap-jschecked
npm registry, @neoimpulse/cap-js-trimversion, releases, installschecked
github.com/git+https://github.com/neoimpulseGmbH/cap-js-trim.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>=9
latestv1.2.4
first release
releases and cadence7, ~181d median
discovered vianpm registry · cds-plugin, npm registry · @cap-js
first seen in the atlas
ecosystem and domaincap, data-and-persistence
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:neoimpulse-cap-js-trim
JSON
/artifacts/neoimpulse-cap-js-trim.json
MCP
Connecting an agent