@sap/cds 8.9.4 → 9.0.2
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 +113 -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 +12 -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 -6
- 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/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 +1 -4
- package/libx/odata/utils/normalizeTimeData.js +4 -7
- package/libx/odata/utils/readAfterWrite.js +1 -1
- package/libx/{outbox/OutboxRunner.js → queue/TaskRunner.js} +17 -22
- package/libx/queue/index.js +530 -0
- package/libx/rest/RestAdapter.js +43 -82
- package/libx/rest/middleware/create.js +35 -33
- package/libx/rest/middleware/delete.js +9 -7
- package/libx/rest/middleware/error.js +11 -18
- package/libx/rest/middleware/operation.js +44 -137
- package/libx/rest/middleware/parse.js +114 -130
- package/libx/rest/middleware/read.js +23 -21
- package/libx/rest/middleware/update.js +20 -32
- package/libx/rest/middleware/upsert.js +31 -0
- package/libx/rest/pre-processing.js +8 -18
- package/package.json +6 -7
- package/srv/outbox.cds +1 -0
- package/bin/test.js +0 -125
- package/lib/env/plugins.js +0 -18
- package/lib/req/cds-context.js +0 -52
- package/lib/req/locale.js +0 -35
- package/lib/srv/cds.ServiceClient.js +0 -96
- package/lib/srv/cds.ServiceProvider.js +0 -20
- package/lib/srv/protocols/okra.js +0 -22
- package/lib/test/axios.js +0 -63
- package/lib/test/data.js +0 -52
- package/lib/test/expect.js +0 -343
- package/lib/test/reporter.js +0 -176
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +0 -275
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +0 -217
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +0 -101
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/debug.js +0 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/delete.js +0 -60
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +0 -161
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/language.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +0 -602
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +0 -238
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +0 -327
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/applyToCQN.js +0 -243
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/boundToCQN.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/createToCQN.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/deleteToCQN.js +0 -36
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +0 -250
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/index.js +0 -81
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/orderByToCQN.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +0 -389
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/searchToCQN.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/selectToCQN.js +0 -35
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/updateToCQN.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +0 -217
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/FeatureSupport.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/FullQualifiedName.js +0 -94
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAction.js +0 -139
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlActionImport.js +0 -82
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAliasInfo.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAnnotation.js +0 -104
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlAnnotations.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlComplexType.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityContainer.js +0 -142
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityContainerInfo.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntitySet.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEntityType.js +0 -177
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEnumMember.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlEnumType.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlFunction.js +0 -149
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlFunctionImport.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlInclude.js +0 -68
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlIncludeAnnotation.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlJsonProvider.js +0 -1365
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlNavigationProperty.js +0 -190
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlNavigationPropertyBinding.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlOnDelete.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlParameter.js +0 -227
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlProperty.js +0 -250
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlPropertyRef.js +0 -49
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlProvider.js +0 -190
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReference.js +0 -97
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReferentialConstraint.js +0 -60
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlReturnType.js +0 -216
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlSchema.js +0 -328
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlSingleton.js +0 -84
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlTerm.js +0 -320
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/CsdlTypeDefinition.js +0 -193
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlAnnotationExpression.js +0 -73
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlAnnotationPathExpression.js +0 -33
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlApplyExpression.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlArithmeticExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlBinaryExpression.js +0 -110
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlCastExpression.js +0 -188
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlCollectionExpression.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlConstantExpression.js +0 -116
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlIfExpression.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlIsOfExpression.js +0 -200
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlLabeledElementExpression.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlLabeledElementReferenceExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlModelElementPathExpression.js +0 -29
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNavigationPropertyPathExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNegationExpression.js +0 -27
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNotExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlNullExpression.js +0 -18
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPathExpression.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPropertyPathExpression.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlPropertyValueExpression.js +0 -55
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlRecordExpression.js +0 -54
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlUnknownExpression.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/csdl/annotationExpression/CsdlUrlRefExpression.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmBindingTarget.js +0 -163
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmFaceted.js +0 -136
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmOperation.js +0 -205
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmOperationImport.js +0 -126
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/AbstractEdmStructuredType.js +0 -275
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/Edm.js +0 -775
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAction.js +0 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmActionImport.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAnnotation.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmAnnotations.js +0 -57
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmComplexType.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityContainer.js +0 -455
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntitySet.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityType.js +0 -119
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEnumMember.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEnumType.js +0 -117
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmFunction.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmFunctionImport.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmInclude.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmIncludeAnnotation.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmKeyPropertyRef.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmNavigationProperty.js +0 -182
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmNavigationPropertyBinding.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmOnDelete.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmParameter.js +0 -22
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmPrimitiveType.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmPrimitiveTypeKind.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmProperty.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmProvider.js +0 -399
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReference.js +0 -88
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReferentialConstraint.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmReturnType.js +0 -14
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmSchema.js +0 -355
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmSingleton.js +0 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTerm.js +0 -75
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmType.js +0 -95
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTypeDefinition.js +0 -121
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmTypeFactory.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmVocabularyTermType.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/KeyFactory.js +0 -67
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/Target.js +0 -56
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/TransientStructuredType.js +0 -244
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/AnnotationExpressionFactory.js +0 -130
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmAnnotationExpression.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmAnnotationPathExpression.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmApplyExpression.js +0 -85
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmArithmeticExpression.js +0 -92
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmBinaryExpression.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmCastExpression.js +0 -129
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmCollectionExpression.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmConstantExpression.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmIfExpression.js +0 -103
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmIsOfExpression.js +0 -125
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmLabeledElementExpression.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmLabeledElementReferenceExpression.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmModelElementPathExpression.js +0 -35
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNavigationPropertyPathExpression.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNegationExpression.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNotExpression.js +0 -75
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmNullExpression.js +0 -50
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPathExpression.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPropertyPathExpression.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmPropertyValueExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmRecordExpression.js +0 -100
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmUnknownExpression.js +0 -72
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/annotationExpression/EdmUrlRefExpression.js +0 -73
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/AbstractError.js +0 -82
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/IllegalArgumentError.js +0 -58
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/IllegalCallError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/NotImplementedError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriQueryOptionSemanticError.js +0 -49
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriSemanticError.js +0 -48
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/errors/UriSyntaxError.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/ContentTypeInfo.js +0 -105
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/JsonContentTypeInfo.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/JsonFormat.js +0 -141
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/format/RepresentationKind.js +0 -251
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpHeader.js +0 -42
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpHeaderReader.js +0 -318
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpMethod.js +0 -25
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/HttpStatusCode.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/http/Preferences.js +0 -32
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/index.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/logging/LoggerFacade.js +0 -183
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/AliasExpression.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ApplyParser.js +0 -946
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/BinaryExpression.js +0 -124
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpandItem.js +0 -76
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpandParser.js +0 -384
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/Expression.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ExpressionParser.js +0 -1988
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/FilterParser.js +0 -34
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/FunctionParameterParser.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/KeyPredicateParser.js +0 -155
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/KeyValueParser.js +0 -213
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/LiteralExpression.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/MemberExpression.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/MethodExpression.js +0 -146
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/OrderByItem.js +0 -53
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/OrderByParser.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ResourcePathParser.js +0 -848
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SearchParser.js +0 -127
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SelectItem.js +0 -80
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/SelectParser.js +0 -294
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/TypeLiteralExpression.js +0 -28
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UnaryExpression.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriInfo.js +0 -165
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParameter.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParser.js +0 -350
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriResource.js +0 -602
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriTokenizer.js +0 -1156
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/AggregateExpression.js +0 -164
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/AggregateTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/BottomTopTransformation.js +0 -93
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ComputeExpression.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ComputeTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ConcatTransformation.js +0 -38
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/CustomFunctionTransformation.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/ExpandTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/FilterTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/GroupByItem.js +0 -71
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/GroupByTransformation.js +0 -58
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/IdentityTransformation.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/OrderByTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/SearchTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/SkipTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/TopTransformation.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/apply/Transformation.js +0 -53
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/info.md +0 -116
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +0 -667
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueEncoder.js +0 -349
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/ValueConverter.js +0 -545
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ParameterValidator.js +0 -124
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ValueValidator.js +0 -743
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/ServiceFactory.js +0 -234
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchContext.js +0 -351
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchErrorInfo.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchExitHandler.js +0 -239
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchProcessor.js +0 -281
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchValidator.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/batch/BatchedRequestExecutor.js +0 -92
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ComponentManager.js +0 -63
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Context.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Dispatcher.js +0 -147
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataRequest.js +0 -458
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataRequestInBatch.js +0 -147
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataResponse.js +0 -314
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/OdataResponseInBatch.js +0 -83
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/PlainHttpRequest.js +0 -175
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/PlainHttpResponse.js +0 -106
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/RequestContract.js +0 -111
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseContract.js +0 -111
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseHeaderSetter.js +0 -240
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/Service.js +0 -417
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ServiceResolutions.js +0 -24
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ApplicationHttpReader.js +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/BatchJsonDeserializer.js +0 -171
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/BatchRequestListBuilder.js +0 -196
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/Cache.js +0 -154
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ContentDeserializer.js +0 -222
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DataReader.js +0 -220
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DeserializerFactory.js +0 -240
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/HeaderReader.js +0 -133
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/LineReader.js +0 -61
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/MultipartReader.js +0 -419
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/PartReader.js +0 -99
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/Reader.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ResourceJsonDeserializer.js +0 -673
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/ApplicationError.js +0 -108
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/BadRequestError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/ConflictError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/DeserializationError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/InternalServerError.js +0 -20
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/MethodNotAllowedError.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/NotAcceptableError.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/NotFoundError.js +0 -33
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/PreconditionFailedError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/PreconditionRequiredError.js +0 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/SerializationError.js +0 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/errors/UnauthorizedError.js +0 -17
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/AcceptTypeInfo.js +0 -86
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/CharsetInfo.js +0 -76
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/FormatDescription.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/FormatManager.js +0 -91
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/RequestContentNegotiator.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/ResponseContentNegotiator.js +0 -321
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/BatchHandler.js +0 -36
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/MetadataHandler.js +0 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/handler/ServiceHandler.js +0 -25
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/CustomPreference.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HeaderInfo.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeader.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpHeaderReader.js +0 -452
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/HttpStatusCode.js +0 -117
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/Preferences.js +0 -222
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/http/PreferencesApplied.js +0 -199
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/index.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/Command.js +0 -31
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandExecutor.js +0 -94
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/CommandFactory.js +0 -203
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestControlCommand.js +0 -52
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestPreValidationCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ContentNegotiatorCommand.js +0 -70
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugContentNegotiatorCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugDeserializingCommand.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugSerializingCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DeserializingCommand.js +0 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DispatcherCommand.js +0 -95
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ErrorContentNegotiatorCommand.js +0 -44
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ErrorSerializingCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/EventListenerCommand.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/LocaleNegotiatorCommand.js +0 -56
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/OdataVersionValidationCommand.js +0 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/OperationValidationCommand.js +0 -34
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ParsePreferHeaderCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/PresetResponseHeadersCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/QueryOptionsParserCommand.js +0 -43
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/QueryOptionsValidationCommand.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/RequestContentValidationCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SendResponseCommand.js +0 -37
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SerializingCommand.js +0 -159
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetResponseHeadersCommand.js +0 -90
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetStatuscodeCommand.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/UriParserCommand.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/logging/DebugLogger.js +0 -97
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ApplicationHttpWriter.js +0 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/BatchJsonSerializer.js +0 -46
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/BatchMultipartSerializer.js +0 -113
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +0 -405
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/DebugHtmlSerializer.js +0 -302
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/DebugJsonSerializer.js +0 -515
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +0 -47
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorSerializer.js +0 -39
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorXmlSerializer.js +0 -98
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ExpressionTreeImage.js +0 -404
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/MetadataXmlSerializer.js +0 -1416
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/MultipartWriter.js +0 -202
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/NextLinkSerializer.js +0 -330
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ResourceJsonSerializer.js +0 -1220
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/SerializerFactory.js +0 -484
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ServiceJsonSerializer.js +0 -89
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +0 -612
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/debugview.html +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/BufferedWriter.js +0 -59
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/ExpandHelper.js +0 -96
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/MetadataCache.js +0 -136
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/PerformanceMonitor.js +0 -221
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/UriHelper.js +0 -157
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/ConditionalRequestValidator.js +0 -79
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/OperationValidator.js +0 -199
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/RequestValidator.js +0 -392
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/VersionValidator.js +0 -62
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +0 -51
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +0 -331
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +0 -159
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +0 -404
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/oDataConfiguration.js +0 -55
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/omitValues.js +0 -86
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +0 -107
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +0 -64
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +0 -385
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +0 -12
- package/libx/_runtime/cds-services/util/errors.js +0 -15
- package/libx/_runtime/common/aspects/relation.js +0 -40
- package/libx/_runtime/common/composition/data.js +0 -370
- package/libx/_runtime/common/composition/delete.js +0 -313
- package/libx/_runtime/common/composition/index.js +0 -22
- package/libx/_runtime/common/composition/insert.js +0 -108
- package/libx/_runtime/common/composition/tree.js +0 -275
- package/libx/_runtime/common/composition/update.js +0 -354
- package/libx/_runtime/common/composition/utils.js +0 -95
- package/libx/_runtime/common/error/constants.js +0 -20
- package/libx/_runtime/common/error/entry.js +0 -36
- package/libx/_runtime/common/error/frontend.js +0 -199
- package/libx/_runtime/common/error/index.js +0 -12
- package/libx/_runtime/common/error/log.js +0 -35
- package/libx/_runtime/common/error/standardError.js +0 -11
- package/libx/_runtime/common/error/utils.js +0 -18
- package/libx/_runtime/common/generic/auth/constants.js +0 -17
- package/libx/_runtime/common/generic/put.js +0 -85
- package/libx/_runtime/common/utils/columns.js +0 -177
- package/libx/_runtime/common/utils/compareJsonOLD.js +0 -280
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +0 -1039
- package/libx/_runtime/common/utils/data.js +0 -16
- package/libx/_runtime/common/utils/dollar.js +0 -27
- package/libx/_runtime/common/utils/generateOnCond.js +0 -127
- package/libx/_runtime/common/utils/onlyKeysRemain.js +0 -10
- package/libx/_runtime/common/utils/path.js +0 -20
- package/libx/_runtime/common/utils/quotingStyles.js +0 -29
- package/libx/_runtime/common/utils/restrictions.js +0 -67
- package/libx/_runtime/common/utils/search2cqn4sql.js +0 -37
- package/libx/_runtime/common/utils/searchToLike.js +0 -56
- package/libx/_runtime/common/utils/stream.js +0 -103
- package/libx/_runtime/common/utils/ucsn.js +0 -119
- package/libx/_runtime/common/utils/union.js +0 -31
- package/libx/_runtime/common/utils/unionCqnTemplate.js +0 -174
- package/libx/_runtime/db/Service.js +0 -93
- package/libx/_runtime/db/data-conversion/post-processing.js +0 -175
- package/libx/_runtime/db/expand/expand-v2.js +0 -147
- package/libx/_runtime/db/expand/expandCQNToJoin.js +0 -1775
- package/libx/_runtime/db/expand/index.js +0 -13
- package/libx/_runtime/db/expand/rawToExpanded.js +0 -250
- package/libx/_runtime/db/generic/create.js +0 -30
- package/libx/_runtime/db/generic/delete.js +0 -18
- package/libx/_runtime/db/generic/index.js +0 -25
- package/libx/_runtime/db/generic/input.js +0 -227
- package/libx/_runtime/db/generic/read.js +0 -16
- package/libx/_runtime/db/generic/rewrite.js +0 -68
- package/libx/_runtime/db/generic/structured.js +0 -92
- package/libx/_runtime/db/generic/update.js +0 -97
- package/libx/_runtime/db/generic/virtual.js +0 -83
- package/libx/_runtime/db/query/delete.js +0 -39
- package/libx/_runtime/db/query/index.js +0 -13
- package/libx/_runtime/db/query/insert.js +0 -21
- package/libx/_runtime/db/query/read.js +0 -97
- package/libx/_runtime/db/query/run.js +0 -30
- package/libx/_runtime/db/query/update.js +0 -94
- package/libx/_runtime/db/result/InsertResult.js +0 -87
- package/libx/_runtime/db/sql-builder/BaseBuilder.js +0 -65
- package/libx/_runtime/db/sql-builder/CreateBuilder.js +0 -212
- package/libx/_runtime/db/sql-builder/DeleteBuilder.js +0 -87
- package/libx/_runtime/db/sql-builder/DropBuilder.js +0 -63
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +0 -345
- package/libx/_runtime/db/sql-builder/FunctionBuilder.js +0 -232
- package/libx/_runtime/db/sql-builder/InsertBuilder.js +0 -494
- package/libx/_runtime/db/sql-builder/ReferenceBuilder.js +0 -135
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +0 -482
- package/libx/_runtime/db/sql-builder/UpdateBuilder.js +0 -207
- package/libx/_runtime/db/sql-builder/UpsertBuilder.js +0 -25
- package/libx/_runtime/db/sql-builder/annotations.js +0 -50
- package/libx/_runtime/db/sql-builder/arrayed.js +0 -4
- package/libx/_runtime/db/sql-builder/dataTypes.js +0 -59
- package/libx/_runtime/db/sql-builder/dollar.js +0 -37
- package/libx/_runtime/db/sql-builder/index.js +0 -28
- package/libx/_runtime/db/sql-builder/sqlFactory.js +0 -104
- package/libx/_runtime/db/utils/coloredTxCommands.js +0 -7
- package/libx/_runtime/db/utils/columns.js +0 -41
- package/libx/_runtime/db/utils/deep.js +0 -71
- package/libx/_runtime/db/utils/generateAliases.js +0 -160
- package/libx/_runtime/db/utils/localized.js +0 -77
- package/libx/_runtime/db/utils/normalizeTimeData.js +0 -98
- package/libx/_runtime/db/utils/stream.js +0 -41
- package/libx/_runtime/hana/Service.js +0 -173
- package/libx/_runtime/hana/conversion.js +0 -73
- package/libx/_runtime/hana/customBuilder/CustomCreateBuilder.js +0 -11
- package/libx/_runtime/hana/customBuilder/CustomDeleteBuilder.js +0 -17
- package/libx/_runtime/hana/customBuilder/CustomDropBuilder.js +0 -12
- package/libx/_runtime/hana/customBuilder/CustomExpressionBuilder.js +0 -23
- package/libx/_runtime/hana/customBuilder/CustomFunctionBuilder.js +0 -34
- package/libx/_runtime/hana/customBuilder/CustomReferenceBuilder.js +0 -38
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +0 -90
- package/libx/_runtime/hana/customBuilder/index.js +0 -11
- package/libx/_runtime/hana/driver.js +0 -205
- package/libx/_runtime/hana/dynatrace.js +0 -130
- package/libx/_runtime/hana/execute.js +0 -429
- package/libx/_runtime/hana/localized.js +0 -39
- package/libx/_runtime/hana/pool.js +0 -186
- package/libx/_runtime/hana/search.js +0 -20
- package/libx/_runtime/hana/search2Contains.js +0 -106
- package/libx/_runtime/hana/search2cqn4sql.js +0 -98
- package/libx/_runtime/hana/streaming.js +0 -248
- package/libx/_runtime/messaging/Outbox.js +0 -15
- package/libx/_runtime/sqlite/Service.js +0 -153
- package/libx/_runtime/sqlite/conversion.js +0 -47
- package/libx/_runtime/sqlite/convertAssocToOneManaged.js +0 -60
- package/libx/_runtime/sqlite/convertDraftAdminPathExpression.js +0 -74
- package/libx/_runtime/sqlite/customBuilder/CustomExpressionBuilder.js +0 -24
- package/libx/_runtime/sqlite/customBuilder/CustomFunctionBuilder.js +0 -102
- package/libx/_runtime/sqlite/customBuilder/CustomSelectBuilder.js +0 -16
- package/libx/_runtime/sqlite/customBuilder/CustomUpsertBuilder.js +0 -47
- package/libx/_runtime/sqlite/customBuilder/index.js +0 -49
- package/libx/_runtime/sqlite/execute.js +0 -345
- package/libx/_runtime/sqlite/localized.js +0 -49
- package/libx/outbox/index.js +0 -307
|
@@ -1,1416 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { xmlbuilder } = require('@sap/cds-foss')
|
|
4
|
-
const commons = require('../../odata-commons')
|
|
5
|
-
const EdmTypeKind = commons.edm.EdmType.TypeKind
|
|
6
|
-
const EdmPrimitiveTypeKind = commons.edm.EdmPrimitiveTypeKind
|
|
7
|
-
const validateThat = commons.validator.ParameterValidator.validateThat
|
|
8
|
-
const PrimitiveValueEncoder = commons.utils.PrimitiveValueEncoder
|
|
9
|
-
const ExpressionKinds = commons.csdl.annotationExpression.CsdlAnnotationExpression.kinds
|
|
10
|
-
const NotImplementedError = commons.errors.NotImplementedError
|
|
11
|
-
const SerializationError = require('../errors/SerializationError')
|
|
12
|
-
|
|
13
|
-
const EXTENDS = 'Extends'
|
|
14
|
-
const TARGET = 'Target'
|
|
15
|
-
const PATH = 'Path'
|
|
16
|
-
const NAVIGATION_PROPERTY_BINDING = 'NavigationPropertyBinding'
|
|
17
|
-
const UNDERLYING_TYPE = 'UnderlyingType'
|
|
18
|
-
const PROPERTY_REF = 'PropertyRef'
|
|
19
|
-
const KEY = 'Key'
|
|
20
|
-
const SCALE = 'Scale'
|
|
21
|
-
const SRID = 'SRID'
|
|
22
|
-
const PRECISION = 'Precision'
|
|
23
|
-
const MAX_LENGTH = 'MaxLength'
|
|
24
|
-
const DEFAULT_VALUE = 'DefaultValue'
|
|
25
|
-
const UNICODE = 'Unicode'
|
|
26
|
-
const PROPERTY = 'Property'
|
|
27
|
-
const PARTNER = 'Partner'
|
|
28
|
-
const NULLABLE = 'Nullable'
|
|
29
|
-
const NAVIGATION_PROPERTY = 'NavigationProperty'
|
|
30
|
-
const ONDELETE = 'OnDelete'
|
|
31
|
-
const REFERENTIAL_CONSTRAINT = 'ReferentialConstraint'
|
|
32
|
-
const REFERENCED_PROPERTY = 'ReferencedProperty'
|
|
33
|
-
const HAS_STREAM = 'HasStream'
|
|
34
|
-
const BASE_TYPE = 'BaseType'
|
|
35
|
-
const COMPLEX_TYPE = 'ComplexType'
|
|
36
|
-
const RETURN_TYPE = 'ReturnType'
|
|
37
|
-
const TYPE = 'Type'
|
|
38
|
-
const COLLECTION = 'Collection'
|
|
39
|
-
const PARAMETER = 'Parameter'
|
|
40
|
-
const IS_COMPOSABLE = 'IsComposable'
|
|
41
|
-
const IS_BOUND = 'IsBound'
|
|
42
|
-
const ENTITY_TYPE = 'EntityType'
|
|
43
|
-
const SINGLETON = 'Singleton'
|
|
44
|
-
const ACTION = 'Action'
|
|
45
|
-
const ACTION_IMPORT = 'ActionImport'
|
|
46
|
-
const INCLUDE_IN_SERVICE_DOCUMENT = 'IncludeInServiceDocument'
|
|
47
|
-
const ENTITY_SET = 'EntitySet'
|
|
48
|
-
const FUNCTION = 'Function'
|
|
49
|
-
const FUNCTION_IMPORT = 'FunctionImport'
|
|
50
|
-
const NAME = 'Name'
|
|
51
|
-
const ENTITY_CONTAINER = 'EntityContainer'
|
|
52
|
-
const ALIAS = 'Alias'
|
|
53
|
-
const NAMESPACE = 'Namespace'
|
|
54
|
-
const ENUM_TYPE = 'EnumType'
|
|
55
|
-
const IS_FLAGS = 'IsFlags'
|
|
56
|
-
const MEMBER = 'Member'
|
|
57
|
-
const VALUE = 'Value'
|
|
58
|
-
const TYPE_DEFINITION = 'TypeDefinition'
|
|
59
|
-
const REFERENCE = 'Reference'
|
|
60
|
-
const INCLUDE = 'Include'
|
|
61
|
-
const INCLUDE_ANNOTATIONS = 'IncludeAnnotations'
|
|
62
|
-
const TERM_NAMESPACE = 'TermNamespace'
|
|
63
|
-
const TARGET_NAMESPACE = 'TargetNamespace'
|
|
64
|
-
const QUALIFIER = 'Qualifier'
|
|
65
|
-
const URI = 'Uri'
|
|
66
|
-
const SCHEMA = 'Schema'
|
|
67
|
-
const DATA_SERVICES = 'DataServices'
|
|
68
|
-
const ABSTRACT = 'Abstract'
|
|
69
|
-
const PREFIX_EDMX = 'edmx'
|
|
70
|
-
|
|
71
|
-
const EDMX = 'Edmx'
|
|
72
|
-
const NS_EDMX = 'http://docs.oasis-open.org/odata/ns/edmx'
|
|
73
|
-
|
|
74
|
-
const NS_EDM = 'http://docs.oasis-open.org/odata/ns/edm'
|
|
75
|
-
const ENTITY_SET_PATH = 'EntitySetPath'
|
|
76
|
-
const CONTAINS_TARGET = 'ContainsTarget'
|
|
77
|
-
|
|
78
|
-
const TERM = 'Term'
|
|
79
|
-
const BASE_TERM = 'BaseTerm'
|
|
80
|
-
const APPLIES_TO = 'AppliesTo'
|
|
81
|
-
const ANNOTATION = 'Annotation'
|
|
82
|
-
const ANNOTATIONS = 'Annotations'
|
|
83
|
-
const ANNOTATION_PATH = 'AnnotationPath'
|
|
84
|
-
const APPLY = 'Apply'
|
|
85
|
-
const CAST = 'Cast'
|
|
86
|
-
const IF = 'If'
|
|
87
|
-
const IS_OF = 'IsOf'
|
|
88
|
-
const LABELED_ELEMENT = 'LabeledElement'
|
|
89
|
-
const LABELED_ELEMENT_REFERENCE = 'LabeledElementReference'
|
|
90
|
-
const MODEL_ELEMENT_PATH = 'ModelElementPath'
|
|
91
|
-
const NULL = 'Null'
|
|
92
|
-
const NAVIGATION_PROPERTY_PATH = 'NavigationPropertyPath'
|
|
93
|
-
const PROPERTY_PATH = 'PropertyPath'
|
|
94
|
-
const NEG = 'Neg'
|
|
95
|
-
const NOT = 'Not'
|
|
96
|
-
const RECORD = 'Record'
|
|
97
|
-
const PROPERTY_VALUE = 'PropertyValue'
|
|
98
|
-
const URL_REF = 'UrlRef'
|
|
99
|
-
|
|
100
|
-
const ANNOTATION_TYPES = {
|
|
101
|
-
'edm:Binary': EdmPrimitiveTypeKind.Binary,
|
|
102
|
-
'edm:Bool': EdmPrimitiveTypeKind.Boolean,
|
|
103
|
-
'edm:Date': EdmPrimitiveTypeKind.Date,
|
|
104
|
-
'edm:DateTimeOffset': EdmPrimitiveTypeKind.DateTimeOffset,
|
|
105
|
-
'edm:Decimal': EdmPrimitiveTypeKind.Decimal,
|
|
106
|
-
'edm:Duration': EdmPrimitiveTypeKind.Duration,
|
|
107
|
-
'edm:Float': EdmPrimitiveTypeKind.Double,
|
|
108
|
-
'edm:Guid': EdmPrimitiveTypeKind.Guid,
|
|
109
|
-
'edm:Int': EdmPrimitiveTypeKind.Int64,
|
|
110
|
-
'edm:String': EdmPrimitiveTypeKind.String,
|
|
111
|
-
'edm:TimeOfDay': EdmPrimitiveTypeKind.TimeOfDay
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const EXPRESSION_SERIALIZERS = {
|
|
115
|
-
[ExpressionKinds.Collection]: '_serializeCollectionExpr',
|
|
116
|
-
[ExpressionKinds.Path]: '_serializePathExpr',
|
|
117
|
-
[ExpressionKinds.Arithmetic]: '_serializeArithmeticExpr',
|
|
118
|
-
[ExpressionKinds.Binary]: '_serializeBinaryExpr',
|
|
119
|
-
[ExpressionKinds.Negation]: '_serializeNegationExpr',
|
|
120
|
-
[ExpressionKinds.Not]: '_serializeNotExpr',
|
|
121
|
-
[ExpressionKinds.PropertyPath]: '_serializePropertyPathExpr',
|
|
122
|
-
[ExpressionKinds.Constant]: '_serializeConstantExpr',
|
|
123
|
-
[ExpressionKinds.AnnotationPath]: '_serializeAnnotationPathExpr',
|
|
124
|
-
[ExpressionKinds.LabeledElement]: '_serializeLabeledElementExpr',
|
|
125
|
-
[ExpressionKinds.LabeledElementReference]: '_serializeLabeledElementReferenceExpr',
|
|
126
|
-
[ExpressionKinds.ModelElementPath]: '_serializeModelElementPathExpr',
|
|
127
|
-
[ExpressionKinds.NavigationPropertyPath]: '_serializeNavigationPropertyPathExpr',
|
|
128
|
-
[ExpressionKinds.Null]: '_serializeNullExpr',
|
|
129
|
-
[ExpressionKinds.Apply]: '_serializeApplyExpr',
|
|
130
|
-
[ExpressionKinds.If]: '_serializeIfExpr',
|
|
131
|
-
[ExpressionKinds.Record]: '_serializeRecordExpr',
|
|
132
|
-
[ExpressionKinds.PropertyValue]: '_serializePropertyValueExpr',
|
|
133
|
-
[ExpressionKinds.UrlRef]: '_serializeUrlRefExpr',
|
|
134
|
-
[ExpressionKinds.Cast]: '_serializeCastExpr',
|
|
135
|
-
[ExpressionKinds.IsOf]: '_serializeIsOfExpr'
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* XML serializer for EDM metadata.
|
|
140
|
-
*/
|
|
141
|
-
class MetadataXmlSerializer {
|
|
142
|
-
/**
|
|
143
|
-
* @param {Edm} edm - Edm instance, representing metadata of the service
|
|
144
|
-
* @param {LoggerFacede} logger - Logger instance
|
|
145
|
-
*/
|
|
146
|
-
constructor (edm, logger) {
|
|
147
|
-
validateThat('edm', edm)
|
|
148
|
-
.truthy()
|
|
149
|
-
.instanceOf(Object)
|
|
150
|
-
|
|
151
|
-
this._logger = logger
|
|
152
|
-
this._edm = edm
|
|
153
|
-
this._namespaceToAlias = new Map()
|
|
154
|
-
|
|
155
|
-
this._encoder = new PrimitiveValueEncoder()
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Serializes EDM metadata into XML string.
|
|
160
|
-
* @returns {string} metadata XML
|
|
161
|
-
*/
|
|
162
|
-
serialize () {
|
|
163
|
-
let xmlStreamClosed = false
|
|
164
|
-
let edmxElement
|
|
165
|
-
try {
|
|
166
|
-
edmxElement = this._createEdmxElement()
|
|
167
|
-
this._xml = edmxElement
|
|
168
|
-
|
|
169
|
-
this._serializeReferences(edmxElement)
|
|
170
|
-
this._serializeDataServices(edmxElement)
|
|
171
|
-
|
|
172
|
-
// end the document, i.e. close any unclosed xml tags
|
|
173
|
-
const result = edmxElement.end()
|
|
174
|
-
xmlStreamClosed = true
|
|
175
|
-
return result
|
|
176
|
-
} catch (e) {
|
|
177
|
-
// Close underlying stream -> Prevent memory leaks
|
|
178
|
-
if (edmxElement && !xmlStreamClosed) {
|
|
179
|
-
if (this._logger) {
|
|
180
|
-
this._logger.debug('The following XML could be created (until error):', edmxElement.toString())
|
|
181
|
-
}
|
|
182
|
-
edmxElement.end()
|
|
183
|
-
}
|
|
184
|
-
throw new SerializationError('An error occurred during serialization of metadata document', e)
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Creates Edmx element.
|
|
190
|
-
* @returns {Object} object representation of the created XML element
|
|
191
|
-
* @private
|
|
192
|
-
*/
|
|
193
|
-
_createEdmxElement () {
|
|
194
|
-
return xmlbuilder
|
|
195
|
-
.create(PREFIX_EDMX + ':' + EDMX, { version: '1.0', encoding: 'UTF-8' })
|
|
196
|
-
.attribute('xmlns', NS_EDM)
|
|
197
|
-
.attribute('xmlns:' + PREFIX_EDMX, NS_EDMX)
|
|
198
|
-
.attribute('Version', '4.0')
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Adds DataServices element.
|
|
203
|
-
* @param {*} edmx the Edmx element the DataServices element is added to
|
|
204
|
-
* @private
|
|
205
|
-
*/
|
|
206
|
-
_serializeDataServices (edmx) {
|
|
207
|
-
const dataServicesElement = edmx.element(PREFIX_EDMX + ':' + DATA_SERVICES)
|
|
208
|
-
|
|
209
|
-
// First find referenced external services and their namespaces.
|
|
210
|
-
let referencedServices = new Map()
|
|
211
|
-
for (const reference of this._edm.getReferences().values()) {
|
|
212
|
-
for (const include of reference.getIncludes()) referencedServices.set(include.getNamespace(), include)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
for (const schema of this._edm.getSchemas()) {
|
|
216
|
-
// Only adding those schemas which are not referenced.
|
|
217
|
-
// Currently cross service referencing is done by reference the external service
|
|
218
|
-
// inside the $Reference csdl property AND creating a corresponding second schema
|
|
219
|
-
// namespace in the csdl model. The metadata xml should not serialize this
|
|
220
|
-
// external model so it is filtered out.
|
|
221
|
-
if (!referencedServices.get(schema.getNamespace())) {
|
|
222
|
-
this._serializeSchema(dataServicesElement, schema)
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Serializes Schema.
|
|
229
|
-
* @param {*} dataServicesElement XML element to add to
|
|
230
|
-
* @param {*} schema the schema
|
|
231
|
-
* @private
|
|
232
|
-
*/
|
|
233
|
-
_serializeSchema (dataServicesElement, schema) {
|
|
234
|
-
try {
|
|
235
|
-
const schemaElement = dataServicesElement.element(SCHEMA).attribute(NAMESPACE, schema.getNamespace())
|
|
236
|
-
|
|
237
|
-
if (schema.getAlias()) {
|
|
238
|
-
schemaElement.attribute(ALIAS, schema.getAlias())
|
|
239
|
-
this._namespaceToAlias.set(schema.getNamespace(), schema.getAlias())
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// EnumTypes
|
|
243
|
-
this._serializeEnumTypes(schemaElement, schema.getEnumTypes())
|
|
244
|
-
|
|
245
|
-
// TypeDefinitions
|
|
246
|
-
this._serializeTypeDefinitions(schemaElement, schema.getTypeDefinitions())
|
|
247
|
-
|
|
248
|
-
// EntityTypes
|
|
249
|
-
this._serializeEntityTypes(schemaElement, schema.getEntityTypes())
|
|
250
|
-
|
|
251
|
-
// ComplexTypes
|
|
252
|
-
this._serializeComplexTypes(schemaElement, schema.getComplexTypes())
|
|
253
|
-
|
|
254
|
-
// Actions
|
|
255
|
-
this._serializeActions(schemaElement, schema.getActions())
|
|
256
|
-
|
|
257
|
-
// Functions
|
|
258
|
-
this._serializeFunctions(schemaElement, schema.getFunctions())
|
|
259
|
-
|
|
260
|
-
// Terms
|
|
261
|
-
this._serializeTerms(schemaElement, schema.getTerms())
|
|
262
|
-
|
|
263
|
-
// EntityContainer
|
|
264
|
-
this._serializeEntityContainer(schemaElement, schema.getEntityContainer())
|
|
265
|
-
|
|
266
|
-
// Annotations
|
|
267
|
-
this._serializeExternalAnnotations(schemaElement, schema.getExternalAnnotations())
|
|
268
|
-
this._serializeAnnotations(schemaElement, schema)
|
|
269
|
-
} catch (e) {
|
|
270
|
-
throw new SerializationError('An error occurred during serialization of Schema', e)
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Serializes enumeration types.
|
|
276
|
-
* @param {*} schemaElement XML element to add to
|
|
277
|
-
* @param {*} enumTypes the enumeration types
|
|
278
|
-
* @private
|
|
279
|
-
*/
|
|
280
|
-
_serializeEnumTypes (schemaElement, enumTypes) {
|
|
281
|
-
try {
|
|
282
|
-
for (const enumType of enumTypes) {
|
|
283
|
-
let element = schemaElement
|
|
284
|
-
.element(ENUM_TYPE)
|
|
285
|
-
.attribute(NAME, enumType.getName())
|
|
286
|
-
.attribute(UNDERLYING_TYPE, this._getAliasedFQN(enumType.getUnderlyingType().getFullQualifiedName()))
|
|
287
|
-
|
|
288
|
-
if (enumType.isFlags()) element.attribute(IS_FLAGS, enumType.isFlags())
|
|
289
|
-
|
|
290
|
-
for (const [name, member] of enumType.getMembers()) {
|
|
291
|
-
const memberElement = element
|
|
292
|
-
.element(MEMBER)
|
|
293
|
-
.attribute(NAME, name)
|
|
294
|
-
.attribute(VALUE, member.getValue())
|
|
295
|
-
|
|
296
|
-
this._serializeAnnotations(memberElement, member)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
this._serializeAnnotations(element, enumType)
|
|
300
|
-
}
|
|
301
|
-
} catch (e) {
|
|
302
|
-
throw new SerializationError('An error occurred during serialization of Enumeration Type', e)
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Serializes TypeDefinitions.
|
|
308
|
-
* @param {*} schemaElement XML element to add to
|
|
309
|
-
* @param {*} typeDefinitions the type definitions
|
|
310
|
-
* @private
|
|
311
|
-
*/
|
|
312
|
-
_serializeTypeDefinitions (schemaElement, typeDefinitions) {
|
|
313
|
-
try {
|
|
314
|
-
for (const typeDef of typeDefinitions) {
|
|
315
|
-
const typeDefElement = schemaElement
|
|
316
|
-
.element(TYPE_DEFINITION)
|
|
317
|
-
.attribute(NAME, typeDef.getName())
|
|
318
|
-
.attribute(UNDERLYING_TYPE, this._getAliasedFQN(typeDef.getUnderlyingType().getFullQualifiedName()))
|
|
319
|
-
|
|
320
|
-
this._serializeFacets(typeDefElement, typeDef)
|
|
321
|
-
|
|
322
|
-
this._serializeAnnotations(typeDefElement, typeDef)
|
|
323
|
-
}
|
|
324
|
-
} catch (e) {
|
|
325
|
-
throw new SerializationError('An error occurred during serialization of Type Definition', e)
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Serializes EntityContainer.
|
|
331
|
-
* @param {*} schemaElement XML element to add to
|
|
332
|
-
* @param {*} container the entity container
|
|
333
|
-
* @private
|
|
334
|
-
*/
|
|
335
|
-
_serializeEntityContainer (schemaElement, container) {
|
|
336
|
-
if (!container) return
|
|
337
|
-
|
|
338
|
-
try {
|
|
339
|
-
const containerElement = schemaElement.element(ENTITY_CONTAINER).attribute(NAME, container.getName())
|
|
340
|
-
|
|
341
|
-
const parentContainerNameFqn = container.getParentContainerName()
|
|
342
|
-
if (parentContainerNameFqn) {
|
|
343
|
-
const parentContainerName = this._getAliasedFQN(parentContainerNameFqn)
|
|
344
|
-
containerElement.attribute(EXTENDS, parentContainerName)
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// EntitySets
|
|
348
|
-
this._serializeEntitySets(containerElement, container.getEntitySets())
|
|
349
|
-
|
|
350
|
-
// ActionImports
|
|
351
|
-
this._serializeActionImports(containerElement, container.getActionImports())
|
|
352
|
-
|
|
353
|
-
// FunctionImports
|
|
354
|
-
this._serializeFunctionImports(containerElement, container.getFunctionImports())
|
|
355
|
-
|
|
356
|
-
// Singletons
|
|
357
|
-
this._serializeSingletons(containerElement, container.getSingletons())
|
|
358
|
-
|
|
359
|
-
this._serializeAnnotations(containerElement, container)
|
|
360
|
-
} catch (e) {
|
|
361
|
-
throw new SerializationError('An error occurred during serialization of Entity Container', e)
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Serializes FunctionImports.
|
|
367
|
-
* @param {*} containerElement XML element to add to
|
|
368
|
-
* @param {*} functionImports the function imports
|
|
369
|
-
* @private
|
|
370
|
-
*/
|
|
371
|
-
_serializeFunctionImports (containerElement, functionImports) {
|
|
372
|
-
try {
|
|
373
|
-
for (const functionImport of functionImports) {
|
|
374
|
-
const functionImportElement = containerElement
|
|
375
|
-
.element(FUNCTION_IMPORT)
|
|
376
|
-
.attribute(NAME, functionImport.getName())
|
|
377
|
-
|
|
378
|
-
const functionName = this._getAliasedFQN(functionImport.getFunctionFqn())
|
|
379
|
-
functionImportElement.attribute(FUNCTION, functionName)
|
|
380
|
-
|
|
381
|
-
const returnedEntitySet = functionImport.getReturnedEntitySet()
|
|
382
|
-
if (returnedEntitySet) {
|
|
383
|
-
functionImportElement.attribute(
|
|
384
|
-
ENTITY_SET,
|
|
385
|
-
this._getAliasedFQN(returnedEntitySet.getEntityContainer().getFullQualifiedName()) +
|
|
386
|
-
'/' +
|
|
387
|
-
returnedEntitySet.getName()
|
|
388
|
-
)
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// Default is false and we do not write the default
|
|
392
|
-
if (functionImport.isIncludeInServiceDocument()) {
|
|
393
|
-
functionImportElement.attribute(INCLUDE_IN_SERVICE_DOCUMENT, functionImport.isIncludeInServiceDocument())
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
this._serializeAnnotations(functionImportElement, functionImport)
|
|
397
|
-
}
|
|
398
|
-
} catch (e) {
|
|
399
|
-
throw new SerializationError('An error occurred during serialization of Function Import', e)
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Serializes ActionImports.
|
|
405
|
-
* @param {*} containerElement XML element to add to
|
|
406
|
-
* @param {*} actionImports the action imports
|
|
407
|
-
* @private
|
|
408
|
-
*/
|
|
409
|
-
_serializeActionImports (containerElement, actionImports) {
|
|
410
|
-
try {
|
|
411
|
-
for (const actionImport of actionImports) {
|
|
412
|
-
const actionImportElement = containerElement
|
|
413
|
-
.element(ACTION_IMPORT)
|
|
414
|
-
.attribute(NAME, actionImport.getName())
|
|
415
|
-
.attribute(ACTION, this._getAliasedFQN(actionImport.getUnboundAction().getFullQualifiedName()))
|
|
416
|
-
|
|
417
|
-
let returnedEntitySet = actionImport.getReturnedEntitySet()
|
|
418
|
-
if (returnedEntitySet) {
|
|
419
|
-
actionImportElement.attribute(
|
|
420
|
-
ENTITY_SET,
|
|
421
|
-
this._getAliasedFQN(returnedEntitySet.getEntityContainer().getFullQualifiedName()) +
|
|
422
|
-
'/' +
|
|
423
|
-
returnedEntitySet.getName()
|
|
424
|
-
)
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
this._serializeAnnotations(actionImportElement, actionImport)
|
|
428
|
-
}
|
|
429
|
-
} catch (e) {
|
|
430
|
-
throw new SerializationError('An error occurred during serialization of Action Import', e)
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Serializes Singletons.
|
|
436
|
-
* @param {*} containerElement XML element to add to
|
|
437
|
-
* @param {*} singletons the singletons
|
|
438
|
-
* @private
|
|
439
|
-
*/
|
|
440
|
-
_serializeSingletons (containerElement, singletons) {
|
|
441
|
-
let last
|
|
442
|
-
try {
|
|
443
|
-
for (const singleton of singletons) {
|
|
444
|
-
last = singleton
|
|
445
|
-
const singletonElement = containerElement
|
|
446
|
-
.element(SINGLETON)
|
|
447
|
-
.attribute(NAME, singleton.getName())
|
|
448
|
-
.attribute(TYPE, this._getAliasedFQN(singleton.getEntityType().getFullQualifiedName()))
|
|
449
|
-
|
|
450
|
-
this._serializeNavigationPropertyBindings(singletonElement, singleton)
|
|
451
|
-
|
|
452
|
-
this._serializeAnnotations(singletonElement, singleton)
|
|
453
|
-
}
|
|
454
|
-
} catch (e) {
|
|
455
|
-
throw new SerializationError(`An error occurred during serialization of Singleton '${last.getName()}'`, e)
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Serializes NavigationPropertyBindings.
|
|
461
|
-
* @param {*} entitySetElement XML element to add to
|
|
462
|
-
* @param {*} bindingTarget the bindings
|
|
463
|
-
* @private
|
|
464
|
-
*/
|
|
465
|
-
_serializeNavigationPropertyBindings (entitySetElement, bindingTarget) {
|
|
466
|
-
if (!bindingTarget.getNavigationPropertyBindings()) return
|
|
467
|
-
|
|
468
|
-
try {
|
|
469
|
-
for (const binding of bindingTarget.getNavigationPropertyBindings()) {
|
|
470
|
-
entitySetElement
|
|
471
|
-
.element(NAVIGATION_PROPERTY_BINDING)
|
|
472
|
-
.attribute(PATH, binding.getPath())
|
|
473
|
-
.attribute(TARGET, binding.getTarget())
|
|
474
|
-
}
|
|
475
|
-
} catch (e) {
|
|
476
|
-
throw new SerializationError('An error occurred during serialization of Navigation Property Binding', e)
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Serializes EntitySets.
|
|
482
|
-
* @param {*} containerElement XML element to add to
|
|
483
|
-
* @param {*} entitySets the entity sets
|
|
484
|
-
* @private
|
|
485
|
-
*/
|
|
486
|
-
_serializeEntitySets (containerElement, entitySets) {
|
|
487
|
-
try {
|
|
488
|
-
for (const entitySet of entitySets) {
|
|
489
|
-
const entitySetElement = containerElement
|
|
490
|
-
.element(ENTITY_SET)
|
|
491
|
-
.attribute(NAME, entitySet.getName())
|
|
492
|
-
.attribute(ENTITY_TYPE, this._getAliasedFQN(entitySet.getEntityType().getFullQualifiedName()))
|
|
493
|
-
|
|
494
|
-
if (!entitySet.isIncludeInServiceDocument()) {
|
|
495
|
-
entitySetElement.attribute(INCLUDE_IN_SERVICE_DOCUMENT, entitySet.isIncludeInServiceDocument())
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
this._serializeNavigationPropertyBindings(entitySetElement, entitySet)
|
|
499
|
-
|
|
500
|
-
this._serializeAnnotations(entitySetElement, entitySet)
|
|
501
|
-
}
|
|
502
|
-
} catch (e) {
|
|
503
|
-
throw new SerializationError('An error occurred during serialization of Entity Set', e)
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Serializes Functions.
|
|
509
|
-
* @param {*} schemaElement XML element to add to
|
|
510
|
-
* @param {*} functions the functions
|
|
511
|
-
* @private
|
|
512
|
-
*/
|
|
513
|
-
_serializeFunctions (schemaElement, functions) {
|
|
514
|
-
try {
|
|
515
|
-
for (const edmFunction of functions) {
|
|
516
|
-
const functionElement = schemaElement.element(FUNCTION).attribute(NAME, edmFunction.getName())
|
|
517
|
-
|
|
518
|
-
if (edmFunction.getEntitySetPath()) {
|
|
519
|
-
functionElement.attribute(ENTITY_SET_PATH, edmFunction.getEntitySetPath())
|
|
520
|
-
}
|
|
521
|
-
if (edmFunction.isBound()) {
|
|
522
|
-
functionElement.attribute(IS_BOUND, edmFunction.isBound())
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
if (edmFunction.isComposable()) {
|
|
526
|
-
functionElement.attribute(IS_COMPOSABLE, edmFunction.isComposable())
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
this._serializeOperationParameters(functionElement, edmFunction)
|
|
530
|
-
|
|
531
|
-
this._serializeOperationReturnType(functionElement, edmFunction)
|
|
532
|
-
|
|
533
|
-
this._serializeAnnotations(functionElement, edmFunction)
|
|
534
|
-
}
|
|
535
|
-
} catch (e) {
|
|
536
|
-
throw new SerializationError('An error occurred during serialization of Function', e)
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Serializes ReturnType.
|
|
542
|
-
* @param {*} operationElement XML element to add to
|
|
543
|
-
* @param {*} operation the operation that has a return type
|
|
544
|
-
* @private
|
|
545
|
-
*/
|
|
546
|
-
_serializeOperationReturnType (operationElement, operation) {
|
|
547
|
-
const returnType = operation.getReturnType()
|
|
548
|
-
|
|
549
|
-
if (!returnType) return
|
|
550
|
-
|
|
551
|
-
try {
|
|
552
|
-
const returnTypeElement = operationElement
|
|
553
|
-
.element(RETURN_TYPE)
|
|
554
|
-
.attribute(TYPE, this._getAliasedFQN(returnType.getType().getFullQualifiedName(), returnType.isCollection()))
|
|
555
|
-
this._serializeFacets(returnTypeElement, returnType)
|
|
556
|
-
|
|
557
|
-
this._serializeAnnotations(returnTypeElement, returnType)
|
|
558
|
-
} catch (e) {
|
|
559
|
-
throw new SerializationError('An error occurred during serialization of Return Type', e)
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Serializes Parameters.
|
|
565
|
-
* @param {*} operationElement XML element to add to
|
|
566
|
-
* @param {*} operation the operation that has parameters
|
|
567
|
-
* @private
|
|
568
|
-
*/
|
|
569
|
-
_serializeOperationParameters (operationElement, operation) {
|
|
570
|
-
try {
|
|
571
|
-
for (const [parameterName, parameter] of operation.getParameters()) {
|
|
572
|
-
const parameterElement = operationElement
|
|
573
|
-
.element(PARAMETER)
|
|
574
|
-
.attribute(NAME, parameterName)
|
|
575
|
-
.attribute(TYPE, this._getAliasedFQN(parameter.getType().getFullQualifiedName(), parameter.isCollection()))
|
|
576
|
-
|
|
577
|
-
this._serializeFacets(parameterElement, parameter)
|
|
578
|
-
|
|
579
|
-
this._serializeAnnotations(parameterElement, parameter)
|
|
580
|
-
}
|
|
581
|
-
} catch (e) {
|
|
582
|
-
throw new SerializationError('An error occurred during serialization of Parameter', e)
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Serializes Actions.
|
|
588
|
-
* @param {*} schemaElement XML element to add to
|
|
589
|
-
* @param {*} actions the actions
|
|
590
|
-
* @private
|
|
591
|
-
*/
|
|
592
|
-
_serializeActions (schemaElement, actions) {
|
|
593
|
-
try {
|
|
594
|
-
for (const action of actions) {
|
|
595
|
-
const actionElement = schemaElement.element(ACTION).attribute(NAME, action.getName())
|
|
596
|
-
|
|
597
|
-
if (action.getEntitySetPath()) {
|
|
598
|
-
actionElement.attribute(ENTITY_SET_PATH, action.getEntitySetPath())
|
|
599
|
-
}
|
|
600
|
-
if (action.isBound()) {
|
|
601
|
-
actionElement.attribute(IS_BOUND, action.isBound())
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
this._serializeOperationParameters(actionElement, action)
|
|
605
|
-
|
|
606
|
-
this._serializeOperationReturnType(actionElement, action)
|
|
607
|
-
|
|
608
|
-
this._serializeAnnotations(actionElement, action)
|
|
609
|
-
}
|
|
610
|
-
} catch (e) {
|
|
611
|
-
throw new SerializationError('An error occurred during serialization of Action', e)
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Serializes facets.
|
|
617
|
-
* @param {*} facetableElement XML element to add to
|
|
618
|
-
* @param {*} facetable the element with facets
|
|
619
|
-
* @private
|
|
620
|
-
*/
|
|
621
|
-
_serializeFacets (facetableElement, facetable) {
|
|
622
|
-
// not all the EDM elements support Nullable facet,
|
|
623
|
-
// therefore first check whether the facetable has isNullable function
|
|
624
|
-
if (facetable.isNullable && !facetable.isNullable()) {
|
|
625
|
-
facetableElement.attribute(NULLABLE, facetable.isNullable())
|
|
626
|
-
}
|
|
627
|
-
if (facetable.getMaxLength() !== null && facetable.getMaxLength() !== undefined) {
|
|
628
|
-
facetableElement.attribute(MAX_LENGTH, facetable.getMaxLength())
|
|
629
|
-
}
|
|
630
|
-
if (facetable.getPrecision() !== null && facetable.getPrecision() !== undefined) {
|
|
631
|
-
if (
|
|
632
|
-
facetable.getPrecision() !== 0 ||
|
|
633
|
-
(facetable.getType && facetable.getType() === EdmPrimitiveTypeKind.Decimal) ||
|
|
634
|
-
(facetable.getUnderlyingType && facetable.getUnderlyingType() === EdmPrimitiveTypeKind.Decimal)
|
|
635
|
-
) {
|
|
636
|
-
facetableElement.attribute(PRECISION, facetable.getPrecision())
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
if (facetable.getScale() !== null && facetable.getScale() !== undefined && facetable.getScale() !== 0) {
|
|
640
|
-
facetableElement.attribute(SCALE, facetable.getScale())
|
|
641
|
-
}
|
|
642
|
-
if (facetable.getSrid && facetable.getSrid() !== null && facetable.getSrid() !== undefined) {
|
|
643
|
-
const type =
|
|
644
|
-
(facetable.getUnderlyingType && facetable.getUnderlyingType()) || (facetable.getType && facetable.getType())
|
|
645
|
-
if (
|
|
646
|
-
((type === EdmPrimitiveTypeKind.GeographyPoint ||
|
|
647
|
-
type === EdmPrimitiveTypeKind.GeographyLineString ||
|
|
648
|
-
type === EdmPrimitiveTypeKind.GeographyPolygon ||
|
|
649
|
-
type === EdmPrimitiveTypeKind.GeographyMultiPoint ||
|
|
650
|
-
type === EdmPrimitiveTypeKind.GeographyMultiLineString ||
|
|
651
|
-
type === EdmPrimitiveTypeKind.GeographyMultiPolygon ||
|
|
652
|
-
type === EdmPrimitiveTypeKind.GeographyCollection) &&
|
|
653
|
-
facetable.getSrid() !== 4326) ||
|
|
654
|
-
facetable.getSrid() !== 0
|
|
655
|
-
) {
|
|
656
|
-
facetableElement.attribute(SRID, facetable.getSrid())
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Serializes ComplexTypes.
|
|
663
|
-
* @param {*} schemaElement XML element to add to
|
|
664
|
-
* @param {*} complexTypes the complex types
|
|
665
|
-
* @private
|
|
666
|
-
*/
|
|
667
|
-
_serializeComplexTypes (schemaElement, complexTypes) {
|
|
668
|
-
try {
|
|
669
|
-
for (const complexType of complexTypes) {
|
|
670
|
-
const complexTypeElement = schemaElement.element(COMPLEX_TYPE).attribute(NAME, complexType.getName())
|
|
671
|
-
|
|
672
|
-
if (complexType.getBaseType()) {
|
|
673
|
-
complexTypeElement.attribute(BASE_TYPE, this._getAliasedFQN(complexType.getBaseType().getFullQualifiedName()))
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
if (complexType.isAbstract()) {
|
|
677
|
-
complexTypeElement.attribute(ABSTRACT, true)
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
this._serializeProperties(complexTypeElement, complexType)
|
|
681
|
-
|
|
682
|
-
this._serializeNavigationProperties(complexTypeElement, complexType)
|
|
683
|
-
|
|
684
|
-
this._serializeAnnotations(complexTypeElement, complexType)
|
|
685
|
-
}
|
|
686
|
-
} catch (e) {
|
|
687
|
-
throw new SerializationError('An error occurred during serialization of Complex Type', e)
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* Serializes Entity Types.
|
|
693
|
-
* @param {*} schemaElement XML element to add to
|
|
694
|
-
* @param {*} entityTypes the entity types
|
|
695
|
-
* @private
|
|
696
|
-
*/
|
|
697
|
-
_serializeEntityTypes (schemaElement, entityTypes) {
|
|
698
|
-
try {
|
|
699
|
-
for (const entityType of entityTypes) {
|
|
700
|
-
const entityTypeElement = schemaElement.element(ENTITY_TYPE).attribute(NAME, entityType.getName())
|
|
701
|
-
|
|
702
|
-
if (entityType.hasStream()) {
|
|
703
|
-
entityTypeElement.attribute(HAS_STREAM, entityType.hasStream())
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (entityType.getBaseType()) {
|
|
707
|
-
entityTypeElement.attribute(BASE_TYPE, this._getAliasedFQN(entityType.getBaseType().getFullQualifiedName()))
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (entityType.isAbstract()) {
|
|
711
|
-
entityTypeElement.attribute(ABSTRACT, true)
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
this._serializeKey(entityTypeElement, entityType)
|
|
715
|
-
|
|
716
|
-
this._serializeProperties(entityTypeElement, entityType)
|
|
717
|
-
|
|
718
|
-
this._serializeNavigationProperties(entityTypeElement, entityType)
|
|
719
|
-
|
|
720
|
-
this._serializeAnnotations(entityTypeElement, entityType)
|
|
721
|
-
}
|
|
722
|
-
} catch (e) {
|
|
723
|
-
throw new SerializationError('An error occurred during serialization of Entity Type', e)
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Serializes Navigation properties.
|
|
729
|
-
* @param {*} typeElement XML element to add to
|
|
730
|
-
* @param {*} type the EDM type that has navigation properties
|
|
731
|
-
* @private
|
|
732
|
-
*/
|
|
733
|
-
_serializeNavigationProperties (typeElement, type) {
|
|
734
|
-
try {
|
|
735
|
-
for (const [navigationPropertyName, navigationProperty] of type.getOwnNavigationProperties()) {
|
|
736
|
-
const navPropertyElement = typeElement
|
|
737
|
-
.element(NAVIGATION_PROPERTY)
|
|
738
|
-
.attribute(NAME, navigationPropertyName)
|
|
739
|
-
.attribute(
|
|
740
|
-
TYPE,
|
|
741
|
-
this._getAliasedFQN(
|
|
742
|
-
navigationProperty.getEntityType().getFullQualifiedName(),
|
|
743
|
-
navigationProperty.isCollection()
|
|
744
|
-
)
|
|
745
|
-
)
|
|
746
|
-
|
|
747
|
-
if (!navigationProperty.isNullable()) {
|
|
748
|
-
navPropertyElement.attribute(NULLABLE, navigationProperty.isNullable())
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
const onDelete = navigationProperty.getOnDelete()
|
|
752
|
-
if (onDelete) {
|
|
753
|
-
this._serializeOnDelete(navPropertyElement, onDelete)
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
const partner = navigationProperty.getPartner()
|
|
757
|
-
if (partner) {
|
|
758
|
-
navPropertyElement.attribute(PARTNER, partner.getName())
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
if (navigationProperty.containsTarget()) {
|
|
762
|
-
navPropertyElement.attribute(CONTAINS_TARGET, navigationProperty.containsTarget())
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
const refConstraints = navigationProperty.getReferentialConstraints()
|
|
766
|
-
if (refConstraints) {
|
|
767
|
-
this._serializeReferentialConstraints(navPropertyElement, refConstraints)
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
this._serializeAnnotations(navPropertyElement, navigationProperty)
|
|
771
|
-
}
|
|
772
|
-
} catch (e) {
|
|
773
|
-
throw new SerializationError('An error occurred during serialization of Navigation Property', e)
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* Serializes OnDelete action for Navigation properties.
|
|
779
|
-
*
|
|
780
|
-
* @param {*} navPropertyElement XML element to add to
|
|
781
|
-
* @param {EdmOnDelete} onDelete the EdmOnDelete instance
|
|
782
|
-
* @private
|
|
783
|
-
*/
|
|
784
|
-
_serializeOnDelete (navPropertyElement, onDelete) {
|
|
785
|
-
try {
|
|
786
|
-
const action = onDelete.getAction()
|
|
787
|
-
const onDeleteElement = navPropertyElement.element(ONDELETE).attribute(ACTION, action)
|
|
788
|
-
this._serializeAnnotations(onDeleteElement, onDelete)
|
|
789
|
-
} catch (error) {
|
|
790
|
-
throw new SerializationError('An error occurred during serialization of OnDelete', error)
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* Serializes referential constraints for the NavigationProperty element.
|
|
796
|
-
* @param {*} navPropertyElement XML element to add to
|
|
797
|
-
* @param {*} refConstraints referential constraints
|
|
798
|
-
* @private
|
|
799
|
-
*/
|
|
800
|
-
_serializeReferentialConstraints (navPropertyElement, refConstraints) {
|
|
801
|
-
try {
|
|
802
|
-
for (const refConstraint of refConstraints.values()) {
|
|
803
|
-
const refConstraintElement = navPropertyElement
|
|
804
|
-
.element(REFERENTIAL_CONSTRAINT)
|
|
805
|
-
.attribute(PROPERTY, refConstraint.getPropertyName())
|
|
806
|
-
.attribute(REFERENCED_PROPERTY, refConstraint.getReferencedPropertyName())
|
|
807
|
-
|
|
808
|
-
this._serializeAnnotations(refConstraintElement, refConstraint)
|
|
809
|
-
}
|
|
810
|
-
} catch (e) {
|
|
811
|
-
throw new SerializationError('An error occurred during serialization of Referential Constraint', e)
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* Serializes Properties.
|
|
817
|
-
* @param {*} typeElement XML element to add to
|
|
818
|
-
* @param {*} type the EDM type that has properties
|
|
819
|
-
* @private
|
|
820
|
-
*/
|
|
821
|
-
_serializeProperties (typeElement, type) {
|
|
822
|
-
try {
|
|
823
|
-
for (const [propertyName, property] of type.getOwnProperties()) {
|
|
824
|
-
const propertyElement = typeElement
|
|
825
|
-
.element(PROPERTY)
|
|
826
|
-
.attribute(NAME, propertyName)
|
|
827
|
-
.attribute(TYPE, this._getAliasedFQN(property.getType().getFullQualifiedName(), property.isCollection()))
|
|
828
|
-
|
|
829
|
-
// Facets
|
|
830
|
-
this._serializeFacets(propertyElement, property)
|
|
831
|
-
if (!property.isUnicode()) {
|
|
832
|
-
propertyElement.attribute(UNICODE, property.isUnicode())
|
|
833
|
-
}
|
|
834
|
-
if (property.getDefaultValue()) {
|
|
835
|
-
propertyElement.attribute(DEFAULT_VALUE, property.getDefaultValue())
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
this._serializeAnnotations(propertyElement, property)
|
|
839
|
-
}
|
|
840
|
-
} catch (e) {
|
|
841
|
-
throw new SerializationError('An error occurred during serialization of Property', e)
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Serializes Entity Type key.
|
|
847
|
-
* @param {*} entityTypeElement XML element to add to
|
|
848
|
-
* @param {*} entityType the entity type that has a key
|
|
849
|
-
* @private
|
|
850
|
-
*/
|
|
851
|
-
_serializeKey (entityTypeElement, entityType) {
|
|
852
|
-
try {
|
|
853
|
-
const keyPropertyRefs = entityType.getKeyPropertyRefs()
|
|
854
|
-
if (!keyPropertyRefs || keyPropertyRefs.size === 0) return
|
|
855
|
-
|
|
856
|
-
// Resolve Base Type key as it is shown in derived type
|
|
857
|
-
const baseType = entityType.getBaseType()
|
|
858
|
-
if (baseType && baseType.getKeyPropertyRefs() && baseType.getKeyPropertyRefs().size !== 0) {
|
|
859
|
-
return
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
const keyElement = entityTypeElement.element(KEY)
|
|
863
|
-
for (const keyRef of keyPropertyRefs.values()) {
|
|
864
|
-
const propertyRefElement = keyElement.element(PROPERTY_REF).attribute(NAME, keyRef.getName())
|
|
865
|
-
|
|
866
|
-
if (keyRef.getAlias()) {
|
|
867
|
-
propertyRefElement.attribute(ALIAS, keyRef.getAlias())
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
} catch (e) {
|
|
871
|
-
throw new SerializationError('An error occurred during serialization of Entity Type Key', e)
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
* Returns string, representing aliased full qualified name for the specified FullQualifiedName instance.
|
|
877
|
-
* @param {FullQualifiedName} fqn - FullQualifiedName instance
|
|
878
|
-
* @param {boolean} isCollection - indicates, whether the type is used for a collection elements
|
|
879
|
-
* @returns {string} aliased full qualified name
|
|
880
|
-
*
|
|
881
|
-
* @private
|
|
882
|
-
*/
|
|
883
|
-
_getAliasedFQN (fqn, isCollection) {
|
|
884
|
-
const typeName =
|
|
885
|
-
(this._namespaceToAlias.has(fqn.namespace) ? this._namespaceToAlias.get(fqn.namespace) : fqn.namespace) +
|
|
886
|
-
'.' +
|
|
887
|
-
fqn.name
|
|
888
|
-
return isCollection ? COLLECTION + '(' + typeName + ')' : typeName
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Serializes References.
|
|
893
|
-
* @param {*} edmx XML element to add to
|
|
894
|
-
* @private
|
|
895
|
-
*/
|
|
896
|
-
_serializeReferences (edmx) {
|
|
897
|
-
try {
|
|
898
|
-
for (const reference of this._edm.getReferences().values()) {
|
|
899
|
-
const referenceElement = edmx.element(PREFIX_EDMX + ':' + REFERENCE).attribute(URI, reference.getUri())
|
|
900
|
-
|
|
901
|
-
this._serializeIncludes(referenceElement, reference.getIncludes())
|
|
902
|
-
this._serializeIncludeAnnotations(referenceElement, reference.getIncludeAnnotations())
|
|
903
|
-
|
|
904
|
-
this._serializeAnnotations(referenceElement, reference)
|
|
905
|
-
}
|
|
906
|
-
} catch (e) {
|
|
907
|
-
throw new SerializationError('An error occurred during serialization of Reference', e)
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* Serializes Include elements.
|
|
913
|
-
* @param {*} referenceElement XML element to add to
|
|
914
|
-
* @param {*} includes the include elements
|
|
915
|
-
* @private
|
|
916
|
-
*/
|
|
917
|
-
_serializeIncludes (referenceElement, includes) {
|
|
918
|
-
try {
|
|
919
|
-
for (const include of includes) {
|
|
920
|
-
const includeElement = referenceElement
|
|
921
|
-
.element(PREFIX_EDMX + ':' + INCLUDE)
|
|
922
|
-
.attribute(NAMESPACE, include.getNamespace())
|
|
923
|
-
|
|
924
|
-
if (include.getAlias()) {
|
|
925
|
-
this._namespaceToAlias.set(include.getNamespace(), include.getAlias())
|
|
926
|
-
// Reference Aliases are ignored for now since they are not V2 compatible
|
|
927
|
-
includeElement.attribute(ALIAS, include.getAlias())
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
} catch (e) {
|
|
931
|
-
throw new SerializationError('An error occurred during serialization of Include element', e)
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Serializes IncludeAnnotation elements.
|
|
937
|
-
* @param {*} referenceElement XML element to add to
|
|
938
|
-
* @param {*} includeAnnotations the IncludeAnnotation elements
|
|
939
|
-
* @private
|
|
940
|
-
*/
|
|
941
|
-
_serializeIncludeAnnotations (referenceElement, includeAnnotations) {
|
|
942
|
-
try {
|
|
943
|
-
for (const includeAnnotation of includeAnnotations) {
|
|
944
|
-
const includeAnnotationsElement = referenceElement
|
|
945
|
-
.element(PREFIX_EDMX + ':' + INCLUDE_ANNOTATIONS)
|
|
946
|
-
.attribute(TERM_NAMESPACE, includeAnnotation.getTermNamespace())
|
|
947
|
-
|
|
948
|
-
if (includeAnnotation.getQualifier()) {
|
|
949
|
-
includeAnnotationsElement.attribute(QUALIFIER, includeAnnotation.getQualifier())
|
|
950
|
-
}
|
|
951
|
-
if (includeAnnotation.getTargetNamespace()) {
|
|
952
|
-
includeAnnotationsElement.attribute(TARGET_NAMESPACE, includeAnnotation.getTargetNamespace())
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
} catch (e) {
|
|
956
|
-
throw new SerializationError('An error occurred during serialization of IncludeAnnotations element', e)
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Serializes Term elements.
|
|
962
|
-
* @param {*} schemaElement XML element to add to
|
|
963
|
-
* @param {Array} terms the terms
|
|
964
|
-
* @private
|
|
965
|
-
*/
|
|
966
|
-
_serializeTerms (schemaElement, terms) {
|
|
967
|
-
try {
|
|
968
|
-
for (const term of terms) {
|
|
969
|
-
if (!term.getType()) {
|
|
970
|
-
throw new SerializationError(`Type of '${term.getName()}' is not defined`)
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
const termElement = schemaElement
|
|
974
|
-
.element(TERM)
|
|
975
|
-
.attribute(NAME, term.getName())
|
|
976
|
-
.attribute(TYPE, this._getAliasedFQN(term.getType().getFullQualifiedName(), term.isCollection()))
|
|
977
|
-
|
|
978
|
-
if (term.getBaseTerm()) {
|
|
979
|
-
termElement.attribute(BASE_TERM, this._getAliasedFQN(term.getBaseTerm().getFullQualifiedName()))
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
const appliesTo = term.getAppliesTo()
|
|
983
|
-
if (appliesTo && appliesTo.length > 0) {
|
|
984
|
-
termElement.attribute(APPLIES_TO, appliesTo.join(' '))
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
this._serializeFacets(termElement, term)
|
|
988
|
-
|
|
989
|
-
if (term.getDefaultValue()) {
|
|
990
|
-
const defaultValue = this._convertDefaultValue(term)
|
|
991
|
-
termElement.attribute(DEFAULT_VALUE, defaultValue)
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
this._serializeAnnotations(termElement, term)
|
|
995
|
-
}
|
|
996
|
-
} catch (e) {
|
|
997
|
-
throw new SerializationError('An error occurred during serialization of Term', e)
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Converts default value to the OData-specific format.
|
|
1003
|
-
* @param {EdmProperty | EdmTerm} valueContainer - EDM object, which contains the default value.
|
|
1004
|
-
* @returns {*} converted default value
|
|
1005
|
-
* @private
|
|
1006
|
-
*/
|
|
1007
|
-
_convertDefaultValue (valueContainer) {
|
|
1008
|
-
const typeKind = valueContainer.getType().getKind()
|
|
1009
|
-
|
|
1010
|
-
switch (typeKind) {
|
|
1011
|
-
case EdmTypeKind.PRIMITIVE:
|
|
1012
|
-
case EdmTypeKind.DEFINITION:
|
|
1013
|
-
return this._encoder.encodeText(valueContainer.getDefaultValue(), valueContainer)
|
|
1014
|
-
case EdmTypeKind.ENUM:
|
|
1015
|
-
return this._convertEnumValue(
|
|
1016
|
-
this._getAliasedFQN(valueContainer.getType().getFullQualifiedName()),
|
|
1017
|
-
valueContainer.getDefaultValue()
|
|
1018
|
-
)
|
|
1019
|
-
default:
|
|
1020
|
-
throw new SerializationError(`Serialization of default values of ${typeKind} type kind is not supported`)
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
* Converts a value of an enumeration type to the OData-specific format for XML output.
|
|
1026
|
-
* @param {string} typeName the name of the enumeration type
|
|
1027
|
-
* @param {string} value the value
|
|
1028
|
-
* @returns {string} converted value
|
|
1029
|
-
* @private
|
|
1030
|
-
*/
|
|
1031
|
-
_convertEnumValue (typeName, value) {
|
|
1032
|
-
if (!typeName) throw new SerializationError(`No type provided for enum value '${value}'`)
|
|
1033
|
-
return value
|
|
1034
|
-
.split(',')
|
|
1035
|
-
.map(name => typeName + '/' + name)
|
|
1036
|
-
.join(' ')
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
* Serializes Annotations elements.
|
|
1041
|
-
* @param {Object} schemaElement - XML element for the EDM Schema
|
|
1042
|
-
* @param {EdmAnnotations[]} externalAnnotations - values for Annotations elements
|
|
1043
|
-
* @private
|
|
1044
|
-
*/
|
|
1045
|
-
_serializeExternalAnnotations (schemaElement, externalAnnotations) {
|
|
1046
|
-
if (!externalAnnotations) return
|
|
1047
|
-
|
|
1048
|
-
try {
|
|
1049
|
-
for (const annotations of externalAnnotations) {
|
|
1050
|
-
const annotationsElement = schemaElement.element(ANNOTATIONS).attribute(TARGET, annotations.getTarget())
|
|
1051
|
-
|
|
1052
|
-
const qualifier = annotations.getQualifier()
|
|
1053
|
-
if (qualifier) {
|
|
1054
|
-
annotationsElement.attribute(QUALIFIER, qualifier)
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
this._serializeAnnotations(annotationsElement, annotations)
|
|
1058
|
-
}
|
|
1059
|
-
} catch (e) {
|
|
1060
|
-
throw new SerializationError('An error occurred during serialization of Annotations element', e)
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* Serializes annotations for an EDM element.
|
|
1066
|
-
* @param {Object} annotatableElement - XML element for the EDM element, for which the annotations have to be
|
|
1067
|
-
* serialized
|
|
1068
|
-
* @param {Object} annotatable - EDM object, containing the annotations, e.g. EdmProperty
|
|
1069
|
-
* @private
|
|
1070
|
-
*/
|
|
1071
|
-
_serializeAnnotations (annotatableElement, annotatable) {
|
|
1072
|
-
const annotations = annotatable.getAnnotations()
|
|
1073
|
-
|
|
1074
|
-
if (!annotations) return
|
|
1075
|
-
|
|
1076
|
-
try {
|
|
1077
|
-
for (const annotation of annotations) {
|
|
1078
|
-
const annotationElement = annotatableElement
|
|
1079
|
-
.element(ANNOTATION)
|
|
1080
|
-
.attribute(TERM, this._getAliasedFQN(annotation.getTermFullQualifiedName()))
|
|
1081
|
-
|
|
1082
|
-
if (annotation.getQualifier()) {
|
|
1083
|
-
annotationElement.attribute(QUALIFIER, annotation.getQualifier())
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
this._serializeAnnotations(annotationElement, annotation)
|
|
1087
|
-
|
|
1088
|
-
this._serializeExpression(
|
|
1089
|
-
annotationElement,
|
|
1090
|
-
annotation.getExpression(),
|
|
1091
|
-
annotation.getTerm() ? annotation.getTerm().getType() : null
|
|
1092
|
-
)
|
|
1093
|
-
}
|
|
1094
|
-
} catch (e) {
|
|
1095
|
-
const reason = annotatable.getTarget ? " with target '" + annotatable.getTarget() + "'" : ''
|
|
1096
|
-
throw new SerializationError('An error occurred during serialization of annotation' + reason, e)
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Dispatcher method for serialization of annotation expressions.
|
|
1102
|
-
* @param {Object} parentElement - XML element, to which the annotations have to be added
|
|
1103
|
-
* @param {Object} expression - instance of an EDM annotation expression, e.g. EdmApplyExpression
|
|
1104
|
-
* @param {?EdmType} annotatedType the type of the element (term, property, ...) that is annotated
|
|
1105
|
-
* @private
|
|
1106
|
-
*/
|
|
1107
|
-
_serializeExpression (parentElement, expression, annotatedType) {
|
|
1108
|
-
if (!expression) return
|
|
1109
|
-
|
|
1110
|
-
if (expression.constructor.name === 'EdmUnknownExpression') {
|
|
1111
|
-
throw new SerializationError(
|
|
1112
|
-
'Ambiguous expression found. This is either a constant or dynamic expression.' +
|
|
1113
|
-
' See https://issues.oasis-open.org/browse/ODATA-1221'
|
|
1114
|
-
)
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
const exprSerializer = EXPRESSION_SERIALIZERS[expression.getKind()]
|
|
1118
|
-
if (!exprSerializer) {
|
|
1119
|
-
throw new NotImplementedError(`'${expression.getKind()}' annotation expressions are not supported`)
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
this[exprSerializer](parentElement, expression, annotatedType)
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
_serializeConstantExpr (parentElement, constantExpr, annotatedType) {
|
|
1126
|
-
try {
|
|
1127
|
-
const exprType = constantExpr.getTypeName()
|
|
1128
|
-
// The XML-serialized enumeration-type value needs the full-qualified type name.
|
|
1129
|
-
// This can be found in the annotated type. If that is not available
|
|
1130
|
-
// (e.g., because it is in a referenced schema), an '@odata.type' annotation
|
|
1131
|
-
// as specified in OData Version 4.01 CS02 is used (and required in that case).
|
|
1132
|
-
const exprValue =
|
|
1133
|
-
exprType === 'edm:EnumMember'
|
|
1134
|
-
? this._convertEnumValue(
|
|
1135
|
-
annotatedType
|
|
1136
|
-
? this._getAliasedFQN(annotatedType.getFullQualifiedName())
|
|
1137
|
-
: constantExpr
|
|
1138
|
-
.getAnnotations()
|
|
1139
|
-
.find(annotation => annotation.getTermFullQualifiedName().toString() === 'odata.type')
|
|
1140
|
-
.getExpression()
|
|
1141
|
-
.getValue()
|
|
1142
|
-
.substring(1),
|
|
1143
|
-
constantExpr.getValue()
|
|
1144
|
-
)
|
|
1145
|
-
: this._convertConstantExprValue(exprType, constantExpr.getValue())
|
|
1146
|
-
|
|
1147
|
-
// expression name is the type name without 'edm:' prefix, i.e. starting with the 4th character
|
|
1148
|
-
const exprName = exprType.substring(4)
|
|
1149
|
-
|
|
1150
|
-
parentElement.element(exprName).text(exprValue)
|
|
1151
|
-
} catch (e) {
|
|
1152
|
-
throw new SerializationError('An error occurred during serialization of constant annotation expression', e)
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
_convertConstantExprValue (typeName, value) {
|
|
1157
|
-
const edmPrimitiveType = ANNOTATION_TYPES[typeName]
|
|
1158
|
-
if (!edmPrimitiveType) {
|
|
1159
|
-
throw new SerializationError(`Serialization of constant expressions of ${typeName} type is not supported`)
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
return this._encoder.encodeText(value, {
|
|
1163
|
-
getType: () => edmPrimitiveType,
|
|
1164
|
-
isNullable: () => true,
|
|
1165
|
-
getMaxLength: () => null,
|
|
1166
|
-
getPrecision: () => Number.MAX_SAFE_INTEGER,
|
|
1167
|
-
getScale: () => 'variable'
|
|
1168
|
-
})
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
_serializeAnnotationPathExpr (parentElement, expression) {
|
|
1172
|
-
parentElement.element(ANNOTATION_PATH).text(expression.getAnnotationPath())
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
_serializeApplyExpr (parentElement, applyExpr, annotatedType) {
|
|
1176
|
-
try {
|
|
1177
|
-
const applyElement = parentElement
|
|
1178
|
-
.element(APPLY)
|
|
1179
|
-
.attribute(FUNCTION, this._getAliasedFQN(applyExpr.getFunctionName()))
|
|
1180
|
-
|
|
1181
|
-
for (const parameterExpr of applyExpr.getParameters()) {
|
|
1182
|
-
this._serializeExpression(applyElement, parameterExpr, annotatedType)
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
this._serializeAnnotations(applyElement, applyExpr)
|
|
1186
|
-
} catch (e) {
|
|
1187
|
-
throw new SerializationError('An error occurred during serialization of Apply annotation expression', e)
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
_serializeCastExpr (parentElement, castExpr, annotatedType) {
|
|
1192
|
-
try {
|
|
1193
|
-
const castElement = parentElement
|
|
1194
|
-
.element(CAST)
|
|
1195
|
-
.attribute(TYPE, this._getAliasedFQN(castExpr.getType().getFullQualifiedName(), castExpr.isCollection()))
|
|
1196
|
-
|
|
1197
|
-
this._serializeFacets(castElement, castExpr)
|
|
1198
|
-
this._serializeExpression(castElement, castExpr.getExpression(), annotatedType)
|
|
1199
|
-
|
|
1200
|
-
this._serializeAnnotations(castElement, castExpr)
|
|
1201
|
-
} catch (e) {
|
|
1202
|
-
throw new SerializationError('An error occurred during serialization of Cast annotation expression', e)
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
_serializeCollectionExpr (parentElement, collectionExpr, annotatedType) {
|
|
1207
|
-
try {
|
|
1208
|
-
const collectionElement = parentElement.element(COLLECTION)
|
|
1209
|
-
|
|
1210
|
-
for (const expression of collectionExpr.getExpressions()) {
|
|
1211
|
-
this._serializeExpression(collectionElement, expression, annotatedType)
|
|
1212
|
-
}
|
|
1213
|
-
} catch (e) {
|
|
1214
|
-
throw new SerializationError('An error occurred during serialization of Collection annotation expression', e)
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
_serializeIfExpr (parentElement, ifExpr, annotatedType) {
|
|
1219
|
-
try {
|
|
1220
|
-
const ifElement = parentElement.element(IF)
|
|
1221
|
-
|
|
1222
|
-
this._serializeExpression(ifElement, ifExpr.getCondition(), annotatedType)
|
|
1223
|
-
this._serializeExpression(ifElement, ifExpr.getIfTrue(), annotatedType)
|
|
1224
|
-
this._serializeExpression(ifElement, ifExpr.getIfFalse(), annotatedType)
|
|
1225
|
-
|
|
1226
|
-
this._serializeAnnotations(ifElement, ifExpr)
|
|
1227
|
-
} catch (e) {
|
|
1228
|
-
throw new SerializationError('An error occurred during serialization of If annotation expression', e)
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
_serializeArithmeticExpr (parentElement, arithmeticExpr, annotatedType) {
|
|
1233
|
-
try {
|
|
1234
|
-
const exprElement = parentElement.element(arithmeticExpr.getOperator())
|
|
1235
|
-
|
|
1236
|
-
this._serializeExpression(exprElement, arithmeticExpr.getLeft(), annotatedType)
|
|
1237
|
-
this._serializeExpression(exprElement, arithmeticExpr.getRight(), annotatedType)
|
|
1238
|
-
|
|
1239
|
-
this._serializeAnnotations(exprElement, arithmeticExpr)
|
|
1240
|
-
} catch (e) {
|
|
1241
|
-
throw new SerializationError('An error occurred during serialization of arithmetic annotation expression', e)
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
_serializeBinaryExpr (parentElement, binaryExpr, annotatedType) {
|
|
1246
|
-
try {
|
|
1247
|
-
const exprElement = parentElement.element(binaryExpr.getOperator())
|
|
1248
|
-
|
|
1249
|
-
this._serializeExpression(exprElement, binaryExpr.getLeft(), annotatedType)
|
|
1250
|
-
this._serializeExpression(exprElement, binaryExpr.getRight(), annotatedType)
|
|
1251
|
-
|
|
1252
|
-
this._serializeAnnotations(exprElement, binaryExpr)
|
|
1253
|
-
} catch (e) {
|
|
1254
|
-
throw new SerializationError(
|
|
1255
|
-
'An error occurred during serialization of binary logical / comparison annotation expression',
|
|
1256
|
-
e
|
|
1257
|
-
)
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
_serializeIsOfExpr (parentElement, isOfExpr, annotatedType) {
|
|
1262
|
-
try {
|
|
1263
|
-
const isOfElement = parentElement
|
|
1264
|
-
.element(IS_OF)
|
|
1265
|
-
.attribute(TYPE, this._getAliasedFQN(isOfExpr.getType().getFullQualifiedName(), isOfExpr.isCollection()))
|
|
1266
|
-
this._serializeFacets(isOfElement, isOfExpr)
|
|
1267
|
-
|
|
1268
|
-
this._serializeExpression(isOfElement, isOfExpr.getExpression(), annotatedType)
|
|
1269
|
-
|
|
1270
|
-
this._serializeAnnotations(isOfElement, isOfExpr)
|
|
1271
|
-
} catch (e) {
|
|
1272
|
-
throw new SerializationError('An error occurred during serialization of IsOf annotation expression', e)
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
_serializeLabeledElementExpr (parentElement, labeledElementExpr, annotatedType) {
|
|
1277
|
-
try {
|
|
1278
|
-
const labeledElementElement = parentElement.element(LABELED_ELEMENT).attribute(NAME, labeledElementExpr.getName())
|
|
1279
|
-
this._serializeExpression(labeledElementElement, labeledElementExpr.getExpression(), annotatedType)
|
|
1280
|
-
|
|
1281
|
-
this._serializeAnnotations(labeledElementElement, labeledElementExpr)
|
|
1282
|
-
} catch (e) {
|
|
1283
|
-
throw new SerializationError('An error occurred during serialization of LabeledElement annotation expression', e)
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
_serializeLabeledElementReferenceExpr (parentElement, labeledElemRefExpr) {
|
|
1288
|
-
try {
|
|
1289
|
-
parentElement.element(LABELED_ELEMENT_REFERENCE).text(this._getAliasedFQN(labeledElemRefExpr.getName()))
|
|
1290
|
-
} catch (e) {
|
|
1291
|
-
throw new SerializationError(
|
|
1292
|
-
'An error occurred during serialization of LabeledElementReference annotation expression',
|
|
1293
|
-
e
|
|
1294
|
-
)
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
_serializeModelElementPathExpr (parentElement, modelElementPathExpr) {
|
|
1299
|
-
try {
|
|
1300
|
-
parentElement.element(MODEL_ELEMENT_PATH).text(modelElementPathExpr.getModelElementPath())
|
|
1301
|
-
} catch (e) {
|
|
1302
|
-
throw new SerializationError(
|
|
1303
|
-
'An error occurred during serialization of ModelElementPath annotation expression',
|
|
1304
|
-
e
|
|
1305
|
-
)
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
_serializeNullExpr (parentElement, nullExpr) {
|
|
1310
|
-
try {
|
|
1311
|
-
const nullElement = parentElement.element(NULL)
|
|
1312
|
-
this._serializeAnnotations(nullElement, nullExpr)
|
|
1313
|
-
} catch (e) {
|
|
1314
|
-
throw new SerializationError('An error occurred during serialization of Null annotation expression', e)
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
_serializeNavigationPropertyPathExpr (parentElement, navPropPathExpr) {
|
|
1319
|
-
try {
|
|
1320
|
-
parentElement.element(NAVIGATION_PROPERTY_PATH).text(navPropPathExpr.getNavigationPropertyPath())
|
|
1321
|
-
} catch (e) {
|
|
1322
|
-
throw new SerializationError(
|
|
1323
|
-
'An error occurred during serialization of NavigationPropertyPath annotation expression',
|
|
1324
|
-
e
|
|
1325
|
-
)
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
_serializePathExpr (parentElement, pathExpr) {
|
|
1330
|
-
try {
|
|
1331
|
-
parentElement.element(PATH).text(pathExpr.getPath())
|
|
1332
|
-
} catch (e) {
|
|
1333
|
-
throw new SerializationError('An error occurred during serialization of Path annotation expression', e)
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
_serializePropertyPathExpr (parentElement, propertyPathExpr) {
|
|
1338
|
-
try {
|
|
1339
|
-
parentElement.element(PROPERTY_PATH).text(propertyPathExpr.getPropertyPath())
|
|
1340
|
-
} catch (e) {
|
|
1341
|
-
throw new SerializationError('An error occurred during serialization of PropertyPath annotation expression', e)
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
_serializeNegationExpr (parentElement, negationExpr, annotatedType) {
|
|
1346
|
-
try {
|
|
1347
|
-
const negationElement = parentElement.element(NEG)
|
|
1348
|
-
this._serializeExpression(negationElement, negationExpr.getExpression(), annotatedType)
|
|
1349
|
-
|
|
1350
|
-
this._serializeAnnotations(negationElement, negationExpr)
|
|
1351
|
-
} catch (e) {
|
|
1352
|
-
throw new SerializationError('An error occurred during serialization of Negation annotation expression', e)
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
_serializeNotExpr (parentElement, notExpr, annotatedType) {
|
|
1357
|
-
try {
|
|
1358
|
-
const notElement = parentElement.element(NOT)
|
|
1359
|
-
this._serializeExpression(notElement, notExpr.getExpression(), annotatedType)
|
|
1360
|
-
|
|
1361
|
-
this._serializeAnnotations(notElement, notExpr)
|
|
1362
|
-
} catch (e) {
|
|
1363
|
-
throw new SerializationError('An error occurred during serialization of Not annotation expression', e)
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
_serializeRecordExpr (parentElement, recordExpr, annotatedType) {
|
|
1368
|
-
try {
|
|
1369
|
-
const recordElement = parentElement.element(RECORD)
|
|
1370
|
-
|
|
1371
|
-
const recordTypeFQN = recordExpr.getTypeFQN()
|
|
1372
|
-
if (recordTypeFQN) {
|
|
1373
|
-
recordElement.attribute(TYPE, this._getAliasedFQN(recordTypeFQN))
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
for (const propValueExpr of recordExpr.getPropertyValues()) {
|
|
1377
|
-
let type = null
|
|
1378
|
-
if (annotatedType && annotatedType.getProperty) {
|
|
1379
|
-
const property = annotatedType.getProperty(propValueExpr.getProperty())
|
|
1380
|
-
if (property && property.getType) type = property.getType()
|
|
1381
|
-
if (property && property.getEntityType) type = property.getEntityType()
|
|
1382
|
-
}
|
|
1383
|
-
this._serializePropertyValueExpr(recordElement, propValueExpr, type)
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
this._serializeAnnotations(recordElement, recordExpr)
|
|
1387
|
-
} catch (e) {
|
|
1388
|
-
throw new SerializationError('An error occurred during serialization of Record annotation expression', e)
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
_serializePropertyValueExpr (recordElement, propValueExpr, annotatedType) {
|
|
1393
|
-
try {
|
|
1394
|
-
const propValueElement = recordElement.element(PROPERTY_VALUE).attribute(PROPERTY, propValueExpr.getProperty())
|
|
1395
|
-
|
|
1396
|
-
this._serializeExpression(propValueElement, propValueExpr.getExpression(), annotatedType)
|
|
1397
|
-
|
|
1398
|
-
this._serializeAnnotations(propValueElement, propValueExpr)
|
|
1399
|
-
} catch (e) {
|
|
1400
|
-
throw new SerializationError('An error occurred during serialization of PropertyValue annotation expression', e)
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
_serializeUrlRefExpr (parentElement, urlRefExpr, annotatedType) {
|
|
1405
|
-
try {
|
|
1406
|
-
const urlRefElement = parentElement.element(URL_REF)
|
|
1407
|
-
this._serializeExpression(urlRefElement, urlRefExpr.getExpression(), annotatedType)
|
|
1408
|
-
|
|
1409
|
-
this._serializeAnnotations(urlRefElement, urlRefExpr)
|
|
1410
|
-
} catch (e) {
|
|
1411
|
-
throw new SerializationError('An error occurred during serialization of UrlRef annotation expression', e)
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
module.exports = MetadataXmlSerializer
|