@sap/cds-dk 7.9.6 → 8.0.3
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 +2136 -0
- package/bin/add.js +18 -52
- package/bin/bind.js +2 -2
- package/bin/build.js +29 -4
- package/bin/cds.js +31 -14
- package/bin/compile/index.js +7 -6
- package/bin/completion/index.js +70 -46
- package/bin/completion/scripts/cds-bash.sh +4 -1
- package/bin/completion/scripts/cds-fish.fish +13 -0
- package/bin/completion/scripts/cds-ps.ps1 +2 -1
- package/bin/completion/scripts/cds-zsh.sh +2 -1
- package/bin/deploy/index.js +6 -5
- package/bin/deploy/to-sqlite.js +2 -2
- package/bin/extend.js +19 -50
- package/bin/help.js +2 -2
- package/bin/init.js +10 -77
- package/bin/login.js +13 -5
- package/bin/migrate.js +1 -1
- package/bin/pull.js +11 -0
- package/bin/repl.js +3 -0
- package/bin/test.js +5 -0
- package/bin/version.js +7 -7
- package/bin/watch.js +13 -14
- package/lib/bind/KubernetesApiAccessor.js +10 -9
- package/lib/build/buildTaskEngine.js +11 -7
- package/lib/build/buildTaskFactory.js +15 -43
- package/lib/build/buildTaskProviderFactory.js +16 -44
- package/lib/build/constants.js +4 -3
- package/lib/build/index.js +2 -2
- package/lib/build/{buildPlugin.js → plugin.js} +65 -46
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
- package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
- package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
- package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
- package/lib/build/plugins/helm/index.js +81 -0
- package/lib/build/plugins.js +12 -15
- package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
- package/lib/build/provider/hana/2migration.js +168 -124
- package/lib/build/provider/hana/index.js +69 -56
- package/lib/build/provider/hana/template/package.json +4 -3
- package/lib/build/provider/internalBuildPlugin.js +32 -97
- package/lib/build/provider/internalBuildTaskProvider.js +12 -48
- package/lib/build/provider/java/index.js +2 -3
- package/lib/build/provider/mtx/index.js +5 -4
- package/lib/build/provider/mtx-extension/index.js +5 -2
- package/lib/build/provider/mtx-sidecar/index.js +2 -2
- package/lib/build/provider/nodejs/index.js +4 -3
- package/lib/build/util.js +83 -12
- package/lib/compile/to-mermaid.js +108 -0
- package/lib/compile/to_asyncapi.js +7 -0
- package/lib/compile/to_openapi.js +7 -0
- package/lib/deploy/to-hana/hana.js +37 -34
- package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
- package/lib/env/schemas/cds-rc.js +1 -1
- package/lib/import/common.js +2 -2
- package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
- package/lib/import/odata/v2parser.js +83 -197
- package/lib/import/odata/v4parser.js +1 -38
- package/lib/import/openapi/importOpenAPI.js +164 -42
- package/lib/index.js +10 -12
- package/lib/init/bas.js +91 -0
- package/lib/init/constants.js +21 -11
- package/lib/init/index.js +72 -150
- package/lib/init/merge.js +12 -20
- package/lib/init/mvn.js +103 -150
- package/lib/init/plugin.js +11 -7
- package/lib/init/projectReader.js +53 -20
- package/lib/init/registries/mta.js +51 -6
- package/lib/init/template/application-logging/files/package.json.hbs +7 -0
- package/lib/init/template/application-logging/index.js +13 -1
- package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
- package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
- package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
- package/lib/init/template/approuter/index.js +29 -25
- package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
- package/lib/init/template/attachments/files/package.json.hbs +5 -0
- package/lib/init/template/attachments/files/values.yaml +7 -0
- package/lib/init/template/attachments/index.js +53 -0
- package/lib/init/template/{redis-messaging → audit-logging}/files/mta.yaml.hbs +4 -4
- package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
- package/lib/init/template/audit-logging/index.js +66 -0
- package/lib/init/template/cf-manifest/index.js +4 -0
- package/lib/init/template/completion/completionSetup.js +54 -33
- package/lib/init/template/completion/index.js +7 -1
- package/lib/init/template/connectivity/index.js +4 -4
- package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
- package/lib/init/template/containerize/index.js +24 -0
- package/lib/init/template/data/index.js +4 -0
- package/lib/init/template/destination/files/mta.yaml.hbs +31 -1
- package/lib/init/template/destination/files/package.sidecar.json +7 -0
- package/lib/init/template/destination/index.js +22 -2
- package/lib/init/template/enterprise-messaging/index.js +6 -3
- package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
- package/lib/init/template/extensibility/files/package.json.hbs +1 -1
- package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
- package/lib/init/template/extensibility/index.js +3 -1
- package/lib/init/template/file-based-messaging/index.js +4 -0
- package/lib/init/template/h2/index.js +4 -0
- package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/hana/files/db/package.json +3 -2
- package/lib/init/template/hana/files/package.json.hbs +4 -7
- package/lib/init/template/hana/files/values.yaml.hbs +1 -2
- package/lib/init/template/hana/index.js +15 -7
- package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
- package/lib/init/template/helm/files/values.schema.json +2173 -0
- package/lib/init/template/helm/files/values.yaml.hbs +11 -6
- package/lib/init/template/helm/index.js +77 -18
- package/lib/init/template/helm-unified-runtime/index.js +19 -56
- package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
- package/lib/init/template/html5-repo/files/manifest.json +13 -0
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +14 -33
- package/lib/init/template/html5-repo/files/package.sidecar.json +7 -0
- package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
- package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
- package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +6 -7
- package/lib/init/template/html5-repo/index.js +41 -35
- package/lib/init/template/http/index.js +36 -12
- package/lib/init/template/java/index.js +18 -12
- package/lib/init/template/kafka/index.js +4 -0
- package/lib/init/template/lint/index.js +7 -2
- package/lib/init/template/liquibase/index.js +4 -0
- package/lib/init/template/local-messaging/index.js +4 -0
- package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
- package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
- package/lib/init/template/malware-scanner/files/values.yaml +7 -0
- package/lib/init/template/malware-scanner/index.js +47 -0
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
- package/lib/init/template/mta/files/package.json +1 -1
- package/lib/init/template/mta/index.js +4 -0
- package/lib/init/template/mtx/index.js +4 -0
- package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
- package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
- package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
- package/lib/init/template/multitenancy/index.js +50 -28
- package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
- package/lib/init/template/nodejs/files/package.json.hbs +2 -3
- package/lib/init/template/nodejs/index.js +4 -0
- package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
- package/lib/init/template/notifications/index.js +4 -0
- package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
- package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
- package/lib/init/template/pipeline/index.js +4 -0
- package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
- package/lib/init/template/portal/files/package.json.hbs +11 -0
- package/lib/init/template/portal/files/package.sidecar.json +7 -0
- package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
- package/lib/init/template/portal/index.js +84 -0
- package/lib/init/template/postgres/index.js +5 -1
- package/lib/init/template/redis/files/mta.yaml.hbs +25 -0
- package/lib/init/template/redis/files/package.json.hbs +5 -0
- package/lib/init/template/redis/index.js +44 -0
- package/lib/init/template/redis-messaging/files/package.json.hbs +0 -3
- package/lib/init/template/redis-messaging/index.js +8 -18
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
- package/lib/init/template/sample/files/app/index.html +1 -1
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
- package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
- package/lib/init/template/sample/files/package.json.hbs +3 -0
- package/lib/init/template/sample/index.js +16 -9
- package/lib/init/template/sqlite/index.js +4 -0
- package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
- package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
- package/lib/init/template/tiny-sample/index.js +4 -0
- package/lib/init/template/toggles/files/package.json.hbs +1 -1
- package/lib/init/template/toggles/index.js +4 -0
- package/lib/init/template/typer/index.js +4 -0
- package/lib/init/template/typescript/files/package.json +12 -0
- package/lib/init/template/typescript/files/tsconfig.json +13 -0
- package/lib/init/template/typescript/index.js +39 -0
- package/lib/init/template/workzone/index.js +9 -0
- package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
- package/lib/init/template/workzone-standard/files/mta.yaml.hbs +59 -0
- package/lib/init/template/workzone-standard/index.js +46 -0
- package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
- package/lib/init/template/xsuaa/index.js +11 -7
- package/lib/init/validate.js +27 -0
- package/lib/lint/generators.js +1 -1
- package/lib/lint/io.js +25 -7
- package/lib/mtx/auth_manager.js +64 -30
- package/lib/mtx/download_legacy.js +2 -2
- package/lib/mtx/index.js +0 -4
- package/lib/mtx/params.js +32 -38
- package/lib/mtx/pull.js +151 -43
- package/lib/mtx/push.js +3 -3
- package/lib/mtx/settings_manager.js +75 -35
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/cf.js +1 -1
- package/lib/mtx/util/fs.js +26 -1
- package/lib/mtx/util/logging.js +7 -3
- package/lib/util/command.js +0 -2
- package/lib/util/fs.js +2 -3
- package/lib/util/question.js +28 -0
- package/lib/util/term.js +5 -3
- package/npm-shrinkwrap.json +225 -1083
- package/package.json +13 -8
- package/bin/activate.js +0 -77
- package/lib/compile/asyncapi/channels.js +0 -22
- package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
- package/lib/compile/asyncapi/components/messages/index.js +0 -173
- package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
- package/lib/compile/asyncapi/components/schemas/array.js +0 -8
- package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
- package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
- package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
- package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
- package/lib/compile/asyncapi/components/schemas/index.js +0 -14
- package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
- package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
- package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
- package/lib/compile/asyncapi/index.js +0 -247
- package/lib/compile/asyncapi/message.js +0 -13
- package/lib/compile/asyncapi/utils.js +0 -27
- package/lib/compile/openapi/csdl2openapi.js +0 -2448
- package/lib/compile/openapi/index.js +0 -68
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
- package/lib/init/template/helm/files/chart/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
- package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
- package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
- package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
- package/lib/init/template/helm-unified-runtime/package.json +0 -4
- package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
- package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
- package/lib/init/template/nodejs/files/eslint.config.js +0 -13
- package/lib/init/template/notebook/index.js +0 -11
- package/lib/init/template/samples/index.js +0 -9
- package/lib/mtx/activate.js +0 -238
- package/lib/mtx/extend.js +0 -173
- package/lib/util/exec.d.ts +0 -54
- package/lib/util/exec.js +0 -211
- /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
- /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
- /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
- /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
- /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
|
@@ -36,7 +36,7 @@ module.exports = new class HanaDeployer {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async deploy(options = {}) {
|
|
39
|
-
let { model, serviceName, tunnelAddress, vcapFile, undeployWhitelist, hdiOptions = {}, dry, storeCredentials } = options;
|
|
39
|
+
let { model, serviceName: pServiceName, tunnelAddress, vcapFile, undeployWhitelist, hdiOptions = {}, dry, storeCredentials } = options;
|
|
40
40
|
|
|
41
41
|
options.for = options.for || 'hybrid';
|
|
42
42
|
|
|
@@ -51,7 +51,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (vcapFile) {
|
|
54
|
-
console.log(`Using VCAP_SERVICES from file ${vcapFile}
|
|
54
|
+
console.log(`Using VCAP_SERVICES from file ${vcapFile}.`);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const fromFile = vcapFile && exists(vcapFile) ? await read(vcapFile) : {};
|
|
@@ -59,23 +59,22 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
59
59
|
const vcapEnv = { ...fromEnv, ...fromFile };
|
|
60
60
|
|
|
61
61
|
const warnings = [];
|
|
62
|
-
if (
|
|
62
|
+
if (pServiceName && vcapEnv.VCAP_SERVICES?.hana?.[0].name !== pServiceName) {
|
|
63
63
|
if (vcapFile) {
|
|
64
|
-
warnings.push(`The specified service name '${
|
|
64
|
+
warnings.push(`The specified service name '${pServiceName}' was used; the information coming from --vcap-service file was ignored.`);
|
|
65
65
|
} else if (Object.keys(fromEnv).length > 0) {
|
|
66
|
-
warnings.push(`The specified service name '${
|
|
66
|
+
warnings.push(`The specified service name '${pServiceName}' was used; the information coming from environment variable VCAP_SERVICES was ignored.`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const projectPath = cds.root;
|
|
71
70
|
const buildResults = await this._build();
|
|
72
71
|
|
|
73
72
|
if (process.env.TARGET_CONTAINER) {
|
|
74
73
|
vcapEnv.TARGET_CONTAINER = process.env.TARGET_CONTAINER;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
for (const { task } of buildResults) {
|
|
77
|
+
if (dry) {
|
|
79
78
|
const model = await cds.load(task.src);
|
|
80
79
|
const data = cds.compile.to.hdbtable(model);
|
|
81
80
|
for (const [src, { file }] of data) {
|
|
@@ -83,23 +82,27 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
83
82
|
console.log(src);
|
|
84
83
|
console.log();
|
|
85
84
|
}
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
for (const { task } of buildResults) {
|
|
85
|
+
} else {
|
|
89
86
|
const dest = task.dest;
|
|
90
87
|
|
|
88
|
+
let serviceName = pServiceName;
|
|
89
|
+
let serviceKeyName;
|
|
90
|
+
if (!serviceName && cds.env.requires.db?.binding?.instance) {
|
|
91
|
+
serviceName = cds.env.requires.db.binding.instance;
|
|
92
|
+
serviceKeyName = cds.env.requires.db.binding.key;
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
if (undeployWhitelist) {
|
|
92
96
|
console.log('Writing undeploy.json');
|
|
93
97
|
await fs.write(path.join(dest, 'undeploy.json'), JSON.stringify(undeployWhitelist, null, 2));
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
const hasVCAPEnv = Object.keys(vcapEnv).length > 0;
|
|
97
|
-
let serviceKeyName
|
|
98
101
|
if (!serviceName && hasVCAPEnv) {
|
|
99
102
|
await fs.mkdir(dest, { recursive: true });
|
|
100
103
|
} else {
|
|
101
104
|
const { cfServiceInstanceName, cfServiceInstanceKeyName, serviceKey } =
|
|
102
|
-
await this._getOrCreateCFService(
|
|
105
|
+
await this._getOrCreateCFService(dest, serviceName, serviceKeyName, tunnelAddress);
|
|
103
106
|
|
|
104
107
|
serviceName ??= cfServiceInstanceName;
|
|
105
108
|
serviceKeyName ??= cfServiceInstanceKeyName
|
|
@@ -108,7 +111,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
if (storeCredentials) {
|
|
111
|
-
await this._addInstanceToDefaultEnvJson([dest,
|
|
114
|
+
await this._addInstanceToDefaultEnvJson([dest, cds.root], cfServiceInstanceName, serviceKey);
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
@@ -129,7 +132,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
if (storeCredentials) {
|
|
132
|
-
await gitUtil.ensureFileIsGitignored('default-env.json',
|
|
135
|
+
await gitUtil.ensureFileIsGitignored('default-env.json', cds.root);
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
console.log(`If not already done, use ${info('cds add hana')} to configure the project for SAP HANA.\n`);
|
|
@@ -146,7 +149,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
|
|
149
|
-
async _getOrCreateCFService(
|
|
152
|
+
async _getOrCreateCFService(currentModelFolder, serviceName, serviceKeyName, tunnelAddress) {
|
|
150
153
|
const modelName = path.basename(currentModelFolder);
|
|
151
154
|
|
|
152
155
|
// get from param
|
|
@@ -155,7 +158,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
155
158
|
if (serviceName) {
|
|
156
159
|
cfServiceInstanceName = serviceName;
|
|
157
160
|
} else {
|
|
158
|
-
const cfServiceDescriptor = await mtaUtil.getHanaDbModuleDescriptor(
|
|
161
|
+
const cfServiceDescriptor = await mtaUtil.getHanaDbModuleDescriptor(cds.root, modelName);
|
|
159
162
|
cfServiceInstanceName = cfServiceDescriptor.hdiServiceName;
|
|
160
163
|
cfServiceInstanceMta = cfServiceDescriptor.hdiService
|
|
161
164
|
}
|
|
@@ -167,16 +170,16 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
167
170
|
const cfConfig = cfServiceInstanceMta?.parameters?.config;
|
|
168
171
|
const serviceInstance = await this.createHanaService(cfServiceInstanceName, cfConfig);
|
|
169
172
|
|
|
170
|
-
const cfServiceInstanceKeyName = `${cfServiceInstanceName}-key`;
|
|
171
|
-
let
|
|
172
|
-
this.
|
|
173
|
+
const cfServiceInstanceKeyName = serviceKeyName ?? `${cfServiceInstanceName}-key`;
|
|
174
|
+
let credentials = await cfUtil.getOrCreateServiceKey(serviceInstance, cfServiceInstanceKeyName, { permissions: 'development' });
|
|
175
|
+
this._validateCredentials(credentials, cfServiceInstanceKeyName);
|
|
173
176
|
|
|
174
177
|
if (tunnelAddress) {
|
|
175
178
|
console.log(`Using tunnel address ${bold(tunnelAddress)} (beta feature)`);
|
|
176
|
-
|
|
179
|
+
credentials = this._injectTunnelAddress(credentials, tunnelAddress)
|
|
177
180
|
}
|
|
178
181
|
|
|
179
|
-
return { cfServiceInstanceName, cfServiceInstanceKeyName, serviceKey, serviceInstance }
|
|
182
|
+
return { cfServiceInstanceName, cfServiceInstanceKeyName, serviceKey: credentials, serviceInstance }
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
|
|
@@ -198,18 +201,18 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
|
|
201
|
-
|
|
202
|
-
if (!
|
|
204
|
+
_validateCredentials(credentials, cfServiceInstanceKey) {
|
|
205
|
+
if (!credentials) {
|
|
203
206
|
throw `Could not create service key ${bold(cfServiceInstanceKey)}.`;
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
if (
|
|
209
|
+
if (credentials['sm_url']) {
|
|
207
210
|
throw `Service key credentials are matching to a Service Manager instance of a multitenant environment. Make sure there is no conflict with ${cfServiceInstanceKey}.`;
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
const fields = ['schema', 'user', 'password', 'url'];
|
|
211
214
|
for (const field of fields) {
|
|
212
|
-
if (!
|
|
215
|
+
if (!credentials[field]) {
|
|
213
216
|
throw `Service key is missing mandatory field '${field}'. Make sure you are ${bold('not')} using a managed service.`;
|
|
214
217
|
}
|
|
215
218
|
}
|
|
@@ -266,17 +269,17 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
|
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
|
|
269
|
-
_injectTunnelAddress(
|
|
272
|
+
_injectTunnelAddress(credentials, tunnelAddress) {
|
|
270
273
|
if (!/\w+:\d+/.test(tunnelAddress)) {
|
|
271
274
|
throw `Invalid tunnel address '${tunnelAddress}' - must be in form 'host:port'`;
|
|
272
275
|
}
|
|
273
276
|
const [tunnelHost, tunnelPort] = tunnelAddress.split(':')
|
|
274
|
-
const { host, port } =
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return
|
|
277
|
+
const { host, port } = credentials
|
|
278
|
+
credentials.host = tunnelHost
|
|
279
|
+
credentials.port = tunnelPort
|
|
280
|
+
credentials.url = credentials.url.replace(`${host}:${port}`, tunnelAddress)
|
|
281
|
+
credentials.hostname_in_certificate = host // make cert. verification happy, see xs2/hdideploy.js#527
|
|
282
|
+
credentials.url = credentials.url + (credentials.url.includes('?') ? '&' : '?') + 'hostNameInCertificate=' + host
|
|
283
|
+
return credentials
|
|
281
284
|
}
|
|
282
285
|
}
|
|
@@ -12,8 +12,8 @@ module.exports = new class HdiDeployUtil {
|
|
|
12
12
|
const { clean_env, deploy } = this._loadHdiDeployLib(dbDir);
|
|
13
13
|
|
|
14
14
|
const deployerEnv = JSON.parse(JSON.stringify(process.env));
|
|
15
|
-
const
|
|
16
|
-
delete
|
|
15
|
+
const options = deployerEnv.HDI_DEPLOY_OPTIONS ? JSON.parse(deployerEnv.HDI_DEPLOY_OPTIONS) : {};
|
|
16
|
+
delete options.root;
|
|
17
17
|
|
|
18
18
|
clean_env?.(deployerEnv);
|
|
19
19
|
|
|
@@ -29,12 +29,15 @@ module.exports = new class HdiDeployUtil {
|
|
|
29
29
|
|
|
30
30
|
if (autoUndeploy) {
|
|
31
31
|
console.log(`HDI deployer automatically undeploys deleted resources using --auto-undeploy.`);
|
|
32
|
-
|
|
32
|
+
options.auto_undeploy = true;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
try { require.resolve('hdb') } catch (e) {
|
|
36
|
+
if (e.code === 'MODULE_NOT_FOUND') options.use_hdb = false
|
|
37
|
+
else throw e
|
|
37
38
|
}
|
|
39
|
+
if (options.use_hdb !== false) options.use_hdb = true
|
|
40
|
+
deployerEnv.HDI_DEPLOY_OPTIONS = JSON.stringify(options)
|
|
38
41
|
|
|
39
42
|
const asyncDeploy = util.promisify(deploy);
|
|
40
43
|
const { exitCode, signal } = await asyncDeploy(dbDir, deployerEnv);
|
|
@@ -47,7 +50,6 @@ module.exports = new class HdiDeployUtil {
|
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
|
|
51
53
|
_loadHdiDeployLib(cwd) {
|
|
52
54
|
const searchPaths = [cwd, __dirname];
|
|
53
55
|
const libPath = require.resolve(path.join(HDI_DEPLOY_LIB, 'library'), { paths: searchPaths });
|
|
@@ -106,7 +106,7 @@ module.exports = {
|
|
|
106
106
|
},
|
|
107
107
|
src: {
|
|
108
108
|
type: "string",
|
|
109
|
-
description: "Optional: Prefer defining 'cds.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
|
|
109
|
+
description: "Optional: Prefer defining 'cds.env.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
|
|
110
110
|
format: "uri-reference"
|
|
111
111
|
},
|
|
112
112
|
for: {
|
package/lib/import/common.js
CHANGED
|
@@ -75,10 +75,10 @@ async function getVersion(fileInputStream){
|
|
|
75
75
|
|
|
76
76
|
function checkForEmptyKeys(element, oDataVersion) {
|
|
77
77
|
if (oDataVersion === "V2") {
|
|
78
|
-
return (element.includes(
|
|
78
|
+
return (element.includes("cds.Association") || element.includes("cds.Composition") && !element.includes(['"on":']));
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
return (['cds.Association'].includes(element.type)) && !element.on && !element.keys;
|
|
81
|
+
return (['cds.Association', 'cds.Composition'].includes(element.type)) && !element.on && !element.keys;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
const vocabulariesMap = new Map([
|
|
4
4
|
['org.odata.core.v1', () => require('../vocabularies/Org.OData.Core.V1.json')],
|
|
5
5
|
['org.odata.aggregation.v1', () => require('../vocabularies/Org.OData.Aggregation.V1.json')],
|
|
@@ -771,21 +771,21 @@ class DefaultValueConverter {
|
|
|
771
771
|
|
|
772
772
|
if (currentDefaultValue == null) return null;
|
|
773
773
|
if (target.$Type.startsWith('Edm.')) {
|
|
774
|
-
|
|
774
|
+
|
|
775
775
|
target.$DefaultValue = Expression.convertDefaultValue(target.$Type, currentDefaultValue);
|
|
776
776
|
return null;
|
|
777
777
|
}
|
|
778
778
|
context.on('pre finalize', (callback) => {
|
|
779
779
|
context.resolveType(target.$Type).then((edmType) => {
|
|
780
780
|
if (edmType instanceof TypeDefinition) {
|
|
781
|
-
|
|
781
|
+
|
|
782
782
|
target.$DefaultValue = Expression.convertDefaultValue(
|
|
783
783
|
edmType.getType().toString(), currentDefaultValue
|
|
784
784
|
);
|
|
785
785
|
return callback();
|
|
786
786
|
}
|
|
787
787
|
if (edmType instanceof EnumType) {
|
|
788
|
-
|
|
788
|
+
|
|
789
789
|
target.$DefaultValue = Expression.convertDefaultValue(
|
|
790
790
|
'EnumType', currentDefaultValue
|
|
791
791
|
);
|