@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
package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlJsonProvider.js
DELETED
|
@@ -1,1365 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const CsdlProvider = require('./CsdlProvider')
|
|
4
|
-
const CsdlEntityContainerInfo = require('../csdl/CsdlEntityContainerInfo')
|
|
5
|
-
const CsdlEntityContainer = require('../csdl/CsdlEntityContainer')
|
|
6
|
-
const CsdlEntitySet = require('../csdl/CsdlEntitySet')
|
|
7
|
-
const CsdlNavigationPropertyBinding = require('../csdl/CsdlNavigationPropertyBinding')
|
|
8
|
-
const CsdlSingleton = require('../csdl/CsdlSingleton')
|
|
9
|
-
const CsdlActionImport = require('../csdl/CsdlActionImport')
|
|
10
|
-
const CsdlFunctionImport = require('../csdl/CsdlFunctionImport')
|
|
11
|
-
const CsdlSchema = require('../csdl/CsdlSchema')
|
|
12
|
-
const CsdlEnumType = require('../csdl/CsdlEnumType')
|
|
13
|
-
const CsdlEnumMember = require('../csdl/CsdlEnumMember')
|
|
14
|
-
const CsdlTypeDefinition = require('../csdl/CsdlTypeDefinition')
|
|
15
|
-
const CsdlEntityType = require('../csdl/CsdlEntityType')
|
|
16
|
-
const CsdlPropertyRef = require('../csdl/CsdlPropertyRef')
|
|
17
|
-
const CsdlProperty = require('../csdl/CsdlProperty')
|
|
18
|
-
const CsdlNavigationProperty = require('../csdl/CsdlNavigationProperty')
|
|
19
|
-
const CsdlReferentialConstraint = require('../csdl/CsdlReferentialConstraint')
|
|
20
|
-
const CsdlComplexType = require('../csdl/CsdlComplexType')
|
|
21
|
-
const CsdlAction = require('../csdl/CsdlAction')
|
|
22
|
-
const CsdlFunction = require('../csdl/CsdlFunction')
|
|
23
|
-
const CsdlParameter = require('../csdl/CsdlParameter')
|
|
24
|
-
const CsdlReturnType = require('../csdl/CsdlReturnType')
|
|
25
|
-
const CsdlTerm = require('../csdl/CsdlTerm')
|
|
26
|
-
const CsdlAliasInfo = require('../csdl/CsdlAliasInfo')
|
|
27
|
-
const CsdlOnDelete = require('../csdl/CsdlOnDelete')
|
|
28
|
-
const CsdlReference = require('../csdl/CsdlReference')
|
|
29
|
-
const CsdlInclude = require('../csdl/CsdlInclude')
|
|
30
|
-
const CsdlAnnotation = require('../csdl/CsdlAnnotation')
|
|
31
|
-
const CsdlAnnotations = require('../csdl/CsdlAnnotations')
|
|
32
|
-
const CsdlConstantExpression = require('../csdl/annotationExpression/CsdlConstantExpression')
|
|
33
|
-
const CsdlUnknownExpression = require('../csdl/annotationExpression/CsdlUnknownExpression')
|
|
34
|
-
const ConstantExpressionType = CsdlConstantExpression.Types
|
|
35
|
-
const CsdlNotExpression = require('../csdl/annotationExpression/CsdlNotExpression')
|
|
36
|
-
const CsdlBinaryExpression = require('../csdl/annotationExpression/CsdlBinaryExpression')
|
|
37
|
-
const LogicalOperators = CsdlBinaryExpression.LogicalOperators
|
|
38
|
-
const ComparisonOperators = CsdlBinaryExpression.ComparisonOperators
|
|
39
|
-
const CsdlArithmeticExpression = require('../csdl/annotationExpression/CsdlArithmeticExpression')
|
|
40
|
-
const CsdlNegationExpression = require('../csdl/annotationExpression/CsdlNegationExpression')
|
|
41
|
-
const CsdlAnnotationPathExpression = require('../csdl/annotationExpression/CsdlAnnotationPathExpression')
|
|
42
|
-
const CsdlApplyExpression = require('../csdl/annotationExpression/CsdlApplyExpression')
|
|
43
|
-
const CsdlCastExpression = require('../csdl/annotationExpression/CsdlCastExpression')
|
|
44
|
-
const CsdlCollectionExpression = require('../csdl/annotationExpression/CsdlCollectionExpression')
|
|
45
|
-
const CsdlIfExpression = require('../csdl/annotationExpression/CsdlIfExpression')
|
|
46
|
-
const CsdlIsOfExpression = require('../csdl/annotationExpression/CsdlIsOfExpression')
|
|
47
|
-
const CsdlLabeledElementExpression = require('../csdl/annotationExpression/CsdlLabeledElementExpression')
|
|
48
|
-
const CsdlLabeledElementReferenceExpression = require('../csdl/annotationExpression/CsdlLabeledElementReferenceExpression')
|
|
49
|
-
const CsdlModelElementPathExpression = require('../csdl/annotationExpression/CsdlModelElementPathExpression')
|
|
50
|
-
const CsdlPathExpression = require('../csdl/annotationExpression/CsdlPathExpression')
|
|
51
|
-
const CsdlNullExpression = require('../csdl/annotationExpression/CsdlNullExpression')
|
|
52
|
-
const CsdlNavigationPropertyPathExpression = require('../csdl/annotationExpression/CsdlNavigationPropertyPathExpression')
|
|
53
|
-
const CsdlPropertyPathExpression = require('../csdl/annotationExpression/CsdlPropertyPathExpression')
|
|
54
|
-
const CsdlRecordExpression = require('../csdl/annotationExpression/CsdlRecordExpression')
|
|
55
|
-
const CsdlPropertyValueExpression = require('../csdl/annotationExpression/CsdlPropertyValueExpression')
|
|
56
|
-
const CsdlUrlRefExpression = require('../csdl/annotationExpression/CsdlUrlRefExpression')
|
|
57
|
-
|
|
58
|
-
const FullQualifiedName = require('../FullQualifiedName')
|
|
59
|
-
const validateThat = require('../validator/ParameterValidator').validateThat
|
|
60
|
-
|
|
61
|
-
const defaultEdmTypeFQN = new FullQualifiedName('Edm', 'String')
|
|
62
|
-
|
|
63
|
-
class AnnotationTokenizer {
|
|
64
|
-
constructor (input) {
|
|
65
|
-
this._input = input
|
|
66
|
-
this._result = null
|
|
67
|
-
this._target = null
|
|
68
|
-
this._index = 0
|
|
69
|
-
}
|
|
70
|
-
getTarget () {
|
|
71
|
-
return this._target
|
|
72
|
-
}
|
|
73
|
-
next () {
|
|
74
|
-
if (this._result === null) {
|
|
75
|
-
this._result = this._input
|
|
76
|
-
.split('@')
|
|
77
|
-
.filter(elem => elem !== '')
|
|
78
|
-
.map(element1 => element1.split('#').filter(element2 => element2 !== ''))
|
|
79
|
-
if (!this._input.startsWith('@')) {
|
|
80
|
-
this._target = this._result.shift()[0]
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (this._index >= this._result.length) {
|
|
84
|
-
return [null, null]
|
|
85
|
-
}
|
|
86
|
-
const result = this._result[this._index]
|
|
87
|
-
this._index++
|
|
88
|
-
return result
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
class AnnotationParser {
|
|
93
|
-
constructor (options = { target: null }) {
|
|
94
|
-
this._options = options
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
parse (element, annotationBuilder, annotations = []) {
|
|
98
|
-
const keys = Object.keys(element).filter(key => key.includes('@'))
|
|
99
|
-
|
|
100
|
-
const findExistingAnnotation = (annotationArray, term) => {
|
|
101
|
-
return annotationArray.find(an => an.toString() === term)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const key of keys) {
|
|
105
|
-
let currentNode = null
|
|
106
|
-
let root = null
|
|
107
|
-
|
|
108
|
-
// @Annotation+, Property@Annotation+, Property@Annotation+#Qualifier
|
|
109
|
-
const tokenizer = new AnnotationTokenizer(key)
|
|
110
|
-
let [term, qualifier] = tokenizer.next()
|
|
111
|
-
const target = tokenizer.getTarget()
|
|
112
|
-
|
|
113
|
-
if (target === this._options.target) {
|
|
114
|
-
const path = [target] // If target is null, join() will left out target
|
|
115
|
-
|
|
116
|
-
do {
|
|
117
|
-
if (term !== null && term !== undefined) {
|
|
118
|
-
const termAndQualifier = term + (qualifier && qualifier.length > 0 ? '#' + qualifier : '')
|
|
119
|
-
path.push(termAndQualifier)
|
|
120
|
-
|
|
121
|
-
const value = element[path.join('@')]
|
|
122
|
-
|
|
123
|
-
if (root === null || root === undefined) {
|
|
124
|
-
root = findExistingAnnotation(annotations, termAndQualifier)
|
|
125
|
-
if (root === null || root === undefined) {
|
|
126
|
-
root = annotationBuilder(term, qualifier, value)
|
|
127
|
-
annotations.push(root)
|
|
128
|
-
}
|
|
129
|
-
currentNode = root
|
|
130
|
-
} else {
|
|
131
|
-
const existingAnnotation = findExistingAnnotation(currentNode.annotations, termAndQualifier)
|
|
132
|
-
if (existingAnnotation === null || existingAnnotation === undefined) {
|
|
133
|
-
const newAnnotation = annotationBuilder(term, qualifier, value)
|
|
134
|
-
currentNode.annotations.push(newAnnotation)
|
|
135
|
-
currentNode = newAnnotation
|
|
136
|
-
} else {
|
|
137
|
-
currentNode = existingAnnotation
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
;[term, qualifier] = tokenizer.next()
|
|
143
|
-
} while (term !== null && term !== undefined)
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// return an array;
|
|
148
|
-
return annotations
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* CSDL Provider from a JSON structure as input
|
|
154
|
-
* @extends CsdlProvider
|
|
155
|
-
*/
|
|
156
|
-
class CsdlJsonProvider extends CsdlProvider {
|
|
157
|
-
/**
|
|
158
|
-
* @param {Object} edmJson - The input JSON structure
|
|
159
|
-
*/
|
|
160
|
-
constructor (edmJson) {
|
|
161
|
-
validateThat('edmJson', edmJson)
|
|
162
|
-
.truthy()
|
|
163
|
-
.typeOf('object')
|
|
164
|
-
|
|
165
|
-
super()
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* The input JSON structure
|
|
169
|
-
* @type {Object}
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
this._edmJson = edmJson
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* the qualified name of the entity container
|
|
176
|
-
* @type {FullQualifiedName}
|
|
177
|
-
* @private
|
|
178
|
-
*/
|
|
179
|
-
if (edmJson.$EntityContainer) {
|
|
180
|
-
this._containerName = FullQualifiedName.createFromNameSpaceAndName(edmJson.$EntityContainer)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* the entity-container part of the input JSON structure
|
|
185
|
-
* @type {Object}
|
|
186
|
-
* @private
|
|
187
|
-
*/
|
|
188
|
-
for (const k in edmJson) if (!k.startsWith('$')) this._containerJson = edmJson[k]
|
|
189
|
-
|
|
190
|
-
// This Map is filled with the versions found
|
|
191
|
-
// Currently this is done through Oasis Issue 1221 compatibility
|
|
192
|
-
this._csdlVersionsFound = new Map()
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Returns a new CsdlEntityContainerInfo of the given entity container name,
|
|
197
|
-
* or null if the given container name does not match this container name.
|
|
198
|
-
*
|
|
199
|
-
* @param {FullQualifiedName} entityContainerName the name of the entity container
|
|
200
|
-
* @returns {?CsdlEntityContainerInfo} the entity-container information
|
|
201
|
-
* @override
|
|
202
|
-
*/
|
|
203
|
-
getEntityContainerInfo (entityContainerName) {
|
|
204
|
-
if (!entityContainerName) return new CsdlEntityContainerInfo(this._containerName)
|
|
205
|
-
|
|
206
|
-
const value = this._getPropertyValue(this._edmJson, entityContainerName.namespace, entityContainerName.name)
|
|
207
|
-
return value === null || value === undefined ? null : new CsdlEntityContainerInfo(entityContainerName)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Returns the value found by a path lookup in the provided object.
|
|
212
|
-
* @param {Objec} data Any object to lookup the value
|
|
213
|
-
* @param {...string} path the property path
|
|
214
|
-
* @returns {?Object} The value found or null
|
|
215
|
-
* @private
|
|
216
|
-
*/
|
|
217
|
-
_getPropertyValue (data, ...path) {
|
|
218
|
-
let context = data
|
|
219
|
-
for (const elem of path) if (context) context = context[elem]
|
|
220
|
-
return context
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Returns the entire entity container with all entitySets, singletons, action imports and function imports.
|
|
225
|
-
*@param {FullQualifiedName} containerFqnParam The full qualified name of the container
|
|
226
|
-
* @returns {CsdlEntityContainer} the CSDL entity container
|
|
227
|
-
* @override
|
|
228
|
-
*/
|
|
229
|
-
getEntityContainer (containerFqnParam) {
|
|
230
|
-
let containerFqn = containerFqnParam
|
|
231
|
-
if (containerFqn === null || containerFqn === undefined) {
|
|
232
|
-
containerFqn = this._containerName
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const containerData = this._getPropertyValue(this._edmJson, containerFqn.namespace, containerFqn.name)
|
|
236
|
-
if (!containerData) return null
|
|
237
|
-
|
|
238
|
-
let entityContainer = new CsdlEntityContainer(containerFqn.name).setAnnotations(
|
|
239
|
-
this._extractInlineAnnotations(containerData)
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
let entitySets = []
|
|
243
|
-
let singletons = []
|
|
244
|
-
let actionImports = []
|
|
245
|
-
let functionImports = []
|
|
246
|
-
|
|
247
|
-
for (const name in containerData) {
|
|
248
|
-
if (this.getEntitySet(containerFqn, name)) {
|
|
249
|
-
entitySets.push(this.getEntitySet(containerFqn, name))
|
|
250
|
-
} else if (this.getActionImport(containerFqn, name)) {
|
|
251
|
-
actionImports.push(this.getActionImport(containerFqn, name))
|
|
252
|
-
} else if (this.getFunctionImport(containerFqn, name)) {
|
|
253
|
-
functionImports.push(this.getFunctionImport(containerFqn, name))
|
|
254
|
-
} else if (this.getSingleton(containerFqn, name)) {
|
|
255
|
-
singletons.push(this.getSingleton(containerFqn, name))
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
entityContainer.setEntitySets(entitySets)
|
|
260
|
-
entityContainer.setSingletons(singletons)
|
|
261
|
-
entityContainer.setActionImports(actionImports)
|
|
262
|
-
entityContainer.setFunctionImports(functionImports)
|
|
263
|
-
|
|
264
|
-
return entityContainer
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Returns the entitySet of the given name, or null if not found.
|
|
269
|
-
* @param {FullQualifiedName} entityContainerName - Entity container name
|
|
270
|
-
* @param {string} entitySetName - Entity set name
|
|
271
|
-
* @returns {?CsdlEntitySet} the CSDL entity set
|
|
272
|
-
* @override
|
|
273
|
-
*/
|
|
274
|
-
getEntitySet (entityContainerName, entitySetName) {
|
|
275
|
-
const containerData = this._getPropertyValue(this._edmJson, entityContainerName.namespace, entityContainerName.name)
|
|
276
|
-
if (!containerData) return null
|
|
277
|
-
|
|
278
|
-
let entitySetJson = containerData[entitySetName]
|
|
279
|
-
if (!entitySetJson) return null
|
|
280
|
-
if (entitySetJson.$Kind) {
|
|
281
|
-
if (entitySetJson.$Kind !== 'EntitySet') return null
|
|
282
|
-
} else {
|
|
283
|
-
if (entitySetJson.$Collection !== true) return null
|
|
284
|
-
if (entitySetJson.$Action) return null
|
|
285
|
-
if (entitySetJson.$Function) return null
|
|
286
|
-
if (entitySetJson.$Type === null || entitySetJson.$Type === undefined) return null
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
let entitySet = new CsdlEntitySet(entitySetName, this._getTypeFQN(entitySetJson)).setAnnotations(
|
|
290
|
-
this._extractInlineAnnotations(entitySetJson)
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
if (Object.prototype.hasOwnProperty.call(entitySetJson, '$IncludeInServiceDocument')) {
|
|
294
|
-
entitySet.setIncludeInServiceDocument(entitySetJson.$IncludeInServiceDocument)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (Object.prototype.hasOwnProperty.call(entitySetJson, '$NavigationPropertyBinding')) {
|
|
298
|
-
const navPropBindings = Object.keys(entitySetJson.$NavigationPropertyBinding).map(
|
|
299
|
-
binding => new CsdlNavigationPropertyBinding(binding, entitySetJson.$NavigationPropertyBinding[binding])
|
|
300
|
-
)
|
|
301
|
-
entitySet.setNavigationPropertyBindings(navPropBindings)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return entitySet
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Returns the singleton of the given name, or null if not found.
|
|
309
|
-
* @param {FullQualifiedName} entityContainerName - Entity container name
|
|
310
|
-
* @param {string} singletonName - Singleton name
|
|
311
|
-
* @returns {?CsdlSingleton} the CSDL singleton
|
|
312
|
-
* @override
|
|
313
|
-
*/
|
|
314
|
-
getSingleton (entityContainerName, singletonName) {
|
|
315
|
-
const containerData = this._getPropertyValue(this._edmJson, entityContainerName.namespace, entityContainerName.name)
|
|
316
|
-
if (!containerData) return null
|
|
317
|
-
|
|
318
|
-
let singletonJson = containerData[singletonName]
|
|
319
|
-
if (!singletonJson) return null
|
|
320
|
-
|
|
321
|
-
if (singletonJson.$Kind) {
|
|
322
|
-
if (singletonJson.$Kind !== 'Singleton') return null
|
|
323
|
-
} else {
|
|
324
|
-
if (singletonJson.$Collection) return null
|
|
325
|
-
if (singletonJson.$Action) return null
|
|
326
|
-
if (singletonJson.$Function) return null
|
|
327
|
-
if (singletonJson.$Type === null || singletonJson.$Type === undefined) return null
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
let singleton = new CsdlSingleton(singletonName, this._getTypeFQN(singletonJson)).setAnnotations(
|
|
331
|
-
this._extractInlineAnnotations(singletonJson)
|
|
332
|
-
)
|
|
333
|
-
|
|
334
|
-
if (Object.prototype.hasOwnProperty.call(singletonJson, '$NavigationPropertyBinding')) {
|
|
335
|
-
const navPropBindings = Object.keys(singletonJson.$NavigationPropertyBinding).map(
|
|
336
|
-
binding => new CsdlNavigationPropertyBinding(binding, singletonJson.$NavigationPropertyBinding[binding])
|
|
337
|
-
)
|
|
338
|
-
singleton.setNavigationPropertyBindings(navPropBindings)
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return singleton
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Returns the action import of the given name, or null if not found.
|
|
346
|
-
* @param {FullQualifiedName} entityContainerName - Entity container name
|
|
347
|
-
* @param {string} actionImportName - Action import name
|
|
348
|
-
* @returns {?CsdlActionImport} the CSDL action import
|
|
349
|
-
* @override
|
|
350
|
-
*/
|
|
351
|
-
getActionImport (entityContainerName, actionImportName) {
|
|
352
|
-
const containerData = this._getPropertyValue(this._edmJson, entityContainerName.namespace, entityContainerName.name)
|
|
353
|
-
if (!containerData) return null
|
|
354
|
-
|
|
355
|
-
let actionJson = containerData[actionImportName]
|
|
356
|
-
if (!actionJson) return null
|
|
357
|
-
if (actionJson.$Action === null || actionJson.$Action === undefined) return null
|
|
358
|
-
|
|
359
|
-
let action = new CsdlActionImport(
|
|
360
|
-
actionImportName,
|
|
361
|
-
FullQualifiedName.createFromNameSpaceAndName(actionJson.$Action)
|
|
362
|
-
).setAnnotations(this._extractInlineAnnotations(actionJson))
|
|
363
|
-
|
|
364
|
-
if (Object.prototype.hasOwnProperty.call(actionJson, '$EntitySet')) {
|
|
365
|
-
action.setEntitySet(actionJson.$EntitySet)
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return action
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Returns the function import of the given name, or null if not found.
|
|
373
|
-
* @param {FullQualifiedName} entityContainerName - Entity container name
|
|
374
|
-
* @param {string} functionImportName - Function import name
|
|
375
|
-
* @returns {?CsdlFunctionImport} the CSDL function import
|
|
376
|
-
* @override
|
|
377
|
-
*/
|
|
378
|
-
getFunctionImport (entityContainerName, functionImportName) {
|
|
379
|
-
const containerData = this._getPropertyValue(this._edmJson, entityContainerName.namespace, entityContainerName.name)
|
|
380
|
-
if (!containerData) return null
|
|
381
|
-
|
|
382
|
-
let functionImpJson = containerData[functionImportName]
|
|
383
|
-
if (!functionImpJson) return null
|
|
384
|
-
if (functionImpJson.$Function === null || functionImpJson.$Function === undefined) return null
|
|
385
|
-
|
|
386
|
-
let functionImp = new CsdlFunctionImport(
|
|
387
|
-
functionImportName,
|
|
388
|
-
FullQualifiedName.createFromNameSpaceAndName(functionImpJson.$Function)
|
|
389
|
-
).setAnnotations(this._extractInlineAnnotations(functionImpJson))
|
|
390
|
-
|
|
391
|
-
if (Object.prototype.hasOwnProperty.call(functionImpJson, '$EntitySet')) {
|
|
392
|
-
functionImp.setEntitySet(functionImpJson.$EntitySet)
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
if (Object.prototype.hasOwnProperty.call(functionImpJson, '$IncludeInServiceDocument')) {
|
|
396
|
-
functionImp.setIncludeInServiceDocument(functionImpJson.$IncludeInServiceDocument)
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
return functionImp
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Returns an array of all schemas, each with all the corresponding type
|
|
404
|
-
* definitions, entity types, complex types, actions and functions.
|
|
405
|
-
* @returns {CsdlSchema[]} the schemas
|
|
406
|
-
* @override
|
|
407
|
-
*/
|
|
408
|
-
getSchemas () {
|
|
409
|
-
let schemas = []
|
|
410
|
-
for (const schemaName in this._edmJson) {
|
|
411
|
-
if (schemaName.startsWith('$')) {
|
|
412
|
-
// exclude $Reference, $Version, $EntityContainer.
|
|
413
|
-
continue
|
|
414
|
-
}
|
|
415
|
-
const schemaJson = this._edmJson[schemaName]
|
|
416
|
-
let schema = new CsdlSchema(schemaName)
|
|
417
|
-
|
|
418
|
-
if (Object.prototype.hasOwnProperty.call(schemaJson, '$Alias')) {
|
|
419
|
-
schema.setAlias(schemaJson.$Alias)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// set external annotations
|
|
423
|
-
if (Object.prototype.hasOwnProperty.call(schemaJson, '$Annotations')) {
|
|
424
|
-
schema.setExternalAnnotations(this._extractExternalAnnotations(schemaJson.$Annotations))
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// set inline annotations: belong to schema
|
|
428
|
-
schema.setAnnotations(this._extractInlineAnnotations(schemaJson))
|
|
429
|
-
|
|
430
|
-
let actions = []
|
|
431
|
-
let functions = []
|
|
432
|
-
let enumTypes = []
|
|
433
|
-
let typeDefinitions = []
|
|
434
|
-
let entityTypes = []
|
|
435
|
-
let complexTypes = []
|
|
436
|
-
let terms = []
|
|
437
|
-
|
|
438
|
-
for (const name in schemaJson) {
|
|
439
|
-
const fqn = new FullQualifiedName(schemaName, name)
|
|
440
|
-
const elementJson = schemaJson[name]
|
|
441
|
-
|
|
442
|
-
if (Array.isArray(elementJson)) {
|
|
443
|
-
// the entry then is either an action or a function
|
|
444
|
-
let res = this.getActions(fqn)
|
|
445
|
-
if (res.length !== 0) {
|
|
446
|
-
actions = actions.concat(res)
|
|
447
|
-
}
|
|
448
|
-
functions = functions.concat(this.getFunctions(fqn))
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
switch (elementJson.$Kind) {
|
|
452
|
-
case 'EnumType':
|
|
453
|
-
enumTypes.push(this.getEnumType(fqn))
|
|
454
|
-
break
|
|
455
|
-
|
|
456
|
-
case 'TypeDefinition':
|
|
457
|
-
typeDefinitions.push(this.getTypeDefinition(fqn))
|
|
458
|
-
break
|
|
459
|
-
|
|
460
|
-
case 'EntityType':
|
|
461
|
-
entityTypes.push(this.getEntityType(fqn))
|
|
462
|
-
break
|
|
463
|
-
|
|
464
|
-
case 'ComplexType':
|
|
465
|
-
complexTypes.push(this.getComplexType(fqn))
|
|
466
|
-
break
|
|
467
|
-
|
|
468
|
-
case 'Term':
|
|
469
|
-
terms.push(this.getTerm(fqn))
|
|
470
|
-
break
|
|
471
|
-
|
|
472
|
-
case 'EntityContainer':
|
|
473
|
-
schema.setEntityContainer(this.getEntityContainer(fqn))
|
|
474
|
-
break
|
|
475
|
-
|
|
476
|
-
default:
|
|
477
|
-
break
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
schema.setActions(actions)
|
|
482
|
-
schema.setFunctions(functions)
|
|
483
|
-
schema.setEnumTypes(enumTypes)
|
|
484
|
-
schema.setTypeDefinitions(typeDefinitions)
|
|
485
|
-
schema.setEntityTypes(entityTypes)
|
|
486
|
-
schema.setComplexTypes(complexTypes)
|
|
487
|
-
schema.setTerms(terms)
|
|
488
|
-
|
|
489
|
-
schemas.push(schema)
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return schemas
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Returns the enumeration type of the given name, or null if not found
|
|
497
|
-
* @param {FullQualifiedName} enumTypeName - enumeration-type name
|
|
498
|
-
* @returns {?CsdlEnumType} the CSDL enumeration type
|
|
499
|
-
* @override
|
|
500
|
-
*/
|
|
501
|
-
getEnumType (enumTypeName) {
|
|
502
|
-
let enumTypeJson = this._getElementJson(enumTypeName, 'EnumType')
|
|
503
|
-
if (enumTypeJson === null) return null
|
|
504
|
-
|
|
505
|
-
let enumType = new CsdlEnumType(
|
|
506
|
-
enumTypeName.name,
|
|
507
|
-
FullQualifiedName.createFromNameSpaceAndName(enumTypeJson.$UnderlyingType || 'Edm.Int32')
|
|
508
|
-
).setAnnotations(this._extractInlineAnnotations(enumTypeJson))
|
|
509
|
-
|
|
510
|
-
if (Object.prototype.hasOwnProperty.call(enumTypeJson, '$IsFlags')) enumType.setIsFlags(enumTypeJson.$IsFlags)
|
|
511
|
-
|
|
512
|
-
enumType.setMembers(
|
|
513
|
-
Object.keys(enumTypeJson)
|
|
514
|
-
.filter(member => !member.startsWith('$') && !member.includes('@'))
|
|
515
|
-
.map(member =>
|
|
516
|
-
new CsdlEnumMember(member, enumTypeJson[member]).setAnnotations(
|
|
517
|
-
this._extractImplicitAnnotations(enumTypeJson, member)
|
|
518
|
-
)
|
|
519
|
-
)
|
|
520
|
-
)
|
|
521
|
-
|
|
522
|
-
return enumType
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Returns the type definition of the given name, or null if not found
|
|
527
|
-
* @param {FullQualifiedName} typeDefName - Type definition
|
|
528
|
-
* @returns {?CsdlTypeDefinition} the CSDL type definition
|
|
529
|
-
* @override
|
|
530
|
-
*/
|
|
531
|
-
getTypeDefinition (typeDefName) {
|
|
532
|
-
let typeDefJson = this._getElementJson(typeDefName, 'TypeDefinition')
|
|
533
|
-
if (typeDefJson === null) return null
|
|
534
|
-
|
|
535
|
-
let typeDef = new CsdlTypeDefinition(
|
|
536
|
-
typeDefName.name,
|
|
537
|
-
FullQualifiedName.createFromNameSpaceAndName(typeDefJson.$UnderlyingType)
|
|
538
|
-
).setAnnotations(this._extractInlineAnnotations(typeDefJson))
|
|
539
|
-
|
|
540
|
-
this._readFacets(typeDef, typeDefJson, ['$MaxLength', '$Precision', '$Scale', '$SRID'])
|
|
541
|
-
|
|
542
|
-
return typeDef
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Returns the entity type of the given name, or null if not found
|
|
547
|
-
* @param {FullQualifiedName} entityTypeName - Entity type name
|
|
548
|
-
* @returns {?CsdlEntityType} the CSDL entity type
|
|
549
|
-
* @override
|
|
550
|
-
*/
|
|
551
|
-
getEntityType (entityTypeName) {
|
|
552
|
-
let entityTypeJson = this._getElementJson(entityTypeName, 'EntityType')
|
|
553
|
-
if (entityTypeJson === null) return null
|
|
554
|
-
|
|
555
|
-
let entityType = new CsdlEntityType(entityTypeName.name).setAnnotations(
|
|
556
|
-
this._extractInlineAnnotations(entityTypeJson)
|
|
557
|
-
)
|
|
558
|
-
if (Object.prototype.hasOwnProperty.call(entityTypeJson, '$BaseType')) {
|
|
559
|
-
entityType.setBaseType(FullQualifiedName.createFromNameSpaceAndName(entityTypeJson.$BaseType))
|
|
560
|
-
}
|
|
561
|
-
if (Object.prototype.hasOwnProperty.call(entityTypeJson, '$HasStream')) {
|
|
562
|
-
entityType.setHasStream(entityTypeJson.$HasStream)
|
|
563
|
-
}
|
|
564
|
-
if (Object.prototype.hasOwnProperty.call(entityTypeJson, '$Abstract')) {
|
|
565
|
-
entityType.isAbstract = entityTypeJson.$Abstract
|
|
566
|
-
}
|
|
567
|
-
if (Object.prototype.hasOwnProperty.call(entityTypeJson, '$Key')) {
|
|
568
|
-
const key = entityTypeJson.$Key.map(value => {
|
|
569
|
-
if (typeof value === 'object') {
|
|
570
|
-
// propertyRef is with an Alias
|
|
571
|
-
let alias = Object.keys(value)[0]
|
|
572
|
-
return new CsdlPropertyRef(value[alias]).setAlias(alias)
|
|
573
|
-
}
|
|
574
|
-
return new CsdlPropertyRef(value)
|
|
575
|
-
})
|
|
576
|
-
entityType.setKey(key)
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
this._setProperties(entityType, entityTypeJson)
|
|
580
|
-
|
|
581
|
-
return entityType
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Sets the properties and navigation properties for the given entity type or complex type.
|
|
586
|
-
* @param {CsdlEntityType | CsdlComplexType} type - the given entity type or complex type
|
|
587
|
-
* @param {Object} typeJson - the corresponding JSON object for the given entity type or complex type
|
|
588
|
-
* @private
|
|
589
|
-
*/
|
|
590
|
-
_setProperties (type, typeJson) {
|
|
591
|
-
let props = []
|
|
592
|
-
let navProps = []
|
|
593
|
-
for (const propertyName in typeJson) {
|
|
594
|
-
if (propertyName.startsWith('$') || propertyName.includes('@')) {
|
|
595
|
-
// properties and navigation properties do not start with '$' and don't include '@'
|
|
596
|
-
continue
|
|
597
|
-
}
|
|
598
|
-
const kind = typeJson[propertyName].$Kind
|
|
599
|
-
if (!kind || kind === 'Property') {
|
|
600
|
-
props.push(this._createCsdlProperty(typeJson[propertyName], propertyName))
|
|
601
|
-
} else if (kind === 'NavigationProperty') {
|
|
602
|
-
navProps.push(this._createCsdlNavigationProperty(typeJson[propertyName], propertyName))
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
type.setProperties(props)
|
|
606
|
-
type.setNavigationProperties(navProps)
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Returns the complex type of the given name, or null if not found.
|
|
611
|
-
* @param {FullQualifiedName} complexTypeName - Complex type name
|
|
612
|
-
* @returns {?CsdlComplexType} the CSDL complex type
|
|
613
|
-
* @override
|
|
614
|
-
*/
|
|
615
|
-
getComplexType (complexTypeName) {
|
|
616
|
-
let complexTypeJson = this._getElementJson(complexTypeName, 'ComplexType')
|
|
617
|
-
if (complexTypeJson === null) return null
|
|
618
|
-
|
|
619
|
-
let complexType = new CsdlComplexType(complexTypeName.name).setAnnotations(
|
|
620
|
-
this._extractInlineAnnotations(complexTypeJson)
|
|
621
|
-
)
|
|
622
|
-
if (Object.prototype.hasOwnProperty.call(complexTypeJson, '$BaseType')) {
|
|
623
|
-
complexType.setBaseType(FullQualifiedName.createFromNameSpaceAndName(complexTypeJson.$BaseType))
|
|
624
|
-
}
|
|
625
|
-
if (Object.prototype.hasOwnProperty.call(complexTypeJson, '$Abstract')) {
|
|
626
|
-
complexType.isAbstract = complexTypeJson.$Abstract
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
this._setProperties(complexType, complexTypeJson)
|
|
630
|
-
|
|
631
|
-
return complexType
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* Creates a CsdlProperty object of a given property in JSON format.
|
|
636
|
-
* @param {JSON} propertyJson - The corresponding property as a JSON object
|
|
637
|
-
* @param {string} propertyName - Property name
|
|
638
|
-
* @returns {CsdlProperty} the CSDL property
|
|
639
|
-
* @private
|
|
640
|
-
*/
|
|
641
|
-
_createCsdlProperty (propertyJson, propertyName) {
|
|
642
|
-
let property = new CsdlProperty(propertyName, this._getTypeFQN(propertyJson) || defaultEdmTypeFQN).setAnnotations(
|
|
643
|
-
this._extractInlineAnnotations(propertyJson)
|
|
644
|
-
)
|
|
645
|
-
|
|
646
|
-
this._readFacets(property, propertyJson, [
|
|
647
|
-
'$Nullable',
|
|
648
|
-
'$MaxLength',
|
|
649
|
-
'$Precision',
|
|
650
|
-
'$Scale',
|
|
651
|
-
'$SRID',
|
|
652
|
-
'$DefaultValue',
|
|
653
|
-
'$Collection'
|
|
654
|
-
])
|
|
655
|
-
|
|
656
|
-
return property
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Creates a CsdlNavigationProperty object of a given navigation property in JSON format
|
|
661
|
-
* @param {JSON} navPropertyJson - The corresponding navigation property as a JSON object
|
|
662
|
-
* @param {string} navPropertyName - Navigation property name
|
|
663
|
-
* @returns {CsdlNavigationProperty} the CSDL navigation property
|
|
664
|
-
* @private
|
|
665
|
-
*/
|
|
666
|
-
_createCsdlNavigationProperty (navPropertyJson, navPropertyName) {
|
|
667
|
-
let navProperty = new CsdlNavigationProperty(navPropertyName, this._getTypeFQN(navPropertyJson)).setAnnotations(
|
|
668
|
-
this._extractInlineAnnotations(navPropertyJson)
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
this._readFacets(navProperty, navPropertyJson, ['$Collection'])
|
|
672
|
-
// Nullable MUST NOT be specified for a collection-valued navigation property.
|
|
673
|
-
if (!navProperty.isCollection) this._readFacets(navProperty, navPropertyJson, ['$Nullable'])
|
|
674
|
-
|
|
675
|
-
if (Object.prototype.hasOwnProperty.call(navPropertyJson, '$Partner')) {
|
|
676
|
-
navProperty.setPartner(navPropertyJson.$Partner)
|
|
677
|
-
}
|
|
678
|
-
if (Object.prototype.hasOwnProperty.call(navPropertyJson, '$ContainsTarget')) {
|
|
679
|
-
navProperty.setContainsTarget(navPropertyJson.$ContainsTarget)
|
|
680
|
-
}
|
|
681
|
-
if (Object.prototype.hasOwnProperty.call(navPropertyJson, '$OnDelete')) {
|
|
682
|
-
navProperty.setOnDelete(
|
|
683
|
-
new CsdlOnDelete(navPropertyJson.$OnDelete).setAnnotations(
|
|
684
|
-
this._extractImplicitAnnotations(navPropertyJson, '$OnDelete')
|
|
685
|
-
)
|
|
686
|
-
)
|
|
687
|
-
}
|
|
688
|
-
if (Object.prototype.hasOwnProperty.call(navPropertyJson, '$ReferentialConstraint')) {
|
|
689
|
-
let refConstraints = new Map()
|
|
690
|
-
for (const prop in navPropertyJson.$ReferentialConstraint) {
|
|
691
|
-
const propValue = navPropertyJson.$ReferentialConstraint[prop]
|
|
692
|
-
|
|
693
|
-
if (!prop.includes('@')) {
|
|
694
|
-
// TODO property refers to a dependant, and not an annotation
|
|
695
|
-
refConstraints.set(prop, new CsdlReferentialConstraint(prop /* dependent */, propValue /* principal */))
|
|
696
|
-
} else {
|
|
697
|
-
// Annotation of a ref constraint, example:
|
|
698
|
-
// "$ReferentialConstraint": {
|
|
699
|
-
// "dependent1": "principal1",
|
|
700
|
-
// "dependent1@Org.OData.Core.V1.Description#q": "ReferentialConstraint annotation"
|
|
701
|
-
// }
|
|
702
|
-
const [propKey, term, qualifier] = this._splitAnnotationString(prop)
|
|
703
|
-
let annotation = this._createAnnotation(term, qualifier, propValue)
|
|
704
|
-
|
|
705
|
-
refConstraints.get(propKey).annotations.push(annotation)
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
navProperty.setReferentialConstraints([...refConstraints.values()])
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
return navProperty
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Creates and returns a CsdlAnnotation object based on input parameters.
|
|
717
|
-
* @param {string} termFqn - Term name as a full-qualified string
|
|
718
|
-
* @param {string} qualifier - Term qualifier
|
|
719
|
-
* @param {Object} expression - The value of the annotation
|
|
720
|
-
* @returns {CsdlAnnotation} the CSDL annotation
|
|
721
|
-
* @private
|
|
722
|
-
*/
|
|
723
|
-
_createAnnotation (termFqn, qualifier, expression) {
|
|
724
|
-
let annotation = new CsdlAnnotation(FullQualifiedName.createFromNameSpaceAndName(termFqn)).setExpression(
|
|
725
|
-
this._interpretAnnotationExpression(expression)
|
|
726
|
-
)
|
|
727
|
-
if (qualifier) annotation.setQualifier(qualifier)
|
|
728
|
-
return annotation
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Splits the string of an annotation of element / property / annotation, and returns an array of the parts.
|
|
733
|
-
* Property annotation: propertyKey@term#qualifier => return [propertyKey, term, qualifier]
|
|
734
|
-
* Annotation annotation: @annotationKey@term#qualifier => return [@annotationKey, term, qualifier]
|
|
735
|
-
* Element annotation: @term#qualifier => return [term, qualifier]
|
|
736
|
-
*
|
|
737
|
-
* @param {string} annStr - Input annotation string.
|
|
738
|
-
* @returns {string[]} the components of the annotation string
|
|
739
|
-
* @private
|
|
740
|
-
*/
|
|
741
|
-
_splitAnnotationString (annStr) {
|
|
742
|
-
let res = []
|
|
743
|
-
if (annStr.startsWith('@')) {
|
|
744
|
-
if (annStr.lastIndexOf('@') === 0) {
|
|
745
|
-
// element annotation
|
|
746
|
-
res = annStr.substring(1).split('#')
|
|
747
|
-
} else {
|
|
748
|
-
// annotation annotation
|
|
749
|
-
let [propKey, termq] = annStr.substring(1).split('@')
|
|
750
|
-
propKey = annStr.charAt(0) + propKey
|
|
751
|
-
const [term, qualifier] = termq.split('#')
|
|
752
|
-
|
|
753
|
-
res = [propKey, term, qualifier]
|
|
754
|
-
}
|
|
755
|
-
} else {
|
|
756
|
-
// property annotation
|
|
757
|
-
let [propKey, termq] = annStr.split('@')
|
|
758
|
-
const [term, qualifier] = termq.split('#')
|
|
759
|
-
|
|
760
|
-
res = [propKey, term, qualifier]
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
return res
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
* Returns the array of actions of the given name, or null if not found.
|
|
768
|
-
* @param {FullQualifiedName} actionName - Action name
|
|
769
|
-
* @returns {?(CsdlAction[])} the CSDL actions
|
|
770
|
-
* @override
|
|
771
|
-
*/
|
|
772
|
-
getActions (actionName) {
|
|
773
|
-
if (!this._edmJson[actionName.namespace]) return null
|
|
774
|
-
|
|
775
|
-
let actionsJson = this._edmJson[actionName.namespace][actionName.name]
|
|
776
|
-
if (!actionsJson || !Array.isArray(actionsJson)) return null
|
|
777
|
-
|
|
778
|
-
let actions = []
|
|
779
|
-
for (const actionObj of actionsJson) {
|
|
780
|
-
if (actionObj.$Kind !== 'Action') continue
|
|
781
|
-
|
|
782
|
-
let action = new CsdlAction(actionName.name).setAnnotations(this._extractInlineAnnotations(actionObj))
|
|
783
|
-
if (Object.prototype.hasOwnProperty.call(actionObj, '$IsBound')) {
|
|
784
|
-
action.setBound(actionObj.$IsBound)
|
|
785
|
-
}
|
|
786
|
-
if (Object.prototype.hasOwnProperty.call(actionObj, '$EntitySetPath')) {
|
|
787
|
-
action.setEntitySetPath(actionObj.$EntitySetPath)
|
|
788
|
-
}
|
|
789
|
-
if (Object.prototype.hasOwnProperty.call(actionObj, '$Parameter')) {
|
|
790
|
-
let parameters = actionObj.$Parameter.map(this._getActionFunctionParameter, this)
|
|
791
|
-
action.setParameters(parameters)
|
|
792
|
-
}
|
|
793
|
-
if (Object.prototype.hasOwnProperty.call(actionObj, '$ReturnType')) {
|
|
794
|
-
action.setReturnType(this._getActionFunctionReturnType(actionObj.$ReturnType))
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
actions.push(action)
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
return actions
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* Returns the array of functions of the given name, or null if not found.
|
|
805
|
-
* @param {FullQualifiedName} funcName - Function name
|
|
806
|
-
* @returns {?(CsdlFunction[])} the CSDL functions
|
|
807
|
-
* @override
|
|
808
|
-
*/
|
|
809
|
-
getFunctions (funcName) {
|
|
810
|
-
if (!this._edmJson[funcName.namespace]) return null
|
|
811
|
-
|
|
812
|
-
let functionsJson = this._edmJson[funcName.namespace][funcName.name]
|
|
813
|
-
if (!functionsJson || !Array.isArray(functionsJson)) return null
|
|
814
|
-
|
|
815
|
-
let functions = []
|
|
816
|
-
for (const funcObj of functionsJson) {
|
|
817
|
-
if (funcObj.$Kind !== 'Function') continue
|
|
818
|
-
|
|
819
|
-
let func = new CsdlFunction(funcName.name, this._getActionFunctionReturnType(funcObj.$ReturnType)).setAnnotations(
|
|
820
|
-
this._extractInlineAnnotations(funcObj)
|
|
821
|
-
)
|
|
822
|
-
|
|
823
|
-
if (Object.prototype.hasOwnProperty.call(funcObj, '$IsBound')) {
|
|
824
|
-
func.setBound(funcObj.$IsBound)
|
|
825
|
-
}
|
|
826
|
-
if (Object.prototype.hasOwnProperty.call(funcObj, '$IsComposable')) {
|
|
827
|
-
func.setComposable(funcObj.$IsComposable)
|
|
828
|
-
}
|
|
829
|
-
if (Object.prototype.hasOwnProperty.call(funcObj, '$EntitySetPath')) {
|
|
830
|
-
func.setEntitySetPath(funcObj.$EntitySetPath)
|
|
831
|
-
}
|
|
832
|
-
if (Object.prototype.hasOwnProperty.call(funcObj, '$Parameter')) {
|
|
833
|
-
let parameters = funcObj.$Parameter.map(this._getActionFunctionParameter, this)
|
|
834
|
-
func.setParameters(parameters)
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
functions.push(func)
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
return functions
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Creats a CsdlParameter object of a given action or function parameter in JSON format
|
|
845
|
-
* @param {JSON} parameterJson - The corresponding parameter as a JSON object
|
|
846
|
-
* @returns {CsdlParameter} the CSDL parameter
|
|
847
|
-
* @private
|
|
848
|
-
*/
|
|
849
|
-
_getActionFunctionParameter (parameterJson) {
|
|
850
|
-
let parameter = new CsdlParameter(
|
|
851
|
-
parameterJson.$Name,
|
|
852
|
-
this._getTypeFQN(parameterJson) || defaultEdmTypeFQN
|
|
853
|
-
).setAnnotations(this._extractInlineAnnotations(parameterJson))
|
|
854
|
-
|
|
855
|
-
this._readFacets(parameter, parameterJson, [
|
|
856
|
-
'$Collection',
|
|
857
|
-
'$Nullable',
|
|
858
|
-
'$MaxLength',
|
|
859
|
-
'$Precision',
|
|
860
|
-
'$Scale',
|
|
861
|
-
'$SRID'
|
|
862
|
-
])
|
|
863
|
-
|
|
864
|
-
return parameter
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
* Creats a CsdlReturnType object of a given action or function returnType in JSON format
|
|
869
|
-
* @param {JSON} returnTypeJson - The corresponding return type as a JSON object
|
|
870
|
-
* @returns {CsdlReturnType} the CSDL return type
|
|
871
|
-
* @private
|
|
872
|
-
*/
|
|
873
|
-
_getActionFunctionReturnType (returnTypeJson) {
|
|
874
|
-
let returnType = new CsdlReturnType(this._getTypeFQN(returnTypeJson) || defaultEdmTypeFQN).setAnnotations(
|
|
875
|
-
this._extractInlineAnnotations(returnTypeJson)
|
|
876
|
-
)
|
|
877
|
-
|
|
878
|
-
this._readFacets(returnType, returnTypeJson, [
|
|
879
|
-
'$Collection',
|
|
880
|
-
'$Nullable',
|
|
881
|
-
'$MaxLength',
|
|
882
|
-
'$Precision',
|
|
883
|
-
'$Scale',
|
|
884
|
-
'$SRID'
|
|
885
|
-
])
|
|
886
|
-
|
|
887
|
-
return returnType
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* Returns the term of the given name, or null if not found.
|
|
892
|
-
* @param {FullQualifiedName} termName - Term name
|
|
893
|
-
* @returns {?CsdlTerm} the CSDL term
|
|
894
|
-
* @override
|
|
895
|
-
*/
|
|
896
|
-
getTerm (termName) {
|
|
897
|
-
let termJson = this._getElementJson(termName, 'Term')
|
|
898
|
-
if (termJson === null) return null
|
|
899
|
-
|
|
900
|
-
let term = new CsdlTerm(termName.name, this._getTypeFQN(termJson) || defaultEdmTypeFQN).setAnnotations(
|
|
901
|
-
this._extractInlineAnnotations(termJson)
|
|
902
|
-
)
|
|
903
|
-
|
|
904
|
-
if (Object.prototype.hasOwnProperty.call(termJson, '$BaseTerm')) {
|
|
905
|
-
term.setBaseTerm(FullQualifiedName.createFromNameSpaceAndName(termJson.$BaseTerm))
|
|
906
|
-
}
|
|
907
|
-
if (Object.prototype.hasOwnProperty.call(termJson, '$AppliesTo')) {
|
|
908
|
-
term.setAppliesTo(termJson.$AppliesTo)
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
this._readFacets(term, termJson, [
|
|
912
|
-
'$Collection',
|
|
913
|
-
'$DefaultValue',
|
|
914
|
-
'$Nullable',
|
|
915
|
-
'$MaxLength',
|
|
916
|
-
'$Precision',
|
|
917
|
-
'$Scale',
|
|
918
|
-
'$SRID'
|
|
919
|
-
])
|
|
920
|
-
|
|
921
|
-
return term
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
* Returns an array of the defined aliases under schemas and $Reference.refUri.$include
|
|
926
|
-
* @returns {CsdlAliasInfo[]} the aliases
|
|
927
|
-
* @override
|
|
928
|
-
*/
|
|
929
|
-
getAliasInfos () {
|
|
930
|
-
let aliasInfos = []
|
|
931
|
-
const reference = this._edmJson.$Reference || {}
|
|
932
|
-
const aliasInfoMap = new Map()
|
|
933
|
-
|
|
934
|
-
const addAliasInfo = (namespace, alias) => {
|
|
935
|
-
const fqn = namespace + '.' + alias
|
|
936
|
-
|
|
937
|
-
// We filter already existing alias infos because of cross service referencing.
|
|
938
|
-
// Currently we 'fake' the cross service reference by including the referenced
|
|
939
|
-
// external model as a new namespace inside the current json model.
|
|
940
|
-
// Therefore the second model alias must not be part of the real alias infos.
|
|
941
|
-
if (!aliasInfoMap.has(fqn)) {
|
|
942
|
-
const aliasInfo = new CsdlAliasInfo(namespace, alias)
|
|
943
|
-
aliasInfos.push(aliasInfo)
|
|
944
|
-
aliasInfoMap.set(aliasInfo.toString(), aliasInfo)
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
// get aliases from Ref-Uri.$Include
|
|
949
|
-
for (const refUriName in reference) {
|
|
950
|
-
for (const include of reference[refUriName].$Include) {
|
|
951
|
-
addAliasInfo(include.$Namespace, include.$Alias || include.$Namespace)
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
// get aliases from schema
|
|
956
|
-
for (const name in this._edmJson) {
|
|
957
|
-
let element = this._edmJson[name]
|
|
958
|
-
if (!name.startsWith('$') && Object.prototype.hasOwnProperty.call(element, '$Alias')) {
|
|
959
|
-
addAliasInfo(name, element.$Alias)
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
return aliasInfos
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
/**
|
|
967
|
-
* Returns an array of all references.
|
|
968
|
-
* @returns {CsdlReference[]} the references
|
|
969
|
-
* @override
|
|
970
|
-
*/
|
|
971
|
-
getReferences () {
|
|
972
|
-
let references = []
|
|
973
|
-
|
|
974
|
-
let refJson = this._edmJson.$Reference
|
|
975
|
-
if (!refJson) return references
|
|
976
|
-
|
|
977
|
-
references = Object.keys(refJson).map(uri => {
|
|
978
|
-
let reference = new CsdlReference(uri).setAnnotations(this._extractInlineAnnotations(refJson[uri]))
|
|
979
|
-
const includes = refJson[uri].$Include.map(include =>
|
|
980
|
-
new CsdlInclude(include.$Namespace)
|
|
981
|
-
.setAlias(include.$Alias)
|
|
982
|
-
.setAnnotations(this._extractInlineAnnotations(include))
|
|
983
|
-
)
|
|
984
|
-
reference.setIncludes(includes)
|
|
985
|
-
return reference
|
|
986
|
-
})
|
|
987
|
-
|
|
988
|
-
return references
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* Reads the $Annotations property (referring to OData CSDL # 14.2) of the JSON structure, e.g.
|
|
993
|
-
* "$Annotations": {
|
|
994
|
-
"targetElement": {
|
|
995
|
-
"@term1": "annotation value",
|
|
996
|
-
"@term2": "annotation value"
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
* and returns a corresponding array of CsdlAnnotations elements for each given target
|
|
1000
|
-
*
|
|
1001
|
-
* @param {Object} exAnnotationsJson - Refers to the $Annotations
|
|
1002
|
-
* @returns {CsdlAnnotations[]} List of external annotations
|
|
1003
|
-
*/
|
|
1004
|
-
_extractExternalAnnotations (exAnnotationsJson) {
|
|
1005
|
-
return Object.keys(exAnnotationsJson).map(target =>
|
|
1006
|
-
new CsdlAnnotations(target).setAnnotations(
|
|
1007
|
-
// annotations are written in the same syntax as inline annotations,
|
|
1008
|
-
// e.g. "@term1": "annotation value"
|
|
1009
|
-
// so we can use _extractInlineAnnotations to interpret them
|
|
1010
|
-
this._extractInlineAnnotations(exAnnotationsJson[target])
|
|
1011
|
-
)
|
|
1012
|
-
)
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* Returns the current CSDL Version or '4.01-cs01' if none found. The return value is always in lower case.
|
|
1017
|
-
* @returns {string} The current CSDL Version
|
|
1018
|
-
* @private
|
|
1019
|
-
*/
|
|
1020
|
-
_getCsdlVersion () {
|
|
1021
|
-
return this._edmJson.$CsdlVersion === undefined
|
|
1022
|
-
? CsdlJsonProvider.CSDL_VERSION.CS01
|
|
1023
|
-
: this._edmJson.$CsdlVersion.toLowerCase()
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Returns the CSDL Versions found by the this provider
|
|
1028
|
-
* @returns {Map.<string, boolean>} The Csdl Versions found
|
|
1029
|
-
* @private
|
|
1030
|
-
*/
|
|
1031
|
-
_getCsdlVersionsFound () {
|
|
1032
|
-
return this._csdlVersionsFound
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
* Interprets the given expression (in JSON format) and returns a corresponding CSDL expression object,
|
|
1037
|
-
* e.g. CsdlConstantExpression or a specific CSDL dynamic expression.
|
|
1038
|
-
*
|
|
1039
|
-
* @param {*} expression - The input expression, which can be of any type
|
|
1040
|
-
* @returns {*} CSDL expression object
|
|
1041
|
-
* @private
|
|
1042
|
-
*/
|
|
1043
|
-
_interpretAnnotationExpression (expression) {
|
|
1044
|
-
if (typeof expression === 'string') {
|
|
1045
|
-
if (this._getCsdlVersion() === CsdlJsonProvider.CSDL_VERSION.CS02) {
|
|
1046
|
-
this._getCsdlVersionsFound().set(CsdlJsonProvider.CSDL_VERSION.CS02, true)
|
|
1047
|
-
// Since the OASIS Issue 1221 is adapted we can not detect the type of the expression here.
|
|
1048
|
-
// Therefore we return an CsdlUnknownExpression if the value is of (Javascript) type string.
|
|
1049
|
-
return new CsdlUnknownExpression(expression)
|
|
1050
|
-
}
|
|
1051
|
-
this._getCsdlVersionsFound().set(CsdlJsonProvider.CSDL_VERSION.CS01, true)
|
|
1052
|
-
return new CsdlConstantExpression(ConstantExpressionType.String, expression)
|
|
1053
|
-
} else if (typeof expression === 'boolean') {
|
|
1054
|
-
return new CsdlConstantExpression(ConstantExpressionType.Bool, expression)
|
|
1055
|
-
} else if (typeof expression === 'number') {
|
|
1056
|
-
return new CsdlConstantExpression(ConstantExpressionType.Float, expression)
|
|
1057
|
-
} else if (expression === null) {
|
|
1058
|
-
return new CsdlNullExpression()
|
|
1059
|
-
} else if (typeof expression === 'object') {
|
|
1060
|
-
const expType = [
|
|
1061
|
-
'$Binary',
|
|
1062
|
-
'$Date',
|
|
1063
|
-
'$DateTimeOffset',
|
|
1064
|
-
'$Decimal',
|
|
1065
|
-
'$Duration',
|
|
1066
|
-
'$EnumMember',
|
|
1067
|
-
'$Float',
|
|
1068
|
-
'$Guid',
|
|
1069
|
-
'$Int',
|
|
1070
|
-
'$TimeOfDay'
|
|
1071
|
-
].find(type => expression[type])
|
|
1072
|
-
if (!expType) {
|
|
1073
|
-
return this._interpretDynamicExpression(expression).setAnnotations(this._extractInlineAnnotations(expression))
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
return new CsdlConstantExpression(
|
|
1077
|
-
ConstantExpressionType[expType.substring(1)], // Type is the same as expType without '$'
|
|
1078
|
-
// Binary values are saved as Buffer.
|
|
1079
|
-
expType === '$Binary' ? Buffer.from(expression[expType], 'base64') : expression[expType]
|
|
1080
|
-
).setAnnotations(
|
|
1081
|
-
this._extractInlineAnnotations(expression).concat(this._extractImplicitAnnotations(expression, expType))
|
|
1082
|
-
)
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
return null
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Interprets expressions when they refer to a dynamic expression,
|
|
1090
|
-
* i.e. they are of type 'object' and do not have a constant expression property ($Binary, $Date, ..etc.),
|
|
1091
|
-
* and returns a corresponding CSDL expression object, e.g. CsdlBinaryExpression,
|
|
1092
|
-
* CsdlAnnotationPathExpression, ..etc
|
|
1093
|
-
*
|
|
1094
|
-
* @param {Object} dynExpression - The dynamic expression JSON object
|
|
1095
|
-
* @returns {*} CSDL dynamic expression object
|
|
1096
|
-
* @private
|
|
1097
|
-
*/
|
|
1098
|
-
_interpretDynamicExpression (dynExpression) {
|
|
1099
|
-
if (Array.isArray(dynExpression)) {
|
|
1100
|
-
// Collection
|
|
1101
|
-
return new CsdlCollectionExpression(dynExpression.map(elem => this._interpretAnnotationExpression(elem)))
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
const expType = Object.keys(dynExpression).filter(key => !key.startsWith('@'))[0]
|
|
1105
|
-
switch (expType) {
|
|
1106
|
-
case '$And':
|
|
1107
|
-
case '$Or': {
|
|
1108
|
-
const operands = dynExpression[expType]
|
|
1109
|
-
|
|
1110
|
-
return new CsdlBinaryExpression(
|
|
1111
|
-
LogicalOperators[expType.substring(1)], // And, Or
|
|
1112
|
-
this._interpretAnnotationExpression(operands[0]), // left
|
|
1113
|
-
this._interpretAnnotationExpression(operands[1])
|
|
1114
|
-
) // right
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
case '$Not':
|
|
1118
|
-
return new CsdlNotExpression(this._interpretAnnotationExpression(dynExpression[expType]))
|
|
1119
|
-
|
|
1120
|
-
case '$Eq':
|
|
1121
|
-
case '$Ne':
|
|
1122
|
-
case '$Gt':
|
|
1123
|
-
case '$Ge':
|
|
1124
|
-
case '$Lt':
|
|
1125
|
-
case '$Le':
|
|
1126
|
-
case '$In': {
|
|
1127
|
-
const operands = dynExpression[expType]
|
|
1128
|
-
return new CsdlBinaryExpression(
|
|
1129
|
-
ComparisonOperators[expType.substring(1)],
|
|
1130
|
-
this._interpretAnnotationExpression(operands[0]), // left
|
|
1131
|
-
this._interpretAnnotationExpression(operands[1])
|
|
1132
|
-
) // right
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
case '$Add':
|
|
1136
|
-
case '$Sub':
|
|
1137
|
-
case '$Mul':
|
|
1138
|
-
case '$Div':
|
|
1139
|
-
case '$DivBy':
|
|
1140
|
-
case '$Mod': {
|
|
1141
|
-
const operands = dynExpression[expType]
|
|
1142
|
-
return new CsdlArithmeticExpression(
|
|
1143
|
-
expType.substring(1),
|
|
1144
|
-
this._interpretAnnotationExpression(operands[0]), // left
|
|
1145
|
-
this._interpretAnnotationExpression(operands[1])
|
|
1146
|
-
) // right
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
case '$Neg':
|
|
1150
|
-
return new CsdlNegationExpression(this._interpretAnnotationExpression(dynExpression[expType]))
|
|
1151
|
-
|
|
1152
|
-
case '$AnnotationPath':
|
|
1153
|
-
return new CsdlAnnotationPathExpression(dynExpression.$AnnotationPath)
|
|
1154
|
-
|
|
1155
|
-
case '$Apply': {
|
|
1156
|
-
const func = dynExpression.$Function
|
|
1157
|
-
const params = dynExpression.$Apply.map(parameter => this._interpretAnnotationExpression(parameter))
|
|
1158
|
-
return new CsdlApplyExpression(FullQualifiedName.createFromNameSpaceAndName(func), params)
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
case '$Cast': {
|
|
1162
|
-
let castExpression = new CsdlCastExpression(
|
|
1163
|
-
this._getTypeFQN(dynExpression),
|
|
1164
|
-
this._interpretAnnotationExpression(dynExpression.$Cast)
|
|
1165
|
-
)
|
|
1166
|
-
this._readFacets(castExpression, dynExpression, ['$Collection', '$MaxLength', '$Precision', '$Scale', '$SRID'])
|
|
1167
|
-
return castExpression
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
case '$If':
|
|
1171
|
-
return new CsdlIfExpression(
|
|
1172
|
-
this._interpretAnnotationExpression(dynExpression.$If[0]),
|
|
1173
|
-
this._interpretAnnotationExpression(dynExpression.$If[1]),
|
|
1174
|
-
this._interpretAnnotationExpression(dynExpression.$If[2])
|
|
1175
|
-
)
|
|
1176
|
-
|
|
1177
|
-
case '$IsOf': {
|
|
1178
|
-
let isOf = new CsdlIsOfExpression(
|
|
1179
|
-
this._getTypeFQN(dynExpression),
|
|
1180
|
-
this._interpretAnnotationExpression(dynExpression.$IsOf)
|
|
1181
|
-
)
|
|
1182
|
-
this._readFacets(isOf, dynExpression, ['$Collection', '$MaxLength', '$Precision', '$Scale', '$SRID'])
|
|
1183
|
-
return isOf
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
case '$LabeledElement':
|
|
1187
|
-
return new CsdlLabeledElementExpression(
|
|
1188
|
-
dynExpression.$Name,
|
|
1189
|
-
this._interpretAnnotationExpression(dynExpression.$LabeledElement)
|
|
1190
|
-
)
|
|
1191
|
-
|
|
1192
|
-
case '$LabeledElementReference':
|
|
1193
|
-
return new CsdlLabeledElementReferenceExpression(
|
|
1194
|
-
FullQualifiedName.createFromNameSpaceAndName(dynExpression.$LabeledElementReference)
|
|
1195
|
-
)
|
|
1196
|
-
|
|
1197
|
-
case '$Null':
|
|
1198
|
-
return new CsdlNullExpression()
|
|
1199
|
-
|
|
1200
|
-
case '$Path':
|
|
1201
|
-
return new CsdlPathExpression(dynExpression.$Path)
|
|
1202
|
-
|
|
1203
|
-
case '$ModelElementPath':
|
|
1204
|
-
return new CsdlModelElementPathExpression(dynExpression.$ModelElementPath)
|
|
1205
|
-
|
|
1206
|
-
case '$NavigationPropertyPath':
|
|
1207
|
-
return new CsdlNavigationPropertyPathExpression(dynExpression.$NavigationPropertyPath)
|
|
1208
|
-
|
|
1209
|
-
case '$PropertyPath':
|
|
1210
|
-
return new CsdlPropertyPathExpression(dynExpression.$PropertyPath)
|
|
1211
|
-
|
|
1212
|
-
case '$UrlRef':
|
|
1213
|
-
return new CsdlUrlRefExpression(this._interpretAnnotationExpression(dynExpression.$UrlRef))
|
|
1214
|
-
|
|
1215
|
-
default: {
|
|
1216
|
-
// Record expression
|
|
1217
|
-
let propertyValues = new Map()
|
|
1218
|
-
let type = null
|
|
1219
|
-
|
|
1220
|
-
for (const propertyName in dynExpression) {
|
|
1221
|
-
if (propertyName === '$Type') {
|
|
1222
|
-
type = this._getTypeFQN(dynExpression)
|
|
1223
|
-
} else if (!propertyName.includes('@')) {
|
|
1224
|
-
// annotations of the record expression start with '@',
|
|
1225
|
-
// but the annotations of the property values include '@' at a further position.
|
|
1226
|
-
propertyValues.set(
|
|
1227
|
-
propertyName,
|
|
1228
|
-
new CsdlPropertyValueExpression(
|
|
1229
|
-
propertyName,
|
|
1230
|
-
this._interpretAnnotationExpression(dynExpression[propertyName])
|
|
1231
|
-
).setAnnotations(this._extractImplicitAnnotations(dynExpression, propertyName))
|
|
1232
|
-
)
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
return new CsdlRecordExpression(type, [...propertyValues.values()])
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* Extracts annotations of the form:
|
|
1243
|
-
*
|
|
1244
|
-
*{
|
|
1245
|
-
* element: {..},
|
|
1246
|
-
* 'element@term': '..'
|
|
1247
|
-
* }
|
|
1248
|
-
* @param {*} objJson the object that contains the annotations
|
|
1249
|
-
* @param {string} elementName the name of the annotated element
|
|
1250
|
-
* @returns {Array} the annotations
|
|
1251
|
-
* @private
|
|
1252
|
-
*/
|
|
1253
|
-
_extractImplicitAnnotations (objJson, elementName = null) {
|
|
1254
|
-
let annotations = []
|
|
1255
|
-
|
|
1256
|
-
new AnnotationParser({ target: elementName }).parse(objJson, this._createAnnotation.bind(this), annotations)
|
|
1257
|
-
|
|
1258
|
-
return annotations
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
/**
|
|
1262
|
-
* Extracts the inline annotations (that start with an '@') of an element, and returns an array of CsdlAnnotation
|
|
1263
|
-
* instances. It also extracts the inline annotations of the inline annotations. Example:
|
|
1264
|
-
* {
|
|
1265
|
-
$And: [
|
|
1266
|
-
true,
|
|
1267
|
-
false
|
|
1268
|
-
],
|
|
1269
|
-
'@Org.OData.Core.V1.Description': 'annotation1',
|
|
1270
|
-
'@Org.OData.Core.V1.Description@Org.OData.Core.V1.Desc': 'annotation of annotation1'
|
|
1271
|
-
}
|
|
1272
|
-
*
|
|
1273
|
-
* @param {Object} element - The input JSON element
|
|
1274
|
-
* @param {Array} annotations the annotations
|
|
1275
|
-
* @returns {CsdlAnnotation[]} the inline annotations
|
|
1276
|
-
* @private
|
|
1277
|
-
*/
|
|
1278
|
-
_extractInlineAnnotations (element, annotations = []) {
|
|
1279
|
-
return new AnnotationParser().parse(element, this._createAnnotation.bind(this), annotations)
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
/**
|
|
1283
|
-
* Checks whether the JSON object has the given facets, and then sets on the CSDL object accordingly.
|
|
1284
|
-
* @param {Object} obj - CSDL object, e.g. CsdlEntityType
|
|
1285
|
-
* @param {Object} objJson - JSON object
|
|
1286
|
-
* @param {string[]} allowedFacets - Array of the allowed facets as strings, e.g. '$Nullable', '$MaxLength', etc.
|
|
1287
|
-
* @private
|
|
1288
|
-
*/
|
|
1289
|
-
_readFacets (obj, objJson, allowedFacets) {
|
|
1290
|
-
const type = obj.type || obj.underlyingType
|
|
1291
|
-
|
|
1292
|
-
for (const facet of allowedFacets) {
|
|
1293
|
-
// The JSON defaults for Nullable, Precision, and Scale are different from XML,
|
|
1294
|
-
// so we make sure to set them always. This avoids adapting CSDL classes.
|
|
1295
|
-
if (facet === '$Nullable') obj.setNullable(false)
|
|
1296
|
-
if (facet === '$Precision') {
|
|
1297
|
-
// Precision's default is arbitrary precision (differing for temporal values from XML);
|
|
1298
|
-
// so we choose a sufficiently large number (picosecond precision).
|
|
1299
|
-
if (type.name === 'DateTimeOffset' || type.name === 'TimeOfDay' || type.name === 'Duration') {
|
|
1300
|
-
obj.setPrecision(Object.prototype.hasOwnProperty.call(objJson, facet) ? objJson[facet] : 12)
|
|
1301
|
-
} else if (Object.prototype.hasOwnProperty.call(objJson, facet)) {
|
|
1302
|
-
obj.setPrecision(objJson[facet])
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
if (facet === '$Scale' && type.name === 'Decimal') obj.setScale('variable')
|
|
1306
|
-
|
|
1307
|
-
if (Object.prototype.hasOwnProperty.call(objJson, facet)) {
|
|
1308
|
-
const value = objJson[facet]
|
|
1309
|
-
switch (facet) {
|
|
1310
|
-
case '$Nullable':
|
|
1311
|
-
obj.setNullable(value)
|
|
1312
|
-
break
|
|
1313
|
-
case '$MaxLength':
|
|
1314
|
-
obj.setMaxLength(value)
|
|
1315
|
-
break
|
|
1316
|
-
case '$Scale':
|
|
1317
|
-
obj.setScale(value)
|
|
1318
|
-
break
|
|
1319
|
-
case '$SRID':
|
|
1320
|
-
obj.setSrid(value)
|
|
1321
|
-
break
|
|
1322
|
-
case '$DefaultValue':
|
|
1323
|
-
obj.setDefaultValue(value)
|
|
1324
|
-
break
|
|
1325
|
-
case '$Collection':
|
|
1326
|
-
obj.setCollection(value)
|
|
1327
|
-
break
|
|
1328
|
-
default:
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
/**
|
|
1335
|
-
* Reads the $Type property of an element and converts it to a full-qualified name.
|
|
1336
|
-
* @param {Object} element element
|
|
1337
|
-
* @returns {?FullQualifiedName} The full-qualified name of the $Type property or null if $Type is not there
|
|
1338
|
-
* @private
|
|
1339
|
-
*/
|
|
1340
|
-
_getTypeFQN (element) {
|
|
1341
|
-
return element.$Type ? FullQualifiedName.createFromNameSpaceAndName(element.$Type) : null
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* Reads a specific element by its name of a specific kind from the EDM JSON Model
|
|
1346
|
-
* @param {string} name - Element name
|
|
1347
|
-
* @param {string} kind - Element kind, e.g. EntityType
|
|
1348
|
-
* @returns {Object} The JSON object of the found element, or null if not found
|
|
1349
|
-
* @private
|
|
1350
|
-
*/
|
|
1351
|
-
_getElementJson (name, kind) {
|
|
1352
|
-
let elementJson = this._getPropertyValue(this._edmJson, name.namespace, name.name)
|
|
1353
|
-
if (!elementJson || elementJson.$Kind !== kind) {
|
|
1354
|
-
return null
|
|
1355
|
-
}
|
|
1356
|
-
return elementJson
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
CsdlJsonProvider.CSDL_VERSION = {
|
|
1361
|
-
CS01: 'cs01',
|
|
1362
|
-
CS02: 'cs02'
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
module.exports = CsdlJsonProvider
|