@sap/cds-dk 10.0.7 → 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 +94 -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/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/@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 +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 +15 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +34 -16
- 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 +1 -1
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +22 -13
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +17 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +4 -8
- 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 +3 -3
- 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
|
@@ -93,6 +93,10 @@ function tweakAssocs( model ) {
|
|
|
93
93
|
|
|
94
94
|
if (art.query) {
|
|
95
95
|
traverseQueryPost(art.query, null, (query) => {
|
|
96
|
+
forEachGeneric( query, '$tableAliases', ( mixin ) => {
|
|
97
|
+
if (mixin.$backlink?._redirected)
|
|
98
|
+
pushLink( model, '_associations', mixin );
|
|
99
|
+
} );
|
|
96
100
|
forEachGeneric( query, 'elements', handleQueryElements );
|
|
97
101
|
});
|
|
98
102
|
}
|
|
@@ -338,16 +342,6 @@ function tweakAssocs( model ) {
|
|
|
338
342
|
}
|
|
339
343
|
|
|
340
344
|
function propagateBacklink( assoc, _originAssoc ) {
|
|
341
|
-
// const origin = originAssoc.$backlink;
|
|
342
|
-
// if (assoc.target._artifact === originAssoc.target._artifact) {
|
|
343
|
-
// // no redirection → backlink is the same → no need to traverse ON-condition
|
|
344
|
-
// const backlink = { location: weakLocation( origin.location ), target: {} };
|
|
345
|
-
// setLink( backlink, '_origin', origin._origin );
|
|
346
|
-
// setLink( backlink, '_outer', assoc );
|
|
347
|
-
// assoc.$backlink = backlink;
|
|
348
|
-
// // TODO: _redirected
|
|
349
|
-
// }
|
|
350
|
-
// else {
|
|
351
345
|
checkBacklinkPartner( assoc );
|
|
352
346
|
// console.log('PB:',assoc._main.name.id,assoc.name.id,originAssoc.name.id,
|
|
353
347
|
// !!originAssoc.on,!!assoc.on,!!assoc.$backlink)
|
|
@@ -370,17 +364,21 @@ function tweakAssocs( model ) {
|
|
|
370
364
|
setLink( backlink, '_redirected', null ); // no further processing
|
|
371
365
|
return;
|
|
372
366
|
}
|
|
373
|
-
if (backlink._redirected?.length
|
|
367
|
+
if (!backlink._redirected?.length)
|
|
374
368
|
return;
|
|
375
369
|
// all of the following necessary?
|
|
376
370
|
setLink( backlink, '_main', elem._main );
|
|
377
371
|
setLink( backlink, '_parent', elem._parent );
|
|
378
372
|
setLink( backlink, '_effectiveType', backlink );
|
|
379
373
|
backlink.name = origin.name;
|
|
380
|
-
if (origin.on)
|
|
374
|
+
if (origin.on) {
|
|
381
375
|
rewriteCondition( backlink, origin );
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
if (backlink.$errorReported)
|
|
377
|
+
setLink( backlink, '_redirected', null ); // no further processing
|
|
378
|
+
}
|
|
379
|
+
else if (rewriteKeys( backlink, origin )) {
|
|
380
|
+
setLink( backlink, '_redirected', null ); // no further processing
|
|
381
|
+
}
|
|
384
382
|
}
|
|
385
383
|
|
|
386
384
|
/**
|
|
@@ -419,10 +417,11 @@ function tweakAssocs( model ) {
|
|
|
419
417
|
function rewriteKeys( elem, assoc ) {
|
|
420
418
|
addConditionFromAssocPublishing( elem, assoc, null );
|
|
421
419
|
if (elem.on)
|
|
422
|
-
return;
|
|
420
|
+
return false; // foreign keys were transformed into ON-condition
|
|
423
421
|
|
|
424
422
|
// TODO: split this function: create foreign keys without `targetElement`
|
|
425
423
|
// already in Phase 2: redirectImplicitly()
|
|
424
|
+
let withIssue = false;
|
|
426
425
|
elem.foreignKeys = Object.create(null); // set already here (also for zero foreign keys)
|
|
427
426
|
forEachInOrder( assoc, 'foreignKeys', ( orig, name ) => {
|
|
428
427
|
const location = weakRefLocation( elem.target );
|
|
@@ -431,10 +430,11 @@ function tweakAssocs( model ) {
|
|
|
431
430
|
setLink( fk, '_effectiveType', fk );
|
|
432
431
|
fk.targetElement = copyExpr( orig.targetElement, location );
|
|
433
432
|
if (elem._redirected)
|
|
434
|
-
rewriteKey( elem, fk );
|
|
433
|
+
withIssue = rewriteKey( elem, fk ) || withIssue;
|
|
435
434
|
} );
|
|
436
435
|
if (elem.foreignKeys) // Possibly no fk was set
|
|
437
436
|
elem.foreignKeys[$inferred] = 'rewrite';
|
|
437
|
+
return withIssue;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
function rewriteKey( elem, fk ) {
|
|
@@ -458,8 +458,9 @@ function tweakAssocs( model ) {
|
|
|
458
458
|
message( 'ref-missing-backlink-element',
|
|
459
459
|
[ (outer.value || outer.name).location, outer ],
|
|
460
460
|
{ '#': (outer.value ? 'std' : 'def'), id: undef.id } );
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
// TODO: more info if element was already missing in "intermediate" projection
|
|
462
|
+
// TODO: collect all missing elements?
|
|
463
|
+
return true;
|
|
463
464
|
}
|
|
464
465
|
else {
|
|
465
466
|
setArtifactLink( targetElement.path[0], null );
|
|
@@ -476,7 +477,7 @@ function tweakAssocs( model ) {
|
|
|
476
477
|
target: alias._main,
|
|
477
478
|
name: elem.name?.id,
|
|
478
479
|
} );
|
|
479
|
-
return
|
|
480
|
+
return true;
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
483
|
else {
|
|
@@ -489,9 +490,10 @@ function tweakAssocs( model ) {
|
|
|
489
490
|
const item = targetElement.path[0];
|
|
490
491
|
setArtifactLink( item, projectedKey.elem );
|
|
491
492
|
setArtifactLink( targetElement, projectedKey.elem );
|
|
492
|
-
return
|
|
493
|
+
return false; // ok
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
+
// TODO: check message if this is reached
|
|
496
|
+
return true;
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
/**
|
|
@@ -534,7 +536,7 @@ function tweakAssocs( model ) {
|
|
|
534
536
|
// TODO: Only report once for multi-include chains, see
|
|
535
537
|
// Associations/SubElements/UnmanagedInSubElement.err.cds
|
|
536
538
|
error( 'type-unsupported-rewrite', [ elem.location, elem ], { '#': 'sub-element' } );
|
|
537
|
-
removeArtifactLinks();
|
|
539
|
+
removeArtifactLinks( elem );
|
|
538
540
|
return;
|
|
539
541
|
}
|
|
540
542
|
const nav = (elem._main?.query && elem.value)
|
|
@@ -551,7 +553,7 @@ function tweakAssocs( model ) {
|
|
|
551
553
|
if (!navigation) { // TODO: what about $projection.assoc as myAssoc ?
|
|
552
554
|
if (elem._columnParent) {
|
|
553
555
|
error( 'rewrite-not-supported', [ elem.target.location, elem ], { '#': 'inline-expand' } );
|
|
554
|
-
removeArtifactLinks();
|
|
556
|
+
removeArtifactLinks( elem );
|
|
555
557
|
}
|
|
556
558
|
return; // should not happen: $projection, $magic, or ref to const
|
|
557
559
|
}
|
|
@@ -566,31 +568,31 @@ function tweakAssocs( model ) {
|
|
|
566
568
|
}
|
|
567
569
|
else if (elem._columnParent) {
|
|
568
570
|
error( 'rewrite-not-supported', [ elem.target.location, elem ], { '#': 'inline-expand' } );
|
|
569
|
-
removeArtifactLinks();
|
|
571
|
+
removeArtifactLinks( elem );
|
|
570
572
|
return;
|
|
571
573
|
}
|
|
572
574
|
else {
|
|
573
575
|
// TODO: support that, now that the ON condition is rewritten in the right order
|
|
574
576
|
error( null, [ elem.value.location, elem ], {},
|
|
575
577
|
'Selecting unmanaged associations from a sub query is not supported' );
|
|
576
|
-
removeArtifactLinks();
|
|
578
|
+
removeArtifactLinks( elem );
|
|
577
579
|
return;
|
|
578
580
|
}
|
|
579
581
|
|
|
580
582
|
addConditionFromAssocPublishing( elem, assoc, nav );
|
|
581
583
|
elem.on.$inferred = 'rewrite';
|
|
584
|
+
}
|
|
582
585
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
586
|
+
/**
|
|
587
|
+
* Clear all `_artifact` links in the ON-condition to avoid follow-up
|
|
588
|
+
* issues during ON-condition rewriting of associations that inherit
|
|
589
|
+
* the ON-condition.
|
|
590
|
+
*/
|
|
591
|
+
function removeArtifactLinks( elem ) {
|
|
592
|
+
traverseExpr( elem.on, 'rewrite-on', elem, (expr) => {
|
|
593
|
+
setArtifactLink( expr, null );
|
|
594
|
+
return traverseExpr.SKIP; // TODO: necessary?
|
|
595
|
+
} );
|
|
594
596
|
}
|
|
595
597
|
|
|
596
598
|
/**
|
|
@@ -639,16 +641,22 @@ function tweakAssocs( model ) {
|
|
|
639
641
|
}
|
|
640
642
|
}
|
|
641
643
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
{
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
644
|
+
// Empty filters don't add anything to the ON-condition.
|
|
645
|
+
if (lastStep.where.args?.length) {
|
|
646
|
+
elem.on = {
|
|
647
|
+
op: { val: 'ixpr', location },
|
|
648
|
+
args: [
|
|
649
|
+
{ ...elem.on, $parens: [ assoc.location ] },
|
|
650
|
+
{ val: 'and', literal: 'token', location },
|
|
651
|
+
filterToCondition( lastStep, elem, nav ),
|
|
652
|
+
],
|
|
653
|
+
location,
|
|
654
|
+
$inferred: 'copy',
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
else if (elem.on && !elem.on.$inferred) {
|
|
658
|
+
elem.on.$inferred = 'copy';
|
|
659
|
+
}
|
|
652
660
|
|
|
653
661
|
// Published paths with filters are always associations, never
|
|
654
662
|
// compositions, hence we need to change the type to avoid type propagation.
|
|
@@ -843,6 +851,8 @@ function tweakAssocs( model ) {
|
|
|
843
851
|
message( 'ref-missing-backlink-element',
|
|
844
852
|
[ (outer.value || outer.name).location, outer ],
|
|
845
853
|
{ '#': (outer.value ? 'std' : 'def'), id: undef.id } );
|
|
854
|
+
assoc.$errorReported = true; // for `_redirected: null` later
|
|
855
|
+
// (do not set now, then we would see just the first missing element)
|
|
846
856
|
// TODO: more info if element was already missing in "intermediate" projection
|
|
847
857
|
// TODO: collect all missing elements?
|
|
848
858
|
}
|
|
@@ -1220,14 +1230,16 @@ function findRewriteTarget( expr, index, env, user ) {
|
|
|
1220
1230
|
return [ env.elements[item.id], index ];
|
|
1221
1231
|
return [ null, expr.path.length ];
|
|
1222
1232
|
}
|
|
1223
|
-
const items = (env
|
|
1233
|
+
const items = (env.$queries?.[0] || env)._combined?.[item.id];
|
|
1224
1234
|
const allNavs = !items || Array.isArray(items) ? items : [ items ];
|
|
1225
1235
|
|
|
1226
1236
|
// If the annotation target itself has a table alias, require projections of that
|
|
1227
1237
|
// table alias. Of course, that only works if we're talking about the same query.
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1238
|
+
const valueNav = user.value?.path[0]?._navigation;
|
|
1239
|
+
const tableAlias = (valueNav?.kind === '$tableAlias' &&
|
|
1240
|
+
user._main?._origin?._origin === item._artifact?._main)
|
|
1241
|
+
? valueNav
|
|
1242
|
+
: null;
|
|
1231
1243
|
|
|
1232
1244
|
// Look at all table aliase that could project `item` and only select
|
|
1233
1245
|
// those that have actual projections.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
11
|
-
const { dictAdd
|
|
11
|
+
const { dictAdd } = require('./dictionaries');
|
|
12
12
|
const { Location, weakLocation } = require('../base/location');
|
|
13
13
|
const { XsnName, XsnArtifact } = require('./xsn-model');
|
|
14
14
|
|
|
@@ -158,7 +158,7 @@ function initItemsLinks( obj, block ) {
|
|
|
158
158
|
* is most often the property `elem.name.id`.
|
|
159
159
|
*
|
|
160
160
|
* If argument `prop` is provided, add `elem` to the dictionary of that name,
|
|
161
|
-
* e.g. `elements`. TODO: remove `prop`.
|
|
161
|
+
* e.g. `elements`. TODO: remove `prop` and `name`, rename to `setParentAndMain`.
|
|
162
162
|
*/
|
|
163
163
|
function setMemberParent( elem, name, parent, prop ) {
|
|
164
164
|
if (prop) { // extension or structure include
|
|
@@ -342,6 +342,26 @@ function withAssociation( ref, test = testFunctionPlaceholder, alsoTestLast = fa
|
|
|
342
342
|
return false;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
|
|
346
|
+
function hasSecurityAnno( ext ) {
|
|
347
|
+
return ext['@restrict'] || ext['@requires'] ||
|
|
348
|
+
Object.keys( ext ).some( prop => prop.startsWith( '@ams.' ) );
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function extensionRefContext( ext ) {
|
|
352
|
+
if (ext.kind === 'annotate') {
|
|
353
|
+
if (hasSecurityAnno( ext ))
|
|
354
|
+
return 'annotate-sec';
|
|
355
|
+
}
|
|
356
|
+
else if (ext.artifacts || ext.$syntax === 'empty') {
|
|
357
|
+
// extend … with definitions (or friends) or bare { extend: "ref" } in CSN
|
|
358
|
+
// TODO v8: not for `extend context` and `extend service` → !ext.expectedKind ?
|
|
359
|
+
if (!ext.doc && !Object.keys( ext ).some( a => a.charAt(0) === '@') )
|
|
360
|
+
return 'annotate';
|
|
361
|
+
}
|
|
362
|
+
return ext.kind;
|
|
363
|
+
}
|
|
364
|
+
|
|
345
365
|
/**
|
|
346
366
|
* Return string 'A.B.C' for parsed source `A.B.C` (is vector of ids with
|
|
347
367
|
* locations).
|
|
@@ -639,17 +659,6 @@ function traverseQueryExtra( main, callback ) {
|
|
|
639
659
|
}
|
|
640
660
|
}
|
|
641
661
|
|
|
642
|
-
/**
|
|
643
|
-
* Returns what was available at view._from[0] before:
|
|
644
|
-
* (think first whether to really use this function)
|
|
645
|
-
*/
|
|
646
|
-
function viewFromPrimary( view ) {
|
|
647
|
-
let query = view.$queries?.[0];
|
|
648
|
-
while (query?._origin?.kind === 'select') // sub query in from
|
|
649
|
-
query = query._origin;
|
|
650
|
-
return dictFirst( query?.$tableAliases );
|
|
651
|
-
}
|
|
652
|
-
|
|
653
662
|
/**
|
|
654
663
|
* About Helper property $expand for faster the XSN-to-CSN transformation
|
|
655
664
|
* - null/undefined: artifact, member, items does not contain expanded members
|
|
@@ -730,6 +739,10 @@ function targetCantBeAspect( elem, calledForTargetAspectProp, definitions ) { //
|
|
|
730
739
|
return null;
|
|
731
740
|
}
|
|
732
741
|
|
|
742
|
+
function isLeadingQuery( query ) {
|
|
743
|
+
return query === query._main?.$queries?.[0];
|
|
744
|
+
}
|
|
745
|
+
|
|
733
746
|
function userQuery( user ) {
|
|
734
747
|
// TODO: we need _query links set by the definer
|
|
735
748
|
while (user._main) {
|
|
@@ -898,6 +911,8 @@ module.exports = {
|
|
|
898
911
|
initDollarParameters,
|
|
899
912
|
initBoundSelfParam,
|
|
900
913
|
withAssociation,
|
|
914
|
+
hasSecurityAnno,
|
|
915
|
+
extensionRefContext,
|
|
901
916
|
pathName,
|
|
902
917
|
hasSpecialPathItemProp,
|
|
903
918
|
augmentPath,
|
|
@@ -909,10 +924,10 @@ module.exports = {
|
|
|
909
924
|
forEachQueryExpr,
|
|
910
925
|
traverseQueryPost,
|
|
911
926
|
traverseQueryExtra,
|
|
912
|
-
viewFromPrimary,
|
|
913
927
|
setExpandStatus,
|
|
914
928
|
isDirectComposition,
|
|
915
929
|
targetCantBeAspect,
|
|
930
|
+
isLeadingQuery,
|
|
916
931
|
userQuery,
|
|
917
932
|
userParam,
|
|
918
933
|
pathStartsWithSelf,
|
|
@@ -10,12 +10,12 @@ const { forEachGeneric } = require('../model/csnUtils');
|
|
|
10
10
|
* These transformations are available today:
|
|
11
11
|
*
|
|
12
12
|
* Analytical Scenario:
|
|
13
|
-
*
|
|
13
|
+
* V2 analytical clients don't understand OData V4 vocabulary annotations, therefore
|
|
14
|
+
* if a structure is annotated with '@Aggregation.ApplySupported.PropertyRestrictions'
|
|
14
15
|
* then a number of annotation rewrites are done to this structure and to the
|
|
15
|
-
* elements of this structure
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* the elements dictionary
|
|
16
|
+
* elements of this structure. Also, the key properties of all structure elements are
|
|
17
|
+
* removed and a new artificial key element 'key _ID : String' is inserted at first position of
|
|
18
|
+
* the elements dictionary.
|
|
19
19
|
*
|
|
20
20
|
* PDM (Personal Data Management)
|
|
21
21
|
* Planned but not yet implemented annotation rewriting (pending to finalization)
|
|
@@ -48,6 +48,7 @@ function addToSetAttr( carrier, propName, propValue, removeFromType = true ) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function applyAppSpecificLateCsnTransformationOnElement( options, element, struct, error ) {
|
|
51
|
+
// see "Analytical Scenario" in the module-level comment for why this transformation is needed
|
|
51
52
|
if (options.isV2() && struct['@Aggregation.ApplySupported.PropertyRestrictions'])
|
|
52
53
|
mapAnnotationAssignment(element, struct, GenerateAnalyticalAnnotations());
|
|
53
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
bfa8a04d3ff1bc96f00a7f8d532f11d0
|