@sap/cds-dk 8.3.0 → 8.4.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/CHANGELOG.md +40 -13
- package/bin/build.js +1 -1
- package/bin/cds.js +12 -0
- package/bin/compile/index.js +6 -1
- package/bin/env.js +3 -2
- package/bin/init.js +8 -4
- package/bin/repl.js +3 -3
- package/lib/build/util.js +32 -20
- package/lib/deploy/to-hana/hana.js +2 -21
- package/lib/env/schemas/cds-rc.js +174 -2
- package/lib/import/asyncapi/parserContext.js +4 -30
- package/lib/import/odata/v2parser.js +3 -2
- package/lib/import/openapi/importOpenAPI.js +616 -569
- package/lib/import/openapi/utilities.js +7 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +4 -0
- package/lib/init/projectReader.js +1 -2
- package/lib/init/registries/mta.js +8 -1
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +3 -1
- package/lib/init/template/enterprise-messaging-shared/index.js +1 -1
- package/lib/init/template/file-based-messaging/index.js +1 -1
- package/lib/init/template/hana/files/package.json.hbs +2 -0
- package/lib/init/template/hana/index.js +1 -1
- package/lib/init/template/handler/index.js +1 -1
- package/lib/init/template/html5-repo/files/app-package.json.hbs +2 -2
- package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +2 -2
- package/lib/init/template/local-messaging/index.js +1 -1
- package/lib/init/template/nodejs/files/.vscode/extensions.json +0 -5
- package/lib/init/template/nodejs/files/.vscode/settings.json +1 -1
- package/lib/init/template/nodejs/files/.vscode/tasks.json +0 -2
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/postgres/index.js +1 -1
- package/lib/init/template/redis-messaging/index.js +1 -1
- package/lib/init/template/side-by-side-extensibility/files/mta.yaml.hbs +40 -0
- package/lib/init/template/side-by-side-extensibility/files/package.json.hbs +17 -0
- package/lib/init/template/side-by-side-extensibility/index.js +34 -0
- package/lib/init/template/typescript/files/package.json +2 -2
- package/lib/init/template/xsuaa/index.js +1 -1
- package/lib/util/fs.js +1 -1
- package/lib/util/jsonc.js +1 -1
- package/lib/util/jsonc.pegjs +6 -2
- package/npm-shrinkwrap.json +55 -143
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
9
9
|
|
|
10
|
+
## Version 8.4.0 - 2024-10-29
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Added support for `import` and `export` for auto-completion in `package.json` and `.cdsrc.json`.
|
|
15
|
+
- `cds add side-by-side-extensibility` adds configuration for logic extensibility via extension points (Java).
|
|
16
|
+
- `cds init --java` can be used as an alias to `cds init --add java`.
|
|
17
|
+
- Add cds schema for `helm` build plugin.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- `cds init` does not put comments in JSON files within `.vscode/`.
|
|
22
|
+
- `cds import --from asyncapi` now uses CloudEvents type in `@topic` annotation.
|
|
23
|
+
- `cds deploy` does not fall back to the deprecated `hanatrial` service plan any more.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- `cds env` now colors is output honoring settings like `FORCE_COLOR`.
|
|
28
|
+
- `cds add` commands correctly detect Java/Node in Microsoft PowerShell.
|
|
29
|
+
- `cds add hana` doesn't add `dependencies` to `.cdsrc.json` any more.
|
|
30
|
+
- `cds add cf-manifest` uses the new `sap_java_buildpack_jakarta` buildpack.
|
|
31
|
+
- `cds build --production` now correctly formats console log output.
|
|
32
|
+
- `cds add` correctly handles entries like `cds.requires.auth` if the following configuration is scoped in a profile.
|
|
33
|
+
- `cds add` plugins can use a shortcut for their options.
|
|
34
|
+
- `cds import` fix for no entity schema in OData V2.
|
|
35
|
+
|
|
10
36
|
## Version 8.3.0 - 2024-09-30
|
|
11
37
|
|
|
12
38
|
### Added
|
|
@@ -27,8 +53,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
27
53
|
|
|
28
54
|
### Fixed
|
|
29
55
|
|
|
30
|
-
-
|
|
31
|
-
- Less
|
|
56
|
+
- `cds add workzone`-created apps can now directly be added via Content Manager in SAP Build Work Zone.
|
|
57
|
+
- Less obtrusive warning about `cds` instead of `cds-ts` in Typescript projects.
|
|
32
58
|
|
|
33
59
|
## Version 8.2.3 - 2024-09-25
|
|
34
60
|
|
|
@@ -64,7 +90,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
64
90
|
- `cds add dynatrace` adds configuration for Dynatrace.
|
|
65
91
|
- `cds add cloud-logging` adds configuration for SAP Cloud Logging. Option `--with-telemetry` allows for configuration with telemetry.
|
|
66
92
|
- `cds version` shows version information for `@cap-js/db-service`.
|
|
67
|
-
- `cds add portal` now adds
|
|
93
|
+
- `cds add portal` now adds SAP Cloud Portal configuration for Kyma.
|
|
68
94
|
- `cds add handler` allows to create handler stubs (for Java only, beta)
|
|
69
95
|
- `cds init --add java --no-db` lets you create a Java project without persistent database.
|
|
70
96
|
- `cds import` supports plugins.
|
|
@@ -145,7 +171,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
145
171
|
- `cds compile --to mermaid` no longer fails for complex queries like joins.
|
|
146
172
|
- `cds build --for mtx-sidecar` now correctly supports different `srv` folder name.
|
|
147
173
|
- `cds add audit-log` in combination with `cds add multitenancy` correctly adds the audit-log dependency to the MTX sidecar.
|
|
148
|
-
- `cds build` adds the correct hdbtabledata file paths to the
|
|
174
|
+
- `cds build` adds the correct hdbtabledata file paths to the HANA result set.
|
|
149
175
|
- `cds add` plugins can now correctly interpret `cds.cli` properties.
|
|
150
176
|
- `cds deploy --to hana --dry` now shows correct files with their content.
|
|
151
177
|
- `cds version` now reports the correct version of `@sap/cds` if this one is installed locally along with a local `@sap/cds-dk` installation.
|
|
@@ -275,7 +301,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
275
301
|
- `cds login` eagerly fetches the passcode URL (if supported by `@sap/cds-mtxs`) and prints it on prompt.
|
|
276
302
|
- `cds extend` and `cds activate` have been deprecated and are now removed. (You can still migrate and download projects, see `cds migrate --help` and `cds extend --help`.)
|
|
277
303
|
- Remove obsolete classic MTX checks and enforce `@sap/cds` >= 7.
|
|
278
|
-
- `cds build` uses cds.compile.to.hana API with `@sap/cds` 8.
|
|
304
|
+
- `cds build` uses `cds.compile.to.hana` API with `@sap/cds` 8.
|
|
279
305
|
- `cds bind` and `cds deploy` use direct http requests instead of `cf curl`.
|
|
280
306
|
- `cds build --for java` no longer generates localized EDMX files by default. It can be enabled using `contentLocalizedEdmx` build task option.
|
|
281
307
|
- `@cap-js/sqlite`/`better-sqlite3` is used in dependencies instead of `sqlite3`.
|
|
@@ -377,7 +403,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
377
403
|
- `cds add` doesn't fail for projects with a minimal `package.json` w/o `name` and `version` fields
|
|
378
404
|
- `cds add data` can be executed in projects w/o `package.json` and `.cdsrc.json` files.
|
|
379
405
|
- `cds add sample` does not fail if the `srv` folder doesn't exist.
|
|
380
|
-
- `cds add helm` fixed
|
|
406
|
+
- `cds add helm` fixed XSUAA tenant-mode not updating on adding `multitenancy`
|
|
381
407
|
- `cds watched` cannot be called from command line anymore.
|
|
382
408
|
- `cds login` now correctly handles the case of an expired refresh token and gives more information about token-request errors.
|
|
383
409
|
- `cds login` now refreshes the token URL if it had previously reverted to a legacy URL.
|
|
@@ -659,11 +685,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
659
685
|
- `cds add connectivity` does not add `connectivity: true` to your `package.json` any more.
|
|
660
686
|
- `cds watch` now ignores more files/folders: `app/(webapp|dist|target)`, `app/*/(webapp|dist|target)`, `tsconfig.json`, `*.tsbuildinfo`
|
|
661
687
|
- `cds build` now uses `compile.to.hdbtable` if no migration tables exist.
|
|
662
|
-
-
|
|
688
|
+
- `cds build` plugin API is refactored.
|
|
663
689
|
|
|
664
690
|
### Fixed
|
|
665
691
|
|
|
666
|
-
- `cds login` now prints shorter errors
|
|
692
|
+
- `cds login` now prints shorter errors (set `DEBUG=req` in env to see all details again).
|
|
667
693
|
- Fixed issue when creating a CAP project in SAP Business Application Studio's template wizard.
|
|
668
694
|
- `cds import` now handles name collision within a Schema for OData V4 EDMX.
|
|
669
695
|
- `cds build` for mtx extension projects no longer creates CSN containing unresolved model associations.
|
|
@@ -709,7 +735,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
709
735
|
|
|
710
736
|
### Removed
|
|
711
737
|
|
|
712
|
-
-
|
|
738
|
+
- `cds add auditlog` facet.
|
|
713
739
|
|
|
714
740
|
## Version 7.1.1 - 2023-08-10
|
|
715
741
|
|
|
@@ -732,7 +758,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
732
758
|
|
|
733
759
|
- Calls from Business Application Studio `New Project from Template` wizard are now handled correctly.
|
|
734
760
|
- `cds add cf-manifest` correctly generates the XSUAA instance name.
|
|
735
|
-
- `cds build` always uses the configured
|
|
761
|
+
- `cds build` always uses the configured HANA build task when building the MTX sidecar.
|
|
736
762
|
- `cds import` OData V4 EDMX fix for Annotation Alias and Namespace value replacement.
|
|
737
763
|
|
|
738
764
|
### Changed
|
|
@@ -1215,7 +1241,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
1215
1241
|
- `cds import` switch from `@openapi.schema` to `@JSON.Schema`.
|
|
1216
1242
|
- `cds add mtx` will now add configuration for streamlined MTX. It effectively acts as a shortcut for `cds add multitenancy,toggles,extensibility`
|
|
1217
1243
|
- `cds add mtx` no longer includes `hana` and `xsuaa`. To achieve the same effect as before, run `cds add mtx && cds add hana,xsuaa --for production`.
|
|
1218
|
-
- `cds bind -2 <xsuaa service instance>` binds the CDS `auth` service to the
|
|
1244
|
+
- `cds bind -2 <xsuaa service instance>` binds the CDS `auth` service to the XSUAA instance. Previously `uaa` was used. This requires `@sap/cds` 6 or higher.
|
|
1219
1245
|
- `cds add lint:dev` updated to adjust to new api structure of `@sap/eslint-plugin-cds` v2.5.0
|
|
1220
1246
|
- `cds init` uses latest Maven Java archetype version 1.27.0 for creating Java projects.
|
|
1221
1247
|
- `cds login localhost:<port> -u <username>` now saves username (and empty password, if applicable) with project settings for convenience.
|
|
@@ -1412,7 +1438,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
1412
1438
|
- `cds import` bug fixed for `--force` flag. Now overwrites the correct file content.
|
|
1413
1439
|
- `cds import` fix will no longer capture unwanted annotations in the CSN for OData V4.
|
|
1414
1440
|
- `cds import` now support annotations for properties of type `Type Definition`
|
|
1415
|
-
- `cds import` fix for supporting valid
|
|
1441
|
+
- `cds import` fix for supporting valid data types in unbounded function imports for OData V4.
|
|
1416
1442
|
- `cds import` bug fixed for missing data imports for parameters with entity type not mapped to an entity set.
|
|
1417
1443
|
- `cds import` now supports properties with complex type for OData V4.
|
|
1418
1444
|
- `cds import` fix will now throw error if the key property of an entity is of type `Collection` for both OData V2 and V4 edmx.
|
|
@@ -1549,9 +1575,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
1549
1575
|
- `cds lint` now limits all file extensions to those allowed by the @sap/eslint-plugin-cds ESLint configuration
|
|
1550
1576
|
|
|
1551
1577
|
## Version 4.6.0 - 2021-11-02
|
|
1578
|
+
|
|
1552
1579
|
### Added
|
|
1553
1580
|
|
|
1554
|
-
- `cds bind` binds the given service to a
|
|
1581
|
+
- `cds bind` binds the given service to a HANA instance by storing the credentials in `.cdsrc.json` in your user home directory [beta].
|
|
1555
1582
|
- `cds import` introduced option `--include-namespaces` which imports the custom defined namespaces.
|
|
1556
1583
|
- `cds import` preserve documentation in CSN file for actions and functions from OData V4 EDMX file.
|
|
1557
1584
|
- `cds import` now supports reading values of the `as` option from cds.env
|
package/bin/build.js
CHANGED
|
@@ -148,7 +148,7 @@ async function build([project], options = {}) {
|
|
|
148
148
|
// IMPORTANT: call plugins before subsequent access to cds.env
|
|
149
149
|
await cds.plugins
|
|
150
150
|
|
|
151
|
-
cds.env = cds.env.for('cds', cds.root)
|
|
151
|
+
cds.env = cds.env.for('cds', cds.root)
|
|
152
152
|
delete options.project // avoid that relative project paths are resolved twice
|
|
153
153
|
|
|
154
154
|
if (typeof options["options-model"] === "string") {
|
package/bin/cds.js
CHANGED
|
@@ -68,6 +68,10 @@ const cli = {
|
|
|
68
68
|
const flags = all.filter(([,f]) => f.type === 'boolean')
|
|
69
69
|
const options = all.filter(([,o]) => o.type !== 'boolean')
|
|
70
70
|
task.options.push(...options.map(([key]) => '--'+key))
|
|
71
|
+
task.shortcuts.push(...options.map(([_, { short }]) => short ? '-'+short : undefined).filter(Boolean))
|
|
72
|
+
const byShortcut = (a, b) => (b.short ? 1 : 0) - (a.short ? 1 : 0)
|
|
73
|
+
task.options.sort(byShortcut)
|
|
74
|
+
task.shortcuts.sort(byShortcut)
|
|
71
75
|
task.flags.push(...flags.map(([key]) => '--'+key))
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -138,6 +142,14 @@ const cli = {
|
|
|
138
142
|
add (k, e[path[0]] = v)
|
|
139
143
|
}
|
|
140
144
|
|
|
145
|
+
// always use 'plain' log format for cds-dk logging
|
|
146
|
+
// by default 'plain' log format is used for development while 'json' format is used for production, see cap/cds/blob/main/lib/env/defaults.js#L97
|
|
147
|
+
// the json formatter logs stringified JSON which causing any line breaks to get replaced by '\n'
|
|
148
|
+
// using the env variable ensures that cds.env isn't loaded too early
|
|
149
|
+
env ??= {}
|
|
150
|
+
env.log ??= {}
|
|
151
|
+
env.log.format = 'plain'
|
|
152
|
+
|
|
141
153
|
// if (env) require('../lib/cds').env.add (env) //> avoid loading env
|
|
142
154
|
// unless it has already explicitly been set by the user
|
|
143
155
|
if (env) process.env.CDS_CONFIG ??= JSON.stringify(env)
|
package/bin/compile/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const {colors} = require('../../lib/util/term')
|
|
|
4
4
|
module.exports = Object.assign ( compile, {
|
|
5
5
|
handleCompletion,
|
|
6
6
|
options: [
|
|
7
|
-
|
|
7
|
+
'--from', '--service', '--lang', '--for', '--to', '--dest', '--log-level', '--flavor', '--dialect', '--sql-dialect', '--openapi:url', '--openapi:servers', '--openapi:config-file', '--odata-version'
|
|
8
8
|
],
|
|
9
9
|
shortcuts: [
|
|
10
10
|
undefined, '-s', '-l', '-4', '-2', '-o', undefined, '-f'
|
|
@@ -135,6 +135,11 @@ module.exports = Object.assign ( compile, {
|
|
|
135
135
|
|
|
136
136
|
Include YUML diagram in the generated OpenAPI document, default: *false*.
|
|
137
137
|
|
|
138
|
+
*--openapi:config-file* filename
|
|
139
|
+
|
|
140
|
+
The passed configuration file will be read to generate the OpenAPI document, incorporating all specified options.
|
|
141
|
+
Precedence of Options: Inline options specified in the command line will take precedence over those defined in the configuration file.
|
|
142
|
+
|
|
138
143
|
*--asyncapi:merged*
|
|
139
144
|
|
|
140
145
|
A single AsyncAPI document is generated using the details of all input services. Information of _title_
|
package/bin/env.js
CHANGED
|
@@ -72,6 +72,7 @@ async function env ([cmd, key, value], options={}) {
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
const { inspect, format } = require('node:util')
|
|
75
|
+
const {colors} = require('../lib/util/term')
|
|
75
76
|
const commands = {
|
|
76
77
|
|
|
77
78
|
json: (env,k,v,o) => commands.get (env,k,v,{...o,json:true}),
|
|
@@ -87,7 +88,7 @@ const commands = {
|
|
|
87
88
|
},
|
|
88
89
|
|
|
89
90
|
get (conf, key, val, options) {
|
|
90
|
-
let fmt = x => inspect (x, {depth:22,colors
|
|
91
|
+
let fmt = x => inspect (x, {depth:22, colors})
|
|
91
92
|
|
|
92
93
|
let obj = (
|
|
93
94
|
!key ? conf
|
|
@@ -96,7 +97,7 @@ const commands = {
|
|
|
96
97
|
: conf.get(key.replace(/^cds\./,''))
|
|
97
98
|
)
|
|
98
99
|
|
|
99
|
-
if (!
|
|
100
|
+
if (!colors) {
|
|
100
101
|
fmt = x => typeof x !== 'object' ? x : JSON.stringify(x,0,2)
|
|
101
102
|
}
|
|
102
103
|
if (options.json) {
|
package/bin/init.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = Object.assign(init, {
|
|
|
9
9
|
handleCompletion,
|
|
10
10
|
options: ['--add', '--java:mvn', '--java:package', '--lint:custom', '--lint:custom:example', '--no-db'],
|
|
11
11
|
shortcuts: ['-a'],
|
|
12
|
-
flags: ['--force', '--verbose'],
|
|
12
|
+
flags: ['--java', '--force', '--verbose'],
|
|
13
13
|
help: `
|
|
14
14
|
# SYNOPSIS
|
|
15
15
|
|
|
@@ -20,6 +20,10 @@ module.exports = Object.assign(init, {
|
|
|
20
20
|
|
|
21
21
|
# OPTIONS
|
|
22
22
|
|
|
23
|
+
*--java*
|
|
24
|
+
|
|
25
|
+
Create a CAP Java project.
|
|
26
|
+
|
|
23
27
|
*--add* <feature | comma-separated list of features>
|
|
24
28
|
|
|
25
29
|
Add one or more features while creating the project.
|
|
@@ -40,10 +44,10 @@ ${require('../lib/init').help()}
|
|
|
40
44
|
# EXAMPLES
|
|
41
45
|
|
|
42
46
|
*cds init* bookshop
|
|
43
|
-
*cds init* bookshop --
|
|
44
|
-
*cds init* bookshop --add
|
|
47
|
+
*cds init* bookshop --java
|
|
48
|
+
*cds init* bookshop --add hana
|
|
45
49
|
*cds init* bookshop --add multitenancy,mta
|
|
46
|
-
*cds init* --
|
|
50
|
+
*cds init* --java --java:mvn groupId=myGroup,artifactId=newId,package=my.company
|
|
47
51
|
|
|
48
52
|
# SEE ALSO
|
|
49
53
|
|
package/bin/repl.js
CHANGED
|
@@ -35,9 +35,9 @@ async function repl (_, options={}) {
|
|
|
35
35
|
|
|
36
36
|
Object.defineProperty (cds,'repl',{value:repl})
|
|
37
37
|
cds.extend (repl.context) .with ( class {
|
|
38
|
-
get Foo() { return ctx.Foo ??= new cds.entity({ name: 'Foo' }) }
|
|
39
|
-
get Bar() { return ctx.Bar ??= new cds.entity({ name: 'Bar' }) }
|
|
40
|
-
get expect() { return cds.test.expect }
|
|
38
|
+
get Foo() { return ctx.Foo ??= new cds.entity({ name: 'Foo' }) }; set Foo(v) { ctx.Foo = v }
|
|
39
|
+
get Bar() { return ctx.Bar ??= new cds.entity({ name: 'Bar' }) }; set Bar(v) { ctx.Bar = v }
|
|
40
|
+
get expect() { return ctx.expect ??= cds.test.expect }; set expect(v) { ctx.expect = v }
|
|
41
41
|
} .prototype )
|
|
42
42
|
const ctx={}
|
|
43
43
|
|
package/lib/build/util.js
CHANGED
|
@@ -6,6 +6,7 @@ const execAsync = require('util').promisify(cp.exec)
|
|
|
6
6
|
const IS_WIN = require('os').platform() === 'win32'
|
|
7
7
|
const { SEVERITY_ERROR, FILE_EXT_CDS } = require('./constants');
|
|
8
8
|
const DEBUG = cds.debug('cli|build')
|
|
9
|
+
const SECRETS = /(passw)|(cert)|(ca)|(secret)|(key)/i
|
|
9
10
|
|
|
10
11
|
function getProperty(src, segments) {
|
|
11
12
|
segments = Array.isArray(segments) ? segments : segments.split('.')
|
|
@@ -68,31 +69,42 @@ function relativePaths(root, qualifiedPaths) {
|
|
|
68
69
|
return qualifiedPaths
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
function redactCredentials(config
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
function redactCredentials(config) {
|
|
73
|
+
if (typeof config !== 'object' || config === null) {
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (Array.isArray(config)) {
|
|
78
|
+
return config.map(item => redactCredentials(item));
|
|
79
|
+
} else {
|
|
80
|
+
const newConfig = Object.assign({}, config);
|
|
81
|
+
for (let key in newConfig) {
|
|
82
|
+
if (key === 'credentials') {
|
|
83
|
+
newConfig[key] = _redacted(newConfig[key]);
|
|
84
|
+
} else {
|
|
85
|
+
newConfig[key] = redactCredentials(newConfig[key]);
|
|
86
|
+
}
|
|
80
87
|
}
|
|
81
|
-
return
|
|
82
|
-
}
|
|
88
|
+
return newConfig;
|
|
89
|
+
}
|
|
83
90
|
}
|
|
84
91
|
|
|
85
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Masks password-like strings, also reducing clutter in output
|
|
94
|
+
* @param {any} cred - object or array with credentials
|
|
95
|
+
* @returns {any}
|
|
96
|
+
*/
|
|
86
97
|
function _redacted(cred) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
if (!cred) return cred
|
|
99
|
+
if (Array.isArray(cred)) return cred.map(c => typeof c === 'string' ? '...' : _redacted(c))
|
|
100
|
+
if (typeof cred === 'object') {
|
|
101
|
+
const newCred = Object.assign({}, cred)
|
|
102
|
+
Object.keys(newCred).forEach(k => (typeof newCred[k] === 'string' && SECRETS.test(k)) ? (newCred[k] = '...') : (newCred[k] = _redacted(newCred[k])))
|
|
103
|
+
return newCred
|
|
104
|
+
}
|
|
105
|
+
return cred
|
|
93
106
|
}
|
|
94
|
-
|
|
95
|
-
|
|
107
|
+
|
|
96
108
|
/**
|
|
97
109
|
* Returns a list of fully qualified model names belonging to the '@sap' namespace that cannot be resolved.
|
|
98
110
|
* E.g. the module might NOT have been installed.
|
|
@@ -38,7 +38,7 @@ module.exports = new class HanaDeployer {
|
|
|
38
38
|
async deploy(options = {}) {
|
|
39
39
|
let { model, serviceName: pServiceName, tunnelAddress, vcapFile, undeployWhitelist, hdiOptions = {}, dry, storeCredentials } = options;
|
|
40
40
|
|
|
41
|
-
options.for
|
|
41
|
+
options.for ??= 'hybrid';
|
|
42
42
|
|
|
43
43
|
if (model) {
|
|
44
44
|
throw `Specifying a CDS model for HANA deployment is not supported.
|
|
@@ -168,7 +168,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
168
168
|
console.log(`Using container ${bold(cfServiceInstanceName)}`);
|
|
169
169
|
|
|
170
170
|
const cfConfig = cfServiceInstanceMta?.parameters?.config;
|
|
171
|
-
const serviceInstance = await
|
|
171
|
+
const serviceInstance = await cfUtil.getOrCreateService('hana', 'hdi-shared', cfServiceInstanceName, cfConfig);
|
|
172
172
|
|
|
173
173
|
const cfServiceInstanceKeyName = serviceKeyName ?? `${cfServiceInstanceName}-key`;
|
|
174
174
|
let credentials = await cfUtil.getOrCreateServiceKey(serviceInstance, cfServiceInstanceKeyName, { permissions: 'development' });
|
|
@@ -182,25 +182,6 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
182
182
|
return { cfServiceInstanceName, cfServiceInstanceKeyName, serviceKey: credentials, serviceInstance }
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
async createHanaService(instanceName, cfConfig) {
|
|
187
|
-
// hana or hanatrial, error if neither found
|
|
188
|
-
try {
|
|
189
|
-
return await cfUtil.getOrCreateService('hana', 'hdi-shared', instanceName, cfConfig);
|
|
190
|
-
} catch (error) {
|
|
191
|
-
if (error.command && /offering .* not found/i.test(error.command.stderr)) {
|
|
192
|
-
console.log(`Falling back to 'hanatrial'`);
|
|
193
|
-
return await cfUtil.getOrCreateService('hanatrial', 'hdi-shared', instanceName, cfConfig);
|
|
194
|
-
}
|
|
195
|
-
else if (error.command && /no database/i.test(error.command.stderr)) {
|
|
196
|
-
console.log(`No database connected to 'hana' service. Falling back to 'hanatrial'`);
|
|
197
|
-
return await cfUtil.getOrCreateService('hanatrial', 'hdi-shared', instanceName, cfConfig);
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
185
|
_validateCredentials(credentials, cfServiceInstanceKey) {
|
|
205
186
|
if (!credentials) {
|
|
206
187
|
throw `Could not create service key ${bold(cfServiceInstanceKey)}.`;
|
|
@@ -131,6 +131,141 @@ module.exports = {
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
|
|
134
|
+
import: {
|
|
135
|
+
type: "object",
|
|
136
|
+
description: "Set CDS import configurations.",
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
properties: {
|
|
139
|
+
as: {
|
|
140
|
+
type: "string",
|
|
141
|
+
description: "Converts the input file into one of these supported formats: cds, csn or json.",
|
|
142
|
+
$ref: "#/$defs/import-options/as"
|
|
143
|
+
},
|
|
144
|
+
from: {
|
|
145
|
+
type: "string",
|
|
146
|
+
description: "Imports the model from the one of the given options: edmx, openapi or asyncapi.",
|
|
147
|
+
$ref: "#/$defs/import-options/from"
|
|
148
|
+
},
|
|
149
|
+
force: {
|
|
150
|
+
type: "boolean",
|
|
151
|
+
description: "Forcefully overwrites the contents in the CDS file and updates the checksum",
|
|
152
|
+
},
|
|
153
|
+
no_save: {
|
|
154
|
+
type: "boolean",
|
|
155
|
+
description: "Skips updating ./package.json.",
|
|
156
|
+
},
|
|
157
|
+
out: {
|
|
158
|
+
type: "string",
|
|
159
|
+
description: "Output file written to the specified location."
|
|
160
|
+
},
|
|
161
|
+
dry: {
|
|
162
|
+
type: "boolean",
|
|
163
|
+
description: "Writes the converted csn to stdout only.",
|
|
164
|
+
},
|
|
165
|
+
keepNamespace: {
|
|
166
|
+
type: "boolean",
|
|
167
|
+
description: "Keeps the original namespace from the edmx content instead of using the filename by default.",
|
|
168
|
+
default: false
|
|
169
|
+
},
|
|
170
|
+
includeNamespaces: {
|
|
171
|
+
type: "string",
|
|
172
|
+
description: "Imports only entities matching to the given list of namespaces."
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
export: {
|
|
178
|
+
type: "object",
|
|
179
|
+
description: "Customize cds compile settings",
|
|
180
|
+
additionalProperties: false,
|
|
181
|
+
properties: {
|
|
182
|
+
asyncapi: {
|
|
183
|
+
type: "object",
|
|
184
|
+
description: "AsyncAPI settings for cds compile",
|
|
185
|
+
additionalProperties: false,
|
|
186
|
+
properties: {
|
|
187
|
+
application_namespace: {
|
|
188
|
+
type: "string",
|
|
189
|
+
description: "The registered namespace of the application"
|
|
190
|
+
},
|
|
191
|
+
merged: {
|
|
192
|
+
type: "object",
|
|
193
|
+
description: "properties that needs to be there when merged option is used",
|
|
194
|
+
additionalProperties: false,
|
|
195
|
+
properties: {
|
|
196
|
+
title: {
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Title to be used for merged doc"
|
|
199
|
+
},
|
|
200
|
+
version: {
|
|
201
|
+
type: "string",
|
|
202
|
+
description: "Version to be used for merged doc"
|
|
203
|
+
},
|
|
204
|
+
short_text: {
|
|
205
|
+
type: "string",
|
|
206
|
+
description: "Short decription of the AsyncAPIs"
|
|
207
|
+
},
|
|
208
|
+
description: {
|
|
209
|
+
type: "string",
|
|
210
|
+
description: "Description to be used for the merged doc"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
event_spec_version: {
|
|
215
|
+
type: "string",
|
|
216
|
+
description: "Mentions the version of AsyncAPI spec"
|
|
217
|
+
},
|
|
218
|
+
event_source: {
|
|
219
|
+
type: "string",
|
|
220
|
+
description: "Event source information",
|
|
221
|
+
default: "{region}/{applicationNamespace}/{instanceId}",
|
|
222
|
+
},
|
|
223
|
+
event_source_params: {
|
|
224
|
+
type: "object",
|
|
225
|
+
description: "Parameters related to the source of event",
|
|
226
|
+
default: {
|
|
227
|
+
region: {
|
|
228
|
+
"description": "The regional context of the application.",
|
|
229
|
+
"schema": {
|
|
230
|
+
"type": "string"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
applicationNamespace: {
|
|
234
|
+
"description": "The registered namespace of the application.",
|
|
235
|
+
"schema": {
|
|
236
|
+
"type": "string"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
instanceId: {
|
|
240
|
+
"description": "The instance id (tenant, installation, ...) of the application.",
|
|
241
|
+
"schema": {
|
|
242
|
+
"type": "string"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
additionalProperties: false,
|
|
247
|
+
region: {
|
|
248
|
+
type: "string",
|
|
249
|
+
description: "The regional context of the application"
|
|
250
|
+
},
|
|
251
|
+
applicationNamespace: {
|
|
252
|
+
type: "string",
|
|
253
|
+
description: "The registered namespace of the application"
|
|
254
|
+
},
|
|
255
|
+
instanceId: {
|
|
256
|
+
type: "string",
|
|
257
|
+
description: "The instance id (tenant, installation, ...) of the application."
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
event_characteristics: {
|
|
261
|
+
type: "object",
|
|
262
|
+
description: "The characteristics defined for events",
|
|
263
|
+
additionalProperties: true
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
134
269
|
// deploy specific schema
|
|
135
270
|
deploy: {
|
|
136
271
|
type: "object",
|
|
@@ -164,7 +299,8 @@ module.exports = {
|
|
|
164
299
|
"mtx-extension",
|
|
165
300
|
"mtx",
|
|
166
301
|
"node-cf",
|
|
167
|
-
"java-cf"
|
|
302
|
+
"java-cf",
|
|
303
|
+
"helm"
|
|
168
304
|
],
|
|
169
305
|
enumDescriptions: [
|
|
170
306
|
"Node.js build plugin",
|
|
@@ -174,7 +310,8 @@ module.exports = {
|
|
|
174
310
|
"MTX extension build plugin",
|
|
175
311
|
"MTX build plugin",
|
|
176
312
|
"Node.js Cloud Foundry build plugin",
|
|
177
|
-
"Java Cloud Foundry build plugin"
|
|
313
|
+
"Java Cloud Foundry build plugin",
|
|
314
|
+
"Helm chart build plugin"
|
|
178
315
|
]
|
|
179
316
|
},
|
|
180
317
|
|
|
@@ -193,6 +330,41 @@ module.exports = {
|
|
|
193
330
|
}
|
|
194
331
|
}
|
|
195
332
|
]
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
import_options: {
|
|
336
|
+
from: {
|
|
337
|
+
oneOf: [
|
|
338
|
+
{
|
|
339
|
+
const: "asyncapi",
|
|
340
|
+
description: "AsyncAPI specification"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
const: "edmx",
|
|
344
|
+
description: "OData specification"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
const: "openapi",
|
|
348
|
+
description: "OpenAPI specification"
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
as: {
|
|
353
|
+
oneOf: [
|
|
354
|
+
{
|
|
355
|
+
const: "cds",
|
|
356
|
+
description: "Converts the input file into cds format"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
const: "csn",
|
|
360
|
+
description: "Converts the input file into csn format"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
const: "json",
|
|
364
|
+
description: "Converts the input file into json format"
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
196
368
|
}
|
|
197
369
|
}
|
|
198
370
|
}
|
|
@@ -6,12 +6,11 @@ module.exports = class ParserContext {
|
|
|
6
6
|
* @constructor
|
|
7
7
|
*/
|
|
8
8
|
constructor(content) {
|
|
9
|
-
this.topics = this.getTopics(content);
|
|
10
9
|
this.services = this.getServicesFromContent(content);
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
getTopicName(
|
|
14
|
-
return
|
|
12
|
+
getTopicName(eventName) {
|
|
13
|
+
return eventName.startsWith('ce/') ? eventName.substring(3) : eventName;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
getEventName(messageRefString) {
|
|
@@ -19,28 +18,6 @@ module.exports = class ParserContext {
|
|
|
19
18
|
return lastSlashIndex == -1 ? '' : messageRefString.substring(lastSlashIndex + 1);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
/**
|
|
23
|
-
* Return an obect with topic annotations for messages
|
|
24
|
-
*/
|
|
25
|
-
getTopics(content) {
|
|
26
|
-
const topics = {};
|
|
27
|
-
|
|
28
|
-
Object.entries(content.channels).forEach(([key, value]) => {
|
|
29
|
-
const topic = this.getTopicName(key);
|
|
30
|
-
if (value.subscribe && value.subscribe.message && value.subscribe.message.$ref) {
|
|
31
|
-
const event = this.getEventName(value.subscribe.message.$ref);
|
|
32
|
-
topics[event] = topic;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (value.publish && value.publish.message && value.publish.message.$ref) {
|
|
36
|
-
const event = this.getEventName(value.publish.message.$ref);
|
|
37
|
-
topics[event] = topic;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return topics;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
21
|
/**
|
|
45
22
|
* Returns services from the asyncapi json object along with the events and annotations.
|
|
46
23
|
* @returns an object with all the services.
|
|
@@ -49,7 +26,7 @@ module.exports = class ParserContext {
|
|
|
49
26
|
const services = {};
|
|
50
27
|
const serviceAnnotations = this.getServiceAnnotations(content);
|
|
51
28
|
|
|
52
|
-
Object.entries(content.components.messages).forEach(([
|
|
29
|
+
Object.entries(content.components.messages).forEach(([, value]) => {
|
|
53
30
|
let eventName;
|
|
54
31
|
// Message name should be used to capture the event name
|
|
55
32
|
if (value.name) {
|
|
@@ -71,10 +48,7 @@ module.exports = class ParserContext {
|
|
|
71
48
|
const eventAnnotations = this.getEventAnnotations(value);
|
|
72
49
|
|
|
73
50
|
// add topic annotation
|
|
74
|
-
|
|
75
|
-
eventAnnotations['@topic'] = this.topics[key];
|
|
76
|
-
}
|
|
77
|
-
|
|
51
|
+
eventAnnotations['@topic'] = this.getTopicName(eventName);
|
|
78
52
|
let properties = {};
|
|
79
53
|
let types = {};
|
|
80
54
|
|