Socket
Socket
Sign inDemoInstall

@sap/cds-dk

Package Overview
Dependencies
Maintainers
0
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-dk - npm Package Compare versions

Comparing version 7.9.5 to 7.9.6

36

lib/init/template/data/as-json.js

@@ -6,3 +6,3 @@ const { randomUUID } = require('node:crypto')

let counter = Math.round(Math.random() * 10000) // Default random seed // Non-deterministic behaviour
const MAX_ASSOC_DEPTH = 1
const MAX_ASSOC_DEPTH = 5

@@ -44,15 +44,24 @@ /**

if (!data[name] // removed on purpose because records are created inline through compositions
|| data[name].length >= numRecords) { // already created by following associations
|| data[name].length >= numRecords) { // numRecords already created by following associations
continue
}
const records = data[name] = Array(numRecords).fill({}).map(() => ({}))
let numRecordsToGenerate // numRecords might be reduced if some records were created by following associations
let records = []
if (data[name].length > 0) {
numRecordsToGenerate = numRecords - data[name].length
records = Array(numRecordsToGenerate).fill({}).map(() => ({}))
} else {
numRecordsToGenerate = numRecords
records = data[name] = Array(numRecordsToGenerate).fill({}).map(() => ({}))
}
const entity = defs[name]
const idNum = randomNumber()
for (let i = 0; i < numRecords; i++) {
for (let i = 0; i < numRecordsToGenerate; i++) {
fillRecord(records[i], idNum+i, entity, csn, data, null, 0, referenceData)
}
// Remove records w/ duplicate keys. This can happen if the key is an enum (and we have less enum values than requested records).
data[name] = uniqRecords(records, entity)
data[name] = data[name].concat(records) // append the new records to the possibly existingand referenced records
// remove records w/ duplicate keys. This can happen if the key is an enum (and we have less enum values than requested records).
data[name] = uniqRecords(data[name], entity)
}

@@ -64,2 +73,3 @@ return data

Object.defineProperty(record, '$id', {value: recordID, enumerable: false})
if (data[entity.name]) data[entity.name].push(record) // add id to data, to be referenced by associations to prevent circular dependencies

@@ -248,3 +258,3 @@ const { elements } = entity

const target = csn.definitions[element.target]
if (!target || target === parentEntity || depth > MAX_ASSOC_DEPTH)
if (!target || depth > MAX_ASSOC_DEPTH)
return

@@ -263,6 +273,10 @@

return
targetRecord = fillRecord({}, randomNumber(), target, csn, data, entity, depth, referenceData)
targetRecords.push(targetRecord)
uniqRecords(targetRecords, target)
if (targetRecords.length > 0) { // use record generated by following asociation
targetRecord = targetRecords[0]
} else {
targetRecord = fillRecord({}, randomNumber(), target, csn, data, entity, depth+1, referenceData)
targetRecords.push(targetRecord)
uniqRecords(targetRecords, target)
}
}

@@ -269,0 +283,0 @@

{
"name": "@sap/cds-dk",
"version": "7.9.5",
"version": "7.9.6",
"description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",

@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc