@sap/cds-dk 10.0.6 → 10.1.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 +107 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +10 -0
- package/bin/build.js +20 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +15 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +592 -80
- package/bin/completion/scripts/cds.fish +568 -0
- package/bin/completion/scripts/cds.ps1 +329 -0
- package/bin/completion/scripts/cds.sh +261 -0
- package/bin/completion/scripts/cds.zsh +230 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +208 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +7 -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/export.js +35 -5
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +6 -0
- package/bin/init.js +5 -24
- package/bin/inspect.js +6 -0
- package/bin/login.js +26 -20
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/up.js +14 -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 +8 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +17 -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/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 +114 -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/nodejs/index.js +4 -2
- 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/openapi/lib/compile/csdl.js +3 -3
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
- package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
- package/node_modules/@cap-js/openapi/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +64 -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/for/nodejs.js +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/common-utils/authorizedRequest.js +3 -2
- 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 +60 -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 +41 -15
- 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 +2 -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 +3 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -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/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
- package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
- package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
- 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/sax/lib/sax.js +27 -9
- package/node_modules/sax/package.json +1 -1
- 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 +5 -5
- 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 -372
- package/lib/import/asyncapi/utils.js +0 -49
- package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
- package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
- 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
|
@@ -4,6 +4,8 @@ const cds = require('../../../cds')
|
|
|
4
4
|
|
|
5
5
|
let counter = Math.round(Math.random() * 10000) // Default random seed // Non-deterministic behaviour
|
|
6
6
|
const MAX_ASSOC_DEPTH = 5
|
|
7
|
+
let compositionRecords = 2 // number of records generated per to-many composition
|
|
8
|
+
let requestedRecords = 1 // number of records requested per entity, used to spread association keys
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Creates JSON test data for the given entities
|
|
@@ -16,6 +18,8 @@ const MAX_ASSOC_DEPTH = 5
|
|
|
16
18
|
*/
|
|
17
19
|
const asJson = module.exports = async (data, csn, numRecords=1, options={}) => {
|
|
18
20
|
let { referenceData, contentType, artifact='entity' } = options
|
|
21
|
+
compositionRecords = Number(options.compositionRecords) > 0 ? Number(options.compositionRecords) : 2
|
|
22
|
+
requestedRecords = Number(numRecords) > 0 ? Number(numRecords) : 1
|
|
19
23
|
|
|
20
24
|
// if no data is given, use all data
|
|
21
25
|
if (!data) {
|
|
@@ -120,8 +124,11 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
120
124
|
|
|
121
125
|
if (element.items?.elements) // `array of` / `many` with complex type
|
|
122
126
|
return [ fillRecord({}, record['$id'], element.items, csn, data, null, depth+1, referenceData) ]
|
|
123
|
-
else if (element.items?.type) // `array of` / `many` with simple type
|
|
124
|
-
|
|
127
|
+
else if (element.items?.type) { // `array of` / `many` with simple type
|
|
128
|
+
// `@assert.range` sits on the outer element, not on items, so carry it over
|
|
129
|
+
const items = element['@assert.range'] ? { ...element.items, '@assert.range': element['@assert.range'] } : element.items
|
|
130
|
+
return [ dataForField(items, artifact, csn, record, data, null, depth+1, referenceData) ]
|
|
131
|
+
}
|
|
125
132
|
|
|
126
133
|
if (element.is_struct) {
|
|
127
134
|
let struct = {}
|
|
@@ -134,11 +141,18 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
134
141
|
|
|
135
142
|
const type = element._type || element.type
|
|
136
143
|
switch (type) {
|
|
137
|
-
case 'cds.Time':
|
|
138
|
-
|
|
144
|
+
case 'cds.Time': {
|
|
145
|
+
// vary time across records instead of a fixed constant
|
|
146
|
+
const pad = n => String(n).padStart(2, '0')
|
|
147
|
+
const hh = pad(randomIntInRange({ from: 0, to: 23 }))
|
|
148
|
+
const mm = pad(randomIntInRange({ from: 0, to: 59 }))
|
|
149
|
+
const ss = pad(randomIntInRange({ from: 0, to: 59 }))
|
|
150
|
+
return `${hh}:${mm}:${ss}`
|
|
151
|
+
}
|
|
139
152
|
|
|
140
153
|
case 'cds.Timestamp': {
|
|
141
154
|
const range = {from: new Date('2000-01-01'), to: new Date('2024-01-01')}
|
|
155
|
+
annotatedDateRange(element, range) // honor @assert.range bounds
|
|
142
156
|
return randomDateInRange(range).toISOString()
|
|
143
157
|
}
|
|
144
158
|
case 'cds.Date': {
|
|
@@ -228,18 +242,20 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
228
242
|
case 'cds.hana.REAL':
|
|
229
243
|
case 'cds.Decimal': { // Decimal(9,5), Decimal(9), Decimal(precision:5), Decimal(2,2)
|
|
230
244
|
const scale = element.scale ?? (element.precision ? 0 : 2) // scale is 0 if only precision is given
|
|
231
|
-
//
|
|
232
|
-
const prec = element.precision ? Math.min(Math.pow(10, element.precision - scale) -
|
|
245
|
+
// largest value representable with the given precision/scale, e.g. Decimal(2,2) -> 0.99, Decimal(4,2) -> 99.99
|
|
246
|
+
const prec = element.precision ? Math.min(Math.pow(10, element.precision - scale) - Math.pow(10, -scale), Number.MAX_SAFE_INTEGER) : 100
|
|
233
247
|
const range = { from: 0, to: prec }
|
|
234
248
|
annotatedIntRange(element, range)
|
|
235
249
|
if (scale === 0) return randomIntInRange(range)
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
return +(
|
|
250
|
+
// draw uniformly across the range and round to scale, so annotated bounds are never exceeded
|
|
251
|
+
const val = +randomDecimalInRange(range).toFixed(scale)
|
|
252
|
+
return +Math.min(Math.max(val, range.from), range.to).toFixed(scale)
|
|
239
253
|
}
|
|
240
254
|
case 'cds.Double': {
|
|
241
255
|
const range = {from: 0, to: 100}
|
|
242
|
-
|
|
256
|
+
annotatedIntRange(element, range) // honor @assert.range bounds
|
|
257
|
+
const val = randomDecimalInRange(range)
|
|
258
|
+
return Math.min(Math.max(val, range.from), range.to)
|
|
243
259
|
}
|
|
244
260
|
case 'cds.Composition': {
|
|
245
261
|
const target = csn.definitions[element.target]
|
|
@@ -248,7 +264,7 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
248
264
|
let targetRecords = [] // in findKeysInOnCondition target records are linked to the entity, we don't want to overwrite any existing data
|
|
249
265
|
if (data[target.name]) data[target.name].deleteReference = true // for json composites references are nested and will be deleted when writing to file
|
|
250
266
|
|
|
251
|
-
const targetRecordCount = element.is2many ?
|
|
267
|
+
const targetRecordCount = element.is2many ? compositionRecords : 1
|
|
252
268
|
const targetRecordID = randomNumber()
|
|
253
269
|
for (let i = 0; i < targetRecordCount; i++) {
|
|
254
270
|
const newRecord = fillRecord({}, targetRecordID+i, target, csn, data, artifact, depth+1, referenceData)
|
|
@@ -291,31 +307,52 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
291
307
|
return
|
|
292
308
|
|
|
293
309
|
if (targetRecords.length > 0) { // use record generated by following association
|
|
294
|
-
|
|
310
|
+
// spread across fully-built targets so composite association keys vary; fall back to the last (still-building) record for circular refs
|
|
311
|
+
const targetKeys = Object.keys(target.elements).filter(k => target.elements[k].key)
|
|
312
|
+
const ready = targetRecords.filter(r => targetKeys.every(k => r[k] !== undefined))
|
|
313
|
+
targetRecord = ready.length ? ready[pickIndex(record['$id'], element.name, ready.length)] : targetRecords.at(-1)
|
|
295
314
|
} else {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
// a key association needs distinct targets across rows, else the composite key collapses to one row;
|
|
316
|
+
// seed a pool up to the requested record count so later rows can spread across it
|
|
317
|
+
let poolSize = element.key && target.name !== artifact.name ? requestedRecords : 1
|
|
318
|
+
// a self-referential link (2+ key associations to the same target) needs at least 2 targets to pair distinct rows
|
|
319
|
+
const keyAssocsToTarget = Object.values(artifact.elements).filter(e => e.key && e.target === element.target).length
|
|
320
|
+
if (keyAssocsToTarget > 1) poolSize = Math.max(poolSize, keyAssocsToTarget)
|
|
321
|
+
for (let p = 0; p < poolSize; p++) {
|
|
322
|
+
const rec = fillRecord({}, randomNumber(), target, csn, data, artifact, depth+1, referenceData)
|
|
323
|
+
if (rec) targetRecords.push(rec)
|
|
300
324
|
}
|
|
325
|
+
uniqRecords(targetRecords, target)
|
|
326
|
+
targetRecord = targetRecords.length ? targetRecords[pickIndex(record['$id'], element.name, targetRecords.length)] : undefined
|
|
301
327
|
if (parent && (parent.name != artifact.name)) data[target.name].keepReference = true
|
|
302
328
|
}
|
|
303
329
|
}
|
|
304
330
|
|
|
305
|
-
//
|
|
331
|
+
// build the foreign key from all of the target's keys, recursing into keys that are themselves associations
|
|
306
332
|
const assoc = {}
|
|
307
333
|
Object.keys(target.elements)
|
|
308
334
|
.filter(keyName => target.elements[keyName].key)
|
|
309
|
-
.forEach(keyName =>
|
|
335
|
+
.forEach(keyName => {
|
|
336
|
+
const keyEl = target.elements[keyName]
|
|
337
|
+
assoc[keyName] = keyEl.target
|
|
338
|
+
? dataForField(keyEl, target, csn, targetRecord, data, artifact, depth+1, referenceData)
|
|
339
|
+
: targetRecord[keyName]
|
|
340
|
+
})
|
|
310
341
|
return assoc
|
|
311
342
|
}
|
|
312
343
|
|
|
313
344
|
case 'cds.hana.BINARY':
|
|
314
345
|
case 'cds.Binary':
|
|
315
|
-
case 'cds.LargeBinary':
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
346
|
+
case 'cds.LargeBinary': {
|
|
347
|
+
const bytes = element.length ? Math.min(element.length, 16) : 8
|
|
348
|
+
const buf = Buffer.alloc(bytes)
|
|
349
|
+
for (let i = 0; i < bytes; i++) buf[i] = randomNumber() % 256
|
|
350
|
+
return buf.toString('base64')
|
|
351
|
+
}
|
|
352
|
+
case 'cds.Vector': {
|
|
353
|
+
const dim = element.dimension ?? element.length ?? 3
|
|
354
|
+
return JSON.stringify(Array.from({ length: dim }, () => +randomUnit().toFixed(6)))
|
|
355
|
+
}
|
|
319
356
|
default: {
|
|
320
357
|
console.error(`Unknown type ${element._type} (${element.type}) in '${artifact.name}:${element.name}'`)
|
|
321
358
|
return
|
|
@@ -391,7 +428,8 @@ function findKeysInOnCondition(assocElement, target) {
|
|
|
391
428
|
targetKey = ref[1]
|
|
392
429
|
}
|
|
393
430
|
else if (ref[0] === '$self') {
|
|
394
|
-
|
|
431
|
+
// structured foreign key: carry over the parent's full (possibly composite) key set
|
|
432
|
+
ownKey = Object.keys(assocElement.parent.keys || {})[0]
|
|
395
433
|
ownKeyStructured = true
|
|
396
434
|
}
|
|
397
435
|
else if (assocElement.parent.elements[ref[0]]) {
|
|
@@ -407,7 +445,8 @@ function uniqRecords(records, artifact) {
|
|
|
407
445
|
if (keys.length === 0) keys.push('$id') // no keys (e.g. in actions) -> use record's $id
|
|
408
446
|
const keySet = new Set()
|
|
409
447
|
for (let i = 0; i < records.length; i++) {
|
|
410
|
-
|
|
448
|
+
// JSON-serialize so association-typed keys (object foreign keys) compare by value, not '[object Object]'
|
|
449
|
+
const key = keys.map(k => JSON.stringify(records[i][k])).join('|')
|
|
411
450
|
if (keySet.has(key)) {
|
|
412
451
|
// console.debug('Removing', keys, key, 'from', artifact.name)
|
|
413
452
|
records.splice(i, 1)
|
|
@@ -420,29 +459,60 @@ function uniqRecords(records, artifact) {
|
|
|
420
459
|
|
|
421
460
|
function annotatedDateRange(el, dateRange) {
|
|
422
461
|
if (el['@assert.range']?.length === 2) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
462
|
+
let from = dateBound(el['@assert.range'][0], true)
|
|
463
|
+
let to = dateBound(el['@assert.range'][1], false)
|
|
464
|
+
const YEAR = 10 * 365 * 24 * 60 * 60 * 1000 // anchor window for open-ended bounds
|
|
465
|
+
if (from === Infinity || from === -Infinity) from = to instanceof Date ? new Date(to.valueOf() - YEAR) : dateRange.from
|
|
466
|
+
if (to === Infinity || to === -Infinity) to = from instanceof Date ? new Date(from.valueOf() + YEAR) : dateRange.to
|
|
467
|
+
// use annotated bounds directly, so ranges outside the default window don't invert
|
|
468
|
+
if (from instanceof Date && !isNaN(from)) dateRange.from = from
|
|
469
|
+
if (to instanceof Date && !isNaN(to)) dateRange.to = to
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// resolve one date @assert.range bound: ISO string, open-interval xpr {xpr:[y,'-',m,'-',d]}, or infinity {'=':'_'}
|
|
474
|
+
function dateBound(bound, isLower) {
|
|
475
|
+
if (bound && typeof bound === 'object') {
|
|
476
|
+
if (bound.val === '_' || bound['='] === '_') return isLower ? -Infinity : Infinity
|
|
477
|
+
if (Array.isArray(bound.xpr)) {
|
|
478
|
+
const nums = bound.xpr.filter(p => p && typeof p.val === 'number').map(p => p.val)
|
|
479
|
+
if (nums.length === 3) return new Date(Date.UTC(nums[0], nums[1] - 1, nums[2]))
|
|
430
480
|
}
|
|
481
|
+
return undefined
|
|
431
482
|
}
|
|
483
|
+
return new Date(bound)
|
|
432
484
|
}
|
|
433
485
|
|
|
434
486
|
function annotatedIntRange(el, intRange) {
|
|
435
487
|
if (el['@assert.range']?.length === 2) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
488
|
+
let from = rangeBound(el['@assert.range'][0], true)
|
|
489
|
+
let to = rangeBound(el['@assert.range'][1], false)
|
|
490
|
+
// infinity on one side: anchor a finite window to the other bound so the span stays valid
|
|
491
|
+
if (from === Infinity || from === -Infinity) from = to !== undefined && isFinite(to) ? to - 100 : intRange.from
|
|
492
|
+
if (to === Infinity || to === -Infinity) to = from !== undefined && isFinite(from) ? from + 100 : intRange.to
|
|
493
|
+
// use annotated bounds directly, so ranges outside the default [0,100] don't invert
|
|
494
|
+
if (from !== undefined) intRange.from = from
|
|
495
|
+
if (to !== undefined) intRange.to = to
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// pick a pool index that varies per association name, so multiple associations to the same
|
|
500
|
+
// target on one record (e.g. a self-referential link a<->a) land on different rows
|
|
501
|
+
function pickIndex(id, name, len) {
|
|
502
|
+
let h = 0
|
|
503
|
+
for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) | 0
|
|
504
|
+
return (((id + Math.abs(h)) % len) + len) % len
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// resolve one @assert.range bound: plain number, open bound {'=':true,val}, or infinity {'=':'_'}
|
|
508
|
+
function rangeBound(bound, isLower) {
|
|
509
|
+
if (typeof bound === 'number') return bound
|
|
510
|
+
if (bound && typeof bound === 'object') {
|
|
511
|
+
if (bound.val === '_' || bound['='] === '_') return isLower ? -Infinity : Infinity
|
|
512
|
+
const n = typeof bound.val === 'string' ? Number(bound.val) : bound.val // decimal open bounds arrive as string literals
|
|
513
|
+
if (typeof n === 'number' && !isNaN(n)) return isLower ? n + 1e-9 : n - 1e-9 // open bound: nudge inward
|
|
444
514
|
}
|
|
445
|
-
|
|
515
|
+
return undefined
|
|
446
516
|
}
|
|
447
517
|
|
|
448
518
|
const langList = ['ar', 'cs', 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja', 'ko', 'ms', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'th', 'tr', 'zh']
|
|
@@ -539,9 +609,9 @@ function addSemantics(csn) {
|
|
|
539
609
|
|
|
540
610
|
function randomDateInRange(dateRange) {
|
|
541
611
|
const dateFrom = dateRange.from
|
|
542
|
-
const returnDate = new Date(dateFrom.getUTCFullYear(), dateFrom.getUTCMonth(), dateFrom.getUTCDate())//
|
|
612
|
+
const returnDate = new Date(Date.UTC(dateFrom.getUTCFullYear(), dateFrom.getUTCMonth(), dateFrom.getUTCDate())) // build in UTC to match the UTC mutation below, avoiding a timezone off-by-one-day
|
|
543
613
|
const diffTime = dateRange.to.valueOf() - dateRange.from.valueOf();
|
|
544
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
614
|
+
const diffDays = Math.max(1, Math.ceil(diffTime / (1000 * 60 * 60 * 24))); // at least 1 day so a single-day range never yields NaN
|
|
545
615
|
const step = randomNumber() % diffDays
|
|
546
616
|
returnDate.setUTCDate(returnDate.getUTCDate() + step);
|
|
547
617
|
return returnDate
|
|
@@ -552,6 +622,8 @@ function randomDecimalInRange({ from: min, to: max }) {
|
|
|
552
622
|
}
|
|
553
623
|
|
|
554
624
|
function randomIntInRange({ from: min, to: max }) {
|
|
625
|
+
min = Math.ceil(min) // round fractional bounds inward so the result stays an integer within range
|
|
626
|
+
max = Math.floor(max)
|
|
555
627
|
const span = Math.max(0, max - min + 1)
|
|
556
628
|
return min + Math.floor(randomUnit() * span)
|
|
557
629
|
}
|
|
@@ -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
|
+
}
|