@sap/cds-dk 10.0.7 → 10.1.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 +106 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +14 -0
- package/bin/build.js +21 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +16 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +603 -80
- package/bin/completion/scripts/cds.fish +620 -0
- package/bin/completion/scripts/cds.ps1 +403 -0
- package/bin/completion/scripts/cds.sh +327 -0
- package/bin/completion/scripts/cds.zsh +296 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +217 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +11 -1
- package/bin/deploy/options.js +25 -0
- package/{lib → bin}/deploy/to-hana/hana.js +8 -8
- package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
- package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
- package/bin/deploy/to-sql.js +0 -2
- package/bin/env.js +4 -1
- package/bin/export.js +44 -6
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +9 -0
- package/bin/init.js +6 -24
- package/bin/inspect.js +8 -0
- package/bin/lint.js +5 -3
- package/bin/login.js +26 -20
- package/bin/minify.js +6 -1
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/repl.js +11 -2
- package/bin/run.js +12 -1
- package/bin/serve.js +13 -2
- package/bin/up.js +17 -11
- package/{lib → bin}/upgrade/constants.js +1 -1
- package/bin/{upgrade.js → upgrade/index.js} +2 -2
- package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
- package/{lib → bin}/upgrade/preflight/index.js +1 -1
- package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
- package/{lib → bin}/upgrade/steps/install.js +1 -1
- package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/removals.js +1 -1
- package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/verify.js +1 -1
- package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
- package/{lib → bin}/upgrade/util/pom.js +2 -2
- package/{lib → bin}/upgrade/util/prompt.js +1 -1
- package/bin/util/containerize.js +10 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +24 -9
- package/{lib → bin}/watch/livereload-connect.js +1 -1
- package/{lib → bin}/watch/vite-watch.js +1 -1
- package/{lib → bin}/watch/watched.js +2 -2
- package/lib/build/constants.js +1 -1
- package/lib/build/plugins/fiori/index.js +31 -2
- package/lib/build/plugins/internal.js +4 -2
- package/lib/build/plugins/mtx-sidecar/index.js +7 -8
- package/lib/build/plugins/nodejs/index.js +64 -7
- package/lib/build/util.js +2 -4
- package/lib/compile/to_asyncapi.js +1 -1
- package/lib/env/schema.js +16 -0
- package/lib/env/schemas/cds-rc.js +1 -76
- package/lib/import/importapi.js +2 -3
- package/lib/import/message.js +0 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +2 -2
- package/lib/init/merge.js +123 -280
- package/lib/init/plugin.js +3 -1
- package/lib/init/projectReader.js +22 -6
- package/lib/init/registries/xs-app.js +3 -5
- package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ai/index.js +14 -2
- package/lib/init/template/ams/index.js +2 -2
- package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/app-frontend/index.js +4 -4
- package/lib/init/template/application-logging/index.js +2 -2
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/index.js +8 -3
- package/lib/init/template/attachments/files/package.json.hbs +1 -1
- package/lib/init/template/attachments/index.js +2 -2
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
- package/lib/init/template/cloud-logging/index.js +2 -2
- package/lib/init/template/completion/completionSetup.js +36 -39
- package/lib/init/template/connectivity/index.js +2 -2
- package/lib/init/template/data/as-csv.js +15 -5
- package/lib/init/template/data/as-json.js +117 -42
- package/lib/init/template/data/index.js +16 -2
- package/lib/init/template/destination/index.js +2 -2
- package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
- package/lib/init/template/dynatrace/index.js +2 -2
- package/lib/init/template/enterprise-messaging/index.js +2 -2
- package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
- package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
- package/lib/init/template/extensibility/index.js +3 -3
- package/lib/init/template/github-actions/index.js +2 -2
- package/lib/init/template/hana/index.js +3 -2
- package/lib/init/template/hana-serverless/files/db/package.json +14 -0
- package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
- package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
- package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
- package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
- package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
- package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
- package/lib/init/template/hana-serverless/index.js +184 -0
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
- package/lib/init/template/html5-repo/index.js +18 -14
- package/lib/init/template/http/index.js +123 -26
- package/lib/init/template/ias/index.js +2 -2
- package/lib/init/template/kafka/index.js +2 -2
- package/lib/init/template/kyma/index.js +7 -5
- package/lib/init/template/malware-scanner/index.js +2 -2
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -3
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
- package/lib/init/template/portal/index.js +13 -8
- package/lib/init/template/postgres/index.js +2 -2
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/sample/files/db/currencies.cds +2 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
- package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
- package/lib/init/template/workzone-standard/index.js +5 -5
- package/lib/init/template/xsuaa/index.js +20 -2
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/auth_manager.js +103 -37
- package/lib/mtx/params.js +3 -2
- package/lib/mtx/settings_manager.js +45 -28
- package/lib/mtx/tenant_action.js +0 -1
- package/lib/mtx/util/credentials.js +62 -0
- package/node_modules/@cap-js/db-service/CHANGELOG.md +17 -0
- package/node_modules/@cap-js/db-service/lib/common/generic-pool.js +4 -7
- package/node_modules/@cap-js/db-service/lib/cqn2pql.js +1 -1
- package/node_modules/@cap-js/db-service/lib/cqn2sql.js +15 -11
- package/node_modules/@cap-js/db-service/lib/cqn4sql.js +119 -19
- package/node_modules/@cap-js/db-service/lib/infer/index.js +27 -16
- package/node_modules/@cap-js/db-service/lib/recursion-guard.js +40 -0
- package/node_modules/@cap-js/db-service/lib/search.js +1 -1
- package/node_modules/@cap-js/db-service/package.json +1 -1
- package/node_modules/@cap-js/sqlite/CHANGELOG.md +19 -0
- package/node_modules/@cap-js/sqlite/lib/SQLiteService.js +110 -14
- package/node_modules/@cap-js/sqlite/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +57 -0
- package/node_modules/@sap/cds/app/index.js +5 -4
- package/node_modules/@sap/cds/eslint.config.mjs +1 -0
- package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
- package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
- package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
- package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
- package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
- package/node_modules/@sap/cds/lib/plugins.js +9 -5
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
- package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
- package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
- package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
- package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
- package/node_modules/@sap/cds/libx/http/location.js +3 -3
- package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
- package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
- package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
- package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
- package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
- package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
- package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +75 -8
- package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
- package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
- package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
- package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +48 -18
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
- package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
- package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
- package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
- package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +15 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +10 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/flattening.js +4 -3
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/flattening.js +17 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +20 -0
- package/node_modules/@sap/cds-compiler/lib/transform/fioriTreeViews.js +12 -1
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +7 -2
- package/node_modules/@sap/cds-compiler/lib/transform/odata/adaptAnnotationRefs.js +11 -5
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +48 -10
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +49 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +26 -5
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +37 -16
- package/node_modules/@sap/cds-mtxs/lib/utils.js +23 -7
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +63 -8
- package/node_modules/@sap/cds-mtxs/srv/cf/saas-provisioning-service.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/sms-provisioning-service.js +23 -3
- package/node_modules/@sap/cds-mtxs/srv/extensibility/compat/update.js +15 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +2 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/config.js +2 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +2 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/protected-namespace.js +45 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +30 -16
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +49 -10
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +28 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/common.js +19 -12
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/serverless.js +271 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +7 -10
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker-pool.js +212 -0
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker.js +61 -0
- package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
- package/node_modules/@sap/xsenv/package.json +10 -7
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
- package/node_modules/hdb/lib/protocol/Connection.js +1 -0
- package/node_modules/hdb/package.json +3 -2
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/negotiator/package.json +16 -10
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +2 -2
- package/bin/completion/scripts/cds-bash.sh +0 -20
- package/bin/completion/scripts/cds-fish.fish +0 -13
- package/bin/completion/scripts/cds-ps.ps1 +0 -19
- package/bin/completion/scripts/cds-zsh.sh +0 -13
- package/lib/deploy/index.js +0 -25
- package/lib/import/asyncapi/importAsyncAPI.js +0 -33
- package/lib/import/asyncapi/index.js +0 -18
- package/lib/import/asyncapi/parserContext.js +0 -454
- package/lib/import/asyncapi/utils.js +0 -49
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/negotiator/HISTORY.md +0 -114
- /package/{lib → bin}/upgrade/context.js +0 -0
- /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
- /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
- /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
- /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
- /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
- /package/{lib → bin}/watch/livereload-server.js +0 -0
- /package/{lib → bin}/watch/node-watch.js +0 -0
- /package/{lib → bin}/watch/open.js +0 -0
- /package/{lib → bin}/watch/watcher.js +0 -0
- /package/node_modules/@sap/cds-mtxs/srv/worker/{pool.js → model-worker-pool.js} +0 -0
- /package/node_modules/@sap/cds-mtxs/srv/worker/{load.js → model-worker.js} +0 -0
|
@@ -32,11 +32,21 @@ module.exports = class DataTemplate extends require('../../plugin') {
|
|
|
32
32
|
short: 'n',
|
|
33
33
|
help: 'The number of records to be created for each entity.'
|
|
34
34
|
},
|
|
35
|
+
'composition-records': {
|
|
36
|
+
type: 'number',
|
|
37
|
+
help: 'The number of records to be created per to-many composition (default 2).'
|
|
38
|
+
},
|
|
35
39
|
'content-type': {
|
|
36
40
|
type: 'string',
|
|
37
41
|
short: 'c',
|
|
38
42
|
help: 'The content type of the data. One of "json" or "csv".'
|
|
39
43
|
},
|
|
44
|
+
'keys-only': {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
help: `Only fill key values into the generated CSV records, leaving all
|
|
47
|
+
other columns empty. Requires '--records'. Useful to generate placeholder
|
|
48
|
+
rows for an agent or human to fill in later.`
|
|
49
|
+
},
|
|
40
50
|
'out': {
|
|
41
51
|
type: 'string',
|
|
42
52
|
short: 'o',
|
|
@@ -56,6 +66,8 @@ module.exports = class DataTemplate extends require('../../plugin') {
|
|
|
56
66
|
} = cds.cli.options
|
|
57
67
|
if (typeof records === 'string') records = parseInt(records)
|
|
58
68
|
if (Number.isNaN(records) || records < 1) records = 1
|
|
69
|
+
let compositionRecords = cds.cli.options['composition-records']
|
|
70
|
+
if (typeof compositionRecords === 'string') compositionRecords = parseInt(compositionRecords)
|
|
59
71
|
|
|
60
72
|
const [filterName, filterQueryStr] = (cds.cli.options['filter'] ?? cds.cli.options['data:for'] ?? '').split(':')
|
|
61
73
|
const nameFilter = filterStringAsRegex(filterName)
|
|
@@ -78,12 +90,14 @@ module.exports = class DataTemplate extends require('../../plugin') {
|
|
|
78
90
|
.filter (e => queries || !e.query) // remove all projection-like entities unless specified differently
|
|
79
91
|
.reduce((all, e) => { all[e.name] = []; return all }, {})
|
|
80
92
|
|
|
81
|
-
await asJson(data, csn, records, {contentType})
|
|
93
|
+
await asJson(data, csn, records, {contentType, compositionRecords})
|
|
82
94
|
|
|
83
95
|
if (contentType === 'csv') {
|
|
84
96
|
const headerOnly = !cds.cli.options['records'] // compat to old behavior which only creates headers
|
|
85
97
|
if (headerOnly) console.log(`${dim('adding headers only, use --records to create random entries')}`)
|
|
86
|
-
|
|
98
|
+
const keysOnly = !!cds.cli.options['keys-only']
|
|
99
|
+
if (keysOnly && headerOnly) console.log(`${dim('ignoring --keys-only, use --records to create entries')}`)
|
|
100
|
+
await asCsv(data, csn, Object.assign({ headerOnly, keysOnly }, dataForParams))
|
|
87
101
|
}
|
|
88
102
|
|
|
89
103
|
// write files
|
|
@@ -23,8 +23,8 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
|
|
|
23
23
|
await merge(__dirname, 'files', 'package.json.hbs').into(configFile, { with: project })
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
async combine() {
|
|
27
|
-
const project = readProject()
|
|
26
|
+
async combine(facet) {
|
|
27
|
+
const project = readProject(facet)
|
|
28
28
|
const { addApprouter, addMultitenancy, addKyma, addMta, hasMta, srv, isJava } = project
|
|
29
29
|
|
|
30
30
|
if (addMta || (addApprouter || addMultitenancy) && hasMta) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@cap-js/telemetry": "
|
|
4
|
-
"@opentelemetry/exporter-metrics-otlp-proto": "
|
|
5
|
-
"@opentelemetry/host-metrics": "
|
|
3
|
+
"@cap-js/telemetry": "^2",
|
|
4
|
+
"@opentelemetry/exporter-metrics-otlp-proto": ">=0.200"{{#hasKyma}},
|
|
5
|
+
"@opentelemetry/instrumentation-host-metrics": ">=0.2"
|
|
6
6
|
{{/hasKyma}}
|
|
7
7
|
},
|
|
8
8
|
"cds": {
|
|
@@ -23,8 +23,8 @@ module.exports = class extends require('../../plugin') {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
async combine() {
|
|
27
|
-
const project = readProject()
|
|
26
|
+
async combine(facet) {
|
|
27
|
+
const project = readProject(facet)
|
|
28
28
|
const { appName, addMta, addKyma, isJava, addMultitenancy, srv } = project
|
|
29
29
|
|
|
30
30
|
if (addMta || addMultitenancy) {
|
|
@@ -50,8 +50,8 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
async combine() {
|
|
54
|
-
const project = readProject()
|
|
53
|
+
async combine(facet) {
|
|
54
|
+
const project = readProject(facet)
|
|
55
55
|
const { addXsuaa, hasXsuaa, addKyma, addMta, srv, appName } = project
|
|
56
56
|
|
|
57
57
|
if (addMta) {
|
|
@@ -17,8 +17,8 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../ent
|
|
|
17
17
|
return 'messaging via shared SAP Event Mesh'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async combine() {
|
|
21
|
-
const project = readProject()
|
|
20
|
+
async combine(facet) {
|
|
21
|
+
const project = readProject(facet)
|
|
22
22
|
const { addMta, addKyma, srv } = project
|
|
23
23
|
|
|
24
24
|
if (addMta) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
resources:
|
|
3
|
+
- name: {{appName}}-auth
|
|
4
|
+
type: org.cloudfoundry.managed-service
|
|
5
|
+
parameters:
|
|
6
|
+
service: xsuaa
|
|
7
|
+
config:
|
|
8
|
+
role-collections:
|
|
9
|
+
- name: 'ExtensionDeveloper ({{appName}} ${org}-${space})'
|
|
10
|
+
description: 'generated'
|
|
11
|
+
role-template-references: ['$XSAPPNAME.ExtensionDeveloper']
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"role-templates": [
|
|
9
9
|
{
|
|
10
10
|
"name": "ExtensionDeveloper",
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Extend CAP applications via extension projects",
|
|
12
12
|
"scope-references": [
|
|
13
13
|
"$XSAPPNAME.cds.ExtensionDeveloper"
|
|
14
14
|
]
|
|
@@ -24,14 +24,14 @@ module.exports = class ExtensibilityTemplate extends require('../../plugin') {
|
|
|
24
24
|
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async combine() {
|
|
28
|
-
const project = readProject()
|
|
27
|
+
async combine(facet) {
|
|
28
|
+
const project = readProject(facet)
|
|
29
29
|
const { addXsuaa } = project
|
|
30
30
|
if (addXsuaa) {
|
|
31
31
|
await merge(__dirname, 'files', 'xs-security.json.hbs').into('xs-security.json', {
|
|
32
32
|
project,
|
|
33
33
|
additions: [
|
|
34
|
-
{ in: 'scopes',
|
|
34
|
+
{ in: 'scopes', where: { name: '$XSAPPNAME.cds.ExtensionDeveloper' }},
|
|
35
35
|
{ in: 'role-templates', where: { name: 'ExtensionDeveloper' }}
|
|
36
36
|
]
|
|
37
37
|
})
|
|
@@ -49,8 +49,8 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
async combine() {
|
|
53
|
-
const project = readProject()
|
|
52
|
+
async combine(facet) {
|
|
53
|
+
const project = readProject(facet)
|
|
54
54
|
const { addMta, addKyma } = project, { force } = cds.cli.options
|
|
55
55
|
project.sap = cds.cli.options.sap
|
|
56
56
|
if (addMta) {
|
|
@@ -15,6 +15,7 @@ module.exports = class HanaTemplate extends require('../../plugin') {
|
|
|
15
15
|
|
|
16
16
|
static hasInProduction(env) {
|
|
17
17
|
const { dependencies, isJava } = readProject()
|
|
18
|
+
if (cds.cli.options?.add?.has('hana-serverless') || env.requires?.db?.kind === 'hana-serverless' || env.requires?.db?.serverless) return false
|
|
18
19
|
return dependencies?.['@cap-js/hana'] || isJava && env.requires?.db?.kind === 'hana'
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -38,8 +39,8 @@ module.exports = class HanaTemplate extends require('../../plugin') {
|
|
|
38
39
|
await sort('package.json', 'dependencies')
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
async combine() {
|
|
42
|
-
const project = readProject()
|
|
42
|
+
async combine(facet) {
|
|
43
|
+
const project = readProject(facet)
|
|
43
44
|
const { addMta, hasMta, addMultitenancy, addKyma, isJava, hasKyma, hasMultitenancy, srv } = project
|
|
44
45
|
|
|
45
46
|
if (addMta || addMultitenancy && hasMta) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "deploy",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"hdb": "^2.0.0",
|
|
5
|
+
"@sap/hdi-deploy": "^5"
|
|
6
|
+
},
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^24.0.0"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node node_modules/@sap/hdi-deploy/deploy.js --use-hdb --parameter com.sap.hana.di.table/try_fast_table_migration=true",
|
|
12
|
+
"build": "npm i && npx cds build .. --for hana --production"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
modules:
|
|
3
|
+
- name: {{appName}}-srv
|
|
4
|
+
type: {{language}}
|
|
5
|
+
path: {{& srv.path}}
|
|
6
|
+
requires:
|
|
7
|
+
- name: {{appName}}-db
|
|
8
|
+
- name: {{appName}}-hana-auth
|
|
9
|
+
parameters:
|
|
10
|
+
config:
|
|
11
|
+
credential-type: X509_GENERATED
|
|
12
|
+
app-identifier: srv
|
|
13
|
+
|
|
14
|
+
- name: {{appName}}-db-deployer
|
|
15
|
+
type: hdb
|
|
16
|
+
path: {{& db.path}}
|
|
17
|
+
parameters:
|
|
18
|
+
buildpack: nodejs_buildpack
|
|
19
|
+
{{#isJava}}
|
|
20
|
+
build-parameters:
|
|
21
|
+
builder: custom
|
|
22
|
+
commands:
|
|
23
|
+
- npm run build
|
|
24
|
+
{{/isJava}}
|
|
25
|
+
requires:
|
|
26
|
+
- name: {{appName}}-db
|
|
27
|
+
- name: {{appName}}-hana-auth
|
|
28
|
+
parameters:
|
|
29
|
+
config:
|
|
30
|
+
credential-type: X509_GENERATED
|
|
31
|
+
app-identifier: db-deployer
|
|
32
|
+
|
|
33
|
+
- name: {{appName}}-mtx
|
|
34
|
+
type: nodejs
|
|
35
|
+
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
36
|
+
requires:
|
|
37
|
+
- name: {{appName}}-db
|
|
38
|
+
- name: {{appName}}-hana-auth
|
|
39
|
+
parameters:
|
|
40
|
+
config:
|
|
41
|
+
credential-type: X509_GENERATED
|
|
42
|
+
app-identifier: mtx
|
|
43
|
+
|
|
44
|
+
resources:
|
|
45
|
+
- name: {{appName}}-db
|
|
46
|
+
type: org.cloudfoundry.managed-service
|
|
47
|
+
parameters:
|
|
48
|
+
service: hana-cloud
|
|
49
|
+
service-plan: serverless
|
|
50
|
+
config:
|
|
51
|
+
auto_subscription:
|
|
52
|
+
type: subscription-manager
|
|
53
|
+
subscribe_with_consuming_app: true
|
|
54
|
+
|
|
55
|
+
- name: {{appName}}-hana-auth
|
|
56
|
+
type: org.cloudfoundry.managed-service
|
|
57
|
+
processed-after:
|
|
58
|
+
- {{appName}}-db
|
|
59
|
+
parameters:
|
|
60
|
+
service: identity
|
|
61
|
+
service-plan: application
|
|
62
|
+
config:
|
|
63
|
+
consumed-services:
|
|
64
|
+
- service-instance-name: {{appName}}-db
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
{{#isNodejs}}
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@cap-js/hana": "^3"
|
|
5
|
+
},
|
|
6
|
+
"cds": {
|
|
7
|
+
"requires": {
|
|
8
|
+
"[production]": {
|
|
9
|
+
{{#shortcut}}
|
|
10
|
+
"db": "hana-serverless"
|
|
11
|
+
{{/shortcut}}
|
|
12
|
+
{{^shortcut}}
|
|
13
|
+
"db": {
|
|
14
|
+
"kind": "hana-serverless"
|
|
15
|
+
}
|
|
16
|
+
{{/shortcut}}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
{{/isNodejs}}
|
|
21
|
+
{{#isJava}}
|
|
22
|
+
"requires": {
|
|
23
|
+
"[production]": {
|
|
24
|
+
{{#shortcut}}
|
|
25
|
+
"db": "hana-serverless"
|
|
26
|
+
{{/shortcut}}
|
|
27
|
+
{{^shortcut}}
|
|
28
|
+
"db": {
|
|
29
|
+
"kind": "hana-serverless"
|
|
30
|
+
}
|
|
31
|
+
{{/shortcut}}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
{{/isJava}}
|
|
35
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"file_suffixes": {
|
|
3
|
+
"csv": {
|
|
4
|
+
"plugin_name": "com.sap.hana.di.tabledata.source"
|
|
5
|
+
},
|
|
6
|
+
"hdbafllangprocedure": {
|
|
7
|
+
"plugin_name": "com.sap.hana.di.afllangprocedure"
|
|
8
|
+
},
|
|
9
|
+
"hdbanalyticprivilege": {
|
|
10
|
+
"plugin_name": "com.sap.hana.di.analyticprivilege"
|
|
11
|
+
},
|
|
12
|
+
"hdbcalculationview": {
|
|
13
|
+
"plugin_name": "com.sap.hana.di.calculationview"
|
|
14
|
+
},
|
|
15
|
+
"hdbcollection": {
|
|
16
|
+
"plugin_name": "com.sap.hana.di.collection"
|
|
17
|
+
},
|
|
18
|
+
"hdbconstraint": {
|
|
19
|
+
"plugin_name": "com.sap.hana.di.constraint"
|
|
20
|
+
},
|
|
21
|
+
"hdbdropcreatetable": {
|
|
22
|
+
"plugin_name": "com.sap.hana.di.dropcreatetable"
|
|
23
|
+
},
|
|
24
|
+
"hdbflowgraph": {
|
|
25
|
+
"plugin_name": "com.sap.hana.di.flowgraph"
|
|
26
|
+
},
|
|
27
|
+
"hdbfunction": {
|
|
28
|
+
"plugin_name": "com.sap.hana.di.function"
|
|
29
|
+
},
|
|
30
|
+
"hdbgraphworkspace": {
|
|
31
|
+
"plugin_name": "com.sap.hana.di.graphworkspace"
|
|
32
|
+
},
|
|
33
|
+
"hdbhadoopmrjob": {
|
|
34
|
+
"plugin_name": "com.sap.hana.di.virtualfunctionpackage.hadoop"
|
|
35
|
+
},
|
|
36
|
+
"hdbindex": {
|
|
37
|
+
"plugin_name": "com.sap.hana.di.index"
|
|
38
|
+
},
|
|
39
|
+
"hdblibrary": {
|
|
40
|
+
"plugin_name": "com.sap.hana.di.library"
|
|
41
|
+
},
|
|
42
|
+
"hdbmigrationtable": {
|
|
43
|
+
"plugin_name": "com.sap.hana.di.table.migration"
|
|
44
|
+
},
|
|
45
|
+
"hdbprocedure": {
|
|
46
|
+
"plugin_name": "com.sap.hana.di.procedure"
|
|
47
|
+
},
|
|
48
|
+
"hdbprojectionview": {
|
|
49
|
+
"plugin_name": "com.sap.hana.di.projectionview"
|
|
50
|
+
},
|
|
51
|
+
"hdbprojectionviewconfig": {
|
|
52
|
+
"plugin_name": "com.sap.hana.di.projectionview.config"
|
|
53
|
+
},
|
|
54
|
+
"hdbreptask": {
|
|
55
|
+
"plugin_name": "com.sap.hana.di.reptask"
|
|
56
|
+
},
|
|
57
|
+
"hdbresultcache": {
|
|
58
|
+
"plugin_name": "com.sap.hana.di.resultcache"
|
|
59
|
+
},
|
|
60
|
+
"hdbrole": {
|
|
61
|
+
"plugin_name": "com.sap.hana.di.role"
|
|
62
|
+
},
|
|
63
|
+
"hdbroleconfig": {
|
|
64
|
+
"plugin_name": "com.sap.hana.di.role.config"
|
|
65
|
+
},
|
|
66
|
+
"hdbsearchruleset": {
|
|
67
|
+
"plugin_name": "com.sap.hana.di.searchruleset"
|
|
68
|
+
},
|
|
69
|
+
"hdbsequence": {
|
|
70
|
+
"plugin_name": "com.sap.hana.di.sequence"
|
|
71
|
+
},
|
|
72
|
+
"hdbstatistics": {
|
|
73
|
+
"plugin_name": "com.sap.hana.di.statistics"
|
|
74
|
+
},
|
|
75
|
+
"hdbstructuredprivilege": {
|
|
76
|
+
"plugin_name": "com.sap.hana.di.structuredprivilege"
|
|
77
|
+
},
|
|
78
|
+
"hdbsynonym": {
|
|
79
|
+
"plugin_name": "com.sap.hana.di.synonym"
|
|
80
|
+
},
|
|
81
|
+
"hdbsynonymconfig": {
|
|
82
|
+
"plugin_name": "com.sap.hana.di.synonym.config"
|
|
83
|
+
},
|
|
84
|
+
"hdbsystemversioning": {
|
|
85
|
+
"plugin_name": "com.sap.hana.di.systemversioning"
|
|
86
|
+
},
|
|
87
|
+
"hdbtable": {
|
|
88
|
+
"plugin_name": "com.sap.hana.di.table"
|
|
89
|
+
},
|
|
90
|
+
"hdbtabledata": {
|
|
91
|
+
"plugin_name": "com.sap.hana.di.tabledata"
|
|
92
|
+
},
|
|
93
|
+
"hdbtabletype": {
|
|
94
|
+
"plugin_name": "com.sap.hana.di.tabletype"
|
|
95
|
+
},
|
|
96
|
+
"hdbtrigger": {
|
|
97
|
+
"plugin_name": "com.sap.hana.di.trigger"
|
|
98
|
+
},
|
|
99
|
+
"hdbview": {
|
|
100
|
+
"plugin_name": "com.sap.hana.di.view"
|
|
101
|
+
},
|
|
102
|
+
"hdbvirtualfunction": {
|
|
103
|
+
"plugin_name": "com.sap.hana.di.virtualfunction"
|
|
104
|
+
},
|
|
105
|
+
"hdbvirtualfunctionconfig": {
|
|
106
|
+
"plugin_name": "com.sap.hana.di.virtualfunction.config"
|
|
107
|
+
},
|
|
108
|
+
"hdbvirtualpackagehadoop": {
|
|
109
|
+
"plugin_name": "com.sap.hana.di.virtualpackage.hadoop"
|
|
110
|
+
},
|
|
111
|
+
"hdbvirtualpackagesparksql": {
|
|
112
|
+
"plugin_name": "com.sap.hana.di.virtualpackage.sparksql"
|
|
113
|
+
},
|
|
114
|
+
"hdbvirtualprocedure": {
|
|
115
|
+
"plugin_name": "com.sap.hana.di.virtualprocedure"
|
|
116
|
+
},
|
|
117
|
+
"hdbvirtualprocedureconfig": {
|
|
118
|
+
"plugin_name": "com.sap.hana.di.virtualprocedure.config"
|
|
119
|
+
},
|
|
120
|
+
"hdbvirtualtable": {
|
|
121
|
+
"plugin_name": "com.sap.hana.di.virtualtable"
|
|
122
|
+
},
|
|
123
|
+
"hdbvirtualtableconfig": {
|
|
124
|
+
"plugin_name": "com.sap.hana.di.virtualtable.config"
|
|
125
|
+
},
|
|
126
|
+
"properties": {
|
|
127
|
+
"plugin_name": "com.sap.hana.di.tabledata.properties"
|
|
128
|
+
},
|
|
129
|
+
"tags": {
|
|
130
|
+
"plugin_name": "com.sap.hana.di.tabledata.properties"
|
|
131
|
+
},
|
|
132
|
+
"txt": {
|
|
133
|
+
"plugin_name": "com.sap.hana.di.copyonly"
|
|
134
|
+
},
|
|
135
|
+
"hdbeshconfig": {
|
|
136
|
+
"plugin_name": "com.sap.hana.di.eshconfig"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
srv:
|
|
3
|
+
bindings:
|
|
4
|
+
db:
|
|
5
|
+
serviceInstanceName: db
|
|
6
|
+
{{#hasMultitenancy}}
|
|
7
|
+
sidecar:
|
|
8
|
+
bindings:
|
|
9
|
+
db:
|
|
10
|
+
serviceInstanceName: db
|
|
11
|
+
{{/hasMultitenancy}}
|
|
12
|
+
db:
|
|
13
|
+
serviceOfferingName: hana-cloud
|
|
14
|
+
servicePlanName: serverless
|
|
15
|
+
parameters:
|
|
16
|
+
auto_subscription:
|
|
17
|
+
type: subscription-manager
|
|
18
|
+
subscribe_with_consuming_app: true
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
const { join } = require('path')
|
|
2
|
+
const cds = require('../../../cds')
|
|
3
|
+
const { read, write, exists, copy } = cds.utils
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { merge, sort } = require('../../merge')
|
|
6
|
+
const mvn = require('../../mvn')
|
|
7
|
+
|
|
8
|
+
const { srv4, hdbDeployer, mtxSidecar4 } = require('../../registries/mta')
|
|
9
|
+
|
|
10
|
+
const serverlessDb = {
|
|
11
|
+
in: 'resources',
|
|
12
|
+
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'hana-cloud', 'parameters.service-plan': 'serverless' }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const identity = {
|
|
16
|
+
in: 'resources',
|
|
17
|
+
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'identity' }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = class HanaServerlessTemplate extends require('../../plugin') {
|
|
21
|
+
|
|
22
|
+
static help() {
|
|
23
|
+
return 'database support for SAP HANA Cloud serverless'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static hasInProduction(env) {
|
|
27
|
+
return cds.cli.options?.add?.has('hana-serverless')
|
|
28
|
+
|| env.requires?.db?.kind === 'hana-serverless'
|
|
29
|
+
|| env.requires?.db?.serverless
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async run() {
|
|
33
|
+
const project = readProject()
|
|
34
|
+
const { isJava, configFile, db } = project
|
|
35
|
+
project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.db !== 'object'
|
|
36
|
+
|
|
37
|
+
if (isJava) {
|
|
38
|
+
await copy(join(__dirname, 'files', 'db')).to(db.folder)
|
|
39
|
+
await mvn.add('hana')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project, forceOverwrite: true })
|
|
43
|
+
|
|
44
|
+
const packageJson = exists('package.json') ? await read('package.json') : null
|
|
45
|
+
if (packageJson?.dependencies) {
|
|
46
|
+
delete packageJson.dependencies['@sap/hana-client']
|
|
47
|
+
await write('package.json', packageJson, { spaces: 2 })
|
|
48
|
+
}
|
|
49
|
+
await sort('package.json', 'dependencies')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async combine(facet) {
|
|
53
|
+
const project = readProject(facet)
|
|
54
|
+
const { addMta, hasMta, addMultitenancy, addKyma, isJava, hasMultitenancy, srv } = project
|
|
55
|
+
|
|
56
|
+
if (addMta || addMultitenancy && hasMta) {
|
|
57
|
+
const existingIdentity = await this._existingIdentityName()
|
|
58
|
+
const srvModule = srv4(srv.path)
|
|
59
|
+
|
|
60
|
+
const relationships = [{
|
|
61
|
+
insert: [serverlessDb, 'name'],
|
|
62
|
+
into: [srvModule, 'requires', 'name']
|
|
63
|
+
}]
|
|
64
|
+
if (!existingIdentity) relationships.push({
|
|
65
|
+
insert: [identity, 'name'],
|
|
66
|
+
into: [srvModule, 'requires', 'name']
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
if (hasMultitenancy) {
|
|
70
|
+
const sidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
71
|
+
relationships.push({
|
|
72
|
+
insert: [serverlessDb, 'name'],
|
|
73
|
+
into: [sidecar, 'requires', 'name']
|
|
74
|
+
})
|
|
75
|
+
if (!existingIdentity) relationships.push({
|
|
76
|
+
insert: [identity, 'name'],
|
|
77
|
+
into: [sidecar, 'requires', 'name']
|
|
78
|
+
})
|
|
79
|
+
} else {
|
|
80
|
+
relationships.push({
|
|
81
|
+
insert: [serverlessDb, 'name'],
|
|
82
|
+
into: [hdbDeployer, 'requires', 'name']
|
|
83
|
+
})
|
|
84
|
+
if (!existingIdentity) relationships.push({
|
|
85
|
+
insert: [identity, 'name'],
|
|
86
|
+
into: [hdbDeployer, 'requires', 'name']
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const modules = hasMultitenancy ? [srvModule] : [srvModule, hdbDeployer]
|
|
91
|
+
const additions = [...modules, serverlessDb]
|
|
92
|
+
if (!existingIdentity) additions.push(identity)
|
|
93
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
94
|
+
with: project, additions, relationships
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
if (existingIdentity) await this._consumeServerlessFrom(existingIdentity)
|
|
98
|
+
|
|
99
|
+
if (hasMultitenancy) await this._alignSidecarDbKind()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (addKyma) {
|
|
103
|
+
const KymaTemplate = require('../kyma')
|
|
104
|
+
const existingIdentity = await this._existingIdentityInChart()
|
|
105
|
+
|
|
106
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
107
|
+
|
|
108
|
+
if (existingIdentity) {
|
|
109
|
+
await this._consumeServerlessInChart(existingIdentity)
|
|
110
|
+
} else {
|
|
111
|
+
await merge(__dirname, 'files/identity.values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
112
|
+
await KymaTemplate.mergeDependency('service-instance', 'identity')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (hasMultitenancy) await this._alignSidecarDbKind()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async _existingIdentityInChart() {
|
|
120
|
+
const { readYAML } = require('../../../util/fs')
|
|
121
|
+
const doc = await readYAML('chart/values.yaml')
|
|
122
|
+
if (!doc) return undefined
|
|
123
|
+
const js = doc.toJS?.() ?? doc
|
|
124
|
+
const identity = js?.identity
|
|
125
|
+
if (identity && identity.serviceOfferingName === 'identity') return 'identity'
|
|
126
|
+
return undefined
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async _consumeServerlessInChart(identityKey) {
|
|
130
|
+
const { readYAML, writeYAML } = require('../../../util/fs')
|
|
131
|
+
const doc = await readYAML('chart/values.yaml')
|
|
132
|
+
if (!doc) return
|
|
133
|
+
const js = doc.toJS()
|
|
134
|
+
const identity = js[identityKey]
|
|
135
|
+
if (!identity) return
|
|
136
|
+
const parameters = (identity.parameters ??= {})
|
|
137
|
+
const consumed = (parameters['consumed-services'] ??= [])
|
|
138
|
+
const dbName = `${readProject().appName}-db`
|
|
139
|
+
if (!consumed.some(c => c?.['service-instance-name'] === dbName)) {
|
|
140
|
+
consumed.push({ 'service-instance-name': dbName })
|
|
141
|
+
}
|
|
142
|
+
await writeYAML('chart/values.yaml', js)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async _existingIdentityName() {
|
|
146
|
+
const { readYAML } = require('../../../util/fs')
|
|
147
|
+
const doc = await readYAML('mta.yaml')
|
|
148
|
+
if (!doc) return undefined
|
|
149
|
+
const js = doc.toJS?.() ?? doc
|
|
150
|
+
const resources = js?.resources || []
|
|
151
|
+
const found = resources.find(r => r?.parameters?.service === 'identity')
|
|
152
|
+
return found?.name
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async _consumeServerlessFrom(identityName) {
|
|
156
|
+
const { readYAML, writeYAML } = require('../../../util/fs')
|
|
157
|
+
const doc = await readYAML('mta.yaml')
|
|
158
|
+
if (!doc) return
|
|
159
|
+
const js = doc.toJS()
|
|
160
|
+
const resource = (js.resources || []).find(r => r.name === identityName)
|
|
161
|
+
if (!resource) return
|
|
162
|
+
const config = ((resource.parameters ??= {}).config ??= {})
|
|
163
|
+
const consumed = (config['consumed-services'] ??= [])
|
|
164
|
+
const dbName = `${readProject().appName}-db`
|
|
165
|
+
if (!consumed.some(c => c?.['service-instance-name'] === dbName)) {
|
|
166
|
+
consumed.push({ 'service-instance-name': dbName })
|
|
167
|
+
}
|
|
168
|
+
const after = (resource['processed-after'] ??= [])
|
|
169
|
+
if (!after.includes(dbName)) after.push(dbName)
|
|
170
|
+
await writeYAML('mta.yaml', js)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async _alignSidecarDbKind() {
|
|
174
|
+
const sidecarPackageJson = join('mtx', 'sidecar', 'package.json')
|
|
175
|
+
if (!exists(sidecarPackageJson)) return
|
|
176
|
+
const packageJson = await read(sidecarPackageJson)
|
|
177
|
+
const requires = ((packageJson.cds ??= {}).requires ??= {})
|
|
178
|
+
const profile = (requires['[production]'] ??= {})
|
|
179
|
+
profile.db = 'hana-serverless'
|
|
180
|
+
const mt = (requires.multitenancy ??= {})
|
|
181
|
+
mt.serverless = { ...mt.serverless, autoSubscription: true }
|
|
182
|
+
await write(sidecarPackageJson, packageJson, { spaces: 2 })
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -7,7 +7,7 @@ modules:
|
|
|
7
7
|
builder: proxy-unified-runtime-dmz.int.repositories.cloud.sap/builder/noble
|
|
8
8
|
{{/hasKymaUnifiedRuntime}}
|
|
9
9
|
{{^hasKymaUnifiedRuntime}}
|
|
10
|
-
type: sapse/application-content-deployer-buildpack:1.
|
|
10
|
+
type: sapse/application-content-deployer-buildpack:1.5.0
|
|
11
11
|
builder: builder-jammy-base
|
|
12
12
|
{{/hasKymaUnifiedRuntime}}
|
|
13
|
-
path:
|
|
13
|
+
path: {{& html5DeployerPath}}
|