@sap/cds 5.9.8 → 6.0.1
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 +252 -20
- package/apis/services.d.ts +1 -1
- package/app/fiori/preview.js +2 -6
- package/app/index.js +3 -3
- package/bin/build/buildTaskEngine.js +17 -15
- package/bin/build/buildTaskFactory.js +29 -19
- package/bin/build/buildTaskHandler.js +27 -11
- package/bin/build/buildTaskProvider.js +2 -4
- package/bin/build/buildTaskProviderFactory.js +11 -16
- package/bin/build/constants.js +14 -6
- package/bin/build/csv-reader.js +2 -1
- package/bin/build/index.js +12 -18
- package/bin/build/provider/buildTaskHandlerEdmx.js +3 -39
- package/bin/build/provider/buildTaskHandlerFeatureToggles.js +149 -0
- package/bin/build/provider/buildTaskHandlerInternal.js +2 -3
- package/bin/build/provider/buildTaskProviderInternal.js +108 -239
- package/bin/build/provider/fiori/index.js +2 -2
- package/bin/build/provider/hana/2migration.js +11 -11
- package/bin/build/provider/hana/2tabledata.js +3 -3
- package/bin/build/provider/hana/index.js +89 -99
- package/bin/build/provider/hana/migrationtable.js +4 -3
- package/bin/build/provider/java/index.js +101 -0
- package/bin/build/provider/java-cf/index.js +1 -101
- package/bin/build/provider/mtx/index.js +83 -41
- package/bin/build/provider/mtx/resourcesTarBuilder.js +68 -0
- package/bin/build/provider/mtx-sidecar/index.js +80 -0
- package/bin/build/provider/node-cf/index.js +1 -308
- package/bin/build/provider/nodejs/index.js +189 -0
- package/bin/build/util.js +19 -31
- package/bin/cds.js +5 -3
- package/bin/deploy/to-hana/cfUtil.js +31 -6
- package/bin/deploy/to-hana/gitUtil.js +5 -3
- package/bin/deploy/to-hana/hana.js +9 -10
- package/bin/{build → deploy/to-hana}/mtaUtil.js +10 -9
- package/bin/mtx/in-cds.js +19 -7
- package/bin/serve.js +56 -21
- package/bin/utils/log.js +13 -30
- package/bin/version.js +4 -3
- package/common.cds +61 -16
- package/lib/compile/cdsc.js +3 -2
- package/lib/compile/etc/_localized.js +15 -14
- package/lib/compile/for/drafts.js +3 -4
- package/lib/compile/for/java.js +13 -10
- package/lib/compile/for/nodejs.js +8 -8
- package/lib/compile/for/odata.js +7 -12
- package/lib/compile/for/sql.js +5 -6
- package/lib/compile/index.js +5 -4
- package/lib/compile/load.js +9 -11
- package/lib/compile/minify.js +8 -5
- package/lib/compile/parse.js +4 -2
- package/lib/compile/resolve.js +18 -15
- package/lib/compile/to/edm.js +0 -1
- package/lib/compile/to/gql.js +3 -2
- package/lib/compile/to/json.js +24 -17
- package/lib/connect/bindings.js +3 -2
- package/lib/connect/index.js +5 -5
- package/lib/core/classes.js +74 -2
- package/lib/core/entities.js +52 -3
- package/lib/core/reflect.js +2 -1
- package/lib/deploy.js +11 -8
- package/lib/env/defaults.js +4 -3
- package/lib/env/index.js +71 -31
- package/lib/env/presets.js +1 -14
- package/lib/env/requires.js +70 -20
- package/lib/env/serviceBindings.js +147 -0
- package/lib/i18n/localize.js +22 -23
- package/lib/index.js +148 -144
- package/lib/log/errors.js +55 -12
- package/lib/log/format/kibana.js +1 -1
- package/lib/log/index.js +4 -0
- package/lib/ql/SELECT.js +7 -2
- package/lib/ql/Whereable.js +8 -2
- package/lib/ql/index.js +2 -2
- package/lib/req/assert.js +71 -0
- package/lib/req/cds-context.js +38 -70
- package/lib/req/context.js +34 -21
- package/lib/req/request.js +12 -18
- package/lib/req/response.js +6 -2
- package/lib/req/user.js +30 -22
- package/lib/serve/Service-api.js +17 -12
- package/lib/serve/Service-dispatch.js +5 -9
- package/lib/serve/Service-methods.js +4 -3
- package/lib/serve/Transaction.js +24 -21
- package/lib/serve/adapters.js +15 -5
- package/lib/serve/factory.js +23 -20
- package/lib/serve/index.js +51 -54
- package/lib/utils/axios.js +8 -12
- package/lib/utils/index.js +3 -3
- package/lib/utils/resources/index.js +1 -44
- package/lib/utils/resources/tar.js +2 -1
- package/lib/utils/tests.js +13 -15
- package/libx/_runtime/.eslintrc +1 -1
- package/libx/_runtime/audit/Service.js +6 -4
- package/libx/_runtime/audit/generic/personal/access.js +19 -43
- package/libx/_runtime/audit/generic/personal/index.js +40 -34
- package/libx/_runtime/audit/generic/personal/modification.js +11 -9
- package/libx/_runtime/audit/generic/personal/utils.js +13 -6
- package/libx/_runtime/audit/utils/v2.js +6 -3
- package/libx/_runtime/auth/index.js +71 -66
- package/libx/_runtime/auth/strategies/JWT.js +3 -2
- package/libx/_runtime/auth/strategies/mock.js +54 -53
- package/libx/_runtime/auth/strategies/xssecUtils.js +3 -4
- package/libx/_runtime/auth/strategies/xsuaa.js +3 -2
- package/libx/_runtime/auth/utils.js +2 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/Dispatcher.js +127 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +6 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +93 -73
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +10 -45
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +5 -9
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +9 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +4 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +60 -53
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +15 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +8 -15
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +29 -41
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/index.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +13 -13
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/selectToCQN.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +24 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityContainer.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +4 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +4 -5
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/ValueConverter.js +4 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ValueValidator.js +5 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseHeaderSetter.js +2 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugSerializingCommand.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/PresetResponseHeadersCommand.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SerializingCommand.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetResponseHeadersCommand.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +3 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +3 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/SerializerFactory.js +1 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +3 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +36 -25
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +100 -91
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +382 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/oDataConfiguration.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/omitValues.js +5 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +77 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +3 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +91 -69
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +27 -6
- package/libx/_runtime/cds-services/adapter/rest/utils/validation-checks.js +7 -17
- package/libx/_runtime/cds-services/services/Service.js +17 -76
- package/libx/_runtime/cds-services/services/utils/columns.js +6 -4
- package/libx/_runtime/cds-services/services/utils/compareJson.js +1 -53
- package/libx/_runtime/cds-services/services/utils/differ.js +15 -19
- package/libx/_runtime/cds-services/util/assert.js +107 -34
- package/libx/_runtime/cds.js +1 -31
- package/libx/_runtime/common/aspects/Association.js +40 -54
- package/libx/_runtime/common/aspects/any.js +61 -6
- package/libx/_runtime/common/aspects/entity.js +19 -79
- package/libx/_runtime/common/composition/data.js +2 -2
- package/libx/_runtime/common/composition/delete.js +8 -7
- package/libx/_runtime/common/composition/tree.js +10 -10
- package/libx/_runtime/common/composition/update.js +3 -2
- package/libx/_runtime/common/constants/events.js +15 -0
- package/libx/_runtime/common/error/entry.js +9 -3
- package/libx/_runtime/common/error/frontend.js +13 -19
- package/libx/_runtime/common/error/index.js +8 -3
- package/libx/_runtime/common/generic/auth/capabilities.js +2 -1
- package/libx/_runtime/common/generic/auth/constants.js +1 -4
- package/libx/_runtime/common/generic/auth/requires.js +1 -1
- package/libx/_runtime/common/generic/auth/restrict.js +12 -28
- package/libx/_runtime/common/generic/auth/restrictions.js +12 -4
- package/libx/_runtime/common/generic/auth/utils.js +2 -1
- package/libx/_runtime/common/generic/crud.js +9 -60
- package/libx/_runtime/common/generic/etag.js +41 -7
- package/libx/_runtime/common/generic/input.js +128 -66
- package/libx/_runtime/common/generic/paging.js +9 -3
- package/libx/_runtime/common/generic/put.js +2 -2
- package/libx/_runtime/common/generic/sorting.js +7 -3
- package/libx/_runtime/common/generic/temporal.js +0 -5
- package/libx/_runtime/common/i18n/messages.properties +2 -1
- package/libx/_runtime/common/utils/binary.js +69 -0
- package/libx/_runtime/common/utils/cqn.js +39 -14
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +93 -59
- package/libx/_runtime/common/utils/csn.js +87 -85
- package/libx/_runtime/common/utils/dollar.js +8 -7
- package/libx/_runtime/common/utils/draft.js +1 -1
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +23 -7
- package/libx/_runtime/common/utils/generateOnCond.js +2 -1
- package/libx/_runtime/common/utils/keys.js +30 -13
- package/libx/_runtime/common/utils/postProcessing.js +6 -1
- package/libx/_runtime/common/utils/quotingStyles.js +0 -23
- package/libx/_runtime/common/utils/resolveStructured.js +23 -26
- package/libx/_runtime/common/utils/resolveView.js +4 -1
- package/libx/_runtime/common/utils/rewriteAsterisks.js +3 -0
- package/libx/_runtime/common/utils/search2cqn4sql.js +4 -13
- package/libx/_runtime/common/utils/searchToLike.js +9 -13
- package/libx/_runtime/common/utils/streamProp.js +35 -0
- package/libx/_runtime/common/utils/structured.js +12 -18
- package/libx/_runtime/common/utils/template.js +3 -5
- package/libx/_runtime/common/utils/templateProcessor.js +22 -14
- package/libx/_runtime/common/utils/unionCqnTemplate.js +4 -14
- package/libx/_runtime/db/Service.js +2 -1
- package/libx/_runtime/db/expand/expand-v2.js +2 -2
- package/libx/_runtime/db/expand/expandCQNToJoin.js +7 -6
- package/libx/_runtime/db/generic/input.js +14 -17
- package/libx/_runtime/db/generic/integrity.js +1 -2
- package/libx/_runtime/db/generic/update.js +14 -1
- package/libx/_runtime/db/query/read.js +0 -1
- package/libx/_runtime/db/query/update.js +1 -1
- package/libx/_runtime/db/sql-builder/BaseBuilder.js +1 -1
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +5 -31
- package/libx/_runtime/db/sql-builder/InsertBuilder.js +1 -1
- package/libx/_runtime/db/sql-builder/ReferenceBuilder.js +0 -9
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +11 -10
- package/libx/_runtime/db/sql-builder/UpdateBuilder.js +2 -2
- package/libx/_runtime/db/sql-builder/annotations.js +1 -2
- package/libx/_runtime/db/utils/coloredTxCommands.js +5 -0
- package/libx/_runtime/db/utils/columns.js +1 -1
- package/libx/_runtime/db/utils/propagateForeignKeys.js +10 -2
- package/libx/_runtime/extensibility/activate.js +69 -0
- package/libx/_runtime/extensibility/add.js +41 -0
- package/libx/_runtime/extensibility/addExtension.js +68 -0
- package/libx/_runtime/extensibility/defaults.js +39 -0
- package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformREAD.js +0 -0
- package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformRESULT.js +2 -2
- package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformWRITE.js +2 -2
- package/libx/_runtime/extensibility/push.js +61 -0
- package/libx/_runtime/extensibility/service.js +21 -0
- package/libx/_runtime/extensibility/{uiflex/utils.js → utils.js} +39 -3
- package/libx/_runtime/extensibility/validation.js +53 -0
- package/libx/_runtime/extensibility/views.js +12 -0
- package/libx/_runtime/fiori/generic/activate.js +6 -4
- package/libx/_runtime/fiori/generic/before.js +17 -29
- package/libx/_runtime/fiori/generic/cancel.js +2 -4
- package/libx/_runtime/fiori/generic/delete.js +2 -4
- package/libx/_runtime/fiori/generic/edit.js +3 -7
- package/libx/_runtime/fiori/generic/index.js +31 -0
- package/libx/_runtime/fiori/generic/new.js +2 -4
- package/libx/_runtime/fiori/generic/patch.js +4 -8
- package/libx/_runtime/fiori/generic/prepare.js +2 -4
- package/libx/_runtime/fiori/generic/read.js +137 -162
- package/libx/_runtime/fiori/generic/readOverDraft.js +10 -4
- package/libx/_runtime/fiori/utils/handler.js +10 -5
- package/libx/_runtime/fiori/utils/where.js +1 -4
- package/libx/_runtime/hana/Service.js +14 -7
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +1 -1
- package/libx/_runtime/hana/dynatrace.js +2 -2
- package/libx/_runtime/hana/localized.js +7 -6
- package/libx/_runtime/hana/pool.js +9 -6
- package/libx/_runtime/hana/search.js +2 -3
- package/libx/_runtime/hana/{searchToContains.js → search2Contains.js} +5 -2
- package/libx/_runtime/hana/search2cqn4sql.js +20 -17
- package/libx/_runtime/index.js +2 -6
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +11 -2
- package/libx/_runtime/messaging/common-utils/AMQPClient.js +4 -3
- package/libx/_runtime/messaging/common-utils/appId.js +9 -0
- package/libx/_runtime/messaging/common-utils/authorizedRequest.js +2 -18
- package/libx/_runtime/messaging/common-utils/connections.js +1 -1
- package/libx/_runtime/messaging/enterprise-messaging-shared.js +2 -2
- package/libx/_runtime/messaging/enterprise-messaging-utils/EMManagement.js +305 -231
- package/libx/_runtime/messaging/enterprise-messaging-utils/cloudEvents.js +2 -2
- package/libx/_runtime/messaging/enterprise-messaging-utils/options-management.js +15 -8
- package/libx/_runtime/messaging/enterprise-messaging-utils/options-messaging.js +57 -14
- package/libx/_runtime/messaging/enterprise-messaging.js +14 -19
- package/libx/_runtime/messaging/file-based.js +2 -1
- package/libx/_runtime/messaging/http-utils/token.js +18 -6
- package/libx/_runtime/messaging/message-queuing-utils/options-management.js +22 -12
- package/libx/_runtime/messaging/message-queuing-utils/options-messaging.js +27 -14
- package/libx/_runtime/messaging/message-queuing.js +138 -85
- package/libx/_runtime/messaging/outbox/utils.js +13 -7
- package/libx/_runtime/messaging/redis-messaging.js +0 -1
- package/libx/_runtime/messaging/service.js +4 -1
- package/libx/_runtime/remote/Service.js +24 -18
- package/libx/_runtime/remote/utils/client.js +84 -46
- package/libx/_runtime/remote/utils/data.js +23 -6
- package/libx/_runtime/sqlite/Service.js +14 -13
- package/libx/_runtime/sqlite/convertAssocToOneManaged.js +2 -0
- package/libx/_runtime/sqlite/customBuilder/CustomSelectBuilder.js +1 -0
- package/libx/_runtime/sqlite/execute.js +3 -9
- package/libx/_runtime/types/api.js +23 -11
- package/libx/common/utils/ucsn.js +15 -9
- package/libx/odata/afterburner.js +109 -29
- package/libx/odata/cqn2odata.js +48 -9
- package/libx/odata/grammar.pegjs +261 -157
- package/libx/odata/index.js +21 -9
- package/libx/odata/parseToCqn.js +8 -5
- package/libx/odata/parser.js +1 -1
- package/libx/odata/utils.js +13 -3
- package/libx/rest/RestAdapter.js +173 -113
- package/libx/rest/RestRequest.js +3 -2
- package/libx/rest/middleware/create.js +8 -6
- package/libx/rest/middleware/delete.js +6 -13
- package/libx/rest/middleware/error.js +1 -1
- package/libx/rest/middleware/input.js +6 -6
- package/libx/rest/middleware/operation.js +8 -3
- package/libx/rest/middleware/parse.js +3 -3
- package/libx/rest/middleware/payload.js +12 -0
- package/libx/rest/middleware/read.js +12 -2
- package/libx/rest/middleware/update.js +3 -3
- package/package.json +4 -6
- package/server.js +3 -44
- package/srv/extensibility-service.cds +56 -0
- package/srv/extensibility-service.js +1 -0
- package/srv/extensions.cds +8 -0
- package/srv/model-provider.cds +59 -0
- package/srv/model-provider.js +163 -0
- package/srv/mtx.cds +2 -0
- package/srv/mtx.js +22 -0
- package/srv/outbox.cds +2 -0
- package/tasks/enterprise-messaging-deploy.js +19 -12
- package/lib/serve/Service-compat.js +0 -36
- package/libx/_runtime/audit/generic/personal/constants.js +0 -4
- package/libx/_runtime/auth/strategies/dwc.js +0 -45
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/dispatcherUtils.js +0 -56
- package/libx/_runtime/cds-services/adapter/rest/Rest.js +0 -183
- package/libx/_runtime/cds-services/adapter/rest/RestRequest.js +0 -67
- package/libx/_runtime/cds-services/adapter/rest/handlers/create.js +0 -82
- package/libx/_runtime/cds-services/adapter/rest/handlers/delete.js +0 -39
- package/libx/_runtime/cds-services/adapter/rest/handlers/operation.js +0 -63
- package/libx/_runtime/cds-services/adapter/rest/handlers/read.js +0 -52
- package/libx/_runtime/cds-services/adapter/rest/handlers/update.js +0 -81
- package/libx/_runtime/cds-services/adapter/rest/rest-to-cqn/index.js +0 -56
- package/libx/_runtime/cds-services/adapter/rest/rest-to-cqn/utils.js +0 -33
- package/libx/_runtime/cds-services/adapter/rest/to.js +0 -8
- package/libx/_runtime/cds-services/adapter/rest/utils/binary.js +0 -50
- package/libx/_runtime/cds-services/adapter/rest/utils/data.js +0 -117
- package/libx/_runtime/cds-services/adapter/rest/utils/header-checks.js +0 -14
- package/libx/_runtime/cds-services/adapter/rest/utils/key-value-utils.js +0 -30
- package/libx/_runtime/cds-services/adapter/rest/utils/parse-url.js +0 -250
- package/libx/_runtime/cds-services/adapter/rest/utils/result.js +0 -26
- package/libx/_runtime/cds-services/services/utils/handlerUtils.js +0 -200
- package/libx/_runtime/common/aspects/utils.js +0 -152
- package/libx/_runtime/common/toggles/handler.js +0 -21
- package/libx/_runtime/common/utils/extensibilityUtils.js +0 -18
- package/libx/_runtime/extensibility/mps/index.js +0 -5
- package/libx/_runtime/extensibility/mps/service.js +0 -111
- package/libx/_runtime/extensibility/mps/tar.js +0 -42
- package/libx/_runtime/extensibility/mps/utils.js +0 -11
- package/libx/_runtime/extensibility/uiflex/index.js +0 -54
- package/libx/_runtime/extensibility/uiflex/service.js +0 -276
- package/libx/_runtime/messaging/common-utils/naming-conventions.js +0 -20
- package/libx/_runtime/remote/utils/client-types.d.ts +0 -7
- package/libx/gql/GraphQLAdapter.js +0 -33
- package/libx/gql/constants/adapter.js +0 -69
- package/libx/gql/constants/cds.js +0 -18
- package/libx/gql/constants/graphql.js +0 -33
- package/libx/gql/readme.md +0 -1
- package/libx/gql/resolvers/crud/create.js +0 -20
- package/libx/gql/resolvers/crud/delete.js +0 -29
- package/libx/gql/resolvers/crud/index.js +0 -6
- package/libx/gql/resolvers/crud/read.js +0 -30
- package/libx/gql/resolvers/crud/update.js +0 -42
- package/libx/gql/resolvers/crud/utils/index.js +0 -36
- package/libx/gql/resolvers/field.js +0 -5
- package/libx/gql/resolvers/index.js +0 -7
- package/libx/gql/resolvers/mutation.js +0 -23
- package/libx/gql/resolvers/parse/ast/enrich.js +0 -52
- package/libx/gql/resolvers/parse/ast/fragment.js +0 -11
- package/libx/gql/resolvers/parse/ast/fromObject.js +0 -39
- package/libx/gql/resolvers/parse/ast/index.js +0 -3
- package/libx/gql/resolvers/parse/ast/meta.js +0 -4
- package/libx/gql/resolvers/parse/ast/variable.js +0 -7
- package/libx/gql/resolvers/parse/ast2cqn/columns.js +0 -44
- package/libx/gql/resolvers/parse/ast2cqn/entries.js +0 -31
- package/libx/gql/resolvers/parse/ast2cqn/index.js +0 -8
- package/libx/gql/resolvers/parse/ast2cqn/limit.js +0 -6
- package/libx/gql/resolvers/parse/ast2cqn/orderBy.js +0 -24
- package/libx/gql/resolvers/parse/ast2cqn/utils/index.js +0 -3
- package/libx/gql/resolvers/parse/ast2cqn/where.js +0 -70
- package/libx/gql/resolvers/parse/utils/index.js +0 -8
- package/libx/gql/resolvers/query.js +0 -13
- package/libx/gql/resolvers/root.js +0 -34
- package/libx/gql/schema/generate.js +0 -18
- package/libx/gql/schema/index.js +0 -5
- package/libx/gql/schema/mutation.js +0 -76
- package/libx/gql/schema/query.js +0 -108
- package/libx/gql/schema/typeDefMap.js +0 -45
- package/libx/gql/schema/utils/index.js +0 -54
- package/libx/gql/utils/index.js +0 -12
- package/libx/rest/middleware/auth.js +0 -20
- package/libx/rest/middleware/content.js +0 -19
- package/srv/flex.cds +0 -21
- package/srv/flex.js +0 -1
- package/srv/mps.cds +0 -23
- package/srv/mps.js +0 -1
- package/srv/outbox.js +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
|
-
const { hasJavaNature, getProperty } = require('../util')
|
|
4
|
-
const { FILE_EXT_CDS, BUILD_TASK_HANA, BUILD_TASK_FIORI, BUILD_TASK_JAVA, BUILD_TASK_NODE, BUILD_TASK_MTX,
|
|
5
|
-
CDS_CONFIG_PATH_SEP, BUILD_MODE_INPLACE, BUILD_TASK_PREFIX, BUILD_TASKS } = require("../constants")
|
|
3
|
+
const { hasJavaNature, getProperty, isStreamlinedMtx } = require('../util')
|
|
6
4
|
const BuildTaskProvider = require('../buildTaskProvider')
|
|
7
5
|
|
|
6
|
+
const { FILE_EXT_CDS, BUILD_TASK_HANA, BUILD_TASK_FIORI, BUILD_TASK_JAVA, BUILD_TASK_JAVA_CF, BUILD_TASK_NODEJS, BUILD_TASK_NODE_CF, BUILD_TASK_MTX,
|
|
7
|
+
BUILD_TASK_PREFIX, BUILD_TASKS, BUILD_TASK_MTX_SIDECAR, MTX_SIDECAR_FOLDER } = require("../constants")
|
|
8
|
+
|
|
8
9
|
class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
9
10
|
constructor(cds, logger) {
|
|
10
11
|
super()
|
|
@@ -33,8 +34,8 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
33
34
|
return require(`./${BuildTaskProviderInternal._getForValueFromTask(task)}`)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
async lookupTasks(buildOptions) {
|
|
37
|
-
return
|
|
37
|
+
async lookupTasks(tasks, buildOptions) {
|
|
38
|
+
return this._createTasks(tasks, buildOptions, tasks.length > 0)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
async applyTaskDefaults(task) {
|
|
@@ -48,7 +49,9 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
48
49
|
task.src = BuildTaskProviderInternal._normalizePath(this.env.folders.db)
|
|
49
50
|
break
|
|
50
51
|
case BUILD_TASK_JAVA:
|
|
51
|
-
case
|
|
52
|
+
case BUILD_TASK_JAVA_CF:
|
|
53
|
+
case BUILD_TASK_NODEJS:
|
|
54
|
+
case BUILD_TASK_NODE_CF:
|
|
52
55
|
task.src = BuildTaskProviderInternal._normalizePath(this.env.folders.srv)
|
|
53
56
|
break
|
|
54
57
|
case BUILD_TASK_FIORI:
|
|
@@ -57,16 +60,17 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
57
60
|
case BUILD_TASK_MTX:
|
|
58
61
|
task.src = "."
|
|
59
62
|
break
|
|
63
|
+
case BUILD_TASK_MTX_SIDECAR:
|
|
64
|
+
task.src = MTX_SIDECAR_FOLDER
|
|
65
|
+
break
|
|
60
66
|
default:
|
|
61
67
|
throw new Error(`Unknown build task '${task.use || task.for}'`)
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
async _createTasks(buildOptions) {
|
|
67
|
-
this.logger.debug("determining CDS build tasks from CDS configuration - applying defaults")
|
|
72
|
+
async _createTasks(tasks, buildOptions, addRequiredTasks) {
|
|
68
73
|
const { root: projectPath } = buildOptions
|
|
69
|
-
let tasks = []
|
|
70
74
|
let db = typeof this.env.folders.db === "string" ? [BuildTaskProviderInternal._normalizePath(this.env.folders.db)] : this.env.folders.db
|
|
71
75
|
let srv = typeof this.env.folders.srv === "string" ? [BuildTaskProviderInternal._normalizePath(this.env.folders.srv)] : this.env.folders.srv
|
|
72
76
|
|
|
@@ -82,64 +86,62 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
82
86
|
if (Array.isArray(srv) && srv.length > 0) {
|
|
83
87
|
srv = BuildTaskProviderInternal._getModuleFolder(projectPath, srv) || null
|
|
84
88
|
}
|
|
85
|
-
|
|
89
|
+
// create required build tasks
|
|
90
|
+
if (addRequiredTasks) {
|
|
91
|
+
const mtxTask = tasks.find(task => task.for === BUILD_TASK_MTX || task.for === BUILD_TASK_MTX_SIDECAR)
|
|
92
|
+
if (mtxTask) {
|
|
93
|
+
//restore used tasks as they might have been filtered by 'cds build --for mtx'
|
|
94
|
+
if (mtxTask._uses) {
|
|
95
|
+
mtxTask._uses.map(use => use.task).forEach(task => {
|
|
96
|
+
if (!tasks.includes(task)) {
|
|
97
|
+
tasks.push(task)
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
let dbTask = tasks.find(task => task.for === BUILD_TASK_HANA)
|
|
102
|
+
if (!dbTask) {
|
|
103
|
+
// db task might be missing if mtx task is enforced by 'cds build --for mtx'
|
|
104
|
+
dbTask = this._createDbTask(projectPath, db, dbOptions)
|
|
105
|
+
if (dbTask) {
|
|
106
|
+
tasks.push(dbTask)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (dbTask && (!mtxTask._uses || !mtxTask._uses.map(use => use.task).includes(dbTask))) {
|
|
110
|
+
const use = { task: dbTask }
|
|
111
|
+
mtxTask._uses ? mtxTask._uses.push(use) : mtxTask._uses = [use]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
if (!db) {
|
|
116
|
+
this.logger.log(`project doesn't have a database module [${this.env.folders.db}]`)
|
|
117
|
+
}
|
|
118
|
+
if (!srv) {
|
|
119
|
+
this.logger.log(`project doesn't have a service module '${this.env.folders.srv}'`)
|
|
120
|
+
}
|
|
86
121
|
// create hana build task
|
|
87
122
|
const dbTask = this._createDbTask(projectPath, db, dbOptions, buildOptions)
|
|
88
123
|
if (dbTask) {
|
|
89
124
|
tasks.push(dbTask)
|
|
90
125
|
}
|
|
91
|
-
} else {
|
|
92
|
-
this.logger.log(`project doesn't have a database module [${this.env.folders.db}]`)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (srv) {
|
|
96
126
|
// create java or node build task
|
|
97
127
|
const srvTask = this._createSrvTask(projectPath, srv, srvOptions)
|
|
98
128
|
if (srvTask) {
|
|
99
129
|
tasks.push(srvTask)
|
|
100
130
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (this.env.build.mode === BUILD_MODE_INPLACE) {
|
|
104
|
-
// create fiori build tasks
|
|
105
|
-
const defaultModels = this._getDefaultModelOptions(projectPath)
|
|
106
|
-
const fioriSrvOptions = {
|
|
107
|
-
model: [...defaultModels]
|
|
108
|
-
}
|
|
109
|
-
const fioriTasks = this._createFioriTasks(projectPath, fioriSrvOptions)
|
|
110
|
-
if (fioriTasks.length > 0) {
|
|
111
|
-
tasks = tasks.concat(fioriTasks)
|
|
112
|
-
const appDirs = this._getFioriAppModelPaths(fioriTasks, projectPath)
|
|
113
|
-
if (!BuildTaskProviderInternal._appDirsIncluded(defaultModels, appDirs)) {
|
|
114
|
-
// adding additional appDirs, otherwise use default
|
|
115
|
-
// tasks.forEach(task => task.options.model = BuildTaskProviderInternal._pushModelPaths(projectPath, defaultModels, appDirs))
|
|
116
|
-
srvOptions.model = BuildTaskProviderInternal._pushModelPaths(projectPath, defaultModels, appDirs)
|
|
117
|
-
dbOptions.model = BuildTaskProviderInternal._pushModelPaths(projectPath, defaultModels, appDirs)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
this.logger.log(`project doesn't have a service module '${this.env.folders.srv}'`)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// create mtx build task for node applications
|
|
126
|
-
if (db && tasks.find(task => task.for === BUILD_TASK_NODE)) {
|
|
127
|
-
const mtxTask = this._createMtxTask(srv)
|
|
131
|
+
// create mtx build task
|
|
132
|
+
const mtxTask = this._createMtxTask(projectPath, srv, srv, tasks)
|
|
128
133
|
if (mtxTask) {
|
|
129
134
|
tasks.push(mtxTask)
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
|
-
return tasks
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
static _appDirsIncluded(defaultDirs, appDirs) {
|
|
136
|
-
return !appDirs.some(appDir => !defaultDirs.includes(appDir))
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
_createDbTask(projectPath, src, taskOptions, buildOptions) {
|
|
140
140
|
this.logger.debug("determining database kind.")
|
|
141
|
+
if (!src) {
|
|
142
|
+
return null
|
|
143
|
+
}
|
|
141
144
|
let task = null
|
|
142
|
-
|
|
143
145
|
if (this._useHana(projectPath, buildOptions)) {
|
|
144
146
|
this.logger.debug("found HANA database.")
|
|
145
147
|
// legacy build supports dest property
|
|
@@ -149,7 +151,6 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
149
151
|
// compileDest is relative to src folder in modular build - resolve correctly
|
|
150
152
|
taskOptions.compileDest = path.relative(path.resolve(projectPath, src), path.resolve(projectPath, compileDest))
|
|
151
153
|
}
|
|
152
|
-
|
|
153
154
|
task = {
|
|
154
155
|
src: src,
|
|
155
156
|
for: BUILD_TASK_HANA,
|
|
@@ -162,8 +163,7 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
_useHana(projectPath, buildOptions) {
|
|
165
|
-
if (
|
|
166
|
-
|| getProperty(buildOptions, "for.hana.skipManifestGeneration") // deprecated fallback for webide fullstack and mtx
|
|
166
|
+
if (getProperty(buildOptions, "for.hana.skipManifestGeneration") // deprecated fallback for webide fullstack and mtx
|
|
167
167
|
|| getProperty(buildOptions, "for.hana.contentManifest") === false // fallback for webide fullstack and mtx
|
|
168
168
|
|| this.env.get("requires.db.kind") === "hana"
|
|
169
169
|
|| this.env.get("requires.db.dialect") === "hana") {
|
|
@@ -180,151 +180,83 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
180
180
|
return userEnv && (userEnv.get("data.model") || userEnv.get("service.model"))
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
_createMtxTask(
|
|
184
|
-
this.logger.debug("determining single or multi-tenant strategy.")
|
|
183
|
+
_createMtxTask(projectPath, src, dest, tasks) {
|
|
185
184
|
let task = null
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
const isJava = tasks.some(task => task.for === BUILD_TASK_JAVA || task.for === BUILD_TASK_JAVA_CF)
|
|
186
|
+
const isNode = tasks.some(task => task.for === BUILD_TASK_NODEJS || task.for === BUILD_TASK_NODE_CF)
|
|
187
|
+
|
|
188
|
+
this.logger.debug("determining mtx type for nodejs")
|
|
189
|
+
if (isStreamlinedMtx(this.cds) && !isJava) {
|
|
190
|
+
if (this.env.requires["cds.xt.ModelProviderService"]) {
|
|
191
|
+
// sidecar scenario for Nodejs or Java
|
|
192
|
+
const sidecarEnv = this.env.for("cds", path.join(projectPath, MTX_SIDECAR_FOLDER))
|
|
193
|
+
if (this._isSidecar(sidecarEnv)) {
|
|
194
|
+
task = {
|
|
195
|
+
for: BUILD_TASK_MTX_SIDECAR
|
|
196
|
+
}
|
|
197
|
+
this.logger.debug(`${isJava ? "Java" : "Nodejs"} MTX sidecar scenario`)
|
|
198
|
+
} else {
|
|
199
|
+
throw Error(`MTX sidecar module '${MTX_SIDECAR_FOLDER}' not found`)
|
|
200
|
+
}
|
|
201
|
+
} else if (isNode) {
|
|
202
|
+
task = {
|
|
203
|
+
for: BUILD_TASK_MTX,
|
|
204
|
+
src
|
|
205
|
+
}
|
|
206
|
+
this.logger.debug("Nodejs MTX scenario without sidecar")
|
|
207
|
+
}
|
|
208
|
+
} else if (this.env.get("requires.multitenancy") && isNode) {
|
|
209
|
+
// classic mtx
|
|
189
210
|
task = {
|
|
190
211
|
src: ".",
|
|
191
212
|
for: BUILD_TASK_MTX,
|
|
192
|
-
dest
|
|
213
|
+
dest
|
|
193
214
|
}
|
|
194
|
-
|
|
195
|
-
this.logger.debug("found single-tenant app - skipping mtx build task")
|
|
215
|
+
this.logger.debug("classic Nodejs MTX scenario")
|
|
196
216
|
}
|
|
197
217
|
return task
|
|
198
218
|
}
|
|
199
219
|
|
|
200
220
|
_createSrvTask(projectPath, src, taskOptions) {
|
|
201
|
-
this.logger.debug("
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
221
|
+
this.logger.debug("determining implementation technology")
|
|
222
|
+
if (!src) {
|
|
223
|
+
return null
|
|
224
|
+
}
|
|
225
|
+
let task = null
|
|
226
|
+
if (this._hasJavaNature(projectPath, src)) {
|
|
227
|
+
task = this._createJavaTask(projectPath, src, taskOptions)
|
|
228
|
+
} else {
|
|
229
|
+
task = this._createNodeTask(src, taskOptions)
|
|
211
230
|
}
|
|
212
231
|
return task
|
|
213
232
|
}
|
|
214
233
|
|
|
215
234
|
_createJavaTask(projectPath, src, taskOptions) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
taskOptions.compileDest = path.relative(path.resolve(projectPath, src), path.resolve(projectPath, compileDest))
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
src: src,
|
|
226
|
-
for: BUILD_TASK_JAVA,
|
|
227
|
-
options: taskOptions
|
|
228
|
-
}
|
|
235
|
+
this.logger.debug("found implementation technology java")
|
|
236
|
+
// legacy build supports dest property
|
|
237
|
+
const compileDest = this.env.get("service.dest")
|
|
238
|
+
if (compileDest) {
|
|
239
|
+
// compileDest is relative to src folder in modular build - resolve correctly
|
|
240
|
+
taskOptions.compileDest = path.relative(path.resolve(projectPath, src), path.resolve(projectPath, compileDest))
|
|
229
241
|
}
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
* Only used in WebIDE Fullstack szenario
|
|
235
|
-
* @deprecated
|
|
236
|
-
* @param {*} projectPath
|
|
237
|
-
* @param {*} fioriSrvOptions
|
|
238
|
-
* @returns
|
|
239
|
-
*/
|
|
240
|
-
_createFioriTasks(projectPath, fioriSrvOptions) {
|
|
241
|
-
let tasks = []
|
|
242
|
-
this.logger.debug("determining fiori modules - matching modules */webapp/manifest.json")
|
|
243
|
-
// fiori-app build-tasks
|
|
244
|
-
let appDirs = this.env.ui && this.env.ui.apps ? this.env.ui.apps : undefined
|
|
245
|
-
if (!appDirs) {
|
|
246
|
-
const DEFAULT_UI_MANIFEST_PATTERNS = [
|
|
247
|
-
"*/webapp/manifest.json" // top-level UI apps (typical Web IDE layout)
|
|
248
|
-
]
|
|
249
|
-
let app = BuildTaskProviderInternal._normalizePath(this.env.folders.app)
|
|
250
|
-
if (typeof app === "string") {
|
|
251
|
-
DEFAULT_UI_MANIFEST_PATTERNS.push(path.join(app, "*/webapp/manifest.json"))
|
|
252
|
-
} else if (Array.isArray(app)) {
|
|
253
|
-
app.forEach(entry => DEFAULT_UI_MANIFEST_PATTERNS.push(path.join(entry, "*/webapp/manifest.json")))
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const manifestPaths = BuildTaskProviderInternal._findFiles(projectPath, DEFAULT_UI_MANIFEST_PATTERNS)
|
|
257
|
-
|
|
258
|
-
// use '/' for any cds-config path entries
|
|
259
|
-
appDirs = manifestPaths.map(manifestPath => path.relative(projectPath, manifestPath.split("webapp")[0]).replace(/\\/g, CDS_CONFIG_PATH_SEP))
|
|
260
|
-
} else {
|
|
261
|
-
appDirs = appDirs.map(appDir => {
|
|
262
|
-
if (path.basename(appDir) === "webapp") {
|
|
263
|
-
return path.dirname(appDir)
|
|
264
|
-
}
|
|
265
|
-
return appDir
|
|
266
|
-
})
|
|
242
|
+
return {
|
|
243
|
+
src: src,
|
|
244
|
+
for: BUILD_TASK_JAVA,
|
|
245
|
+
options: taskOptions
|
|
267
246
|
}
|
|
268
|
-
this.logger._debug && this.logger.debug(`found fiori app paths [${appDirs}]`)
|
|
269
|
-
appDirs.forEach(appDir => {
|
|
270
|
-
appDir = BuildTaskProviderInternal._normalizePath(appDir)
|
|
271
|
-
let modelPaths = this._resolveModel(path.resolve(projectPath, appDir))
|
|
272
|
-
const newTask = {
|
|
273
|
-
src: appDir,
|
|
274
|
-
for: "fiori",
|
|
275
|
-
options: {
|
|
276
|
-
model: BuildTaskProviderInternal._pushModelPaths(projectPath, fioriSrvOptions.model, modelPaths.length > 0 ? [appDir] : [])
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (!tasks.find((task) => {
|
|
280
|
-
return task.src === newTask.src && task.for === newTask.for
|
|
281
|
-
})) {
|
|
282
|
-
tasks.push(newTask)
|
|
283
|
-
}
|
|
284
|
-
})
|
|
285
|
-
return tasks
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
_getDefaultModelOptions(projectPath) {
|
|
289
|
-
// clear model cache - see https://github.tools.sap/cap/cds/pull/181
|
|
290
|
-
// Required as cds.serve is invoking cds.resolve('*') which caused cds to cache the current model state
|
|
291
|
-
// which in turn screwed-up all subsequent tests - see ./lib/compile/resolve.js#L67 and ./lib/compile/resolve.js#L58
|
|
292
|
-
const fts = this.env.features.folders
|
|
293
|
-
const modelPaths = this.cds.resolve(!fts ? '*' : ['*', fts], false)
|
|
294
|
-
return BuildTaskProviderInternal._pushModelPaths(projectPath, [], modelPaths)
|
|
295
247
|
}
|
|
296
248
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const appRoot = task.src.split(CDS_CONFIG_PATH_SEP)[0]
|
|
305
|
-
let appDir = task.src
|
|
306
|
-
let model = this._resolveModel(path.resolve(projectPath, appRoot))
|
|
307
|
-
if (model.length > 0) {
|
|
308
|
-
// appRoot may contain index.cds file
|
|
309
|
-
appDir = appRoot
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (appDir && !appDirs.find(cur => cur === appDir)) {
|
|
313
|
-
appDirs.push(appDir)
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
})
|
|
317
|
-
return appDirs
|
|
249
|
+
_createNodeTask(src, taskOptions) {
|
|
250
|
+
this.logger.debug("found implementation technology node")
|
|
251
|
+
return {
|
|
252
|
+
src: src,
|
|
253
|
+
for: BUILD_TASK_NODEJS,
|
|
254
|
+
options: taskOptions
|
|
255
|
+
}
|
|
318
256
|
}
|
|
319
257
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
try {
|
|
323
|
-
model = this.cds.resolve(modelPath)
|
|
324
|
-
} catch (e) {
|
|
325
|
-
// silently ignore -> assume no model exists
|
|
326
|
-
}
|
|
327
|
-
return model ? model : []
|
|
258
|
+
_isSidecar(env) {
|
|
259
|
+
return env.requires['cds.xt.ModelProviderService']?.root
|
|
328
260
|
}
|
|
329
261
|
|
|
330
262
|
/**
|
|
@@ -340,69 +272,6 @@ class BuildTaskProviderInternal extends BuildTaskProvider {
|
|
|
340
272
|
return task.for ? task.for : task.use && task.use.substring(BUILD_TASK_PREFIX.length + 1)
|
|
341
273
|
}
|
|
342
274
|
|
|
343
|
-
static _pushModelPaths(projectPath, model, ...modelPaths) {
|
|
344
|
-
model = new Set(model)
|
|
345
|
-
// may contain nested arrays
|
|
346
|
-
modelPaths = BuildTaskProviderInternal._flatten(modelPaths)
|
|
347
|
-
|
|
348
|
-
modelPaths.forEach(m => {
|
|
349
|
-
if (m && !model.has(m) && !model.has(m + "/")) {
|
|
350
|
-
const dir = path.resolve(projectPath, m)
|
|
351
|
-
if (fs.existsSync(dir)) {
|
|
352
|
-
model.add(BuildTaskProviderInternal._normalizePath(m))
|
|
353
|
-
} else if (fs.existsSync(dir + FILE_EXT_CDS)) { //might be cds file name, compability to old build configs
|
|
354
|
-
model.add(m)
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
return [...model]
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
static _flatten(modelPaths) {
|
|
362
|
-
return modelPaths.reduce((acc, m) => {
|
|
363
|
-
if (Array.isArray(m)) {
|
|
364
|
-
acc = acc.concat(BuildTaskProviderInternal._flatten(m))
|
|
365
|
-
} else if (m) {
|
|
366
|
-
acc.push(m)
|
|
367
|
-
}
|
|
368
|
-
return acc
|
|
369
|
-
}, [])
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
static _strippedPath(p) {
|
|
373
|
-
return p.replace(/^(\/|\\)/, '').replace(/(\/|\\)$/, '') // strip leading and trailing slash or backslash
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
static _readDirs(dir) {
|
|
377
|
-
if (!fs.existsSync(dir) || !fs.lstatSync(dir).isDirectory()) return []
|
|
378
|
-
return fs.readdirSync(dir)
|
|
379
|
-
.map(f => path.resolve(dir, f))
|
|
380
|
-
.filter(f => fs.lstatSync(f).isDirectory())
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
static _findFiles(projectPath, patterns) {
|
|
384
|
-
const files = []
|
|
385
|
-
patterns.forEach(pattern => {
|
|
386
|
-
const starIndex = pattern.indexOf('*')
|
|
387
|
-
if (starIndex >= 0) {
|
|
388
|
-
const dir = path.resolve(projectPath, pattern.substring(0, starIndex))
|
|
389
|
-
const subPattern = BuildTaskProviderInternal._strippedPath(pattern.substring(starIndex + 1, pattern.length)) // '*/foo/bar/' -> 'foo/bar'
|
|
390
|
-
files.push(...BuildTaskProviderInternal._readDirs(dir).map(subDir => BuildTaskProviderInternal._findFiles(subDir, [subPattern])))
|
|
391
|
-
} else {
|
|
392
|
-
const file = path.resolve(projectPath, pattern)
|
|
393
|
-
if (fs.existsSync(file)) files.push(file)
|
|
394
|
-
}
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
function _flatten(o, arr = []) {
|
|
398
|
-
if (o) {
|
|
399
|
-
Array.isArray(o) ? o.forEach(e => _flatten(e, arr)) : arr.push(o)
|
|
400
|
-
}
|
|
401
|
-
return arr
|
|
402
|
-
}
|
|
403
|
-
return _flatten(files)
|
|
404
|
-
}
|
|
405
|
-
|
|
406
275
|
/**
|
|
407
276
|
* For valid paths remove trailing '/'. Otherwise return as is - important!!
|
|
408
277
|
* @param {*} dir
|
|
@@ -3,7 +3,7 @@ const BuildTaskHandlerEdmx = require('../buildTaskHandlerEdmx')
|
|
|
3
3
|
const URL = require('url')
|
|
4
4
|
const { getProperty, isOldJavaStack, relativePaths } = require('../../util')
|
|
5
5
|
|
|
6
|
-
const { ODATA_VERSION, ODATA_VERSION_V2, BUILD_OPTION_OUTPUT_MODE, OUTPUT_MODE_RESULT_ONLY, BUILD_TASK_FIORI,
|
|
6
|
+
const { ODATA_VERSION, ODATA_VERSION_V2, BUILD_OPTION_OUTPUT_MODE, OUTPUT_MODE_RESULT_ONLY, BUILD_TASK_FIORI, BUILD_TASK_JAVA_CF, CDS_CONFIG_PATH_SEP, BUILD_TASK_JAVA } = require('../../constants')
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* With cds 4 service metadata for the UI service binding is no longer created by default.
|
|
@@ -47,7 +47,7 @@ class FioriAppModuleBuilder extends BuildTaskHandlerEdmx {
|
|
|
47
47
|
const edmxOptions = { version: this.env.get(ODATA_VERSION) }
|
|
48
48
|
|
|
49
49
|
if (edmxOptions.version !== ODATA_VERSION_V2) {
|
|
50
|
-
const javaTask = this.buildOptions.tasks.find(task => task.for === BUILD_TASK_JAVA)
|
|
50
|
+
const javaTask = this.buildOptions.tasks.find(task => task.for === BUILD_TASK_JAVA_CF || task.for === BUILD_TASK_JAVA)
|
|
51
51
|
|
|
52
52
|
if (javaTask
|
|
53
53
|
&& await isOldJavaStack([javaTask.src, this.buildOptions.root])
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const parser = require('./migrationtable')
|
|
3
|
-
const {
|
|
4
|
-
const { getArtifactCdsPersistenceName } = require('@sap/cds-compiler')
|
|
3
|
+
const { BuildError } = require('../../util')
|
|
5
4
|
const { LOG_MODULE_NAMES } = require('../../constants')
|
|
6
|
-
const cdscVersion = `-- generated by cds-compiler version ${require('@sap/cds-compiler/package.json').version}`
|
|
7
5
|
const cds = require('../../cds'), { compiler: cdsc } = cds
|
|
6
|
+
const cdscVersion = `-- generated by cds-compiler version ${cdsc.version()}`
|
|
7
|
+
const { getArtifactCdsPersistenceName } = cdsc
|
|
8
8
|
let logger = cds.log(LOG_MODULE_NAMES)
|
|
9
9
|
|
|
10
10
|
module.exports = async (model, lastDevVersion, srcPath, options = {}) => {
|
|
@@ -22,7 +22,7 @@ module.exports = async (model, lastDevVersion, srcPath, options = {}) => {
|
|
|
22
22
|
if (suffix === '.hdbtable') {
|
|
23
23
|
if (journalFileNames.has(name)) {
|
|
24
24
|
const migration = migrations.find(migration => migration.name === name)
|
|
25
|
-
definitionEntry = await _2migrationtable(srcPath, migration || _emptyMigration(name), sql
|
|
25
|
+
definitionEntry = await _2migrationtable(srcPath, migration || _emptyMigration(name), sql)
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (definitionEntry) {
|
|
@@ -58,10 +58,9 @@ ${migration ? migration.changeset.map(change => change.sql).join('\n') : 'Empty
|
|
|
58
58
|
* @param {String} srcPath Fully quailified path of the directory containing .hdbmigrationtable files
|
|
59
59
|
* @param {String} migration the migration descriptor
|
|
60
60
|
* @param {String} tableSql SQL TABLE definition
|
|
61
|
-
* @param {Object} options compile options
|
|
62
61
|
* @returns {Object} Providing access to 'content' and 'fileName'.
|
|
63
62
|
*/
|
|
64
|
-
async function _2migrationtable(srcPath, migration, tableSql
|
|
63
|
+
async function _2migrationtable(srcPath, migration, tableSql) {
|
|
65
64
|
let migrationTableModel = null
|
|
66
65
|
const file = path.join(srcPath, migration.name + migration.suffix)
|
|
67
66
|
try {
|
|
@@ -73,10 +72,11 @@ async function _2migrationtable(srcPath, migration, tableSql, options) {
|
|
|
73
72
|
|
|
74
73
|
if (migrationTableModel) {
|
|
75
74
|
// adding new changeset if change exist, ignore otherwise
|
|
76
|
-
const migrationEntry = _getNewMigrationEntry(migration.changeset, migrationTableModel.versionNumber
|
|
75
|
+
const migrationEntry = _getNewMigrationEntry(migration.changeset, migrationTableModel.versionNumber)
|
|
77
76
|
if (migrationEntry) {
|
|
78
77
|
const versionNumber = migrationTableModel.versionNumber + 1
|
|
79
|
-
const
|
|
78
|
+
const migrationCount = migrationTableModel.migrations.entries.length
|
|
79
|
+
const migrations = `${migrationEntry.content}${migrationCount > 0 ? '\n' : ''}${migrationTableModel.migrations.toString()}${migrationCount > 0 ? '\n' : ''}`
|
|
80
80
|
return {
|
|
81
81
|
name: migration.name,
|
|
82
82
|
suffix: migration.suffix,
|
|
@@ -90,10 +90,10 @@ async function _2migrationtable(srcPath, migration, tableSql, options) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
// initial migration file version
|
|
93
|
-
return { name: migration.name, suffix: migration.suffix, content: `== version=1\n${tableSql}`, changed: true }
|
|
93
|
+
return { name: migration.name, suffix: migration.suffix, content: `== version=1\n${tableSql}\n`, changed: true }
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
function _getNewMigrationEntry(changeset, currentVersion
|
|
96
|
+
function _getNewMigrationEntry(changeset, currentVersion) {
|
|
97
97
|
if (changeset && changeset.length > 0) {
|
|
98
98
|
const dropColumns = changeset.some(e => e.drop)
|
|
99
99
|
const manualChange = changeset.some(e => !e.sql)
|
|
@@ -144,7 +144,7 @@ function _getJournalFileNames(model) {
|
|
|
144
144
|
return true
|
|
145
145
|
}
|
|
146
146
|
return false
|
|
147
|
-
}).map(entity => getArtifactCdsPersistenceName(entity.name, 'quoted', model)))
|
|
147
|
+
}).map(entity => getArtifactCdsPersistenceName(entity.name, 'quoted', model, 'hana')))
|
|
148
148
|
|
|
149
149
|
logger._debug && logger.debug(`\n[hdbmigrationtable] found ${journalNames.size} model entities annotated with '@cds.persistence.journal`)
|
|
150
150
|
logger._debug && logger.debug(`[hdbmigrationtable] ${[...journalNames].join(', ')}\n`)
|
|
@@ -40,7 +40,7 @@ async function _tabledata4(dir, csvFile, model, baseDir, naming) {
|
|
|
40
40
|
return logger.warn(`[hdbtabledata] ${message}`)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const tableName = getArtifactCdsPersistenceName(entity.name, naming, model)
|
|
43
|
+
const tableName = getArtifactCdsPersistenceName(entity.name, naming, model, 'hana')
|
|
44
44
|
const tabledata = { format_version: 1, imports: [] }
|
|
45
45
|
const _import = {
|
|
46
46
|
target_table: tableName,
|
|
@@ -57,7 +57,7 @@ async function _tabledata4(dir, csvFile, model, baseDir, naming) {
|
|
|
57
57
|
cols.forEach(csvCol => {
|
|
58
58
|
// Only translate the column name, but do not check for the existence of the element in the model.
|
|
59
59
|
// This gets tricky for foreign key elements, and the DB deployment anyways checks the column.
|
|
60
|
-
const tableCol = getElementCdsPersistenceName(csvCol, naming)
|
|
60
|
+
const tableCol = getElementCdsPersistenceName(csvCol, naming, 'hana')
|
|
61
61
|
_import.import_settings.import_columns.push(tableCol)
|
|
62
62
|
_import.column_mappings[tableCol] = csvCol
|
|
63
63
|
})
|
|
@@ -68,7 +68,7 @@ async function _tabledata4(dir, csvFile, model, baseDir, naming) {
|
|
|
68
68
|
if (entity.elements.locale) {
|
|
69
69
|
const locale = /_texts_(.+)\.csv$/.test(csvFile) ? RegExp.$1 : null
|
|
70
70
|
if (locale) {
|
|
71
|
-
const localeKey = getElementCdsPersistenceName(entity.elements.locale.name/*usually 'LOCALE'*/, naming)
|
|
71
|
+
const localeKey = getElementCdsPersistenceName(entity.elements.locale.name/*usually 'LOCALE'*/, naming, 'hana');
|
|
72
72
|
_import.import_settings.include_filter.push({ [localeKey]: locale })
|
|
73
73
|
}
|
|
74
74
|
}
|