@sap/cds-dk 10.0.6 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +10 -0
- package/bin/build.js +20 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +15 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +592 -80
- package/bin/completion/scripts/cds.fish +568 -0
- package/bin/completion/scripts/cds.ps1 +329 -0
- package/bin/completion/scripts/cds.sh +261 -0
- package/bin/completion/scripts/cds.zsh +230 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +208 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +7 -1
- package/bin/deploy/options.js +25 -0
- package/{lib → bin}/deploy/to-hana/hana.js +8 -8
- package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
- package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
- package/bin/deploy/to-sql.js +0 -2
- package/bin/export.js +35 -5
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +6 -0
- package/bin/init.js +5 -24
- package/bin/inspect.js +6 -0
- package/bin/login.js +26 -20
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/up.js +14 -11
- package/{lib → bin}/upgrade/constants.js +1 -1
- package/bin/{upgrade.js → upgrade/index.js} +2 -2
- package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
- package/{lib → bin}/upgrade/preflight/index.js +1 -1
- package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
- package/{lib → bin}/upgrade/steps/install.js +1 -1
- package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/removals.js +1 -1
- package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/verify.js +1 -1
- package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
- package/{lib → bin}/upgrade/util/pom.js +2 -2
- package/{lib → bin}/upgrade/util/prompt.js +1 -1
- package/bin/util/containerize.js +8 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +17 -9
- package/{lib → bin}/watch/livereload-connect.js +1 -1
- package/{lib → bin}/watch/vite-watch.js +1 -1
- package/{lib → bin}/watch/watched.js +2 -2
- package/lib/build/constants.js +1 -1
- package/lib/build/plugins/fiori/index.js +31 -2
- package/lib/build/plugins/internal.js +4 -2
- package/lib/build/plugins/mtx-sidecar/index.js +7 -8
- package/lib/build/plugins/nodejs/index.js +64 -7
- package/lib/compile/to_asyncapi.js +1 -1
- package/lib/env/schema.js +16 -0
- package/lib/env/schemas/cds-rc.js +1 -76
- package/lib/import/importapi.js +2 -3
- package/lib/import/message.js +0 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +2 -2
- package/lib/init/merge.js +123 -280
- package/lib/init/plugin.js +3 -1
- package/lib/init/projectReader.js +22 -6
- package/lib/init/registries/xs-app.js +3 -5
- package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ai/index.js +14 -2
- package/lib/init/template/ams/index.js +2 -2
- package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/app-frontend/index.js +4 -4
- package/lib/init/template/application-logging/index.js +2 -2
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/index.js +8 -3
- package/lib/init/template/attachments/files/package.json.hbs +1 -1
- package/lib/init/template/attachments/index.js +2 -2
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
- package/lib/init/template/cloud-logging/index.js +2 -2
- package/lib/init/template/completion/completionSetup.js +36 -39
- package/lib/init/template/connectivity/index.js +2 -2
- package/lib/init/template/data/as-csv.js +15 -5
- package/lib/init/template/data/as-json.js +114 -42
- package/lib/init/template/data/index.js +16 -2
- package/lib/init/template/destination/index.js +2 -2
- package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
- package/lib/init/template/dynatrace/index.js +2 -2
- package/lib/init/template/enterprise-messaging/index.js +2 -2
- package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
- package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
- package/lib/init/template/extensibility/index.js +3 -3
- package/lib/init/template/github-actions/index.js +2 -2
- package/lib/init/template/hana/index.js +3 -2
- package/lib/init/template/hana-serverless/files/db/package.json +14 -0
- package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
- package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
- package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
- package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
- package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
- package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
- package/lib/init/template/hana-serverless/index.js +184 -0
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
- package/lib/init/template/html5-repo/index.js +18 -14
- package/lib/init/template/http/index.js +123 -26
- package/lib/init/template/ias/index.js +2 -2
- package/lib/init/template/kafka/index.js +2 -2
- package/lib/init/template/kyma/index.js +7 -5
- package/lib/init/template/malware-scanner/index.js +2 -2
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -3
- package/lib/init/template/nodejs/index.js +4 -2
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
- package/lib/init/template/portal/index.js +13 -8
- package/lib/init/template/postgres/index.js +2 -2
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/sample/files/db/currencies.cds +2 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
- package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
- package/lib/init/template/workzone-standard/index.js +5 -5
- package/lib/init/template/xsuaa/index.js +20 -2
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/auth_manager.js +103 -37
- package/lib/mtx/params.js +3 -2
- package/lib/mtx/settings_manager.js +45 -28
- package/lib/mtx/tenant_action.js +0 -1
- package/lib/mtx/util/credentials.js +62 -0
- package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
- package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
- package/node_modules/@cap-js/openapi/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +64 -0
- package/node_modules/@sap/cds/app/index.js +5 -4
- package/node_modules/@sap/cds/eslint.config.mjs +1 -0
- package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
- package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
- package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
- package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
- package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
- package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
- package/node_modules/@sap/cds/lib/plugins.js +9 -5
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
- package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
- package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
- package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
- package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
- package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
- package/node_modules/@sap/cds/libx/http/location.js +3 -3
- package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
- package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
- package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
- package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
- package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
- package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
- package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
- package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
- package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
- package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
- package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
- package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
- package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
- package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
- package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
- package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
- package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
- package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
- package/node_modules/@sap/xsenv/package.json +10 -7
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
- package/node_modules/hdb/lib/protocol/Connection.js +1 -0
- package/node_modules/hdb/package.json +3 -2
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/negotiator/package.json +16 -10
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/sax/lib/sax.js +27 -9
- package/node_modules/sax/package.json +1 -1
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +5 -5
- package/bin/completion/scripts/cds-bash.sh +0 -20
- package/bin/completion/scripts/cds-fish.fish +0 -13
- package/bin/completion/scripts/cds-ps.ps1 +0 -19
- package/bin/completion/scripts/cds-zsh.sh +0 -13
- package/lib/deploy/index.js +0 -25
- package/lib/import/asyncapi/importAsyncAPI.js +0 -33
- package/lib/import/asyncapi/index.js +0 -18
- package/lib/import/asyncapi/parserContext.js +0 -372
- package/lib/import/asyncapi/utils.js +0 -49
- package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
- package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
- package/node_modules/negotiator/HISTORY.md +0 -114
- /package/{lib → bin}/upgrade/context.js +0 -0
- /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
- /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
- /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
- /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
- /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
- /package/{lib → bin}/watch/livereload-server.js +0 -0
- /package/{lib → bin}/watch/node-watch.js +0 -0
- /package/{lib → bin}/watch/open.js +0 -0
- /package/{lib → bin}/watch/watcher.js +0 -0
|
@@ -167,7 +167,9 @@ class PerMessageDeflate {
|
|
|
167
167
|
(typeof opts.serverMaxWindowBits === 'number' &&
|
|
168
168
|
opts.serverMaxWindowBits > params.server_max_window_bits))) ||
|
|
169
169
|
(typeof opts.clientMaxWindowBits === 'number' &&
|
|
170
|
-
|
|
170
|
+
(typeof params.client_max_window_bits === 'number'
|
|
171
|
+
? opts.clientMaxWindowBits > params.client_max_window_bits
|
|
172
|
+
: !params.client_max_window_bits))
|
|
171
173
|
) {
|
|
172
174
|
return false;
|
|
173
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-dk",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
|
|
5
5
|
"homepage": "https://cap.cloud.sap/",
|
|
6
6
|
"keywords": [
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "lib/index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cap-js/asyncapi": "^1.
|
|
20
|
+
"@cap-js/asyncapi": "^1.1.0",
|
|
21
21
|
"@cap-js/openapi": "^1.0.0",
|
|
22
22
|
"@cap-js/sqlite": "^3",
|
|
23
|
-
"@sap/cds": "
|
|
24
|
-
"@sap/cds-mtxs": "
|
|
23
|
+
"@sap/cds": "^10",
|
|
24
|
+
"@sap/cds-mtxs": "4.0.3",
|
|
25
25
|
"@sap/hdi-deploy": "^5",
|
|
26
|
-
"express": "^
|
|
26
|
+
"express": "^5",
|
|
27
27
|
"hdb": "^2.0.0",
|
|
28
28
|
"livereload-js": "^4.0.1",
|
|
29
29
|
"mustache": "^4.0.1",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
CDS_COMMAND="cds"
|
|
4
|
-
|
|
5
|
-
_completeCds()
|
|
6
|
-
{
|
|
7
|
-
local current options previous
|
|
8
|
-
COMPREPLY=()
|
|
9
|
-
current="${COMP_WORDS[COMP_CWORD]}"
|
|
10
|
-
previous="${COMP_WORDS[COMP_CWORD - 1]}"
|
|
11
|
-
|
|
12
|
-
# double quoting needed to avoid word 'h' to be recognized as command shortcut 'help'
|
|
13
|
-
options=$($CDS_COMMAND completion --shell bash --prev "'$previous'" --curr "'$current'" --line "'${COMP_WORDS[*]}'")
|
|
14
|
-
|
|
15
|
-
COMPREPLY=( $(compgen -W "${options}" -- ${current}) )
|
|
16
|
-
compopt -o nosort -o nospace
|
|
17
|
-
return 0
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
complete -F _completeCds $CDS_COMMAND
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/bin/fish
|
|
2
|
-
|
|
3
|
-
set CDS_COMMAND "cds"
|
|
4
|
-
function _completeCds
|
|
5
|
-
set -l line (commandline -cp)
|
|
6
|
-
set -l words (string split " " -- $line)
|
|
7
|
-
|
|
8
|
-
# double quoting needed to avoid word 'h' to be recognized as command shortcut 'help'
|
|
9
|
-
echo ($CDS_COMMAND completion --shell fish --prev "'$words[-2]'" --curr "'$words[-1]'" --line "'$line'")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# split into string array so result is not interpreted as single string
|
|
13
|
-
complete -c $CDS_COMMAND --no-files --keep-order --arguments "(_completeCds | string split ' ')"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
$COMMAND = "cds"
|
|
2
|
-
|
|
3
|
-
Register-ArgumentCompleter -Native -CommandName $COMMAND -ScriptBlock {
|
|
4
|
-
param($wordToComplete, $commandAst, $cursorPosition)
|
|
5
|
-
|
|
6
|
-
$cmdSegments = $commandAst.CommandElements
|
|
7
|
-
$idx = $cmdSegments.IndexOf(($cmdSegments | Where-Object { $_.Extent.Text -eq $wordToComplete }))
|
|
8
|
-
if ($idx -gt 0) {
|
|
9
|
-
$previousWord = $cmdSegments[$idx - 1].Extent.Text
|
|
10
|
-
} else {
|
|
11
|
-
$previousWord = $cmdSegments[$cmdSegments.Count - 1].Extent.Text
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
# double quoting needed to avoid word 'h' to be recognized as command shortcut 'help'
|
|
15
|
-
$options = & $COMMAND completion --shell ps --prev "'$previousWord'" --curr "'$wordToComplete'" --line "'$commandAst'"
|
|
16
|
-
foreach ($option in $options) {
|
|
17
|
-
[System.Management.Automation.CompletionResult]::new($option, $option, 'ParameterValue', $option)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/bin/zsh
|
|
2
|
-
|
|
3
|
-
# compinit is required but added to ~/.zshrc so user can remove it if it is already loaded
|
|
4
|
-
# autoload -Uz compinit && compinit
|
|
5
|
-
|
|
6
|
-
CDS_COMMAND="cds"
|
|
7
|
-
|
|
8
|
-
_completeCds() {
|
|
9
|
-
# double quoting needed to avoid word 'h' to be recognized as command shortcut 'help'
|
|
10
|
-
compadd -S '' -V 'force no sort' -- `${CDS_COMMAND} completion --shell zsh --prev "'${words[CURRENT-1]}'" --curr "'${words[CURRENT]}'" --line "'${words}'"`
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
compdef _completeCds ${CDS_COMMAND}
|
package/lib/deploy/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
options: /** @type{const} */([
|
|
3
|
-
'--to',
|
|
4
|
-
'--for',
|
|
5
|
-
'--out',
|
|
6
|
-
'--on',
|
|
7
|
-
'--tunnel-address',
|
|
8
|
-
'--vcap-file',
|
|
9
|
-
'--delta-from'
|
|
10
|
-
]),
|
|
11
|
-
flags: /** @type{const} */([
|
|
12
|
-
'--resolve-bindings',
|
|
13
|
-
'--no-save',
|
|
14
|
-
'--auto-undeploy',
|
|
15
|
-
'--dry',
|
|
16
|
-
'--xdry',
|
|
17
|
-
'--with-mocks',
|
|
18
|
-
'--store-credentials',
|
|
19
|
-
'--no-build',
|
|
20
|
-
'--model-only',
|
|
21
|
-
'--script',
|
|
22
|
-
'--with-auto-schema-evolution'
|
|
23
|
-
]),
|
|
24
|
-
shortcuts: ['-2', '-4', '-o', '-n', '', '', '', '-b']
|
|
25
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const ParserContext = require("./parserContext");
|
|
2
|
-
const cdsDkVersion = require("../../../package.json").version;
|
|
3
|
-
|
|
4
|
-
function importAsyncAPI(input) {
|
|
5
|
-
const context = new ParserContext(input);
|
|
6
|
-
return convertToCSN(context);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function convertToCSN(context) {
|
|
10
|
-
const csn = {
|
|
11
|
-
meta: {
|
|
12
|
-
creator: `cds-dk ${cdsDkVersion}`
|
|
13
|
-
},
|
|
14
|
-
$version: '2.0',
|
|
15
|
-
definitions: {}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Object.entries(context.services).forEach(([key, value]) => {
|
|
19
|
-
const events = value.events;
|
|
20
|
-
const types = value.types;
|
|
21
|
-
delete value.events;
|
|
22
|
-
delete value.types;
|
|
23
|
-
|
|
24
|
-
csn.definitions[key] = value;
|
|
25
|
-
Object.assign(csn.definitions, events, types);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return csn;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = {
|
|
32
|
-
importAsyncAPI
|
|
33
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const { importAsyncAPI } = require("./importAsyncAPI");
|
|
2
|
-
const { validateAsyncAPI } = require('./utils');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The starting function for conversion of AsyncAPI document to csn
|
|
6
|
-
* @returns AsyncAPI document
|
|
7
|
-
*/
|
|
8
|
-
function asyncapi2csn(source) {
|
|
9
|
-
// validate asyncapi document
|
|
10
|
-
const content = JSON.parse(source);
|
|
11
|
-
validateAsyncAPI(content);
|
|
12
|
-
|
|
13
|
-
return importAsyncAPI(content);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
asyncapi2csn
|
|
18
|
-
}
|
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
const { getRegExpGroups } = require('./utils');
|
|
2
|
-
const messages = require("../message").getMessages();
|
|
3
|
-
|
|
4
|
-
module.exports = class ParserContext {
|
|
5
|
-
/**
|
|
6
|
-
* @constructor
|
|
7
|
-
*/
|
|
8
|
-
constructor(content) {
|
|
9
|
-
this.services = this.getServicesFromContent(content);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
getTopicName(eventName) {
|
|
13
|
-
return eventName.startsWith('ce/') ? eventName.substring(3) : eventName;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getEventName(messageRefString) {
|
|
17
|
-
const lastSlashIndex = messageRefString.lastIndexOf('/');
|
|
18
|
-
return lastSlashIndex == -1 ? '' : messageRefString.substring(lastSlashIndex + 1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns services from the asyncapi json object along with the events and annotations.
|
|
23
|
-
* @returns an object with all the services.
|
|
24
|
-
*/
|
|
25
|
-
getServicesFromContent(content) {
|
|
26
|
-
const services = {};
|
|
27
|
-
const serviceAnnotations = this.getServiceAnnotations(content);
|
|
28
|
-
|
|
29
|
-
Object.entries(content.components.messages).forEach(([, value]) => {
|
|
30
|
-
let eventName;
|
|
31
|
-
// Message name should be used to capture the event name
|
|
32
|
-
if (value.name) {
|
|
33
|
-
eventName = value.name;
|
|
34
|
-
} else {
|
|
35
|
-
throw new Error(messages.INVALID_ASYNCAPI_FILE);
|
|
36
|
-
}
|
|
37
|
-
// uses regex to break event name in different components
|
|
38
|
-
const regExpGroups = getRegExpGroups(eventName);
|
|
39
|
-
const service = regExpGroups[1] + "." + regExpGroups[2];
|
|
40
|
-
const event = regExpGroups[0];
|
|
41
|
-
|
|
42
|
-
// add service to services entry if not present
|
|
43
|
-
if (!(service in services)) {
|
|
44
|
-
services[service] = { 'kind': 'service', '@cds.external': 'true', ...serviceAnnotations, 'events': {}, 'types': {} };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// add event entry to service
|
|
48
|
-
const eventAnnotations = this.getEventAnnotations(value);
|
|
49
|
-
|
|
50
|
-
// add topic annotation
|
|
51
|
-
eventAnnotations['@topic'] = this.getTopicName(eventName);
|
|
52
|
-
let properties = {};
|
|
53
|
-
let types = {};
|
|
54
|
-
|
|
55
|
-
if (value.payload) {
|
|
56
|
-
// gets the schema being referred to in the event
|
|
57
|
-
const eventSchema = this.resolveRef(content, value.payload);
|
|
58
|
-
[properties, types] = this.getPropertiesAndTypes(event, eventSchema);
|
|
59
|
-
}
|
|
60
|
-
services[service].types = types;
|
|
61
|
-
services[service].events[event] = { 'kind': 'event', '@cds.external': 'true', ...eventAnnotations, elements: properties };
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return services;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Returns annotations of a particular service.
|
|
69
|
-
* @returns an object with all the annotations as key value pairs.
|
|
70
|
-
*/
|
|
71
|
-
getServiceAnnotations(content) {
|
|
72
|
-
const serviceAnnotationsMapping = {
|
|
73
|
-
'x-sap-stateInfo': 'StateInfo', // expected: object
|
|
74
|
-
'x-sap-shortText': 'ShortText' // expected: string
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const infoAnnotationsMapping = {
|
|
78
|
-
'title': 'Title', // expected: string
|
|
79
|
-
'version': 'SchemaVersion', // expected: string
|
|
80
|
-
'description': 'Description' // expected: string
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const annotations = this.getAnnotations(content, serviceAnnotationsMapping);
|
|
84
|
-
|
|
85
|
-
if (content.info) {
|
|
86
|
-
for (const [key, value] of Object.entries(infoAnnotationsMapping)) {
|
|
87
|
-
if (content.info[key] && !(content.info[key] instanceof Object)) {
|
|
88
|
-
// info values will always be in string format
|
|
89
|
-
annotations['@AsyncAPI.' + value] = content.info[key];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return annotations;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns annotations of a particular event. Here the parameter content is event content.
|
|
99
|
-
* @returns an object with all the annotations as key value pairs.
|
|
100
|
-
*/
|
|
101
|
-
getEventAnnotations(content) {
|
|
102
|
-
const eventLevelAnnotationsMapping = {
|
|
103
|
-
'x-sap-event-spec-version': 'EventSpecVersion', // expected: string
|
|
104
|
-
'x-sap-event-source': 'EventSource', // expected: string
|
|
105
|
-
'x-sap-event-version': 'EventSchemaVersion', // expected: string
|
|
106
|
-
'x-sap-event-source-parameters': 'EventSourceParams', // expected: object
|
|
107
|
-
'x-sap-event-characteristics': 'EventCharacteristics', // expected: object
|
|
108
|
-
'x-sap-stateInfo': 'EventStateInfo' // expected: object
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const annotations = this.getAnnotations(content, eventLevelAnnotationsMapping);
|
|
112
|
-
|
|
113
|
-
return annotations;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Returns validity of the annotation value. Here the parameter
|
|
118
|
-
* content is the annotation name and value of the annotation.
|
|
119
|
-
* @returns true/false depending on the annotation value.
|
|
120
|
-
*/
|
|
121
|
-
isValidAnnotationValue(annotation, value) {
|
|
122
|
-
const objectTypeAnnotations = ['StateInfo', 'EventSourceParams', 'EventCharacteristics', 'EventStateInfo'];
|
|
123
|
-
// if the value is an array or null
|
|
124
|
-
if (Array.isArray(value) || value === null) return false;
|
|
125
|
-
|
|
126
|
-
if (objectTypeAnnotations.includes(annotation) && (value instanceof Object)) {
|
|
127
|
-
return true;
|
|
128
|
-
} else if ((!objectTypeAnnotations.includes(annotation)) && (typeof value === 'string')) {
|
|
129
|
-
return true;
|
|
130
|
-
} else {
|
|
131
|
-
console.warn(`WARNING: Annotations which are not following the expected type are omitted.`);
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Returns annotations for an event/service. Here the parameter content
|
|
138
|
-
* is event/service content along with the corresponding mapping.
|
|
139
|
-
* @returns an object with the annotations as key value pairs.
|
|
140
|
-
*/
|
|
141
|
-
getAnnotations(content, annotationsMapping) {
|
|
142
|
-
const annotations = {};
|
|
143
|
-
|
|
144
|
-
for (const [key, value] of Object.entries(content)) {
|
|
145
|
-
// case: known annotation
|
|
146
|
-
if (annotationsMapping[key] && this.isValidAnnotationValue(annotationsMapping[key], value)) {
|
|
147
|
-
annotations['@AsyncAPI.' + annotationsMapping[key]] = value;
|
|
148
|
-
}
|
|
149
|
-
// case: unkown annotation
|
|
150
|
-
else if (key.startsWith('x-')) {
|
|
151
|
-
if (!annotations['@AsyncAPI.Extensions']) {
|
|
152
|
-
annotations['@AsyncAPI.Extensions'] = {};
|
|
153
|
-
}
|
|
154
|
-
// removes x- from the element
|
|
155
|
-
annotations['@AsyncAPI.Extensions'][key.substring(2)] = value;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return annotations;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Returns the referred schema. Here the content is the asyncapi
|
|
164
|
-
* document and payloadObject is the reference path
|
|
165
|
-
* @returns an object with the referred schema.
|
|
166
|
-
*/
|
|
167
|
-
resolveRef(content, payloadObject) {
|
|
168
|
-
let schema = {};
|
|
169
|
-
|
|
170
|
-
if (payloadObject['$ref']) {
|
|
171
|
-
const pathArray = payloadObject['$ref'].split('/');
|
|
172
|
-
pathArray.forEach((value) => {
|
|
173
|
-
if (value === '#') schema = content;
|
|
174
|
-
else if (schema[value]) schema = schema[value];
|
|
175
|
-
// in case path doesn't exist in the file
|
|
176
|
-
else schema = {};
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (!Object.keys(schema).length) {
|
|
180
|
-
console.warn(`WARNING: Unable to resolve ref path: ` + payloadObject['$ref']);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
else if (payloadObject instanceof Object) {
|
|
184
|
-
// in case ref is not there and schema object is there
|
|
185
|
-
schema = payloadObject;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return schema;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Returns the properties and types generated, related to an event.
|
|
193
|
-
* @returns a properties object and a types object.
|
|
194
|
-
*/
|
|
195
|
-
getPropertiesAndTypes(eventName, content) {
|
|
196
|
-
const properties = {};
|
|
197
|
-
let types = {};
|
|
198
|
-
|
|
199
|
-
if (content.properties) {
|
|
200
|
-
for (const [key, value] of Object.entries(content.properties)) {
|
|
201
|
-
// will contain type objects generated for a property
|
|
202
|
-
let referredTypes = {};
|
|
203
|
-
let isRequired = false;
|
|
204
|
-
if (content['required']?.includes(key)) isRequired = true;
|
|
205
|
-
[properties[key], referredTypes] = this.parseProperty(eventName, key, value, isRequired);
|
|
206
|
-
// collecting all the types
|
|
207
|
-
types = { ...types, ...referredTypes };
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return [properties, types];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Returns the processed objects for property and type.
|
|
215
|
-
* @returns property object and type object.
|
|
216
|
-
*/
|
|
217
|
-
parseProperty(eventName, propertyName, propertyContent, isRequired) {
|
|
218
|
-
let property = {};
|
|
219
|
-
let propertyAttributes = {};
|
|
220
|
-
let types = {};
|
|
221
|
-
|
|
222
|
-
if (isRequired === true) {
|
|
223
|
-
property['@mandatory'] = true;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
let type = this.getTypeFromArray(propertyContent.type);
|
|
227
|
-
|
|
228
|
-
// case where type is defined
|
|
229
|
-
if (type && (type === 'object' || type === 'array')) {
|
|
230
|
-
// for generation of type: event name + property name
|
|
231
|
-
propertyName = propertyName[0].toUpperCase() + propertyName.substring(1);
|
|
232
|
-
let typeName = eventName + "." + propertyName;
|
|
233
|
-
// generate object for the introduced type
|
|
234
|
-
const elements = this.getTypeElements(propertyContent);
|
|
235
|
-
types[typeName] = { 'kind': 'type', '@cds.external': 'true', ...elements };
|
|
236
|
-
// referring to the generated type from the property
|
|
237
|
-
propertyAttributes = { 'type': typeName };
|
|
238
|
-
} else {
|
|
239
|
-
propertyAttributes = this.getPropertyObject(propertyContent);
|
|
240
|
-
}
|
|
241
|
-
property = { ...property, ...propertyAttributes };
|
|
242
|
-
|
|
243
|
-
return [property, types];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Returns generated type for the property.
|
|
248
|
-
* @returns an object for a type.
|
|
249
|
-
*/
|
|
250
|
-
getTypeElements(propertyContent) {
|
|
251
|
-
let properties = {};
|
|
252
|
-
let type = this.getTypeFromArray(propertyContent.type);
|
|
253
|
-
|
|
254
|
-
// for nested object
|
|
255
|
-
if (type === 'object') {
|
|
256
|
-
for (const [key, value] of Object.entries(propertyContent.properties)) {
|
|
257
|
-
properties[key] = this.getTypeElements(value);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// for nested array
|
|
261
|
-
else if (type === 'array') {
|
|
262
|
-
properties.items = this.getTypeElements(propertyContent.items);
|
|
263
|
-
return properties;
|
|
264
|
-
}
|
|
265
|
-
// base data type mapping
|
|
266
|
-
else {
|
|
267
|
-
return this.getPropertyObject(propertyContent);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return { elements: properties };
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Returns type for the property from the AsyncAPI Document.
|
|
275
|
-
* @returns the value of type.
|
|
276
|
-
*/
|
|
277
|
-
getTypeFromArray(typeValue) {
|
|
278
|
-
let type;
|
|
279
|
-
// if type is an array
|
|
280
|
-
if (Array.isArray(typeValue)) {
|
|
281
|
-
// one of the value will be null
|
|
282
|
-
type = typeValue[0] === 'null' ? typeValue[1] : typeValue[0];
|
|
283
|
-
} else {
|
|
284
|
-
type = typeValue;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return type;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Returns generated object for a single property.
|
|
292
|
-
* @returns an object for a property.
|
|
293
|
-
*/
|
|
294
|
-
getPropertyObject(propertyContent) {
|
|
295
|
-
const property = {};
|
|
296
|
-
if ('$ref' in propertyContent) {
|
|
297
|
-
const refPathParts = propertyContent['$ref'].split('/');
|
|
298
|
-
const propertyName = refPathParts[refPathParts.length - 1];
|
|
299
|
-
property['type'] = { 'ref': [refPathParts[3], propertyName] };
|
|
300
|
-
return property;
|
|
301
|
-
}
|
|
302
|
-
const inputType = this.getTypeFromArray(propertyContent.type);
|
|
303
|
-
const cdsType = this.getDataType(inputType, propertyContent.format);
|
|
304
|
-
|
|
305
|
-
property['type'] = cdsType;
|
|
306
|
-
|
|
307
|
-
// case: cds type is decimal
|
|
308
|
-
if (cdsType === 'cds.Decimal') {
|
|
309
|
-
if (propertyContent['x-sap-precision']) property.precision = propertyContent['x-sap-precision'];
|
|
310
|
-
if (propertyContent['x-sap-scale']) property.scale = propertyContent['x-sap-scale'];
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (propertyContent['default']) {
|
|
314
|
-
property['default'] = { 'val': propertyContent['default'] };
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (propertyContent['enum']) {
|
|
318
|
-
property['enum'] = this.getEnumObject(propertyContent['enum']);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return property;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Takes the enums from the AsyncAPI Document.
|
|
326
|
-
* @returns the property object of enums.
|
|
327
|
-
*/
|
|
328
|
-
getEnumObject(enumArray) {
|
|
329
|
-
const enumProperty = {};
|
|
330
|
-
|
|
331
|
-
enumArray.forEach(val => {
|
|
332
|
-
enumProperty[val] = {};
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
return enumProperty;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Takes the type and format from the document and returns the corresponding cds type.
|
|
340
|
-
* @returns the corresponding cds type.
|
|
341
|
-
*/
|
|
342
|
-
getDataType(type, format = null) {
|
|
343
|
-
const asyncapiToCdsMapping = {
|
|
344
|
-
'number': 'cds.Double',
|
|
345
|
-
'boolean': 'cds.Boolean',
|
|
346
|
-
'integer': 'cds.Integer'
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
if (type === 'string') {
|
|
350
|
-
switch (format) {
|
|
351
|
-
case 'int64':
|
|
352
|
-
return 'cds.Integer64';
|
|
353
|
-
case 'decimal':
|
|
354
|
-
return 'cds.Decimal';
|
|
355
|
-
case 'uuid':
|
|
356
|
-
return 'cds.UUID';
|
|
357
|
-
case 'date':
|
|
358
|
-
return 'cds.Date';
|
|
359
|
-
case 'partial-time':
|
|
360
|
-
return 'cds.Time';
|
|
361
|
-
case 'date-time':
|
|
362
|
-
return 'cds.Timestamp';
|
|
363
|
-
default:
|
|
364
|
-
return 'cds.LargeString';
|
|
365
|
-
}
|
|
366
|
-
} else if (asyncapiToCdsMapping[type]) {
|
|
367
|
-
return asyncapiToCdsMapping[type];
|
|
368
|
-
} else {
|
|
369
|
-
throw new Error(messages.UNRESOLVED_TYPE + `'${type}'`);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const messages = require("../message").getMessages();
|
|
2
|
-
|
|
3
|
-
function validateAsyncAPI(content) {
|
|
4
|
-
if ('channels' in content && 'components' in content && 'messages' in content.components) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
throw new Error(messages.INVALID_ASYNCAPI_FILE);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Accepted scenarios:
|
|
13
|
-
* * with version info : <namespace>.<businessObject>.<operation>.<version>
|
|
14
|
-
* * without version info : <namespace>.<businessObject>.<operation>
|
|
15
|
-
*
|
|
16
|
-
* ? Is it mandatory for <namespace> to always follow small case notation?
|
|
17
|
-
* ? Is it mandatory for <businessObject> to follow Camel Case or Upper Came Case notation?
|
|
18
|
-
*
|
|
19
|
-
* ToDo: Can we support `-` in operations?
|
|
20
|
-
*/
|
|
21
|
-
const regExp = new RegExp(
|
|
22
|
-
'^(?<namespace>(?:[a-z][a-z0-9]*)(?:[.][a-z][a-z0-9]*)+)[.](?<businessObject>[a-zA-Z0-9]+)[.](?<operation>[a-zA-Z0-9]+)[.]?(?<version>v(?:[0-9]|[1-9][0-9]*))?$'
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Validates the messages' `key` with the regExp and returns the regEx groups.
|
|
27
|
-
* @returns regexGroups
|
|
28
|
-
*/
|
|
29
|
-
function getRegExpGroups(key) {
|
|
30
|
-
/**
|
|
31
|
-
* Result format:
|
|
32
|
-
* index 0: key
|
|
33
|
-
* index 1: <namespace> value
|
|
34
|
-
* index 2: <businessObject> value
|
|
35
|
-
* index 3: <operation> value
|
|
36
|
-
* index 4: <version> value; undefined if <version> is optional
|
|
37
|
-
*/
|
|
38
|
-
const regExpGroups = regExp.exec(key);
|
|
39
|
-
|
|
40
|
-
if (regExpGroups == null) {
|
|
41
|
-
throw new Error(messages.INVALID_MESSAGE_NAME);
|
|
42
|
-
}
|
|
43
|
-
return regExpGroups;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
module.exports = {
|
|
47
|
-
validateAsyncAPI,
|
|
48
|
-
getRegExpGroups
|
|
49
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# CAP {{ projectName }}
|
|
2
|
-
_out
|
|
3
|
-
*.db
|
|
4
|
-
*.sqlite
|
|
5
|
-
connection.properties
|
|
6
|
-
default-*.json
|
|
7
|
-
.cdsrc-private.json
|
|
8
|
-
gen/
|
|
9
|
-
node_modules/
|
|
10
|
-
target/
|
|
11
|
-
|
|
12
|
-
# Web IDE, App Studio
|
|
13
|
-
.che/
|
|
14
|
-
.gen/
|
|
15
|
-
|
|
16
|
-
# MTA
|
|
17
|
-
*_mta_build_tmp
|
|
18
|
-
*.mtar
|
|
19
|
-
mta_archives/
|
|
20
|
-
|
|
21
|
-
# Other
|
|
22
|
-
.DS_Store
|
|
23
|
-
*.orig
|
|
24
|
-
*.log
|
|
25
|
-
|
|
26
|
-
*.iml
|
|
27
|
-
*.flattened-pom.xml
|
|
28
|
-
|
|
29
|
-
# IDEs
|
|
30
|
-
# .vscode
|
|
31
|
-
# .idea
|
|
32
|
-
|
|
33
|
-
# @cap-js/cds-typer
|
|
34
|
-
@cds-models
|