
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
cds-change-log
Advanced tools
provide the
ChangeLog
best practice for SAP CAP nodejs runtime
package.json
{
"cds": {
"plugins": {
"cds-change-log": {
"impl": "cds-change-log"
}
}
}
}
entity.cds
using from 'cds-change-log'
statement in CDS model@cds.changelog.enabled
on elementsentity
level, annotations on projection
/view
will not workusing {cap.community.common} from 'cds-change-log'
entity People : cuid, managed, customManaged {
Name : String(255);
Age : Integer;
changeLogs : Association to many common.ChangeLog
on changeLogs.entityKey = $self.ID
and changeLogs.entityName = 'People';
}
// mark in entity and field elements level
// annotation in another place, you can put it into entity definition directly
annotate People with {
Age @cds.changelog.enabled;
Name @cds.changelog.enabled;
};
create and update objects
let response = await axios.post("/sample/Peoples", { Name: "Theo Sun 2", Age: 39 })
const { ID } = response.data
await axios.patch(`/sample/Peoples(${ID})`, { Name: "Theo Sun 9", Age: 12 })
generated change logs
[
{
ID: "595b3604-d7dd-434f-962c-1e70e92bd775",
actionAt: "2022-03-17T04:20:41.402Z",
actionBy: "anonymous",
entityName: "People",
entityKey: "0e926ff2-53ad-4cd9-9569-ad2147dad0bc",
action: "Create",
Items: [
{
sequence: 0,
Parent_ID: "595b3604-d7dd-434f-962c-1e70e92bd775",
attributeKey: "Name",
attributeNewValue: "Theo Sun 2",
attributeOldValue: null,
},
{
sequence: 1,
Parent_ID: "595b3604-d7dd-434f-962c-1e70e92bd775",
attributeKey: "Age",
attributeNewValue: "39",
attributeOldValue: null,
},
],
},
{
ID: "55bca8b8-1e79-4c9b-8bc9-1a013bf3cf39",
actionAt: "2022-03-17T04:20:41.461Z",
actionBy: "anonymous",
entityName: "People",
entityKey: "0e926ff2-53ad-4cd9-9569-ad2147dad0bc",
action: "Update",
Items: [
{
sequence: 0,
Parent_ID: "55bca8b8-1e79-4c9b-8bc9-1a013bf3cf39",
attributeKey: "Name",
attributeNewValue: "Theo Sun 9",
attributeOldValue: "Theo Sun 2",
},
{
sequence: 1,
Parent_ID: "55bca8b8-1e79-4c9b-8bc9-1a013bf3cf39",
attributeKey: "Age",
attributeNewValue: "12",
attributeOldValue: "39",
},
],
},
]
if you want to use
Integer
or other cds built-in type as primary key
entity.cds
@cds.changelog.enabled
entity Order : managed { // a sample entity
key ID : Integer; // use Integer as key, not out-of-box UUID
@cds.changelog.enabled
Amount : Decimal;
};
extension.cds
// remember using this file from your project root
using {cap.community.common.ChangeLog} from 'cds-change-log';
extend ChangeLog with {
// add a new column 'entityKeyInteger' for integer key
@cds.changelog.extension.entityKey
// this column will be used when entity use `Integer` as primary key
// MUST add the `cds.` prefix for built-in types
@cds.changelog.extension.for.type : cds.Integer
entityKeyInteger : Integer;
};
if you want to manually specify the data storage for entity keys
entity.cds
@cds.changelog.enabled
entity PeopleOrderForProduct {
// store key to ChangeLog.entityKeyInteger
@cds.changelog.extension.key.target : 'entityKeyInteger'
key OrderID : Integer;
// store key to ChangeLog.entityKey
@cds.changelog.extension.key.target : 'entityKey'
key PeopleID : UUID;
@cds.changelog.enabled
Amount : Decimal;
}
CUD
OData requestsCUD
CQLUpdate/Delete
CQL (without where
)draftActivate
)
Blob
@cds.changelog.to
FAQs
best practice of Change Log for CAP nodejs runtime
The npm package cds-change-log receives a total of 10 weekly downloads. As such, cds-change-log popularity was classified as not popular.
We found that cds-change-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.