@sap/cds-dk 7.9.5 → 7.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/version.js CHANGED
@@ -62,27 +62,29 @@ function list_versions(args, options) {
62
62
  }
63
63
 
64
64
  function info({ root:cwd=process.cwd() }) {
65
- const env = require('../lib').env.for('cds', cwd)
66
- const isJava = env['project-nature'] === 'java'
67
- if (isJava && process.stderr.isTTY) {
65
+ const cds = require('../lib')
66
+ const env = cds.env.for('cds', cwd)
67
+ env.cli ??= {}; env.cli.version ??= {}
68
+ const javaInfo = !env.cli.version.skipjava && env['project-nature'] === 'java'
69
+ if (javaInfo && process.stderr.isTTY) {
68
70
  console.error('\x1b[2m'+'This takes a while. Collecting Java versions...', '\x1b[0m')
69
71
  }
70
72
 
71
73
  const npmRoot = execSync('npm root -g').toString().trim()
72
74
  let versions = {
73
- ..._versions_from(_pkg_path('@sap/cds-dk', __dirname), '@sap/cds-dk (global)'), // ... linked in cap/dev setup
74
- ..._versions_from(_pkg_path('@sap/cds-dk', npmRoot), '@sap/cds-dk (global)'), // ... or installed globally
75
+ ..._versions_from(_pkg_path('@sap/cds-dk', npmRoot), '@sap/cds-dk (global)'), // linked in cap/dev or installed globally
75
76
  ..._versions_from(_pkg_path('@sap/cds-dk', cwd)), // local dk, important for Java projects
76
77
  ..._versions_from(_pkg_path('@sap/cds', __dirname)), // @sap/cds from here
77
- ..._versions_from(cwd), // ... or from local app dependencies
78
- ..._versions_from(_pkg_path('@sap/cds-compiler', cwd, __dirname)), // compiler is no direct dependency, so list it explicitly
78
+ ..._versions_from(_pkg_path('@sap/cds', cds.home)), // ... or local @sap/cds
79
+ ..._versions_from(cwd), // ... more from local app dependencies
80
+ '@sap/cds-compiler': cds.compiler.version(),
79
81
  'Node.js': process.version,
80
- 'home': require('../lib/cds').home, // effective (local) cds
82
+ 'home': cds.home, // effective cds home
81
83
  }
82
84
  // sort Node entries
83
85
  versions = Object.keys(versions).sort().reduce((all, key) => { all[key] = versions[key]; return all }, {})
84
86
 
85
- if (isJava) {
87
+ if (javaInfo) {
86
88
  Object.assign(versions, capJavaVersion(cwd))
87
89
  }
88
90
  return versions
@@ -45,7 +45,7 @@ class MtxSidecarBuildPlugin extends NodejsBuildPlugin {
45
45
  */
46
46
  async _buildNodeApp(sidecarEnv) {
47
47
  const destSidecar = this.task.dest
48
- const destSidecarSrc = path.join(destSidecar, cds.env.folders.srv)
48
+ const destSidecarSrc = path.join(destSidecar, sidecarEnv.folders.srv)
49
49
  const model = this._compileSidecarSync(sidecarEnv)
50
50
  await this.compileToJson(model, path.join(destSidecarSrc, DEFAULT_CSN_FILE_NAME))
51
51
  await this.collectLanguageBundles(model, path.join(destSidecarSrc, getI18nDefaultFolder()))
@@ -165,6 +165,7 @@ class NodejsBuildPlugin extends EdmxBuildPlugin {
165
165
  if (this.task.options.workspaces) {
166
166
  workspaces = Array.isArray(this.task.options.workspaces) ? this.task.options.workspaces : [this.task.options.workspaces]
167
167
  } else {
168
+ // devDependencies are not considered
168
169
  workspaces = await getWorkspaces(true, false, wsRoot);
169
170
  }
170
171
  if (workspaces.length) {
@@ -203,7 +204,7 @@ class NodejsBuildPlugin extends EdmxBuildPlugin {
203
204
  } catch (err) {
204
205
  // ignore
205
206
  }
206
- if (fs.existsSync(path.join(dir, '.gitmodules')) || fs.existsSync(path.join(dir, 'node_modules'))) {
207
+ if (fs.existsSync(path.join(dir, '.gitmodules'))) {
207
208
  return // project root reached
208
209
  }
209
210
  if (path.dirname(dir) !== dir) {
package/lib/build/util.js CHANGED
@@ -189,7 +189,8 @@ async function getWorkspaces(resolve = false, devDependencies = true, wsRoot = c
189
189
  // read npm workspaces
190
190
  const pkgs = await _execNpmWs(wsRoot)
191
191
  pkgs.forEach(pkg => {
192
- if (!resolve || devDependencies && pgkJson.devDependencies?.[pkg] || pgkJson.dependencies?.[pkg]) {
192
+ // only create tarball archives for dependencies with version '*'
193
+ if (!resolve || devDependencies && pgkJson.devDependencies?.[pkg] === '*' || pgkJson.dependencies?.[pkg] === '*') {
193
194
  const workspace = _getWorkspace(wsRoot, pkg)
194
195
  if (workspace) {
195
196
  workspaces.push(workspace)
@@ -3,7 +3,7 @@ const { dirname } = require('node:path')
3
3
  const cds = require('../../../cds')
4
4
 
5
5
  let counter = Math.round(Math.random() * 10000) // Default random seed // Non-deterministic behaviour
6
- const MAX_ASSOC_DEPTH = 1
6
+ const MAX_ASSOC_DEPTH = 5
7
7
 
8
8
  /**
9
9
  * Creates JSON test data for the given entities
@@ -40,25 +40,35 @@ const asJson = module.exports = async (data, csn, numRecords=1, options={}) => {
40
40
 
41
41
  for (const name of entityNames) {
42
42
  if (!data[name] // removed on purpose because records are created inline through compositions
43
- || data[name].length >= numRecords) { // already created by following associations
43
+ || data[name].length >= numRecords) { // numRecords already created by following associations
44
44
  continue
45
45
  }
46
46
 
47
- const records = data[name] = Array(numRecords).fill({}).map(() => ({}))
47
+ let numRecordsToGenerate // numRecords might be reduced if some records were created by following associations
48
+ let records = []
49
+ if (data[name].length > 0) {
50
+ numRecordsToGenerate = numRecords - data[name].length
51
+ records = Array(numRecordsToGenerate).fill({}).map(() => ({}))
52
+ } else {
53
+ numRecordsToGenerate = numRecords
54
+ records = data[name] = Array(numRecordsToGenerate).fill({}).map(() => ({}))
55
+ }
48
56
  const entity = defs[name]
49
57
 
50
58
  const idNum = randomNumber()
51
- for (let i = 0; i < numRecords; i++) {
59
+ for (let i = 0; i < numRecordsToGenerate; i++) {
52
60
  fillRecord(records[i], idNum+i, entity, csn, data, null, 0, referenceData)
53
61
  }
54
- // Remove records w/ duplicate keys. This can happen if the key is an enum (and we have less enum values than requested records).
55
- data[name] = uniqRecords(records, entity)
62
+ data[name] = data[name].concat(records) // append the new records to the possibly existingand referenced records
63
+ // remove records w/ duplicate keys. This can happen if the key is an enum (and we have less enum values than requested records).
64
+ data[name] = uniqRecords(data[name], entity)
56
65
  }
57
66
  return data
58
67
  }
59
68
 
60
69
  function fillRecord(record, recordID, entity, csn, data, parentEntity, depth, referenceData) {
61
70
  Object.defineProperty(record, '$id', {value: recordID, enumerable: false})
71
+ if (data[entity.name]) data[entity.name].push(record) // add id to data, to be referenced by associations to prevent circular dependencies
62
72
 
63
73
  const { elements } = entity
64
74
  Object.values(elements).sort(asJson.elementsSorter(csn)).forEach(el => {
@@ -242,7 +252,7 @@ function dataForField(element, entity, csn, record, data, parentEntity, depth, r
242
252
  if (element.is2many)
243
253
  return
244
254
  const target = csn.definitions[element.target]
245
- if (!target || target === parentEntity || depth > MAX_ASSOC_DEPTH)
255
+ if (!target || depth > MAX_ASSOC_DEPTH)
246
256
  return
247
257
 
248
258
  let targetRecord = randomFromReferenceData(target, csn, referenceData)
@@ -256,10 +266,14 @@ function dataForField(element, entity, csn, record, data, parentEntity, depth, r
256
266
  targetRecords = data[target.name] = []
257
267
  else if (!targetRecords) // target entity is not in the list of entities to be created
258
268
  return
259
-
260
- targetRecord = fillRecord({}, randomNumber(), target, csn, data, entity, depth, referenceData)
261
- targetRecords.push(targetRecord)
262
- uniqRecords(targetRecords, target)
269
+
270
+ if (targetRecords.length > 0) { // use record generated by following asociation
271
+ targetRecord = targetRecords[0]
272
+ } else {
273
+ targetRecord = fillRecord({}, randomNumber(), target, csn, data, entity, depth+1, referenceData)
274
+ targetRecords.push(targetRecord)
275
+ uniqRecords(targetRecords, target)
276
+ }
263
277
  }
264
278
 
265
279
  // TODO: handle foreign keys correctly
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "7.9.5",
3
+ "version": "7.9.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sap/cds-dk",
9
- "version": "7.9.5",
9
+ "version": "7.9.7",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@sap/cds": "^7",
@@ -81,7 +81,7 @@
81
81
  }
82
82
  },
83
83
  "node_modules/@eslint/eslintrc/node_modules/debug": {
84
- "version": "4.3.5",
84
+ "version": "4.3.6",
85
85
  "license": "MIT",
86
86
  "dependencies": {
87
87
  "ms": "2.1.2"
@@ -124,7 +124,7 @@
124
124
  }
125
125
  },
126
126
  "node_modules/@humanwhocodes/config-array/node_modules/debug": {
127
- "version": "4.3.5",
127
+ "version": "4.3.6",
128
128
  "license": "MIT",
129
129
  "dependencies": {
130
130
  "ms": "2.1.2"
@@ -208,10 +208,10 @@
208
208
  }
209
209
  },
210
210
  "node_modules/@sap/cds": {
211
- "version": "7.9.3",
211
+ "version": "7.9.4",
212
212
  "license": "SEE LICENSE IN LICENSE",
213
213
  "dependencies": {
214
- "@cap-js/cds-types": "<1",
214
+ "@cap-js/cds-types": "<=0.2.0",
215
215
  "@sap/cds-compiler": "^4",
216
216
  "@sap/cds-fiori": "^1",
217
217
  "@sap/cds-foss": "^5.0.0"
@@ -225,7 +225,7 @@
225
225
  }
226
226
  },
227
227
  "node_modules/@sap/cds-compiler": {
228
- "version": "4.9.4",
228
+ "version": "4.9.8",
229
229
  "license": "SEE LICENSE IN LICENSE",
230
230
  "dependencies": {
231
231
  "antlr4": "4.9.3"
@@ -261,7 +261,7 @@
261
261
  }
262
262
  },
263
263
  "node_modules/@sap/cds-mtxs": {
264
- "version": "1.18.2",
264
+ "version": "1.18.3",
265
265
  "license": "SEE LICENSE IN LICENSE",
266
266
  "dependencies": {
267
267
  "@sap/hdi-deploy": "^4",
@@ -424,7 +424,7 @@
424
424
  }
425
425
  },
426
426
  "node_modules/agent-base/node_modules/debug": {
427
- "version": "4.3.5",
427
+ "version": "4.3.6",
428
428
  "license": "MIT",
429
429
  "optional": true,
430
430
  "dependencies": {
@@ -549,7 +549,7 @@
549
549
  "license": "MIT"
550
550
  },
551
551
  "node_modules/axios": {
552
- "version": "1.7.2",
552
+ "version": "1.7.4",
553
553
  "license": "MIT",
554
554
  "dependencies": {
555
555
  "follow-redirects": "^1.15.6",
@@ -1141,7 +1141,7 @@
1141
1141
  }
1142
1142
  },
1143
1143
  "node_modules/eslint/node_modules/debug": {
1144
- "version": "4.3.5",
1144
+ "version": "4.3.6",
1145
1145
  "license": "MIT",
1146
1146
  "dependencies": {
1147
1147
  "ms": "2.1.2"
@@ -1666,7 +1666,7 @@
1666
1666
  }
1667
1667
  },
1668
1668
  "node_modules/http-proxy-agent/node_modules/debug": {
1669
- "version": "4.3.5",
1669
+ "version": "4.3.6",
1670
1670
  "license": "MIT",
1671
1671
  "optional": true,
1672
1672
  "dependencies": {
@@ -1699,7 +1699,7 @@
1699
1699
  }
1700
1700
  },
1701
1701
  "node_modules/https-proxy-agent/node_modules/debug": {
1702
- "version": "4.3.5",
1702
+ "version": "4.3.6",
1703
1703
  "license": "MIT",
1704
1704
  "optional": true,
1705
1705
  "dependencies": {
@@ -1757,7 +1757,7 @@
1757
1757
  "optional": true
1758
1758
  },
1759
1759
  "node_modules/ignore": {
1760
- "version": "5.3.1",
1760
+ "version": "5.3.2",
1761
1761
  "license": "MIT",
1762
1762
  "engines": {
1763
1763
  "node": ">= 4"
@@ -2225,12 +2225,9 @@
2225
2225
  }
2226
2226
  },
2227
2227
  "node_modules/node-addon-api": {
2228
- "version": "7.1.0",
2228
+ "version": "7.1.1",
2229
2229
  "license": "MIT",
2230
- "optional": true,
2231
- "engines": {
2232
- "node": "^16 || ^18 || >= 20"
2233
- }
2230
+ "optional": true
2234
2231
  },
2235
2232
  "node_modules/node-cache": {
2236
2233
  "version": "5.1.2",
@@ -2691,7 +2688,7 @@
2691
2688
  "license": "ISC"
2692
2689
  },
2693
2690
  "node_modules/semver": {
2694
- "version": "7.6.2",
2691
+ "version": "7.6.3",
2695
2692
  "license": "ISC",
2696
2693
  "bin": {
2697
2694
  "semver": "bin/semver.js"
@@ -2891,7 +2888,7 @@
2891
2888
  }
2892
2889
  },
2893
2890
  "node_modules/socks-proxy-agent/node_modules/debug": {
2894
- "version": "4.3.5",
2891
+ "version": "4.3.6",
2895
2892
  "license": "MIT",
2896
2893
  "optional": true,
2897
2894
  "dependencies": {
@@ -3139,7 +3136,7 @@
3139
3136
  }
3140
3137
  },
3141
3138
  "node_modules/uglify-js": {
3142
- "version": "3.18.0",
3139
+ "version": "3.19.2",
3143
3140
  "license": "BSD-2-Clause",
3144
3141
  "optional": true,
3145
3142
  "bin": {
@@ -3283,7 +3280,7 @@
3283
3280
  }
3284
3281
  },
3285
3282
  "node_modules/yaml": {
3286
- "version": "2.4.5",
3283
+ "version": "2.5.0",
3287
3284
  "license": "ISC",
3288
3285
  "bin": {
3289
3286
  "yaml": "bin.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "7.9.5",
3
+ "version": "7.9.7",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [