@sap/cds-dk 6.8.2 → 7.0.0
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/activate.js +15 -7
- package/bin/add.js +29 -15
- package/bin/bind.js +49 -116
- package/bin/build.js +114 -0
- package/bin/cds.js +67 -24
- package/bin/compile/index.js +2 -2
- package/bin/deploy/index.js +46 -39
- package/bin/deploy/to-hana.js +11 -8
- package/bin/deploy/to-postgres.js +8 -2
- package/bin/deploy/to-sqlite.js +0 -1
- package/bin/env.js +75 -41
- package/bin/eval.js +3 -3
- package/bin/extend.js +17 -10
- package/bin/help.js +22 -21
- package/bin/import.js +10 -7
- package/bin/init.js +38 -17
- package/bin/login.js +69 -55
- package/bin/logout.js +12 -9
- package/bin/migrate.js +10 -4
- package/bin/pull.js +12 -5
- package/bin/push.js +24 -13
- package/bin/repl.js +1 -0
- package/bin/run.js +25 -0
- package/bin/subscribe.js +13 -8
- package/bin/unsubscribe.js +15 -8
- package/bin/upgrade.js +15 -9
- package/bin/util/log.js +24 -0
- package/bin/version.js +124 -0
- package/bin/watch.js +1 -35
- package/bin/watched.js +39 -0
- package/lib/bind/KubernetesApiAccessor.js +2 -2
- package/lib/bind/bindingManager.js +1 -1
- package/lib/bind/bindingUtil.js +0 -9
- package/lib/bind/cfKeyProvider.js +10 -72
- package/lib/bind/index.js +114 -0
- package/lib/bind/kubernetesCredentialsProvider.js +2 -2
- package/lib/bind/userCdsrcJsonStorageProvider.js +7 -44
- package/lib/build/buildTaskEngine.js +355 -0
- package/lib/build/buildTaskFactory.js +284 -0
- package/lib/build/buildTaskHandler.js +240 -0
- package/lib/build/buildTaskProvider.js +22 -0
- package/lib/build/buildTaskProviderFactory.js +182 -0
- package/lib/build/constants.js +56 -0
- package/lib/build/index.js +21 -0
- package/lib/build/provider/buildTaskHandlerEdmx.js +83 -0
- package/lib/build/provider/buildTaskHandlerFeatureToggles.js +132 -0
- package/lib/build/provider/buildTaskHandlerInternal.js +228 -0
- package/lib/build/provider/buildTaskProviderInternal.js +370 -0
- package/lib/build/provider/fiori/index.js +167 -0
- package/lib/build/provider/hana/2migration.js +179 -0
- package/lib/build/provider/hana/index.js +522 -0
- package/lib/build/provider/hana/migrationtable.js +472 -0
- package/lib/build/provider/hana/template/.hdiconfig-all +163 -0
- package/lib/build/provider/hana/template/.hdiconfig-cloud +137 -0
- package/lib/build/provider/hana/template/.hdinamespace +4 -0
- package/lib/build/provider/hana/template/package.json +12 -0
- package/lib/build/provider/hana/template/undeploy.json +5 -0
- package/lib/build/provider/java/index.js +93 -0
- package/lib/build/provider/java-cf/index.js +1 -0
- package/lib/build/provider/mtx/index.js +37 -0
- package/lib/build/provider/mtx/resourcesTarBuilder.js +94 -0
- package/lib/build/provider/mtx-extension/index.js +131 -0
- package/lib/build/provider/mtx-sidecar/index.js +138 -0
- package/lib/build/provider/node-cf/index.js +1 -0
- package/lib/build/provider/nodejs/index.js +178 -0
- package/lib/build/util.js +263 -0
- package/lib/cds.js +9 -21
- package/lib/client/auth_manager.js +39 -16
- package/lib/client/helper/dependency_helper.js +7 -6
- package/lib/client/push.js +2 -1
- package/lib/client/settings_manager.js +10 -39
- package/lib/deploy/to-hana/hana.js +273 -0
- package/lib/deploy/to-hana/hdiDeployUtil.js +68 -0
- package/lib/deploy/to-hana/mtaUtil.js +171 -0
- package/lib/import/asyncapi/importAsyncAPI.js +3 -2
- package/lib/import/asyncapi/index.js +5 -2
- package/lib/import/asyncapi/parserContext.js +67 -26
- package/lib/import/asyncapi/utils.js +34 -3
- package/lib/import/common.js +40 -30
- package/lib/import/importapi.js +36 -35
- package/lib/index.js +12 -17
- package/lib/init/constants.js +36 -71
- package/lib/init/index.js +18 -52
- package/lib/init/template/_merging/registry-mta.js +21 -3
- package/lib/init/template/approuter/files/mta.yaml.hbs +29 -29
- package/lib/init/template/approuter/files/values.yaml.hbs +5 -5
- package/lib/init/template/approuter/files/xs-app.json.hbs +8 -2
- package/lib/init/template/approuter/index.js +7 -8
- package/lib/init/template/auditlog/files/mta.yaml.hbs +5 -5
- package/lib/init/template/auditlog/files/package.json.hbs +13 -13
- package/lib/init/template/auditlog/index.js +3 -3
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +22 -22
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +3 -3
- package/lib/init/template/connectivity/files/mta.yaml.hbs +14 -0
- package/lib/init/template/connectivity/files/package.json.hbs +17 -0
- package/lib/init/template/connectivity/index.js +21 -4
- package/lib/init/template/data/index.js +5 -1
- package/lib/init/template/destination/files/mta.yaml.hbs +14 -0
- package/lib/init/template/destination/files/package.json.hbs +17 -0
- package/lib/init/template/{destinations → destination}/index.js +19 -13
- package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +3 -3
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/enterprise-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/enterprise-messaging/files/xs-security.json.hbs +19 -0
- package/lib/init/template/enterprise-messaging/index.js +27 -6
- package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +3 -3
- package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +5 -5
- package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +9 -9
- package/lib/init/template/enterprise-messaging-shared/index.js +4 -5
- package/lib/init/template/extensibility/files/package.json.hbs +10 -10
- package/lib/init/template/extensibility/index.js +8 -9
- package/lib/init/template/file-based-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/file-based-messaging/index.js +3 -4
- package/lib/init/template/hana/files/db/package.json +1 -1
- package/lib/init/template/hana/files/mta.yaml.hbs +21 -21
- package/lib/init/template/hana/files/package.json.hbs +16 -22
- package/lib/init/template/hana/files/values.yaml.hbs +1 -1
- package/lib/init/template/hana/index.js +5 -15
- package/lib/init/template/helm/files/Chart.yaml.hbs +4 -4
- package/lib/init/template/helm/files/values.yaml.hbs +6 -6
- package/lib/init/template/helm/index.js +5 -10
- package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +37 -31
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +13 -14
- package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +2 -2
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +1 -1
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/values.md +116 -116
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +9 -9
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +2 -2
- package/lib/init/template/helm/subcharts/service-instance/values.md +15 -15
- package/lib/init/template/helm/subcharts/web-application/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/web-application/templates/NOTES.txt +15 -0
- package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +23 -23
- package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
- package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +17 -17
- package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +24 -3
- package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
- package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
- package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/values.md +141 -123
- package/lib/init/template/helm/subcharts/web-application/values.schema.json +7 -0
- package/lib/init/template/helm/subcharts/web-application/values.yaml +1 -0
- package/lib/init/template/html5-repo/index.js +4 -5
- package/lib/init/template/java/index.js +5 -5
- package/lib/init/template/kibana-logging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/kibana-logging/files/package.json.hbs +9 -9
- package/lib/init/template/kibana-logging/index.js +3 -4
- package/lib/init/template/lint/index.js +3 -3
- package/lib/init/template/mta/files/mta.yaml.hbs +14 -14
- package/lib/init/template/mta/files/package.json +5 -0
- package/lib/init/template/mta/index.js +12 -13
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +29 -27
- package/lib/init/template/multitenancy/files/package.json.hbs +17 -14
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -7
- package/lib/init/template/multitenancy/files/values.yaml.hbs +19 -19
- package/lib/init/template/multitenancy/index.js +14 -16
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/nodejs/index.js +5 -8
- package/lib/init/template/redis-messaging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/redis-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/redis-messaging/index.js +4 -5
- package/lib/init/template/sample/files/app/_i18n/i18n.properties +43 -0
- package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +14 -0
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +114 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +8 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +11 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +129 -0
- package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +57 -0
- package/lib/init/template/sample/files/app/common.cds +263 -0
- package/lib/init/template/sample/files/app/index.html +30 -0
- package/lib/init/template/sample/files/app/services.cds +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -0
- package/lib/init/template/sample/files/db/schema.cds +31 -0
- package/lib/init/template/sample/files/nodejs/admin-service.js +12 -0
- package/lib/init/template/sample/files/nodejs/cat-service.js +26 -0
- package/lib/init/template/sample/files/srv/admin-service.cds +5 -0
- package/lib/init/template/sample/files/srv/cat-service.cds +16 -0
- package/lib/init/template/sample/index.js +24 -0
- package/lib/init/template/sample-tiny/index.js +39 -0
- package/lib/init/template/samples/index.js +5 -56
- package/lib/init/template/sqlite/files/package.json.hbs +13 -13
- package/lib/init/template/sqlite/index.js +2 -2
- package/lib/init/template/templateBase.js +24 -1
- package/lib/init/template/toggles/files/package.json.hbs +10 -10
- package/lib/init/template/toggles/index.js +3 -3
- package/lib/init/template/typer/files/gitignore +1 -0
- package/lib/init/template/typer/files/package.json +8 -0
- package/lib/init/template/typer/files/xsconfig.json +9 -0
- package/lib/init/template/typer/index.js +36 -0
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +12 -12
- package/lib/init/template/xsuaa/files/package.json.hbs +13 -13
- package/lib/init/template/xsuaa/files/values.yaml.hbs +8 -8
- package/lib/init/template/xsuaa/index.js +8 -19
- package/lib/init/util/merge.js +73 -59
- package/lib/init/util/mvn.js +21 -17
- package/lib/init/util/projectReader.js +49 -87
- package/lib/init/util/xml.js +14 -23
- package/lib/util/cfUtil.js +366 -0
- package/lib/util/command.js +3 -3
- package/lib/util/gitUtil.js +55 -0
- package/lib/util/version.js +27 -0
- package/npm-shrinkwrap.json +339 -277
- package/package.json +6 -6
- package/CHANGELOG.md +0 -1453
- package/bin/build/all.js +0 -88
- package/bin/build/index.js +0 -82
- package/lib/compile/index.js +0 -14
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data-model.cds +0 -0
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/srv/cat-service.cds.hbs +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const parser = require('./migrationtable')
|
|
3
|
+
const { BuildError, hasOptionValue } = require('../../util')
|
|
4
|
+
const { LOG_MODULE_NAMES } = require('../../constants')
|
|
5
|
+
const cds = require('../../../cds'), { compiler: cdsc } = cds
|
|
6
|
+
const cdscVersion = `-- generated by cds-compiler version ${cdsc.version()}`
|
|
7
|
+
const { getArtifactCdsPersistenceName } = cdsc
|
|
8
|
+
let logger = cds.log(LOG_MODULE_NAMES)
|
|
9
|
+
const ANNO_PERSISTENCE_JOURNAL = '@cds.persistence.journal'
|
|
10
|
+
|
|
11
|
+
module.exports = async (model, lastDevVersion, srcPath, options = {}) => {
|
|
12
|
+
if (options.logger) {
|
|
13
|
+
logger = options.logger
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const journalFileNames = _getJournalFileNames(model)
|
|
17
|
+
const { definitions, deletions, migrations, afterImage } = _toHdiMigration(model, lastDevVersion, journalFileNames, options)
|
|
18
|
+
const definitionResult = []
|
|
19
|
+
|
|
20
|
+
for (const { name, suffix, sql } of definitions) {
|
|
21
|
+
let definitionEntry = { name, suffix, content: sql }
|
|
22
|
+
|
|
23
|
+
if (suffix === '.hdbtable') {
|
|
24
|
+
if (journalFileNames.has(name)) {
|
|
25
|
+
const migration = migrations.find(migration => migration.name === name)
|
|
26
|
+
definitionEntry = await _2migrationtable(srcPath, migration || _emptyMigration(name), sql)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (definitionEntry) {
|
|
30
|
+
definitionResult.push(definitionEntry)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { definitions: definitionResult, deletions, afterImage: _filterJournalArtifacts(afterImage) }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _toHdiMigration(model, lastDevVersion, journalFileNames, options) {
|
|
37
|
+
const result = cdsc.to.hdi.migration(cds.minify(model), options, lastDevVersion);
|
|
38
|
+
if (logger._debug) {
|
|
39
|
+
logger.debug('cdsc.to.hdi.migration returned')
|
|
40
|
+
for (const { name, suffix, sql } of result.definitions) {
|
|
41
|
+
if (suffix === '.hdbtable' || suffix === '.hdbmigrationtable') {
|
|
42
|
+
if (journalFileNames.has(name)) {
|
|
43
|
+
const migration = result.migrations.find(migration => migration.name === name)
|
|
44
|
+
logger.debug(`
|
|
45
|
+
File ${name + '.hdbmigrationtable'} - ${migration ? migration.changeset.length : 0} new changes
|
|
46
|
+
${sql}
|
|
47
|
+
${migration ? migration.changeset.map(change => change.sql).join('\n') : 'Empty changeset'}
|
|
48
|
+
`)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns an object providing access to the .hdbmigrationtable file content and its corresponding filename.
|
|
58
|
+
*
|
|
59
|
+
* @param {String} srcPath Fully qualified path of the directory containing .hdbmigrationtable files
|
|
60
|
+
* @param {String} migration the migration descriptor
|
|
61
|
+
* @param {String} tableSql SQL TABLE definition
|
|
62
|
+
* @returns {Object} Providing access to 'content' and 'fileName'.
|
|
63
|
+
*/
|
|
64
|
+
async function _2migrationtable(srcPath, migration, tableSql) {
|
|
65
|
+
let migrationTableModel = null
|
|
66
|
+
const file = path.join(srcPath, migration.name + migration.suffix)
|
|
67
|
+
try {
|
|
68
|
+
migrationTableModel = await parser.read(file)
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// abort build in order to ensure consistent afterImage model state / hdbmigrationtable file state
|
|
71
|
+
throw new BuildError(`${path.relative(process.cwd(), file)}: ${e.message}`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (migrationTableModel) {
|
|
75
|
+
// adding new changeset if change exist, ignore otherwise
|
|
76
|
+
const migrationEntry = _getNewMigrationEntry(migration.changeset, migrationTableModel.versionNumber)
|
|
77
|
+
if (migrationEntry) {
|
|
78
|
+
const versionNumber = migrationTableModel.versionNumber + 1
|
|
79
|
+
const migrationCount = migrationTableModel.migrations.entries.length
|
|
80
|
+
const migrations = `${migrationEntry.content}${migrationCount > 0 ? '\n' : ''}${migrationTableModel.migrations.toString()}${migrationCount > 0 ? '\n' : ''}`
|
|
81
|
+
return {
|
|
82
|
+
name: migration.name,
|
|
83
|
+
suffix: migration.suffix,
|
|
84
|
+
content: `== version=${versionNumber}\n${tableSql}\n\n${migrations}`,
|
|
85
|
+
changed: true,
|
|
86
|
+
dropColumns: migrationEntry.dropColumns
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
// existing migration file version
|
|
90
|
+
return { name: migration.name, suffix: migration.suffix, content: migrationTableModel.toString(), changed: false }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// initial migration file version
|
|
94
|
+
return { name: migration.name, suffix: migration.suffix, content: `== version=1\n${tableSql}\n`, changed: true }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function _getNewMigrationEntry(changeset, currentVersion) {
|
|
98
|
+
if (changeset && changeset.length > 0) {
|
|
99
|
+
const dropColumns = changeset.some(e => e.drop)
|
|
100
|
+
const manualChange = changeset.some(e => !e.sql)
|
|
101
|
+
const enableDrop = cds.env.hana?.journal?.['enable-drop']
|
|
102
|
+
const content = changeset.reduce((acc, e) => {
|
|
103
|
+
if (!acc) {
|
|
104
|
+
acc = `== migration=${currentVersion + 1}\n`
|
|
105
|
+
acc += `${cdscVersion}\n`
|
|
106
|
+
|
|
107
|
+
if (dropColumns && enableDrop !== true) {
|
|
108
|
+
acc += `>>>>> Manual resolution required - DROP statements causing data loss are disabled by default.
|
|
109
|
+
>>>>> You may either:
|
|
110
|
+
>>>>> uncomment statements to allow incompatible changes, or
|
|
111
|
+
>>>>> refactor statements, e.g. replace DROP/ADD by single RENAME statement
|
|
112
|
+
>>>>> After manual resolution delete all lines starting with >>>>>\n`
|
|
113
|
+
} else if (manualChange) {
|
|
114
|
+
acc += `>>>>> Manual resolution required - insert ALTER statement(s) as described below.
|
|
115
|
+
>>>>> After manual resolution delete all lines starting with >>>>>\n`
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (e.sql) {
|
|
119
|
+
if (e.drop && enableDrop !== true) {
|
|
120
|
+
acc += `${e.sql.replace(/^/gm, '-- ')}\n`;
|
|
121
|
+
} else {
|
|
122
|
+
acc += `${e.sql}\n`
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
acc +=
|
|
126
|
+
`>>>>> Insert ALTER statement for: ${e.description}\n`
|
|
127
|
+
}
|
|
128
|
+
return acc
|
|
129
|
+
}, null)
|
|
130
|
+
return { dropColumns, content }
|
|
131
|
+
}
|
|
132
|
+
return null
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function _emptyMigration(name) {
|
|
136
|
+
return { name, suffix: ".hdbmigrationtable", changeset: [] }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function _getJournalFileNames(model) {
|
|
140
|
+
const journalNames = new Set(cds.reflect(model).all(item => {
|
|
141
|
+
if (item.kind === 'entity' && item[ANNO_PERSISTENCE_JOURNAL] === true) {
|
|
142
|
+
if (item['@cds.persistence.skip'] === true || item['@cds.persistence.exists'] === true) {
|
|
143
|
+
logger.warn(`[hdbmigrationtable] annotation @cds.persistence.journal skipped for entity '${item.name}' as persistence exists`)
|
|
144
|
+
}
|
|
145
|
+
return true
|
|
146
|
+
}
|
|
147
|
+
return false
|
|
148
|
+
}).map(entity => getArtifactCdsPersistenceName(entity.name, 'quoted', model, 'hana')))
|
|
149
|
+
|
|
150
|
+
logger._debug && logger.debug(`\n[hdbmigrationtable] found ${journalNames.size} model entities annotated with '@cds.persistence.journal`)
|
|
151
|
+
logger._debug && logger.debug(`[hdbmigrationtable] ${[...journalNames].join(', ')}\n`)
|
|
152
|
+
|
|
153
|
+
return journalNames
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// delete all entities that are not relevant
|
|
157
|
+
function _filterJournalArtifacts(csn) {
|
|
158
|
+
if (!csn) {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
const dict = csn.definitions
|
|
162
|
+
for (const name in dict) {
|
|
163
|
+
if (!_isPersistedAsJournalTable(dict[name])) {
|
|
164
|
+
delete dict[name]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// mark CSN as modified by cds build
|
|
168
|
+
csn.meta.build = `CDS Build v${cds.version}`
|
|
169
|
+
return csn;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// see cds-compiler/lib/model/csnUtils.js#isPersistedAsTable
|
|
173
|
+
function _isPersistedAsJournalTable(artifact) {
|
|
174
|
+
return artifact.kind === 'entity' && hasOptionValue(artifact['@cds.persistence.journal'], true) &&
|
|
175
|
+
!artifact.abstract &&
|
|
176
|
+
!hasOptionValue(artifact['@cds.persistence.skip'], true) &&
|
|
177
|
+
!hasOptionValue(artifact['@cds.persistence.exists'], true) &&
|
|
178
|
+
(!artifact.query && !artifact.projection || hasOptionValue(artifact['@cds.persistence.table'], true))
|
|
179
|
+
}
|