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-softdelete-plugin

A CAP plugin that turns DELETE into a flag on the record: annotated entities keep the row, record who deleted it and when, flag composition children with it, and drop out of reads.

A softdelete aspect adds isDeleted, deletedAt and deletedBy to an entity. On a service projection carrying @softdelete.enabled, DELETE becomes an UPDATE that sets the flag, composition children are flagged with their parent, and READ filters flagged rows out. Both parent and child projections need the annotation — the aspect on the persistence entity does not carry the behaviour into the service by itself.

Facts

Latestv1.0.2ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Soft deleteCAPSoft deletecapabilityDeleting a record without removing it — flagging the row, recording who deleted it and when, and keeping it out of reads. The question underneath is what DELETE should mean to a client that cannot tell the difference, and what happens to a composition tree when its root is flagged.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds≥ 9@sap/cdsartifactThe peer range, as published.

Who is behind it

Mio YasutakeMio YasutakePersonMaintains this
In the atlas: maintains 47, contributes to 47, wrote 10
@miyasuta
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 →
PracticalFunctional boundary

It changes what DELETE means for every client of the annotated projection, so anything that must actually remove a row — an erasure request, a retention job — has to go around it.

What it declares

Every artifact

Type
CDS plugin
Origin
Independently maintained
Runtime
Node.js

As a CDS plugin

Declared for
>=9
Distributed through
npm

Connections2

cds-softdelete-plugin connectionscds-softdelete-pluginFUNCTIONAL← alternative to1alternative to derivedcds-feature-softdelete→ provides1provides authoredSoft delete

Install

npm add cds-softdelete-plugin

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

README

quoted from miyasuta/cds-softdelete-plugin under MIT, read
miyasuta/cds-softdelete-plugin/README.mdOn GitHub

cds-softdelete-plugin

npm version npm downloads license GitHub tag

A plugin for implementing soft delete functionality in SAP Cloud Application Programming Model (CAP) applications.

What It Does

This plugin automatically converts DELETE operations to soft deletes (marking records as deleted instead of removing them) and filters out soft-deleted records from READ operations. When a parent entity is deleted, its composition children are automatically soft-deleted as well.

Installation

npm install cds-softdelete-plugin

Quick Start

1. Add the softdelete aspect to your entities
// db/schema.cds
using { softdelete } from 'cds-softdelete-plugin';

entity Orders: softdelete {
  key ID    : UUID;
      total : Decimal(9,2);
      items : Composition of many OrderItems on items.order = $self;
}

entity OrderItems: softdelete {
  key ID       : UUID;
      order    : Association to Orders;
      quantity : Integer;
}

The softdelete aspect adds these fields:

  • isDeleted (Boolean) - Deletion flag
  • deletedAt (DateTime) - Deletion timestamp
  • deletedBy (String) - User who deleted the record
2. Enable soft delete in your service

Add @softdelete.enabled to every entity that should use soft delete:

// srv/order-service.cds
service OrderService {
    @softdelete.enabled
    entity Orders as projection on my.Orders;

    @softdelete.enabled
    entity OrderItems as projection on my.OrderItems;
}

Important: Both parent and child entities need @softdelete.enabled for cascade delete to work. The annotation is required because service projections do not automatically inherit aspect behavior.

How It Works

DELETE Operations

Delete operations are converted to updates that set isDeleted=true:

DELETE /Orders(123)
// Sets: isDeleted=true, deletedAt=<timestamp>, deletedBy=<user>

Composition children are automatically soft-deleted when the parent is deleted.

READ Operations

Soft-deleted records are automatically excluded from list queries:

GET /Orders
// Only returns records where isDeleted=false
Retrieving Deleted Data

Use isDeleted=true filter to access soft-deleted records:

GET /Orders?$filter=isDeleted eq true

Draft Support

Soft delete works in draft mode (Fiori Elements Object Page). Note that in draft edit mode, deleted items may remain visible until the draft is activated. This is expected behavior to ensure proper synchronization.

Limitations

  • Draft Edit Mode: Deleted items remain visible in draft edit mode until the draft is activated

License

MIT

MIT, read

History

Latest

v1.0.2

Features 1

Notes
Added
  • Physical deletion test case (DEL-09) to verify entities without @softdelete.enabled are physically deleted
  1. v1.0.1

    Features 2, Changed 1

    Notes
    Added
    • Navigation path deletion test cases (DEL-03-nav, DEL-05-nav, DEL-07-nav)
    • Grandchild cascade deletion test cases (DEL-03-extended, DEL-05-extended)
    Changed
    • Improved test coverage for composition hierarchy deletion scenarios
  2. v1.0.0

    Features 9, Other 4

    Notes
    First Major Release

    This is the first stable release of cds-softdelete-plugin. The plugin is considered production-ready with comprehensive test coverage and well-defined behavior.

    Features
    • Automatic Soft Delete: DELETE operations are automatically converted to UPDATE operations that set isDeleted=true, deletedAt, and deletedBy
    • Automatic Filtering: READ operations automatically exclude soft-deleted records (where isDeleted=false)
    • Cascade Delete: When a parent entity is deleted, all composition children are automatically soft-deleted recursively
    • Draft Support: Full support for SAP Fiori Elements draft mode, including draft entity soft delete and proper synchronization on activation
    • Key-Based Access: Direct access by key (e.g., Orders(ID)) returns records regardless of isDeleted status, allowing access to deleted records
    • Explicit Filter Support: Users can explicitly query deleted records using $filter=isDeleted eq true
    • Validation: Server startup validation ensures entities with @softdelete.enabled have all required fields (isDeleted, deletedAt, deletedBy)
    • Field Protection: All soft delete fields are protected with @readonly annotation to prevent direct user modification
    • Idempotent Operations: Deleting an already soft-deleted record succeeds without side effects (no timestamp updates)
    Technical Details
    • Test Coverage: 38 test cases covering all scenarios (100% coverage)
      • Deletion operations (8 test cases)
      • Active entity reads (16 test cases)
      • Draft entity reads (7 test cases)
      • Draft activation (2 test cases)
      • Validation (2 test cases)
      • Field protection (4 test cases)
    • Specification: Comprehensive specification documentation in docs/project/spec.md
    • Compatibility: Requires @sap/cds >= 9
    Known Behavior
    • Draft Edit Mode: Deleted items remain visible in draft edit mode until the draft is activated (this is by design to ensure proper synchronization)
  3. v0.3.5

    Features 3, Fixes 1

    Notes
    Added
    • Validation test cases for entity configuration
    • Field protection test cases for readonly fields
    • Comprehensive test specification documentation
    Fixed
    • Idempotency check for soft delete operations to prevent deletedAt updates on already deleted records
  4. v0.3.4

    Features 2, Fixes 1

    Notes
    Added
    • Plugin specification documentation
    • Test specification documentation
    Fixed
    • Draft entity filtering limitation documented as expected behavior
  5. v0.3.3

    Fixes 1

    Notes
    Fixed
    • Prevent overwriting deletedAt/deletedBy on already soft-deleted records during cascade delete
  6. v0.3.2

    Fixes 1

    Notes
    Fixed
    • Propagate parent isDeleted status in navigation paths
  7. v0.3.1

    Fixes 1

    Notes
    Fixed
    • Apply isDeleted filter for navigation path reads in draft entities
  8. v0.3.0

    Features 1

    Notes
    Added
    • Draft entity soft delete support with proper READ handler isolation
  9. v0.2.0

    Fixes 1

    Notes
    Fixed
    • Foreign key naming in cascade delete for draft navigation paths
  10. v0.1.2

    Fixes 2

    Notes
    Fixed
    • Exclude draft virtual keys from cascade soft delete
    • Propagate parent isDeleted status to children in key-based access
  11. v0.1.1

    Fixes 1

    Notes
    Fixed
    • GitHub tag badge markdown syntax
  12. v0.1.0

    Features 2

    Notes
    Added
    • Initial release with basic soft delete functionality
    • Validation for entities with @softdelete.enabled
1downloads per week, npm
Weekly downloads for cds-softdelete-plugin26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 1.27 Apr – 3 May: 204 May – 10 May: 3011 May – 17 May: 4018 May – 24 May: 725 May – 31 May: 401 Jun – 7 Jun: 298 Jun – 14 Jun: 6015 Jun – 21 Jun: 6222 Jun – 28 Jun: 8029 Jun – 5 Jul: 286 Jul – 12 Jul: 1213 Jul – 19 Jul: 320 Jul – 26 Jul: 2127 Jul – 2 Aug: 33 Aug – 9 Aug: 2110 Aug – 16 Aug: 3617 Aug – 23 Aug: 1324 Aug – 30 Aug: 2131 Aug – 6 Sept: 37 Sept – 13 Sept: 2314 Sept – 20 Sept: 621 Sept – 27 Sept: 428 Sept – 4 Oct: 65 Oct – 11 Oct: 312 Oct – 18 Oct: 119 Oct – 25 Oct: 1
Declared alternative
  1. cds-feature-softdeleteCAP Java plugin for soft delete with a softdelete aspect
Soft delete
  1. cds-feature-softdeleteCAP Java plugin for soft delete with a softdelete aspectfrom CAP

Details

Sources5
npm registrydiscovered herechecked
GitHub APIdiscovered here, miyasutachecked
npm registry, cds-softdelete-pluginversion, releases, installschecked
github.com/git+https://github.com/miyasuta/cds-softdelete-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>=9
latestv1.0.2
first release
releases and cadence17, ~2d median
discovered vianpm registry, GitHub API · miyasuta
first seen in the atlas
ecosystem and domaincap, data-and-persistence
History in the atlas2
  1. Entered unmapped because no capability fitted: change-tracking is history of changes, data-privacy is close to the opposite, and inventing an edge would have been worse than the gap. The capability now exists, so the edge is the honest one rather than the nearest one.
  2. First seen.
For your agent
Ref
artifact:miyasuta-cds-softdelete-plugin
JSON
/artifacts/miyasuta-cds-softdelete-plugin.json
MCP
Connecting an agent