@sap/cds 7.3.0 → 7.3.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## Version 7.3.1 - 2023-10-23
8
+
9
+ ### Fixed
10
+
11
+ - `cds-ts` no longer fails if configured with an ESM loader. It tries loading files w/ `import()` in this case.
12
+ - `cds deploy` for draft enabled entities
13
+
7
14
  ## Version 7.3.0 - 2023-10-04
8
15
 
9
16
  ### Added
@@ -145,7 +145,7 @@ module.exports = function cds_compile_for_lean_drafts(csn) {
145
145
  def.elements.IsActiveEntity.virtual = true
146
146
  def.elements.HasDraftEntity.virtual = true
147
147
  def.elements.HasActiveEntity.virtual = true
148
- def.elements.DraftAdministrativeData_DraftUUID.virtual = true
148
+ if (def.elements.DraftAdministrativeData_DraftUUID) def.elements.DraftAdministrativeData_DraftUUID.virtual = true
149
149
  def.elements.DraftAdministrativeData.virtual = true
150
150
  // will insert drafts entities, so that others can use `.drafts` even without incoming draft requests
151
151
  addDraftEntity(def, csn)
package/lib/index.js CHANGED
@@ -116,7 +116,7 @@ const cds = module.exports = new class cds extends EventEmitter {
116
116
 
117
117
  // legacy and to be moved stuff -> hidden for tools in cds.__proto__
118
118
  /** @deprecated */ in (cwd) { return !cwd ? this : {__proto__:this, cwd, env: this.env.for('cds',cwd) } }
119
- /** @deprecated */ get build() { return () => cds.error('\
119
+ get build() { return () => cds.error('\
120
120
  This application uses @sap/cds version >= 7, which is not compatible with the installed @sap/cds-dk version 6. \
121
121
  Either update @sap/cds-dk to version 7 or downgrade @sap/cds to version 6 instead.\
122
122
  ')}
@@ -189,7 +189,14 @@ exports._import = id => require(id)
189
189
  if (process.env.JEST_WORKER_ID === undefined) { // jest's ESM support is experimental: https://jestjs.io/docs/ecmascript-modules
190
190
  const { pathToFileURL } = require('url')
191
191
  exports._import = id => {
192
- if (extname(id) === '.ts') return require(id) // ts-node w/ ESM not working (cap/issues#11980)
193
- else return import (pathToFileURL(id).href) // must use a file: URL, esp. on Windows for C:\... paths
192
+ if (extname(id) === '.ts') {
193
+ try {
194
+ return require(id) // ts-node w/ ESM not working ootb (cap/issues#14463), so try CommonJS first
195
+ } catch (err) {
196
+ if (err.code !== 'ERR_REQUIRE_ESM') throw err
197
+ // else: this means ts-node is configured w/ an ESM loader, so fall through and try w/ ESM
198
+ }
199
+ }
200
+ return import (pathToFileURL(id).href) // must use a file: URL, esp. on Windows for C:\... paths
194
201
  }
195
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "7.3.0",
3
+ "version": "7.3.1",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [