@sap/cds 8.9.4 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -680
- package/LICENSE +15 -21
- package/README.md +1 -1
- package/_i18n/i18n_sl.properties +3 -3
- package/_i18n/messages.properties +1 -1
- package/app/index.js +1 -1
- package/bin/serve.js +17 -19
- package/eslint.config.mjs +7 -1
- package/lib/compile/etc/_localized.js +3 -24
- package/lib/compile/etc/yaml.js +6 -15
- package/lib/compile/for/odata.js +2 -2
- package/lib/compile/load.js +15 -4
- package/lib/compile/minify.js +1 -0
- package/lib/compile/to/edm-files.js +4 -33
- package/lib/compile/to/hdbtabledata.js +16 -3
- package/lib/compile/to/sql.js +1 -2
- package/lib/core/linked-csn.js +7 -8
- package/lib/dbs/cds-deploy.js +4 -3
- package/lib/env/cds-env.js +9 -9
- package/lib/env/cds-requires.js +23 -50
- package/lib/env/defaults.js +15 -44
- package/lib/env/schemas/cds-package.js +1 -1
- package/lib/i18n/index.js +1 -0
- package/lib/i18n/locale.js +41 -0
- package/lib/index.js +25 -15
- package/lib/log/cds-error.js +13 -3
- package/lib/log/cds-log.js +43 -18
- package/lib/log/format/aspects/als.js +2 -15
- package/lib/plugins.js +11 -11
- package/lib/ql/CREATE.js +1 -1
- package/lib/ql/DELETE.js +1 -1
- package/lib/ql/DROP.js +1 -1
- package/lib/ql/INSERT.js +9 -18
- package/lib/ql/SELECT.js +12 -19
- package/lib/ql/UPDATE.js +1 -1
- package/lib/ql/UPSERT.js +1 -0
- package/lib/ql/Whereable.js +7 -6
- package/lib/ql/cds-ql.js +0 -12
- package/lib/ql/cds.ql-Query.js +28 -68
- package/lib/ql/cds.ql-infer.js +97 -108
- package/lib/ql/resolve.js +1 -3
- package/lib/req/context.js +5 -4
- package/lib/req/request.js +46 -42
- package/lib/req/response.js +5 -9
- package/lib/req/spawn.js +38 -0
- package/lib/req/validate.js +9 -8
- package/lib/srv/bindings.js +2 -1
- package/lib/srv/cds-connect.js +5 -2
- package/lib/srv/cds-serve.js +0 -2
- package/lib/srv/cds.Service.js +146 -86
- package/lib/srv/middlewares/auth/ias-auth.js +99 -88
- package/lib/srv/middlewares/auth/jwt-auth.js +44 -57
- package/lib/srv/middlewares/cds-context.js +1 -1
- package/lib/srv/middlewares/ctx-model.js +1 -1
- package/lib/srv/middlewares/errors.js +34 -42
- package/lib/srv/protocols/hcql.js +35 -25
- package/lib/srv/protocols/index.js +0 -9
- package/lib/srv/protocols/odata-v4.js +1 -6
- package/lib/srv/srv-dispatch.js +29 -31
- package/lib/srv/srv-handlers.js +14 -46
- package/lib/srv/srv-methods.js +15 -37
- package/lib/srv/srv-tx.js +19 -25
- package/lib/test/cds-test.js +4 -263
- package/lib/utils/cds-utils.js +18 -2
- package/lib/utils/tar.js +6 -8
- package/lib/utils/unit.js +19 -0
- package/libx/_runtime/.eslintrc +1 -1
- package/libx/_runtime/cds-services/util/assert.js +2 -72
- package/libx/_runtime/cds.js +13 -6
- package/libx/_runtime/common/Service.js +33 -75
- package/libx/_runtime/common/aspects/any.js +0 -38
- package/libx/_runtime/common/constants/events.js +5 -13
- package/libx/_runtime/common/generic/auth/autoexpose.js +10 -24
- package/libx/_runtime/common/generic/auth/capabilities.js +23 -20
- package/libx/_runtime/common/generic/auth/expand.js +3 -3
- package/libx/_runtime/common/generic/auth/index.js +3 -3
- package/libx/_runtime/common/generic/auth/insertOnly.js +3 -3
- package/libx/_runtime/common/generic/auth/readOnly.js +4 -4
- package/libx/_runtime/common/generic/auth/requires.js +4 -4
- package/libx/_runtime/common/generic/auth/restrict.js +12 -29
- package/libx/_runtime/common/generic/auth/service.js +3 -3
- package/libx/_runtime/common/generic/auth/utils.js +2 -12
- package/libx/_runtime/common/generic/crud.js +22 -53
- package/libx/_runtime/common/generic/etag.js +18 -31
- package/libx/_runtime/common/generic/input.js +51 -123
- package/libx/_runtime/common/generic/paging.js +4 -4
- package/libx/_runtime/common/generic/sorting.js +8 -19
- package/libx/_runtime/common/generic/stream-only.js +26 -0
- package/libx/_runtime/common/generic/stream.js +16 -48
- package/libx/_runtime/common/generic/temporal.js +15 -7
- package/libx/_runtime/common/utils/binary.js +1 -26
- package/libx/_runtime/common/utils/compareJson.js +1 -2
- package/libx/_runtime/common/utils/cqn.js +15 -14
- package/libx/_runtime/common/utils/differ.js +121 -44
- package/libx/_runtime/common/utils/keys.js +4 -5
- package/libx/_runtime/common/utils/normalizeTimestamp.js +10 -1
- package/libx/_runtime/common/utils/postProcess.js +2 -2
- package/libx/_runtime/common/utils/propagateForeignKeys.js +21 -36
- package/libx/_runtime/common/utils/resolveView.js +105 -141
- package/libx/_runtime/common/utils/rewriteAsterisks.js +45 -12
- package/libx/_runtime/common/utils/streamProp.js +3 -9
- package/libx/_runtime/common/utils/waitingTime.js +13 -1
- package/libx/_runtime/fiori/lean-draft.js +174 -196
- package/libx/_runtime/messaging/common-utils/connections.js +1 -1
- package/libx/_runtime/messaging/enterprise-messaging-utils/EMManagement.js +1 -0
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +3 -3
- package/libx/_runtime/messaging/enterprise-messaging.js +2 -2
- package/libx/_runtime/messaging/file-based.js +2 -4
- package/libx/_runtime/messaging/redis-messaging.js +1 -1
- package/libx/_runtime/messaging/service.js +5 -19
- package/libx/_runtime/remote/Service.js +20 -33
- package/libx/_runtime/remote/utils/client.js +7 -25
- package/libx/_runtime/remote/utils/cloudSdkProvider.js +8 -13
- package/libx/_runtime/remote/utils/data.js +3 -34
- package/libx/_runtime/types/api.js +0 -8
- package/libx/_runtime/ucl/Service.js +1 -9
- package/libx/common/utils/path.js +2 -3
- package/libx/common/utils/streaming.js +2 -1
- package/libx/http/HttpRequest.js +13 -0
- package/libx/{odata/middleware → http}/body-parser.js +7 -5
- package/libx/http/location.js +41 -0
- package/libx/http/put.js +36 -0
- package/libx/odata/ODataAdapter.js +25 -59
- package/libx/odata/index.js +10 -23
- package/libx/odata/middleware/batch.js +29 -20
- package/libx/odata/middleware/create.js +6 -13
- package/libx/odata/middleware/delete.js +0 -4
- package/libx/odata/middleware/error.js +83 -27
- package/libx/odata/middleware/metadata.js +14 -25
- package/libx/odata/middleware/operation.js +10 -26
- package/libx/odata/middleware/read.js +10 -18
- package/libx/odata/middleware/stream.js +14 -34
- package/libx/odata/middleware/update.js +17 -26
- package/libx/odata/parse/afterburner.js +20 -16
- package/libx/odata/parse/cqn2odata.js +3 -1
- package/libx/odata/parse/grammar.peggy +221 -114
- package/libx/odata/parse/parser.js +1 -1
- package/libx/odata/utils/index.js +10 -38
- package/libx/odata/utils/metadata.js +10 -8
- package/libx/odata/utils/normalizeTimeData.js +5 -8
- package/libx/odata/utils/readAfterWrite.js +1 -1
- package/libx/{outbox/OutboxRunner.js → queue/TaskRunner.js} +17 -22
- package/libx/queue/index.js +531 -0
- package/libx/rest/RestAdapter.js +43 -82
- package/libx/rest/middleware/create.js +35 -33
- package/libx/rest/middleware/delete.js +9 -7
- package/libx/rest/middleware/error.js +11 -18
- package/libx/rest/middleware/operation.js +44 -137
- package/libx/rest/middleware/parse.js +114 -130
- package/libx/rest/middleware/read.js +23 -21
- package/libx/rest/middleware/update.js +20 -32
- package/libx/rest/middleware/upsert.js +31 -0
- package/libx/rest/pre-processing.js +8 -18
- package/package.json +6 -7
- package/srv/outbox.cds +1 -0
- package/bin/test.js +0 -125
- package/lib/env/plugins.js +0 -18
- package/lib/req/cds-context.js +0 -52
- package/lib/req/locale.js +0 -35
- package/lib/srv/cds.ServiceClient.js +0 -96
- package/lib/srv/cds.ServiceProvider.js +0 -20
- package/lib/srv/protocols/okra.js +0 -22
- package/lib/test/axios.js +0 -63
- package/lib/test/data.js +0 -52
- package/lib/test/expect.js +0 -343
- package/lib/test/reporter.js +0 -176
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +0 -275
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +0 -217
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +0 -101
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/debug.js +0 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/delete.js +0 -60
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +0 -161
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/language.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +0 -602
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +0 -238
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +0 -327
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/applyToCQN.js +0 -243
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/boundToCQN.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/createToCQN.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/deleteToCQN.js +0 -36
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +0 -250
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/index.js +0 -81
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/orderByToCQN.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +0 -389
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/searchToCQN.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/selectToCQN.js +0 -35
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/updateToCQN.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +0 -217
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/FeatureSupport.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/FullQualifiedName.js +0 -94
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAction.js +0 -139
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlActionImport.js +0 -82
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAliasInfo.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAnnotation.js +0 -104
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAnnotations.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlComplexType.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityContainer.js +0 -142
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityContainerInfo.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntitySet.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityType.js +0 -177
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEnumMember.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEnumType.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlFunction.js +0 -149
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlFunctionImport.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlInclude.js +0 -68
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlIncludeAnnotation.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlJsonProvider.js +0 -1365
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlNavigationProperty.js +0 -190
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlNavigationPropertyBinding.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlOnDelete.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlParameter.js +0 -227
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlProperty.js +0 -250
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlPropertyRef.js +0 -49
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlProvider.js +0 -190
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReference.js +0 -97
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReferentialConstraint.js +0 -60
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReturnType.js +0 -216
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlSchema.js +0 -328
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlSingleton.js +0 -84
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlTerm.js +0 -320
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlTypeDefinition.js +0 -193
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlAnnotationExpression.js +0 -73
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlAnnotationPathExpression.js +0 -33
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlApplyExpression.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlArithmeticExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlBinaryExpression.js +0 -110
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlCastExpression.js +0 -188
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlCollectionExpression.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlConstantExpression.js +0 -116
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlIfExpression.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlIsOfExpression.js +0 -200
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlLabeledElementExpression.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlLabeledElementReferenceExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlModelElementPathExpression.js +0 -29
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNavigationPropertyPathExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNegationExpression.js +0 -27
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNotExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNullExpression.js +0 -18
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPathExpression.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPropertyPathExpression.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPropertyValueExpression.js +0 -55
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlRecordExpression.js +0 -54
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlUnknownExpression.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlUrlRefExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmBindingTarget.js +0 -163
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmFaceted.js +0 -136
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmOperation.js +0 -205
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmOperationImport.js +0 -126
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmStructuredType.js +0 -275
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/Edm.js +0 -775
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAction.js +0 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmActionImport.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAnnotation.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAnnotations.js +0 -57
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmComplexType.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityContainer.js +0 -455
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntitySet.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityType.js +0 -119
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEnumMember.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEnumType.js +0 -117
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmFunction.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmFunctionImport.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmInclude.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmIncludeAnnotation.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmKeyPropertyRef.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmNavigationProperty.js +0 -182
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmNavigationPropertyBinding.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmOnDelete.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmParameter.js +0 -22
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmPrimitiveType.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmPrimitiveTypeKind.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmProperty.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmProvider.js +0 -399
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReference.js +0 -88
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReferentialConstraint.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReturnType.js +0 -14
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmSchema.js +0 -355
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmSingleton.js +0 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTerm.js +0 -75
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmType.js +0 -95
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTypeDefinition.js +0 -121
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTypeFactory.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmVocabularyTermType.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/KeyFactory.js +0 -67
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/Target.js +0 -56
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/TransientStructuredType.js +0 -244
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/AnnotationExpressionFactory.js +0 -130
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmAnnotationExpression.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmAnnotationPathExpression.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmApplyExpression.js +0 -85
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmArithmeticExpression.js +0 -92
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmBinaryExpression.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmCastExpression.js +0 -129
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmCollectionExpression.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmConstantExpression.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmIfExpression.js +0 -103
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmIsOfExpression.js +0 -125
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmLabeledElementExpression.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmLabeledElementReferenceExpression.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmModelElementPathExpression.js +0 -35
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNavigationPropertyPathExpression.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNegationExpression.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNotExpression.js +0 -75
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNullExpression.js +0 -50
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPathExpression.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPropertyPathExpression.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPropertyValueExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmRecordExpression.js +0 -100
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmUnknownExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmUrlRefExpression.js +0 -73
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/AbstractError.js +0 -82
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/IllegalArgumentError.js +0 -58
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/IllegalCallError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/NotImplementedError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriQueryOptionSemanticError.js +0 -49
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriSemanticError.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriSyntaxError.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/ContentTypeInfo.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/JsonContentTypeInfo.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/JsonFormat.js +0 -141
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/RepresentationKind.js +0 -251
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpHeader.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpHeaderReader.js +0 -318
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpMethod.js +0 -25
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpStatusCode.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/Preferences.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/index.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/logging/LoggerFacade.js +0 -183
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/AliasExpression.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ApplyParser.js +0 -946
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/BinaryExpression.js +0 -124
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpandItem.js +0 -76
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpandParser.js +0 -384
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/Expression.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpressionParser.js +0 -1988
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/FilterParser.js +0 -34
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/FunctionParameterParser.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/KeyPredicateParser.js +0 -155
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/KeyValueParser.js +0 -213
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/LiteralExpression.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/MemberExpression.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/MethodExpression.js +0 -146
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/OrderByItem.js +0 -53
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/OrderByParser.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ResourcePathParser.js +0 -848
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SearchParser.js +0 -127
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SelectItem.js +0 -80
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SelectParser.js +0 -294
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/TypeLiteralExpression.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UnaryExpression.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriInfo.js +0 -165
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParameter.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParser.js +0 -350
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriResource.js +0 -602
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriTokenizer.js +0 -1156
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/AggregateExpression.js +0 -164
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/AggregateTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/BottomTopTransformation.js +0 -93
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ComputeExpression.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ComputeTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ConcatTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/CustomFunctionTransformation.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ExpandTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/FilterTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/GroupByItem.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/GroupByTransformation.js +0 -58
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/IdentityTransformation.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/OrderByTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/SearchTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/SkipTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/TopTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/Transformation.js +0 -53
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/info.md +0 -116
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +0 -667
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueEncoder.js +0 -349
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/ValueConverter.js +0 -545
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ParameterValidator.js +0 -124
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ValueValidator.js +0 -743
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/ServiceFactory.js +0 -234
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchContext.js +0 -351
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchErrorInfo.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchExitHandler.js +0 -239
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchProcessor.js +0 -281
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchValidator.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchedRequestExecutor.js +0 -92
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ComponentManager.js +0 -63
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Context.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Dispatcher.js +0 -147
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataRequest.js +0 -458
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataRequestInBatch.js +0 -147
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataResponse.js +0 -314
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataResponseInBatch.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/PlainHttpRequest.js +0 -175
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/PlainHttpResponse.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/RequestContract.js +0 -111
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseContract.js +0 -111
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseHeaderSetter.js +0 -240
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Service.js +0 -417
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ServiceResolutions.js +0 -24
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ApplicationHttpReader.js +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/BatchJsonDeserializer.js +0 -171
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/BatchRequestListBuilder.js +0 -196
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/Cache.js +0 -154
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ContentDeserializer.js +0 -222
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DataReader.js +0 -220
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DeserializerFactory.js +0 -240
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/HeaderReader.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/LineReader.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/MultipartReader.js +0 -419
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/PartReader.js +0 -99
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/Reader.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ResourceJsonDeserializer.js +0 -673
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/ApplicationError.js +0 -108
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/BadRequestError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/ConflictError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/DeserializationError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/InternalServerError.js +0 -20
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/MethodNotAllowedError.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/NotAcceptableError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/NotFoundError.js +0 -33
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/PreconditionFailedError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/PreconditionRequiredError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/SerializationError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/UnauthorizedError.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/AcceptTypeInfo.js +0 -86
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/CharsetInfo.js +0 -76
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/FormatDescription.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/FormatManager.js +0 -91
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/RequestContentNegotiator.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/ResponseContentNegotiator.js +0 -321
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/BatchHandler.js +0 -36
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/MetadataHandler.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/ServiceHandler.js +0 -25
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/CustomPreference.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HeaderInfo.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeader.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeaderReader.js +0 -452
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpStatusCode.js +0 -117
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/Preferences.js +0 -222
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/PreferencesApplied.js +0 -199
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/index.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/Command.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js +0 -94
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandFactory.js +0 -203
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestControlCommand.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestPreValidationCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ContentNegotiatorCommand.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugContentNegotiatorCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugDeserializingCommand.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugSerializingCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DeserializingCommand.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DispatcherCommand.js +0 -95
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ErrorContentNegotiatorCommand.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ErrorSerializingCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/EventListenerCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/LocaleNegotiatorCommand.js +0 -56
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/OdataVersionValidationCommand.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/OperationValidationCommand.js +0 -34
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ParsePreferHeaderCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/PresetResponseHeadersCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/QueryOptionsParserCommand.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/QueryOptionsValidationCommand.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/RequestContentValidationCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SendResponseCommand.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SerializingCommand.js +0 -159
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetResponseHeadersCommand.js +0 -90
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetStatuscodeCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/UriParserCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/logging/DebugLogger.js +0 -97
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ApplicationHttpWriter.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/BatchJsonSerializer.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/BatchMultipartSerializer.js +0 -113
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +0 -405
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/DebugHtmlSerializer.js +0 -302
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/DebugJsonSerializer.js +0 -515
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorSerializer.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorXmlSerializer.js +0 -98
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ExpressionTreeImage.js +0 -404
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/MetadataXmlSerializer.js +0 -1416
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/MultipartWriter.js +0 -202
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/NextLinkSerializer.js +0 -330
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ResourceJsonSerializer.js +0 -1220
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/SerializerFactory.js +0 -484
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ServiceJsonSerializer.js +0 -89
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +0 -612
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/debugview.html +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/BufferedWriter.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/ExpandHelper.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/MetadataCache.js +0 -136
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/PerformanceMonitor.js +0 -221
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/UriHelper.js +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/ConditionalRequestValidator.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/OperationValidator.js +0 -199
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/RequestValidator.js +0 -392
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/VersionValidator.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +0 -331
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +0 -159
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +0 -404
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/oDataConfiguration.js +0 -55
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/omitValues.js +0 -86
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +0 -385
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +0 -12
- package/libx/_runtime/cds-services/util/errors.js +0 -15
- package/libx/_runtime/common/aspects/relation.js +0 -40
- package/libx/_runtime/common/composition/data.js +0 -370
- package/libx/_runtime/common/composition/delete.js +0 -313
- package/libx/_runtime/common/composition/index.js +0 -22
- package/libx/_runtime/common/composition/insert.js +0 -108
- package/libx/_runtime/common/composition/tree.js +0 -275
- package/libx/_runtime/common/composition/update.js +0 -354
- package/libx/_runtime/common/composition/utils.js +0 -95
- package/libx/_runtime/common/error/constants.js +0 -20
- package/libx/_runtime/common/error/entry.js +0 -36
- package/libx/_runtime/common/error/frontend.js +0 -199
- package/libx/_runtime/common/error/index.js +0 -12
- package/libx/_runtime/common/error/log.js +0 -35
- package/libx/_runtime/common/error/standardError.js +0 -11
- package/libx/_runtime/common/error/utils.js +0 -18
- package/libx/_runtime/common/generic/auth/constants.js +0 -17
- package/libx/_runtime/common/generic/put.js +0 -85
- package/libx/_runtime/common/utils/columns.js +0 -177
- package/libx/_runtime/common/utils/compareJsonOLD.js +0 -280
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +0 -1039
- package/libx/_runtime/common/utils/data.js +0 -16
- package/libx/_runtime/common/utils/dollar.js +0 -27
- package/libx/_runtime/common/utils/generateOnCond.js +0 -127
- package/libx/_runtime/common/utils/onlyKeysRemain.js +0 -10
- package/libx/_runtime/common/utils/path.js +0 -20
- package/libx/_runtime/common/utils/quotingStyles.js +0 -29
- package/libx/_runtime/common/utils/restrictions.js +0 -67
- package/libx/_runtime/common/utils/search2cqn4sql.js +0 -37
- package/libx/_runtime/common/utils/searchToLike.js +0 -56
- package/libx/_runtime/common/utils/stream.js +0 -103
- package/libx/_runtime/common/utils/ucsn.js +0 -119
- package/libx/_runtime/common/utils/union.js +0 -31
- package/libx/_runtime/common/utils/unionCqnTemplate.js +0 -174
- package/libx/_runtime/db/Service.js +0 -93
- package/libx/_runtime/db/data-conversion/post-processing.js +0 -175
- package/libx/_runtime/db/expand/expand-v2.js +0 -147
- package/libx/_runtime/db/expand/expandCQNToJoin.js +0 -1775
- package/libx/_runtime/db/expand/index.js +0 -13
- package/libx/_runtime/db/expand/rawToExpanded.js +0 -250
- package/libx/_runtime/db/generic/create.js +0 -30
- package/libx/_runtime/db/generic/delete.js +0 -18
- package/libx/_runtime/db/generic/index.js +0 -25
- package/libx/_runtime/db/generic/input.js +0 -227
- package/libx/_runtime/db/generic/read.js +0 -16
- package/libx/_runtime/db/generic/rewrite.js +0 -68
- package/libx/_runtime/db/generic/structured.js +0 -92
- package/libx/_runtime/db/generic/update.js +0 -97
- package/libx/_runtime/db/generic/virtual.js +0 -83
- package/libx/_runtime/db/query/delete.js +0 -39
- package/libx/_runtime/db/query/index.js +0 -13
- package/libx/_runtime/db/query/insert.js +0 -21
- package/libx/_runtime/db/query/read.js +0 -97
- package/libx/_runtime/db/query/run.js +0 -30
- package/libx/_runtime/db/query/update.js +0 -94
- package/libx/_runtime/db/result/InsertResult.js +0 -87
- package/libx/_runtime/db/sql-builder/BaseBuilder.js +0 -65
- package/libx/_runtime/db/sql-builder/CreateBuilder.js +0 -212
- package/libx/_runtime/db/sql-builder/DeleteBuilder.js +0 -87
- package/libx/_runtime/db/sql-builder/DropBuilder.js +0 -63
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +0 -345
- package/libx/_runtime/db/sql-builder/FunctionBuilder.js +0 -232
- package/libx/_runtime/db/sql-builder/InsertBuilder.js +0 -494
- package/libx/_runtime/db/sql-builder/ReferenceBuilder.js +0 -135
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +0 -482
- package/libx/_runtime/db/sql-builder/UpdateBuilder.js +0 -207
- package/libx/_runtime/db/sql-builder/UpsertBuilder.js +0 -25
- package/libx/_runtime/db/sql-builder/annotations.js +0 -50
- package/libx/_runtime/db/sql-builder/arrayed.js +0 -4
- package/libx/_runtime/db/sql-builder/dataTypes.js +0 -59
- package/libx/_runtime/db/sql-builder/dollar.js +0 -37
- package/libx/_runtime/db/sql-builder/index.js +0 -28
- package/libx/_runtime/db/sql-builder/sqlFactory.js +0 -104
- package/libx/_runtime/db/utils/coloredTxCommands.js +0 -7
- package/libx/_runtime/db/utils/columns.js +0 -41
- package/libx/_runtime/db/utils/deep.js +0 -71
- package/libx/_runtime/db/utils/generateAliases.js +0 -160
- package/libx/_runtime/db/utils/localized.js +0 -77
- package/libx/_runtime/db/utils/normalizeTimeData.js +0 -98
- package/libx/_runtime/db/utils/stream.js +0 -41
- package/libx/_runtime/hana/Service.js +0 -173
- package/libx/_runtime/hana/conversion.js +0 -73
- package/libx/_runtime/hana/customBuilder/CustomCreateBuilder.js +0 -11
- package/libx/_runtime/hana/customBuilder/CustomDeleteBuilder.js +0 -17
- package/libx/_runtime/hana/customBuilder/CustomDropBuilder.js +0 -12
- package/libx/_runtime/hana/customBuilder/CustomExpressionBuilder.js +0 -23
- package/libx/_runtime/hana/customBuilder/CustomFunctionBuilder.js +0 -34
- package/libx/_runtime/hana/customBuilder/CustomReferenceBuilder.js +0 -38
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +0 -90
- package/libx/_runtime/hana/customBuilder/index.js +0 -11
- package/libx/_runtime/hana/driver.js +0 -205
- package/libx/_runtime/hana/dynatrace.js +0 -130
- package/libx/_runtime/hana/execute.js +0 -429
- package/libx/_runtime/hana/localized.js +0 -39
- package/libx/_runtime/hana/pool.js +0 -186
- package/libx/_runtime/hana/search.js +0 -20
- package/libx/_runtime/hana/search2Contains.js +0 -106
- package/libx/_runtime/hana/search2cqn4sql.js +0 -98
- package/libx/_runtime/hana/streaming.js +0 -248
- package/libx/_runtime/messaging/Outbox.js +0 -15
- package/libx/_runtime/sqlite/Service.js +0 -153
- package/libx/_runtime/sqlite/conversion.js +0 -47
- package/libx/_runtime/sqlite/convertAssocToOneManaged.js +0 -60
- package/libx/_runtime/sqlite/convertDraftAdminPathExpression.js +0 -74
- package/libx/_runtime/sqlite/customBuilder/CustomExpressionBuilder.js +0 -24
- package/libx/_runtime/sqlite/customBuilder/CustomFunctionBuilder.js +0 -102
- package/libx/_runtime/sqlite/customBuilder/CustomSelectBuilder.js +0 -16
- package/libx/_runtime/sqlite/customBuilder/CustomUpsertBuilder.js +0 -47
- package/libx/_runtime/sqlite/customBuilder/index.js +0 -49
- package/libx/_runtime/sqlite/execute.js +0 -345
- package/libx/_runtime/sqlite/localized.js +0 -49
- package/libx/outbox/index.js +0 -307
|
@@ -1,1039 +0,0 @@
|
|
|
1
|
-
const cds = require('../../cds')
|
|
2
|
-
const { SELECT, INSERT, DELETE, UPDATE } = cds.ql
|
|
3
|
-
const Query = require('../../../../lib/ql/cds.ql-Query')
|
|
4
|
-
const { ensureNoDraftsSuffix, getDraftColumnsCQNForDraft, ensureDraftsSuffix } = require('./draft')
|
|
5
|
-
const { flattenStructuredSelect, OPERATIONS_MAP } = require('./structured')
|
|
6
|
-
const search2cqn4sql = require('./search2cqn4sql')
|
|
7
|
-
const { getEntityNameFromCQN } = require('./entityFromCqn')
|
|
8
|
-
const getError = require('../../common/error')
|
|
9
|
-
const { rewriteAsterisks } = require('./rewriteAsterisks')
|
|
10
|
-
const { getEntityFromPath } = require('../../common/utils/path')
|
|
11
|
-
const { addRefToWhereIfNecessary } = require('../../../odata/utils')
|
|
12
|
-
const { addAliasToExpression, PARENT_ALIAS, FOREIGN_ALIAS } = require('../../db/utils/generateAliases')
|
|
13
|
-
const { getColumns } = require('./columns')
|
|
14
|
-
|
|
15
|
-
const _elementFromRef = (name, entity) => {
|
|
16
|
-
if (!entity) return
|
|
17
|
-
|
|
18
|
-
if (entity.elements) {
|
|
19
|
-
return entity.elements[_getTargetFromRef(name)]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const _getTargetFromRef = ref => ref.id || ref
|
|
24
|
-
|
|
25
|
-
const _getEntityName = (fromClause, entity, i) => {
|
|
26
|
-
const targetName = _getTargetFromRef(fromClause.ref[i])
|
|
27
|
-
return i === 0 ? targetName : entity && entity.elements[targetName] && entity.elements[targetName].target
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const convertPathExpressionToWhere = (fromClause, model, options) => {
|
|
31
|
-
if (!fromClause.ref) return
|
|
32
|
-
|
|
33
|
-
if (fromClause.ref.length === 1) {
|
|
34
|
-
const target = _getTargetFromRef(fromClause.ref[0])
|
|
35
|
-
const alias = fromClause.as
|
|
36
|
-
const { where, cardinality, args } = fromClause.ref[0]
|
|
37
|
-
return { target, alias, where, cardinality, args }
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let previousSelect, previousEntityName, previousTableAlias, structParent, previousArgs, draft
|
|
41
|
-
let prefix = []
|
|
42
|
-
let columns
|
|
43
|
-
for (let i = 0; i < fromClause.ref.length; i++) {
|
|
44
|
-
const entity = structParent || (previousEntityName && model.definitions[ensureNoDraftsSuffix(previousEntityName)])
|
|
45
|
-
const element = _elementFromRef(fromClause.ref[i], entity)
|
|
46
|
-
|
|
47
|
-
if (element && element._isStructured) {
|
|
48
|
-
prefix.push(element.name)
|
|
49
|
-
structParent = element
|
|
50
|
-
continue
|
|
51
|
-
} else if (element && element.isAssociation) {
|
|
52
|
-
if (element._isAssociationStrict && !element['@odata.draft.enclosed']) draft = false
|
|
53
|
-
_modifyNavigationInWhere(fromClause.ref[i].where, element._target)
|
|
54
|
-
} else if (element && previousSelect && i === fromClause.ref.length - 1) {
|
|
55
|
-
columns = [{ ref: [...prefix, element.name] }]
|
|
56
|
-
fromClause.ref.splice(-1)
|
|
57
|
-
continue
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const entityName = _getEntityName(fromClause, entity, i)
|
|
61
|
-
const currentEntityName = draft ? entityName && ensureDraftsSuffix(entityName) : entityName
|
|
62
|
-
if (!currentEntityName) continue
|
|
63
|
-
if (!draft && currentEntityName.endsWith('_drafts')) draft = true
|
|
64
|
-
const tableAlias = options.tableAliasPrefix ? `${options.tableAliasPrefix}${i}` : `T${i}`
|
|
65
|
-
const currentSelect = SELECT.from({ ref: [currentEntityName], as: tableAlias })
|
|
66
|
-
|
|
67
|
-
if (fromClause.ref[i].where) {
|
|
68
|
-
currentSelect.where(addAliasToExpression(fromClause.ref[i].where, tableAlias))
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// REVISIT: Only args in last segment are handled, intermediate ones are ignored
|
|
72
|
-
const currentArgs = fromClause.ref[i].args
|
|
73
|
-
|
|
74
|
-
if (i !== fromClause.ref.length - 1) {
|
|
75
|
-
currentSelect.columns([1])
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (previousSelect) {
|
|
79
|
-
const navigation = _getTargetFromRef(fromClause.ref[i])
|
|
80
|
-
previousSelect.where(
|
|
81
|
-
model.definitions[ensureNoDraftsSuffix(previousEntityName)]._relations[[...prefix, navigation]].join(
|
|
82
|
-
tableAlias,
|
|
83
|
-
previousTableAlias
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
_convertSelect(previousSelect, model, options)
|
|
87
|
-
currentSelect.where('exists', previousSelect)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
structParent = undefined
|
|
91
|
-
prefix = []
|
|
92
|
-
previousTableAlias = tableAlias
|
|
93
|
-
previousSelect = currentSelect
|
|
94
|
-
previousEntityName = currentEntityName
|
|
95
|
-
previousArgs = currentArgs
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
target: previousEntityName,
|
|
100
|
-
alias: previousTableAlias,
|
|
101
|
-
where: previousSelect && previousSelect.SELECT && previousSelect.SELECT.where,
|
|
102
|
-
args: previousArgs,
|
|
103
|
-
columns
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const _convertPathExpressionForInsert = (intoClause, model) => {
|
|
108
|
-
// .into is plain string or csn entity
|
|
109
|
-
if (typeof intoClause === 'string' || intoClause.name) {
|
|
110
|
-
return intoClause
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return intoClause.ref.reduce((res, curr, i) => {
|
|
114
|
-
if (i === 0) {
|
|
115
|
-
return curr.id || curr
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return model.definitions[res].elements[curr.id || curr].target
|
|
119
|
-
}, '')
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const _getBottomTopRefOrVal = (func, refVal) => func.args.filter(el => el[refVal])
|
|
123
|
-
|
|
124
|
-
const _getWindowWhere = (where, bottomTop) => {
|
|
125
|
-
const windWhere = where || []
|
|
126
|
-
const bottomTopVal = _getBottomTopRefOrVal(bottomTop[0], 'val')[0]
|
|
127
|
-
bottomTopVal.val = parseInt(bottomTopVal.val, 10)
|
|
128
|
-
|
|
129
|
-
if (windWhere.length > 0) {
|
|
130
|
-
windWhere.push('and')
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
windWhere.push({ ref: ['rowNumber'] }, '<=', bottomTopVal)
|
|
134
|
-
return windWhere
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const _getOrderByForWindowFn = bottomTop => {
|
|
138
|
-
const orderBy = _getBottomTopRefOrVal(bottomTop[0], 'ref')[0]
|
|
139
|
-
const sort = bottomTop[0].func === 'topcount' ? 'desc' : 'asc'
|
|
140
|
-
return [orderBy, sort]
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const _getWindowXpr = (groupBy, bottomTop) => {
|
|
144
|
-
const overXpr = { xpr: [] }
|
|
145
|
-
const xpr = [{ func: 'ROW_NUMBER', args: [] }, 'OVER', overXpr]
|
|
146
|
-
|
|
147
|
-
if (groupBy)
|
|
148
|
-
overXpr.xpr.push(
|
|
149
|
-
'PARTITION BY',
|
|
150
|
-
...groupBy.reduce((acc, el, i) => {
|
|
151
|
-
if (i < groupBy.length - 1) {
|
|
152
|
-
acc.push(el)
|
|
153
|
-
acc.push(',')
|
|
154
|
-
} else {
|
|
155
|
-
acc.push(el)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return acc
|
|
159
|
-
}, [])
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
overXpr.xpr.push('ORDER BY', ..._getOrderByForWindowFn(bottomTop))
|
|
163
|
-
return { xpr, as: 'rowNumber' }
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const _isNavCountFunc = el => el.func && el.func === 'count' && el.args[0] !== '*'
|
|
167
|
-
const _isCountNavigation = columns => columns.some(_isNavCountFunc)
|
|
168
|
-
const _isBottomTop = columns => columns.some(el => el.func && (el.func === 'topcount' || el.func === 'bottomcount'))
|
|
169
|
-
const _getWindColumns = (columns, groupBy, bottomTop) => [].concat(columns, _getWindowXpr(groupBy, bottomTop))
|
|
170
|
-
|
|
171
|
-
const _convertCountNavigation = (SELECT, target) => {
|
|
172
|
-
const newWhere = []
|
|
173
|
-
for (let i = 0; i < SELECT.where.length; i++) {
|
|
174
|
-
const element = SELECT.where[i]
|
|
175
|
-
|
|
176
|
-
if (!element.func) {
|
|
177
|
-
newWhere.push(element)
|
|
178
|
-
continue
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (SELECT.from.as && SELECT.from.as === element.args[0].ref[0]) element.args[0].ref.shift()
|
|
182
|
-
const navigations = element.args[0].ref
|
|
183
|
-
const navigationName = navigations[0].id || navigations[0]
|
|
184
|
-
if (target.elements[navigationName]) {
|
|
185
|
-
let currentEntity = target
|
|
186
|
-
let topQuery
|
|
187
|
-
let lastQuery
|
|
188
|
-
|
|
189
|
-
for (let j = 0; j < navigations.length; j++) {
|
|
190
|
-
if (navigations[j].where) {
|
|
191
|
-
addRefToWhereIfNecessary(navigations[j].where, currentEntity)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const nextNavigation = navigations[j]
|
|
195
|
-
const nestedExistsQuery = _buildExistsQuery(
|
|
196
|
-
currentEntity,
|
|
197
|
-
nextNavigation,
|
|
198
|
-
j > 0 ? `ALIAS_${j - 1}` : currentEntity.name,
|
|
199
|
-
`ALIAS_${j}`
|
|
200
|
-
)
|
|
201
|
-
if (!topQuery) {
|
|
202
|
-
topQuery = nestedExistsQuery
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const nestedNavigationName = nextNavigation.id || nextNavigation
|
|
206
|
-
if (j === navigations.length - 1) {
|
|
207
|
-
nestedExistsQuery.columns('count(1) as counted')
|
|
208
|
-
|
|
209
|
-
if (lastQuery) {
|
|
210
|
-
lastQuery.where([nestedExistsQuery, SELECT.where[i + 1], SELECT.where[i + 2]])
|
|
211
|
-
newWhere.push('exists', topQuery)
|
|
212
|
-
} else {
|
|
213
|
-
newWhere.push(nestedExistsQuery, SELECT.where[i + 1], SELECT.where[i + 2])
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
if (lastQuery) {
|
|
217
|
-
lastQuery.where('exists', nestedExistsQuery)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
lastQuery = nestedExistsQuery
|
|
221
|
-
currentEntity = currentEntity.elements[nestedNavigationName]._target
|
|
222
|
-
}
|
|
223
|
-
i += 2
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
SELECT.where = newWhere
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const _addTableName = (where, tableName) => {
|
|
231
|
-
return where.map(whereEl => {
|
|
232
|
-
if (whereEl.xpr) {
|
|
233
|
-
return { xpr: _addTableName(whereEl.xpr, tableName) }
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (whereEl.ref) {
|
|
237
|
-
whereEl.ref.unshift(tableName)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return whereEl
|
|
241
|
-
})
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const _buildExistsQuery = (entity, navigation, currentAlias, nextAlias) => {
|
|
245
|
-
const target = entity.elements[navigation.id || navigation].target
|
|
246
|
-
|
|
247
|
-
const existsQuery = cds.ql.SELECT.from(target)
|
|
248
|
-
existsQuery.SELECT.from.as = nextAlias
|
|
249
|
-
|
|
250
|
-
if (navigation && navigation.where) {
|
|
251
|
-
existsQuery.where(_addTableName(navigation.where, nextAlias))
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const onCond = entity.elements[navigation.id || navigation]._relations.join(nextAlias, currentAlias)
|
|
255
|
-
return existsQuery.where(onCond)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const _createWindowCQN = (SELECT, model) => {
|
|
259
|
-
const bottomTop = SELECT.columns.filter(el => _isBottomTop([el]))
|
|
260
|
-
const columns = (SELECT.columns = [])
|
|
261
|
-
const { elements } = model.definitions[SELECT.from.ref[0]]
|
|
262
|
-
|
|
263
|
-
for (const el in elements) {
|
|
264
|
-
if (!elements[el].isAssociation) {
|
|
265
|
-
columns.push({ ref: [el] })
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
SELECT.where = _getWindowWhere(SELECT.where, bottomTop)
|
|
270
|
-
SELECT.from = {
|
|
271
|
-
SELECT: {
|
|
272
|
-
columns: _getWindColumns(columns, SELECT.groupBy, bottomTop),
|
|
273
|
-
from: SELECT.from
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
SELECT.groupBy = undefined
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const _unshiftRefsWithNavigation = nav => el => {
|
|
281
|
-
if (el.ref) return { ref: [...nav, ...el.ref] }
|
|
282
|
-
if (el.xpr) return { xpr: el.xpr.map(_unshiftRefsWithNavigation(nav)) }
|
|
283
|
-
return el
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const _getWhereExistsSubSelect = (queryTarget, outerAlias, innerAlias, ref, model, options) => {
|
|
287
|
-
let nav = ref.map(el => (el.id ? el.id : el))
|
|
288
|
-
const last = ref.slice(-1)[0]
|
|
289
|
-
const navName = queryTarget.elements[nav[0]] ? nav[0] : nav[nav.length - 1]
|
|
290
|
-
const navElement = queryTarget.elements[navName]
|
|
291
|
-
|
|
292
|
-
const lastElement = nav.reduce((csn, segment) => {
|
|
293
|
-
if (csn.items) return csn // arrayed not supported
|
|
294
|
-
if (csn.elements) {
|
|
295
|
-
const next = csn.elements[segment]
|
|
296
|
-
if (!next) return csn
|
|
297
|
-
if (next.target) return model.definitions[next.target]
|
|
298
|
-
return next
|
|
299
|
-
}
|
|
300
|
-
}, queryTarget)
|
|
301
|
-
|
|
302
|
-
if (lastElement.items) {
|
|
303
|
-
// > arrayed
|
|
304
|
-
throw getError(501, `Condition expression with arrayed elements is not supported`)
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (nav[0] === outerAlias) nav = nav.slice(1)
|
|
308
|
-
|
|
309
|
-
const condition = last.where
|
|
310
|
-
? nav.length > 1
|
|
311
|
-
? last.where.map(_unshiftRefsWithNavigation(nav.slice(1)))
|
|
312
|
-
: last.where
|
|
313
|
-
: undefined
|
|
314
|
-
|
|
315
|
-
if (!innerAlias && !outerAlias) {
|
|
316
|
-
innerAlias = navElement.target
|
|
317
|
-
outerAlias = navElement.parent.name
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const subSelect = SELECT.from({ ref: [navElement.target], as: innerAlias })
|
|
321
|
-
if (condition) {
|
|
322
|
-
if (subSelect.SELECT.from.as) {
|
|
323
|
-
for (let i = 0; i < condition.length; i++) {
|
|
324
|
-
if (!condition[i].ref) continue
|
|
325
|
-
|
|
326
|
-
if (
|
|
327
|
-
condition[i].ref.length > 1 &&
|
|
328
|
-
condition[i].ref.every(r => typeof r === 'string') &&
|
|
329
|
-
condition[i].ref[0] === navName
|
|
330
|
-
) {
|
|
331
|
-
condition[i].ref[0] = subSelect.SELECT.from.as
|
|
332
|
-
} else if (condition[i].ref.length === 1) {
|
|
333
|
-
condition[i].ref.unshift(subSelect.SELECT.from.as)
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// skip for where: [{ val: 1 }]
|
|
339
|
-
// where: [{ func: 'contains', args: [] }] must be evaluated
|
|
340
|
-
if (condition.length > 1 || (condition.length === 1 && !('val' in condition[0]))) subSelect.where(condition)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (options.localized != null) subSelect.SELECT.localized = options.localized
|
|
344
|
-
|
|
345
|
-
subSelect.where(queryTarget._relations[navName].join(innerAlias, outerAlias))
|
|
346
|
-
if (cds.env.effective.odata.structs || cds.env.features.ucsn_struct_conversion) {
|
|
347
|
-
flattenStructuredSelect(subSelect, model)
|
|
348
|
-
}
|
|
349
|
-
subSelect.columns([{ val: 1 }])
|
|
350
|
-
|
|
351
|
-
// nested where exists needs recursive conversion
|
|
352
|
-
options.lambdaIteration++
|
|
353
|
-
|
|
354
|
-
return _convertSelect(subSelect, model, options)
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/*
|
|
358
|
-
* ensures that the where exists are fully expanded and have an infix filter
|
|
359
|
-
* example: where: ['exists', { ref: ['book', 'author'] }]
|
|
360
|
-
* -> where: ['exists', { id: 'book', where: ['exists', { id: 'author', where: [{ val: 1 }] }] }]
|
|
361
|
-
*/
|
|
362
|
-
const _ensureExpandedNestedWhereExists = ({ ref }, aliases) => {
|
|
363
|
-
const acc = {}
|
|
364
|
-
let cur = acc
|
|
365
|
-
let alias
|
|
366
|
-
|
|
367
|
-
for (const r of ref) {
|
|
368
|
-
if (Array.isArray(cur)) {
|
|
369
|
-
if (cur.length > 1) {
|
|
370
|
-
// > element already has condition(s)
|
|
371
|
-
cur.push('and', 'exists', { ref: [{}] })
|
|
372
|
-
cur = cur[cur.length - 1].ref[0]
|
|
373
|
-
} else {
|
|
374
|
-
cur.unshift('exists')
|
|
375
|
-
cur[1] = { ref: [{}] }
|
|
376
|
-
cur = cur[1].ref[0]
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if (typeof r === 'string' && aliases.includes(r)) {
|
|
381
|
-
alias = r
|
|
382
|
-
} else {
|
|
383
|
-
// use Object.assign to preserve pointers
|
|
384
|
-
if (typeof r === 'string') Object.assign(cur, { id: r, where: [{ val: 1 }] })
|
|
385
|
-
else Object.assign(cur, r)
|
|
386
|
-
cur = cur.where
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (alias) return { ref: [alias, acc] }
|
|
391
|
-
return { ref: [acc] }
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const _getRefIndex = (where, index) => {
|
|
395
|
-
if (
|
|
396
|
-
where[index - 1].ref &&
|
|
397
|
-
where[index - 1].ref[where[index - 1].ref.length - 1] !== 'InProcessByUser' &&
|
|
398
|
-
where[index + 1].val !== undefined &&
|
|
399
|
-
where[index + 1].val !== null &&
|
|
400
|
-
where[index + 1].val !== false
|
|
401
|
-
) {
|
|
402
|
-
return index - 1
|
|
403
|
-
}
|
|
404
|
-
if (
|
|
405
|
-
where[index + 1].ref &&
|
|
406
|
-
where[index + 1].ref[where[index + 1].ref.length - 1] !== 'InProcessByUser' &&
|
|
407
|
-
where[index - 1].val !== undefined &&
|
|
408
|
-
where[index - 1].val !== null &&
|
|
409
|
-
where[index - 1].val !== false
|
|
410
|
-
) {
|
|
411
|
-
return index + 1
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const _convertWhereExistsColumn = (column, model, options, queryTarget) => {
|
|
416
|
-
const lambdaIteration = options.lambdaIteration
|
|
417
|
-
if (typeof column === 'object') {
|
|
418
|
-
if (column.SELECT) {
|
|
419
|
-
convertWhereExists(column.SELECT, model, options)
|
|
420
|
-
options.lambdaIteration = lambdaIteration
|
|
421
|
-
} else if (column.where) {
|
|
422
|
-
convertWhereExists(column, model, options, queryTarget)
|
|
423
|
-
options.lambdaIteration = lambdaIteration
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
const convertWhereExists = (query, model, options, currentTarget) => {
|
|
429
|
-
const { where, columns, expand } = query
|
|
430
|
-
let innerAlias, outerAlias, queryTarget
|
|
431
|
-
const { ref, as } =
|
|
432
|
-
(query.ref && query) ||
|
|
433
|
-
(query.from &&
|
|
434
|
-
((query.from.ref && query.from) || (query.from.args && query.from.args[0].ref && query.from.args[0]))) ||
|
|
435
|
-
{}
|
|
436
|
-
|
|
437
|
-
if (!ref) return
|
|
438
|
-
|
|
439
|
-
if (!options.lambdaIteration) options.lambdaIteration = 1
|
|
440
|
-
const lambdaIteration = options.lambdaIteration
|
|
441
|
-
|
|
442
|
-
if (currentTarget) {
|
|
443
|
-
queryTarget = getEntityFromPath({ ref }, currentTarget)
|
|
444
|
-
} else {
|
|
445
|
-
queryTarget = getEntityFromPath({ ref }, model)
|
|
446
|
-
outerAlias = as || PARENT_ALIAS + lambdaIteration
|
|
447
|
-
innerAlias = FOREIGN_ALIAS + lambdaIteration
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (where) {
|
|
451
|
-
for (let i = 0; i < where.length; i++) {
|
|
452
|
-
const element = where[i]
|
|
453
|
-
|
|
454
|
-
// ensure where exists are fully expanded
|
|
455
|
-
if (element === 'exists' && where[i + 1].ref) {
|
|
456
|
-
const ref = query.from || query
|
|
457
|
-
const aliases = ref.as ? [ref.as] : ref.join ? ref.args.map(arg => arg.as) : []
|
|
458
|
-
where[i + 1] = _ensureExpandedNestedWhereExists(where[i + 1], aliases)
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
if (element.xpr) {
|
|
462
|
-
convertWhereExists({ ...query, where: element.xpr }, model, options, currentTarget) // > recursing into nested {xpr}
|
|
463
|
-
} else if (element === 'exists' && where[i + 1].ref) {
|
|
464
|
-
if (query.from) {
|
|
465
|
-
query.from.as = outerAlias
|
|
466
|
-
}
|
|
467
|
-
where[i + 1] = _getWhereExistsSubSelect(queryTarget, outerAlias, innerAlias, where[i + 1].ref, model, options)
|
|
468
|
-
i += 1
|
|
469
|
-
} else if (element.SELECT) {
|
|
470
|
-
convertWhereExists(element.SELECT, model, options)
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
options.lambdaIteration = lambdaIteration
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
if (columns) {
|
|
478
|
-
columns.forEach(column => _convertWhereExistsColumn(column, model, options, queryTarget))
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
if (expand && expand !== '*') {
|
|
482
|
-
expand.forEach(column => _convertWhereExistsColumn(column, model, options, queryTarget))
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const _convertNotEqual = (container, partName = 'where') => {
|
|
487
|
-
const NOT_EQUAL = { '!=': 1, '<>': 1 }
|
|
488
|
-
const where = container[partName]
|
|
489
|
-
|
|
490
|
-
if (where) {
|
|
491
|
-
for (let index = 0; index < where.length; index++) {
|
|
492
|
-
const el = where[index]
|
|
493
|
-
if (el in NOT_EQUAL) {
|
|
494
|
-
const refIndex = _getRefIndex(where, index)
|
|
495
|
-
if (refIndex !== undefined) {
|
|
496
|
-
where[index - 1] = {
|
|
497
|
-
xpr: [where[index - 1], el, where[index + 1], 'or', where[refIndex], '=', { val: null }]
|
|
498
|
-
}
|
|
499
|
-
where.splice(index, 2)
|
|
500
|
-
--index
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (el && el.SELECT) {
|
|
505
|
-
_convertNotEqual(el.SELECT, partName)
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (el && el.xpr) {
|
|
509
|
-
_convertNotEqual(el, 'xpr')
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
if (container.columns) {
|
|
515
|
-
container.columns.forEach(col => {
|
|
516
|
-
if (typeof col === 'object') {
|
|
517
|
-
if (col.SELECT) {
|
|
518
|
-
_convertNotEqual(col.SELECT, partName)
|
|
519
|
-
return
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (col.where) {
|
|
523
|
-
_convertNotEqual(col, partName)
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
})
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const _ifOrderByOrWhereSkip = (queryTarget, ref, model) => {
|
|
531
|
-
if (!queryTarget || !queryTarget.elements[ref[0]]) return
|
|
532
|
-
return ref.some(el => {
|
|
533
|
-
if (typeof el !== 'string') return
|
|
534
|
-
const orderbyTarget = queryTarget.elements[el]._isStructured
|
|
535
|
-
? queryTarget.elements[el]
|
|
536
|
-
: model.definitions[queryTarget.elements[el].target]
|
|
537
|
-
if (orderbyTarget) queryTarget = orderbyTarget
|
|
538
|
-
return (
|
|
539
|
-
(orderbyTarget && orderbyTarget._hasPersistenceSkip) ||
|
|
540
|
-
(queryTarget.elements[el] && queryTarget.elements[el].virtual)
|
|
541
|
-
)
|
|
542
|
-
})
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
const _skip = (queryTarget, ref, alias, model) => {
|
|
546
|
-
// we remove the alias, if it exists
|
|
547
|
-
const _ref = ref[0] === alias ? ref.slice(1) : ref
|
|
548
|
-
if (_ref.length === 1) return queryTarget && queryTarget.elements[_ref[0]] && queryTarget.elements[_ref[0]].virtual
|
|
549
|
-
|
|
550
|
-
return _ifOrderByOrWhereSkip(queryTarget, _ref, model)
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
const _convertOrderByIfSkip = (orderByCQN, index) => {
|
|
554
|
-
orderByCQN.splice(index, 1)
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
const _convertWhereIfSkip = (whereCQN, index) => {
|
|
558
|
-
whereCQN.splice(index, 1, '1 = 1')
|
|
559
|
-
whereCQN[index + 1] in OPERATIONS_MAP ? whereCQN.splice(index + 1, 2) : whereCQN.splice(index - 2, 2)
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
const _convertOrderByOrWhereCQN = (orderByOrWhereCQN, target, model, alias, processFn) => {
|
|
563
|
-
const queryTarget = model.definitions[ensureNoDraftsSuffix(target)]
|
|
564
|
-
|
|
565
|
-
orderByOrWhereCQN.forEach((el, index) => {
|
|
566
|
-
if (el.xpr) {
|
|
567
|
-
_convertOrderByOrWhereCQN(el.xpr, target, model, alias, processFn)
|
|
568
|
-
return
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
if (el.ref && _skip(queryTarget, el.ref, alias, model)) processFn(orderByOrWhereCQN, index)
|
|
572
|
-
})
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
const _convertOrderByOrWhereIfSkip = (cqn, target, model) => {
|
|
576
|
-
const alias = cqn.SELECT.from.as
|
|
577
|
-
if (cqn.SELECT.orderBy && cqn.SELECT.orderBy.length) {
|
|
578
|
-
_convertOrderByOrWhereCQN(cqn.SELECT.orderBy, target, model, alias, _convertOrderByIfSkip)
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
if (cqn.SELECT.where) {
|
|
582
|
-
_convertOrderByOrWhereCQN(cqn.SELECT.where, target, model, alias, _convertWhereIfSkip)
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/* REVISIT: Unused
|
|
587
|
-
const _convertExpand = expand => {
|
|
588
|
-
expand.forEach(expandElement => {
|
|
589
|
-
if (expandElement.ref && expandElement.ref[0]) {
|
|
590
|
-
if (expandElement.ref[0].where) {
|
|
591
|
-
expandElement.where = expandElement.ref[0].where
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (expandElement.ref[0].id) {
|
|
595
|
-
expandElement.ref[0] = expandElement.ref[0].id
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
if (expandElement.expand) {
|
|
600
|
-
_convertExpand(expandElement.expand)
|
|
601
|
-
}
|
|
602
|
-
})
|
|
603
|
-
}
|
|
604
|
-
*/
|
|
605
|
-
|
|
606
|
-
const _simplifyWhere = col => {
|
|
607
|
-
if (col.ref?.[0].where) {
|
|
608
|
-
col.where = col.ref[0].where
|
|
609
|
-
col.ref[0] = col.ref[0].id
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
const _simplifyWhereInColumns = columns => {
|
|
614
|
-
if (!columns) return
|
|
615
|
-
for (const col of columns) {
|
|
616
|
-
_simplifyWhere(col)
|
|
617
|
-
if (col.expand) _simplifyWhereInColumns(col.expand)
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
const _convertPathExpression = (query, model, options = {}) => {
|
|
622
|
-
const prevAlias = query.SELECT.from.as
|
|
623
|
-
for (const whereEl of query.SELECT.where || []) {
|
|
624
|
-
if (typeof whereEl === 'object' && whereEl.SELECT) _convertPathExpression(whereEl, model)
|
|
625
|
-
}
|
|
626
|
-
const conversion = convertPathExpressionToWhere(query.SELECT.from, model, options)
|
|
627
|
-
if (!conversion) return
|
|
628
|
-
const { target, alias, where, cardinality, columns, args } = conversion
|
|
629
|
-
|
|
630
|
-
// REVISIT: It's not possible to just change the reference (i.e. SELECT.from.ref = [target])
|
|
631
|
-
// as many parts of our code base still refer to SELECT.from (e.g. authorization)
|
|
632
|
-
if (args) {
|
|
633
|
-
query.SELECT.from = { ref: [{ id: target, args }] }
|
|
634
|
-
} else {
|
|
635
|
-
query.SELECT.from = { ref: [target] }
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
if (alias) {
|
|
639
|
-
query.SELECT.from.as = alias
|
|
640
|
-
if (query.SELECT.where && alias !== prevAlias) {
|
|
641
|
-
query.SELECT.where = addAliasToExpression(query.SELECT.where, alias)
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
if (columns) {
|
|
646
|
-
// TODO: use streaming as outer property
|
|
647
|
-
if (options.isStreaming) query.SELECT.columns = columns
|
|
648
|
-
else {
|
|
649
|
-
if (!query.SELECT.columns) {
|
|
650
|
-
// Okra always wants to have the key values, remove once we relax this requirement
|
|
651
|
-
if (model.definitions[target] && model.definitions[target].keys) {
|
|
652
|
-
query.SELECT.columns = Object.keys(model.definitions[target].keys)
|
|
653
|
-
.filter(
|
|
654
|
-
k =>
|
|
655
|
-
!model.definitions[target].keys[k].isAssociation &&
|
|
656
|
-
!columns.find(element => element.ref && element.ref[element.ref.length - 1] === k)
|
|
657
|
-
)
|
|
658
|
-
.map(k => ({ ref: [k] }))
|
|
659
|
-
} else query.SELECT.columns = []
|
|
660
|
-
}
|
|
661
|
-
query.SELECT.columns.push(...columns)
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
if (cardinality && cardinality.max === 1) {
|
|
666
|
-
query.SELECT.one = true
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
// TODO: REVISIT: We need to add alias to subselect in .where, .columns, .from, ... etc
|
|
670
|
-
if (where) query.where(where)
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
const _convertToOneEqNullInFilter = (query, target) => {
|
|
674
|
-
// we do not handle join or union
|
|
675
|
-
if (!target) return
|
|
676
|
-
|
|
677
|
-
for (let i = 0; i < query.where.length; i++) {
|
|
678
|
-
const w = query.where[i]
|
|
679
|
-
if (w.xpr) {
|
|
680
|
-
_convertToOneEqNullInFilter({ where: w.xpr }, target)
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
const w2 = query.where[i + 2]
|
|
684
|
-
if (!w2 || !w.ref || w2.val !== null) {
|
|
685
|
-
continue
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
const element = target.elements[w.ref[w.ref.length - 1]]
|
|
689
|
-
if (element && element.is2one && !element.on) {
|
|
690
|
-
const foreignKeys = Object.values(element.parent.elements).filter(e => e._foreignKey4 === element.name)
|
|
691
|
-
const replacedKeys = foreignKeys.reduce((arr, e, idx) => {
|
|
692
|
-
arr.push({ ref: [...w.ref.slice(0, w.ref.length - 1), e.name] }, query.where[i + 1], query.where[i + 2])
|
|
693
|
-
if (idx < foreignKeys.length - 1) {
|
|
694
|
-
arr.push('and')
|
|
695
|
-
}
|
|
696
|
-
return arr
|
|
697
|
-
}, [])
|
|
698
|
-
|
|
699
|
-
query.where.splice(i, 3, { xpr: [...replacedKeys] })
|
|
700
|
-
i++
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
const _convertSelect = (query, model, _options) => {
|
|
706
|
-
const _4db = _options.service?.isDatabaseService
|
|
707
|
-
const options = Object.assign(
|
|
708
|
-
{ _4db, isStreaming: cds.env.features.stream_compat && query._streaming, localized: query.SELECT.localized },
|
|
709
|
-
_options
|
|
710
|
-
)
|
|
711
|
-
|
|
712
|
-
// ensure query is ql enabled
|
|
713
|
-
if (!(query instanceof Query)) Object.setPrototypeOf(query, Object.getPrototypeOf(SELECT()))
|
|
714
|
-
if (query.SELECT.from && query.SELECT.from.SELECT) {
|
|
715
|
-
if (query.SELECT._4odata) query.SELECT.from.SELECT._4odata = true
|
|
716
|
-
query.SELECT.from = _convertSelect(query.SELECT.from, model, options)
|
|
717
|
-
if (!query.SELECT.columns || !query.SELECT.columns.length) {
|
|
718
|
-
query.SELECT.columns = query.SELECT.from.SELECT.columns.map(c => (c.as ? { ref: [c.as] } : c))
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
// add 'or is null' in case of not equal: '!=' or '<>'
|
|
723
|
-
if (query.SELECT._4odata) {
|
|
724
|
-
_convertNotEqual(query.SELECT, 'where')
|
|
725
|
-
_convertNotEqual(query.SELECT, 'having')
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
_convertPathExpression(query, model, options)
|
|
729
|
-
|
|
730
|
-
convertWhereExists(query.SELECT, model, options)
|
|
731
|
-
|
|
732
|
-
rewriteAsterisks(query, model, options)
|
|
733
|
-
const entity =
|
|
734
|
-
(query.SELECT.from.ref && (query.SELECT.from.ref[0].id || query.SELECT.from.ref[0])) || query.SELECT.from
|
|
735
|
-
const target = entity && model.definitions[entity]
|
|
736
|
-
|
|
737
|
-
if (query.SELECT.where) {
|
|
738
|
-
if (_isCountNavigation(query.SELECT.where)) {
|
|
739
|
-
_convertCountNavigation(query.SELECT, target)
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
_convertToOneEqNullInFilter(query.SELECT, target)
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// extract where clause if it is in an expand column
|
|
746
|
-
_simplifyWhereInColumns(query.SELECT.columns)
|
|
747
|
-
|
|
748
|
-
// REVISIT: The following operations only work for _one_ entity.
|
|
749
|
-
// We must also enable them for joins etc.
|
|
750
|
-
const { entityName, alias } = getEntityNameFromCQN(query)
|
|
751
|
-
|
|
752
|
-
// remove virtual and with skip annotated fields in orderby and where
|
|
753
|
-
_convertOrderByOrWhereIfSkip(query, entityName, model)
|
|
754
|
-
|
|
755
|
-
if (query.SELECT.search && !options.suppressSearch) {
|
|
756
|
-
// COMPAT: new protocol adapter captures input as single "val"
|
|
757
|
-
// old db expects it as cqn xpr
|
|
758
|
-
if (query.SELECT.search.length === 1) {
|
|
759
|
-
query.SELECT.search = query.SELECT.search[0].val
|
|
760
|
-
.match(/("")|("(?:[^"]|\\")*(?:[^\\]|\\\\)")|(\S*)/g)
|
|
761
|
-
.filter(el => el.length)
|
|
762
|
-
.map(el => {
|
|
763
|
-
if (el[0] === '"' && el.at(-1) === '"') {
|
|
764
|
-
try {
|
|
765
|
-
return JSON.parse(el)
|
|
766
|
-
} catch {
|
|
767
|
-
return el
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
return el
|
|
771
|
-
})
|
|
772
|
-
.reduce((arr, val, i) => {
|
|
773
|
-
if (i > 0) arr.push('and')
|
|
774
|
-
arr.push({ val })
|
|
775
|
-
return arr
|
|
776
|
-
}, [])
|
|
777
|
-
|
|
778
|
-
if (!query.SELECT.search.length) query.SELECT.search = [{ val: '' }]
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
search2cqn4sql(query, model, { ...query._searchOptions, ...{ entityName, alias } })
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
if (target && query.SELECT.columns) {
|
|
785
|
-
// clean up associations / compositions from columns, if not expanded
|
|
786
|
-
const cleanedUpColumns = []
|
|
787
|
-
for (const col of query.SELECT.columns) {
|
|
788
|
-
if (!col.expand) {
|
|
789
|
-
const ref = col.ref && col.ref[col.ref.length - 1]
|
|
790
|
-
const refElement = target.elements[ref]
|
|
791
|
-
if (refElement && refElement.isAssociation) {
|
|
792
|
-
// ignore
|
|
793
|
-
continue
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
cleanedUpColumns.push(col)
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
query.SELECT.columns = cleanedUpColumns
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if (query.SELECT.columns && (cds.env.effective.odata.structs || cds.env.features.ucsn_struct_conversion)) {
|
|
804
|
-
flattenStructuredSelect(query, model)
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
// topcount with groupby
|
|
808
|
-
if (query.SELECT.columns && _isBottomTop(query.SELECT.columns)) {
|
|
809
|
-
_createWindowCQN(query.SELECT, model)
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
// best-effort ensure columns
|
|
813
|
-
if (options._4db && !query.SELECT.columns) {
|
|
814
|
-
let target = query._target
|
|
815
|
-
if (target && target._unresolved && typeof target.name === 'string') {
|
|
816
|
-
target = model.definitions[target.name] || target
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
if (target && !Object.prototype.hasOwnProperty.call(target, '_unresolved')) {
|
|
820
|
-
const cols = getColumns(target, { onlyNames: true, filterVirtual: true })
|
|
821
|
-
query.columns(cols)
|
|
822
|
-
if (target._isDraftEnabled && query._target._unresolved) {
|
|
823
|
-
query.SELECT.columns.push(...getDraftColumnsCQNForDraft(target), { ref: ['DraftAdministrativeData_DraftUUID'] })
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
return query
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
const _convertUpsert = (query, model) => {
|
|
832
|
-
// resolve path expression
|
|
833
|
-
const resolvedIntoClause = _convertPathExpressionForInsert(query.UPSERT.into, model)
|
|
834
|
-
|
|
835
|
-
const target = model.definitions[resolvedIntoClause]
|
|
836
|
-
if (!target) {
|
|
837
|
-
// if there is no target, just return original query, as a copy is not deep anyways
|
|
838
|
-
// and all the sub items of query.UPSERT are referenced only anyways
|
|
839
|
-
return query
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
// overwrite only .into, foreign keys are already set
|
|
843
|
-
// 'a' added as placeholder since its overwritten by Object.assign below
|
|
844
|
-
const upsert = UPSERT.into('a')
|
|
845
|
-
|
|
846
|
-
// REVISIT flatten structured types, currently its done in SQL builder
|
|
847
|
-
|
|
848
|
-
// We add all previous properties ot the newly created query.
|
|
849
|
-
// Reason is to not lose the query API functionality
|
|
850
|
-
|
|
851
|
-
for (const key in query.UPSERT) {
|
|
852
|
-
upsert.UPSERT[key] = query.UPSERT[key]
|
|
853
|
-
}
|
|
854
|
-
Object.assign(upsert.UPSERT, { into: { ref: [resolvedIntoClause], as: query.UPSERT.into.as } })
|
|
855
|
-
|
|
856
|
-
const resolved = cds.ql.resolve.resolve4db(upsert, cds.db)
|
|
857
|
-
// required for deploying of extensions, not used anywhere else except UpsertBuilder
|
|
858
|
-
resolved._target = resolved.UPSERT?._transitions?.[0].target || query._target
|
|
859
|
-
// resolved._target = query._target
|
|
860
|
-
return resolved
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
const _convertInsert = (query, model) => {
|
|
864
|
-
// resolve path expression
|
|
865
|
-
const resolvedIntoClause = _convertPathExpressionForInsert(query.INSERT.into, model)
|
|
866
|
-
|
|
867
|
-
// overwrite only .into, foreign keys are already set
|
|
868
|
-
// 'a' added as placeholder since its overwritten by Object.assign below
|
|
869
|
-
const insert = INSERT.into('a')
|
|
870
|
-
|
|
871
|
-
// REVISIT flatten structured types, currently its done in SQL builder
|
|
872
|
-
|
|
873
|
-
// We add all previous properties ot the newly created query.
|
|
874
|
-
// Reason is to not lose the query API functionality
|
|
875
|
-
insert.INSERT = {}
|
|
876
|
-
for (const prop in query.INSERT) {
|
|
877
|
-
insert.INSERT[prop] = query.INSERT[prop]
|
|
878
|
-
}
|
|
879
|
-
Object.assign(insert.INSERT, { into: { ref: [resolvedIntoClause], as: query.INSERT.into.as } })
|
|
880
|
-
|
|
881
|
-
const target = model.definitions[resolvedIntoClause]
|
|
882
|
-
if (!target) return insert
|
|
883
|
-
return cds.ql.resolve.resolve4db(insert, cds.db)
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
function _modifyNavigationInWhere(whereClause, target) {
|
|
887
|
-
if (!whereClause) return
|
|
888
|
-
|
|
889
|
-
whereClause.forEach(e => {
|
|
890
|
-
if (e.ref && e.ref.length > 1 && target.elements[e.ref[0]]) {
|
|
891
|
-
const element = target.elements[e.ref[0]]
|
|
892
|
-
if (!element.isAssociation) return
|
|
893
|
-
const foreignKeys = element._foreignKeys
|
|
894
|
-
const joined = e.ref.join('_')
|
|
895
|
-
|
|
896
|
-
for (const { parentElement } of foreignKeys) {
|
|
897
|
-
if (parentElement && parentElement.name === joined) {
|
|
898
|
-
e.ref = [joined]
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
})
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
const _plainDelete = (cqn, model) => {
|
|
906
|
-
const name = cqn.DELETE.from.name || (cqn.DELETE.from.ref && cqn.DELETE.from.ref[0]) || cqn.DELETE.from
|
|
907
|
-
const target = model.definitions[name]
|
|
908
|
-
|
|
909
|
-
if (cqn.DELETE.where) {
|
|
910
|
-
_convertToOneEqNullInFilter(cqn.DELETE, target)
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
if (!target) return cqn
|
|
914
|
-
|
|
915
|
-
return cds.ql.resolve.resolve4db(cqn, cds.db)
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
const _convertDelete = (query, model, options) => {
|
|
919
|
-
// .from is plain string or csn entity
|
|
920
|
-
if (
|
|
921
|
-
typeof query.DELETE.from === 'string' ||
|
|
922
|
-
query.DELETE.from.name ||
|
|
923
|
-
(query.DELETE.from.ref && typeof query.DELETE.from.ref[0] === 'string')
|
|
924
|
-
) {
|
|
925
|
-
return _plainDelete(query, model)
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
const { target, alias, where } = convertPathExpressionToWhere(query.DELETE.from, model, options)
|
|
929
|
-
const deleet = DELETE('x')
|
|
930
|
-
|
|
931
|
-
for (const key in query.DELETE) {
|
|
932
|
-
deleet.DELETE[key] = query.DELETE[key]
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
Object.assign(deleet.DELETE, { from: target, where: undefined })
|
|
936
|
-
|
|
937
|
-
if (alias) deleet.DELETE.from = { ref: [target], as: alias }
|
|
938
|
-
if (where) deleet.where(where)
|
|
939
|
-
|
|
940
|
-
const targetEntity = model.definitions[target]
|
|
941
|
-
if (query.DELETE.where) {
|
|
942
|
-
deleet.where(addAliasToExpression(query.DELETE.where, alias))
|
|
943
|
-
_convertToOneEqNullInFilter(deleet.DELETE, targetEntity)
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
if (!targetEntity) return deleet
|
|
947
|
-
|
|
948
|
-
return cds.ql.resolve.resolve4db(deleet, cds.db)
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
function _plainUpdate(cqn, model) {
|
|
952
|
-
const name = cqn.UPDATE.entity.name || (cqn.UPDATE.entity.ref && cqn.UPDATE.entity.ref[0]) || cqn.UPDATE.entity
|
|
953
|
-
const target = model.definitions[name]
|
|
954
|
-
|
|
955
|
-
if (cqn.UPDATE.where) {
|
|
956
|
-
_convertToOneEqNullInFilter(cqn.UPDATE, target)
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
if (!target) return cqn
|
|
960
|
-
return cds.ql.resolve.resolve4db(cqn, cds.db)
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
const _convertUpdate = (query, model, options) => {
|
|
964
|
-
// REVISIT flatten structured types, currently its done in SQL builder
|
|
965
|
-
|
|
966
|
-
// .into is plain string or csn entity
|
|
967
|
-
if (
|
|
968
|
-
typeof query.UPDATE.entity === 'string' ||
|
|
969
|
-
query.UPDATE.entity.name ||
|
|
970
|
-
(query.UPDATE.entity.ref && typeof query.UPDATE.entity.ref[0] === 'string' && query.UPDATE.entity.ref.length === 1)
|
|
971
|
-
) {
|
|
972
|
-
return _plainUpdate(query, model)
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
const { target, alias, where } = convertPathExpressionToWhere(query.UPDATE.entity, model, options)
|
|
976
|
-
|
|
977
|
-
// link .with and .data and set query target and remove current where clause
|
|
978
|
-
// REVISIT: update statement does not accept cqn partial as input
|
|
979
|
-
const update = UPDATE('x')
|
|
980
|
-
// Object.assign(update.UPDATE, query.UPDATE, { entity: target, where: undefined })
|
|
981
|
-
for (const key in query.UPDATE) {
|
|
982
|
-
update.UPDATE[key] = query.UPDATE[key]
|
|
983
|
-
}
|
|
984
|
-
Object.assign(update.UPDATE, { entity: target, where: undefined })
|
|
985
|
-
|
|
986
|
-
if (alias) update.UPDATE.entity = { ref: [target], as: alias }
|
|
987
|
-
if (where) update.where(where)
|
|
988
|
-
|
|
989
|
-
const targetEntity = model.definitions[target]
|
|
990
|
-
|
|
991
|
-
if (query.UPDATE.where) {
|
|
992
|
-
update.where(addAliasToExpression(query.UPDATE.where, alias))
|
|
993
|
-
_convertToOneEqNullInFilter(update.UPDATE, targetEntity)
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
if (!targetEntity) return update
|
|
997
|
-
|
|
998
|
-
return cds.ql.resolve.resolve4db(update, cds.db)
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Converts a CQN with path expression into exists clause.
|
|
1003
|
-
* Converts insert/update/delete on view to target table including renaming of properties
|
|
1004
|
-
* REVISIT structured
|
|
1005
|
-
* REVISIT topcount when the additional layer for Analytics before SQLBuilder is ready
|
|
1006
|
-
*
|
|
1007
|
-
* @param {object} query - incoming query
|
|
1008
|
-
* @param {object} model - csn model
|
|
1009
|
-
* @param {import('../../types/api').cqn2cqn4sqlOptions} [options] Additional options.
|
|
1010
|
-
*/
|
|
1011
|
-
const cqn2cqn4sql = (query, model, options = { suppressSearch: false }) => {
|
|
1012
|
-
if (query.SELECT) {
|
|
1013
|
-
return _convertSelect(query, model, options)
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
if (query.UPDATE) {
|
|
1017
|
-
return _convertUpdate(query, model, options)
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
if (query.INSERT) {
|
|
1021
|
-
return _convertInsert(query, model)
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
if (query.UPSERT) {
|
|
1025
|
-
return _convertUpsert(query, model)
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
if (query.DELETE) {
|
|
1029
|
-
return _convertDelete(query, model, options)
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
return query
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
module.exports = {
|
|
1036
|
-
cqn2cqn4sql,
|
|
1037
|
-
convertWhereExists,
|
|
1038
|
-
convertPathExpressionToWhere
|
|
1039
|
-
}
|