@sap/cds-dk 10.1.2 → 10.2.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 +41 -0
- package/bin/add.js +7 -2
- package/bin/bind.js +0 -2
- package/bin/bindings.js +35 -0
- package/bin/build.js +11 -6
- package/bin/compile/index.js +1 -0
- package/bin/completion/index.js +10 -448
- package/bin/completion/scripts/cds.fish +24 -16
- package/bin/completion/scripts/cds.ps1 +26 -25
- package/bin/completion/scripts/cds.sh +22 -19
- package/bin/completion/scripts/cds.zsh +22 -19
- package/bin/deploy/index.js +1 -1
- package/bin/deploy/to-hana/hana.js +5 -4
- package/bin/env.js +0 -1
- package/bin/eval.js +9 -5
- package/bin/export.js +6 -4
- package/bin/help/export.md +28 -4
- package/bin/import.js +6 -5
- package/bin/inspect.js +0 -1
- package/bin/login.js +28 -3
- package/bin/repl.js +82 -26
- package/bin/run.js +6 -7
- package/bin/serve.js +6 -7
- package/bin/up.js +7 -2
- package/bin/upgrade/steps/install.js +6 -6
- package/bin/watch/index.js +1 -0
- package/lib/build/index.js +11 -7
- package/lib/build/plugins/featureToggles.js +2 -2
- package/lib/build/plugins/hana/index.js +1 -1
- package/lib/build/plugins/helm/files/subcharts/web-application/Chart.yaml +1 -1
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/_helpers.tpl +7 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/api-rule.yaml +1 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/service-binding.yaml +4 -4
- package/lib/build/plugins/helm/files/subcharts/web-application/values.schema.json +13 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/values.yaml +7 -1
- package/lib/build/plugins/java/index.js +5 -1
- package/lib/build/plugins/nodejs/index.js +5 -1
- package/lib/build/util.js +4 -5
- package/lib/env/schemas/cds-rc.js +5 -0
- package/lib/import/importapi.js +2 -3
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +8 -3
- package/lib/init/plugin.js +1 -1
- package/lib/init/projectReader.js +13 -10
- package/lib/init/registries/mta.js +0 -6
- package/lib/init/template/ai/index.js +4 -4
- package/lib/init/template/ams/files/extensionDeveloper.dcl +6 -0
- package/lib/init/template/ams/files/mta.yaml.hbs +6 -0
- package/lib/init/template/ams/files/sidecar.package.json.hbs +5 -0
- package/lib/init/template/ams/index.js +42 -40
- package/lib/init/template/app-frontend/files/mta.yaml.hbs +2 -0
- package/lib/init/template/app-frontend/files/ui5.yaml.hbs +0 -4
- package/lib/init/template/app-frontend/index.js +29 -24
- package/lib/init/template/application-logging/index.js +6 -6
- package/lib/init/template/approuter/files/xs-app.json.hbs +22 -0
- package/lib/init/template/approuter/index.js +20 -13
- package/lib/init/template/attachments/index.js +3 -3
- package/lib/init/template/audit-logging/index.js +4 -4
- package/lib/init/template/cloud-logging/index.js +12 -6
- package/lib/init/template/completion/completionSetup.js +19 -6
- package/lib/init/template/connectivity/index.js +3 -3
- package/lib/init/template/data/as-csv.js +7 -4
- package/lib/init/template/data/as-json.js +77 -20
- package/lib/init/template/destination/index.js +12 -9
- package/lib/init/template/dynatrace/index.js +5 -5
- package/lib/init/template/enterprise-messaging/index.js +6 -6
- package/lib/init/template/enterprise-messaging-shared/index.js +4 -4
- package/lib/init/template/extensibility/index.js +2 -2
- package/lib/init/template/extension/index.js +26 -0
- package/lib/init/template/github-actions/index.js +3 -3
- package/lib/init/template/hana/files/package.json.hbs +3 -2
- package/lib/init/template/hana/index.js +5 -5
- package/lib/init/template/hana-serverless/index.js +3 -3
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +2 -0
- package/lib/init/template/html5-repo/files/ui5.yaml.hbs +0 -4
- package/lib/init/template/html5-repo/index.js +68 -40
- package/lib/init/template/http/index.js +1 -1
- package/lib/init/template/ias/index.js +7 -7
- package/lib/init/template/initial/files/.gitignore.hbs +1 -0
- package/lib/init/template/kafka/index.js +3 -3
- package/lib/init/template/kyma/index.js +7 -9
- package/lib/init/template/malware-scanner/index.js +3 -3
- package/lib/init/template/mta/index.js +6 -3
- package/lib/init/template/multitenancy/index.js +6 -7
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/index.js +16 -10
- package/lib/init/template/postgres/index.js +5 -5
- package/lib/init/template/react/files/index.html.hbs +1 -1
- package/lib/init/template/react/files/package.json.hbs +3 -2
- package/lib/init/template/react/files/src/{App.jsx.hbs → App.{{jsxExtension}}.hbs} +8 -2
- package/lib/init/template/react/files/src/{main.jsx → main.{{jsxExtension}}.hbs} +2 -2
- package/lib/init/template/react/index.js +23 -4
- package/lib/init/template/react/typescript/src/vite-env.d.ts +1 -0
- package/lib/init/template/react/typescript/tsconfig.json.hbs +16 -0
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/side-by-side-extensibility/index.js +6 -3
- package/lib/init/template/typescript/files/tsconfig.json +3 -1
- package/lib/init/template/vue/files/index.html.hbs +1 -1
- package/lib/init/template/vue/files/package.json.hbs +2 -1
- package/lib/init/template/vue/files/src/App.vue.hbs +8 -2
- package/lib/init/template/vue/index.js +20 -4
- package/lib/init/template/vue/typescript/tsconfig.json +11 -0
- package/lib/init/template/workzone-standard/files/mta.yaml.hbs +2 -2
- package/lib/init/template/workzone-standard/index.js +29 -27
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +1 -1
- package/lib/init/template/xsuaa/files/values.yaml.hbs +1 -1
- package/lib/init/template/xsuaa/index.js +34 -22
- package/lib/mtx/auth_manager.js +8 -2
- package/lib/mtx/browser_login.js +181 -0
- package/lib/mtx/params.js +6 -0
- package/lib/mtx/settings_manager.js +29 -4
- package/lib/util/cf.js +44 -8
- package/lib/util/fs.js +2 -2
- package/node_modules/@cap-js/db-service/CHANGELOG.md +10 -0
- package/node_modules/@cap-js/db-service/lib/cqn2pql.js +4 -0
- package/node_modules/@cap-js/db-service/lib/cqn2sql.js +3 -0
- package/node_modules/@cap-js/db-service/lib/cqn4sql.js +8 -23
- package/node_modules/@cap-js/db-service/lib/infer/index.js +20 -27
- package/node_modules/@cap-js/db-service/package.json +1 -1
- package/node_modules/@cap-js/openapi/cds-plugin.js +12 -0
- package/node_modules/@cap-js/openapi/index.js +3 -1
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +652 -413
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +16 -13
- package/node_modules/@cap-js/openapi/lib/compile/index.js +10 -7
- package/node_modules/@cap-js/openapi/lib/compile/property-util.js +51 -0
- package/{lib/import/openapi → node_modules/@cap-js/openapi/lib/import}/importOpenAPI.js +12 -9
- package/{lib/import/openapi → node_modules/@cap-js/openapi/lib/import}/index.js +4 -3
- package/node_modules/@cap-js/openapi/package.json +71 -3
- package/node_modules/@cap-js/sqlite/CHANGELOG.md +9 -0
- package/node_modules/@cap-js/sqlite/package.json +3 -3
- package/node_modules/@isaacs/fs-minipass/LICENSE +15 -0
- package/node_modules/@isaacs/fs-minipass/README.md +71 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +430 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +118 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +420 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/fs-minipass/package.json +72 -0
- package/node_modules/@sap/cds/CHANGELOG.md +52 -1
- package/node_modules/@sap/cds/_i18n/messages_ar.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_bg.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_cs.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_da.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_de.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_el.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_en.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_es.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_es_MX.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_fi.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_fr.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_he.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_hr.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_hu.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_it.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_ja.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_kk.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_ko.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_ms.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_nl.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_no.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_pl.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_pt.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_ro.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_ru.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_sh.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_sk.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_sl.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_sv.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_th.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_tr.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_uk.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_vi.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_zh_CN.properties +1 -0
- package/node_modules/@sap/cds/_i18n/messages_zh_TW.properties +1 -0
- package/node_modules/@sap/cds/app/index-client.js +164 -0
- package/node_modules/@sap/cds/app/index.css +598 -87
- package/node_modules/@sap/cds/app/index.html +54 -30
- package/node_modules/@sap/cds/app/index.js +311 -67
- package/node_modules/@sap/cds/app/table.html +226 -0
- package/node_modules/@sap/cds/app/table.js +302 -0
- package/node_modules/@sap/cds/bin/serve.js +3 -2
- package/node_modules/@sap/cds/eslint.config.mjs +2 -0
- package/node_modules/@sap/cds/lib/compile/cdsc.js +7 -0
- package/node_modules/@sap/cds/lib/compile/for/embeddings.js +27 -0
- package/node_modules/@sap/cds/lib/compile/load.js +2 -2
- package/node_modules/@sap/cds/lib/compile/minify.js +17 -4
- package/node_modules/@sap/cds/lib/compile/parse.js +3 -0
- package/node_modules/@sap/cds/lib/compile/resolve.js +16 -14
- package/node_modules/@sap/cds/lib/core/classes.js +1 -0
- package/node_modules/@sap/cds/lib/dbs/cds-deploy.js +4 -5
- package/node_modules/@sap/cds/lib/env/cds-env.js +132 -70
- package/node_modules/@sap/cds/lib/env/cds-requires/auth-strategies.js +62 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/databases.js +49 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/embeddings.js +8 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/index.js +27 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/messaging.js +82 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/platform.js +23 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/queues.js +34 -0
- package/node_modules/@sap/cds/lib/env/cds-requires/services.js +32 -0
- package/node_modules/@sap/cds/lib/env/defaults.js +9 -1
- package/node_modules/@sap/cds/lib/i18n/files.js +4 -4
- package/node_modules/@sap/cds/lib/i18n/locale.js +1 -1
- package/node_modules/@sap/cds/lib/index.js +9 -9
- package/node_modules/@sap/cds/lib/log/cds-log.js +3 -3
- package/node_modules/@sap/cds/lib/ql/SELECT.js +2 -0
- package/node_modules/@sap/cds/lib/ql/UPDATE.js +1 -1
- package/node_modules/@sap/cds/lib/ql/cds.ql-Query.js +4 -1
- package/node_modules/@sap/cds/lib/ql/core/@types/cqn.d.ts +146 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/exprs.d.ts +51 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/index.d.ts +29 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/package.json +7 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/ql/delete.d.ts +8 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/ql/insert.d.ts +19 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/ql/select.d.ts +24 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/ql/update.d.ts +10 -0
- package/node_modules/@sap/cds/lib/ql/core/@types/query.d.ts +18 -0
- package/node_modules/@sap/cds/lib/ql/core/cql/parser.min.js +1 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/index.js +69 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/cache.js +34 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/call-action.js +6 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/delete.js +8 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/insert.js +26 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/select.js +22 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/ql/update.js +26 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/query.js +85 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/xl/fluent.js +47 -0
- package/node_modules/@sap/cds/lib/ql/core/lib/xl/ttl.js +24 -0
- package/node_modules/@sap/cds/lib/ql/core/license +201 -0
- package/node_modules/@sap/cds/lib/ql/core/package.json +24 -0
- package/node_modules/@sap/cds/lib/ql/core/readme.md +99 -0
- package/node_modules/@sap/cds/lib/ql/core/upstream.json +5 -0
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/bindings.js +111 -115
- package/node_modules/@sap/cds/lib/srv/cds-connect.js +11 -10
- package/node_modules/@sap/cds/lib/srv/cds-serve.js +16 -7
- package/node_modules/@sap/cds/lib/srv/cds.Service.js +13 -7
- package/node_modules/@sap/cds/lib/srv/factory.js +8 -10
- package/node_modules/@sap/cds/lib/srv/middlewares/auth/ias-auth.js +35 -32
- package/node_modules/@sap/cds/lib/srv/middlewares/auth/jwt-auth.js +5 -1
- package/node_modules/@sap/cds/lib/srv/middlewares/auth/mocked-users.js +1 -1
- package/node_modules/@sap/cds/lib/srv/protocols/hcql.js +230 -79
- package/node_modules/@sap/cds/lib/srv/protocols/http.js +7 -3
- package/node_modules/@sap/cds/lib/srv/protocols/index.js +7 -2
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +2 -2
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +37 -0
- package/node_modules/@sap/cds/lib/utils/csv-reader.js +2 -2
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +18 -27
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +1 -1
- package/node_modules/@sap/cds/libx/_runtime/common/utils/rewriteAsterisks.js +1 -1
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +121 -84
- package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +24 -1
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +2 -2
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +3 -2
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +11 -6
- package/node_modules/@sap/cds/libx/odata/middleware/create.js +4 -0
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +1 -1
- package/node_modules/@sap/cds/libx/odata/middleware/operation.js +3 -0
- package/node_modules/@sap/cds/libx/odata/middleware/parse.js +9 -0
- package/node_modules/@sap/cds/libx/odata/middleware/read.js +6 -0
- package/node_modules/@sap/cds/libx/odata/middleware/update.js +5 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +3 -3
- package/node_modules/@sap/cds/libx/odata/parse/multipartToJson.js +1 -1
- package/node_modules/@sap/cds/libx/odata/utils/ieee754.js +20 -0
- package/node_modules/@sap/cds/libx/queue/api.js +1 -1
- package/node_modules/@sap/cds/libx/queue/index.js +3 -1
- package/node_modules/@sap/cds/libx/queue/processing.js +5 -0
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +1 -0
- package/node_modules/@sap/cds/package.json +2 -2
- package/node_modules/@sap/cds/server.js +1 -0
- package/node_modules/@sap/cds/srv/ucl-service.cds +1 -0
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +83 -0
- package/node_modules/@sap/cds-compiler/bin/cdsse.js +1 -1
- package/node_modules/@sap/cds-compiler/doc/EffectiveCSN.md +3314 -0
- package/node_modules/@sap/cds-compiler/lib/api/main.js +9 -6
- package/node_modules/@sap/cds-compiler/lib/api/options.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/{model → base}/csnUtils.js +5 -5
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +54 -6
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +4 -4
- package/node_modules/@sap/cds-compiler/lib/{model → base}/sortViews.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/assocOutsideService.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/checkForTypes.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/checkPathsInStoredCalcElement.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/elements.js +37 -3
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/existsInForbiddenPlaces.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/hasPersistedElements.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/manyExpand.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/manyNavigations.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/onConditions.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/parameters.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/queryNoDbArtifacts.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/selectItems.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/structuredAnnoExpressions.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/typeParameters.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/types.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/checks/validator.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +20 -12
- package/node_modules/@sap/cds-compiler/lib/compiler/builtins.js +9 -4
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +50 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +303 -323
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +5 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +1015 -1177
- package/node_modules/@sap/cds-compiler/lib/compiler/generate.js +55 -42
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +74 -45
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +6 -4
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +30 -49
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +32 -18
- package/node_modules/@sap/cds-compiler/lib/edm/annotations/edmJson.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/edm/annotations/genericTranslation.js +2 -2
- package/node_modules/@sap/cds-compiler/lib/edm/annotations/preprocessAnnotations.js +2 -3
- package/node_modules/@sap/cds-compiler/lib/edm/csn2edm.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/edm/edm.js +6 -7
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/edm/edmInboundChecks.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/edm/edmPreprocessor.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/edm/edmUtils.js +12 -7
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +15 -15
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +7 -0
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +30 -30
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/main.js +4 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +42 -15
- package/node_modules/@sap/cds-compiler/lib/render/DuplicateChecker.js +37 -11
- package/node_modules/@sap/cds-compiler/lib/render/manageConstraints.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +11 -6
- package/node_modules/@sap/cds-compiler/lib/render/toRename.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +74 -24
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +81 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/sql.js +17 -10
- package/node_modules/@sap/cds-compiler/lib/transform/db/assertUnique.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +3 -4
- package/node_modules/@sap/cds-compiler/lib/transform/db/assocsToQueries/transformExists.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +2 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/cdsPersistence.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/transform/db/expansion.js +7 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/flattening.js +2 -2
- package/node_modules/@sap/cds-compiler/lib/{modelCompare/compare.js → transform/db/migration/diffModels.js} +5 -5
- package/node_modules/@sap/cds-compiler/lib/{modelCompare/utils/filter.js → transform/db/migration/filterDiff.js} +2 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/processSqlServices.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/rewriteCalculatedElements.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/temporal.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/views.js +2 -6
- package/node_modules/@sap/cds-compiler/lib/transform/draft/db.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/draft/odata.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/associations.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/flattening.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +3 -2
- package/node_modules/@sap/cds-compiler/lib/transform/effective/misc.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/queries.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/types.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/forOdata.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +9 -4
- package/node_modules/@sap/cds-compiler/lib/transform/localized.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/odata/adaptAnnotationRefs.js +5 -11
- package/node_modules/@sap/cds-compiler/lib/transform/odata/createForeignKeys.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/odata/flattening.js +4 -4
- package/node_modules/@sap/cds-compiler/lib/transform/odata/foreignKeyRefsInXprAnnos.js +5 -3
- package/node_modules/@sap/cds-compiler/lib/transform/odata/toFinalBaseType.js +29 -5
- package/node_modules/@sap/cds-compiler/lib/transform/odata/typesExposure.js +13 -3
- package/node_modules/@sap/cds-compiler/lib/transform/odata/utils.js +9 -0
- package/node_modules/@sap/cds-compiler/lib/transform/transformUtils.js +2 -2
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/tupleExpansion.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/universalCsn/coreComputed.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/universalCsn/universalCsnEnricher.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/transform/universalCsn/utils.js +1 -1
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +47 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +4 -6
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +5 -4
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +38 -2
- package/node_modules/@sap/cds-mtxs/db/t0.cds +7 -0
- package/node_modules/@sap/cds-mtxs/lib/utils.js +129 -20
- package/node_modules/@sap/cds-mtxs/package.json +15 -14
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +13 -12
- package/node_modules/@sap/cds-mtxs/srv/cf/saas-provisioning-service.cds +1 -0
- package/node_modules/@sap/cds-mtxs/srv/cf/sms-provisioning-service.cds +1 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/compat/update.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/config.js +1 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/csv-allowlist.js +64 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +4 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/protected-namespace.js +67 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +179 -15
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +12 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/common.js +33 -12
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +24 -6
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr.js +3 -1
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi-native.js +752 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/serverless.js +17 -20
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr-v2.js +511 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +11 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +8 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +27 -18
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker-pool.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker.js +1 -1
- package/node_modules/chownr/LICENSE.md +63 -0
- package/node_modules/chownr/README.md +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/node_modules/chownr/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/node_modules/chownr/dist/commonjs/index.js.map +1 -0
- package/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/node_modules/chownr/dist/esm/index.d.ts.map +1 -0
- package/node_modules/chownr/dist/esm/index.js +85 -0
- package/node_modules/chownr/dist/esm/index.js.map +1 -0
- package/node_modules/chownr/dist/esm/package.json +3 -0
- package/node_modules/chownr/package.json +69 -0
- package/node_modules/content-disposition/README.md +105 -35
- package/node_modules/content-disposition/dist/index.d.ts +72 -0
- package/node_modules/content-disposition/dist/index.js +388 -0
- package/node_modules/content-disposition/dist/index.js.map +1 -0
- package/node_modules/content-disposition/package.json +31 -19
- package/node_modules/content-type/README.md +34 -57
- package/node_modules/content-type/package.json +35 -25
- package/node_modules/express/Readme.md +15 -9
- package/node_modules/express/lib/application.js +2 -2
- package/node_modules/express/lib/request.js +32 -19
- package/node_modules/express/lib/response.js +27 -30
- package/node_modules/express/package.json +10 -10
- package/node_modules/handlebars/bin/handlebars +1 -1
- package/node_modules/handlebars/dist/amd/handlebars/base.js +2 -2
- package/node_modules/handlebars/dist/amd/handlebars/compiler/base.js +2 -59
- package/node_modules/handlebars/dist/amd/handlebars/compiler/code-gen.js +68 -5
- package/node_modules/handlebars/dist/amd/handlebars/compiler/compiler.js +160 -19
- package/node_modules/handlebars/dist/amd/handlebars/compiler/javascript-compiler.js +23 -7
- package/node_modules/handlebars/dist/amd/handlebars/compiler/node-types.js +12 -0
- package/node_modules/handlebars/dist/amd/handlebars/compiler/visitor.js +26 -7
- package/node_modules/handlebars/dist/amd/handlebars/compiler/whitespace-control.js +9 -4
- package/node_modules/handlebars/dist/amd/handlebars/exception.js +8 -4
- package/node_modules/handlebars/dist/amd/handlebars/helpers/each.js +40 -14
- package/node_modules/handlebars/dist/amd/handlebars/internal/proto-access.js +21 -1
- package/node_modules/handlebars/dist/amd/handlebars/runtime.js +24 -4
- package/node_modules/handlebars/dist/amd/handlebars/utils.js +4 -3
- package/node_modules/handlebars/dist/amd/precompiler.js +13 -7
- package/node_modules/handlebars/dist/cjs/handlebars/base.js +2 -2
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js +1 -60
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js +64 -4
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js +161 -18
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js +23 -7
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/node-types.js +10 -0
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js +29 -6
- package/node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js +9 -4
- package/node_modules/handlebars/dist/cjs/handlebars/exception.js +8 -4
- package/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js +40 -14
- package/node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js +21 -1
- package/node_modules/handlebars/dist/cjs/handlebars/runtime.js +24 -4
- package/node_modules/handlebars/dist/cjs/handlebars/utils.js +4 -3
- package/node_modules/handlebars/dist/cjs/precompiler.js +14 -6
- package/node_modules/handlebars/dist/handlebars.amd.js +401 -130
- package/node_modules/handlebars/dist/handlebars.amd.min.js +4 -4
- package/node_modules/handlebars/dist/handlebars.js +396 -125
- package/node_modules/handlebars/dist/handlebars.min.js +4 -4
- package/node_modules/handlebars/dist/handlebars.runtime.amd.js +100 -29
- package/node_modules/handlebars/dist/handlebars.runtime.amd.min.js +2 -2
- package/node_modules/handlebars/dist/handlebars.runtime.js +94 -23
- package/node_modules/handlebars/dist/handlebars.runtime.min.js +2 -2
- package/node_modules/handlebars/lib/handlebars/base.js +1 -1
- package/node_modules/handlebars/lib/handlebars/compiler/base.js +0 -67
- package/node_modules/handlebars/lib/handlebars/compiler/code-gen.js +65 -11
- package/node_modules/handlebars/lib/handlebars/compiler/compiler.js +164 -23
- package/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js +23 -7
- package/node_modules/handlebars/lib/handlebars/compiler/node-types.js +24 -0
- package/node_modules/handlebars/lib/handlebars/compiler/visitor.js +29 -5
- package/node_modules/handlebars/lib/handlebars/compiler/whitespace-control.js +16 -5
- package/node_modules/handlebars/lib/handlebars/exception.js +7 -3
- package/node_modules/handlebars/lib/handlebars/helpers/each.js +39 -16
- package/node_modules/handlebars/lib/handlebars/internal/proto-access.js +22 -0
- package/node_modules/handlebars/lib/handlebars/runtime.js +36 -4
- package/node_modules/handlebars/lib/handlebars/utils.js +3 -2
- package/node_modules/handlebars/lib/precompiler.js +14 -5
- package/node_modules/handlebars/package.json +2 -2
- package/node_modules/handlebars/release-notes.md +20 -1
- package/node_modules/handlebars/types/index.d.ts +8 -0
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/Client.js +6 -2
- package/node_modules/hdb/lib/protocol/ClientInfo.js +28 -15
- package/node_modules/hdb/lib/protocol/Connection.js +30 -3
- package/node_modules/hdb/lib/protocol/Writer.js +2 -2
- package/node_modules/hdb/lib/protocol/common/ConnectOption.js +2 -0
- package/node_modules/hdb/lib/protocol/common/ConnectOptionFlagSet1.js +18 -0
- package/node_modules/hdb/lib/protocol/common/ConnectOptionType.js +2 -0
- package/node_modules/hdb/lib/protocol/common/Constants.js +1 -0
- package/node_modules/hdb/lib/protocol/common/MessageType.js +3 -2
- package/node_modules/hdb/lib/protocol/common/PartKind.js +2 -1
- package/node_modules/hdb/lib/protocol/common/index.js +1 -0
- package/node_modules/hdb/lib/protocol/data/TextList.js +25 -17
- package/node_modules/hdb/lib/protocol/data/index.js +1 -0
- package/node_modules/hdb/lib/protocol/part/ConnectOptions.js +7 -0
- package/node_modules/hdb/lib/protocol/request/index.js +7 -0
- package/node_modules/hdb/package.json +1 -2
- package/node_modules/livereload-js/.github/workflows/main.yml +4 -4
- package/node_modules/livereload-js/README.md +3 -3
- package/node_modules/livereload-js/dist/livereload.js +839 -2742
- package/node_modules/livereload-js/dist/livereload.min.js +1 -1
- package/node_modules/livereload-js/package.json +11 -11
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +545 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/minizlib/LICENSE +26 -0
- package/node_modules/minizlib/README.md +64 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/commonjs/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/node_modules/minizlib/dist/commonjs/constants.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/node_modules/minizlib/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/node_modules/minizlib/dist/commonjs/index.js.map +1 -0
- package/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/node_modules/minizlib/dist/esm/constants.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/node_modules/minizlib/dist/esm/constants.js.map +1 -0
- package/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/node_modules/minizlib/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minizlib/dist/esm/index.js +363 -0
- package/node_modules/minizlib/dist/esm/index.js.map +1 -0
- package/node_modules/minizlib/dist/esm/package.json +3 -0
- package/node_modules/minizlib/package.json +80 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +4 -2
- package/node_modules/qs/CHANGELOG.md +38 -14
- package/node_modules/qs/README.md +31 -3
- package/node_modules/qs/dist/qs.js +20 -20
- package/node_modules/qs/lib/parse.js +94 -4
- package/node_modules/qs/lib/stringify.js +4 -4
- package/node_modules/qs/lib/utils.js +130 -6
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +174 -0
- package/node_modules/qs/test/stringify.js +263 -33
- package/node_modules/qs/test/utils.js +184 -0
- package/node_modules/tar/LICENSE.md +55 -0
- package/node_modules/tar/README.md +1233 -0
- package/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/create.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/create.js +82 -0
- package/node_modules/tar/dist/commonjs/create.js.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/commonjs/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/node_modules/tar/dist/commonjs/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/node_modules/tar/dist/commonjs/extract.js.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/node_modules/tar/dist/commonjs/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/node_modules/tar/dist/commonjs/header.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/header.js +348 -0
- package/node_modules/tar/dist/commonjs/header.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/node_modules/tar/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/index.js +64 -0
- package/node_modules/tar/dist/commonjs/index.js.map +1 -0
- package/node_modules/tar/dist/commonjs/index.min.js +4 -0
- package/node_modules/tar/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/node_modules/tar/dist/commonjs/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/node_modules/tar/dist/commonjs/list.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/list.js +153 -0
- package/node_modules/tar/dist/commonjs/list.js.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/node_modules/tar/dist/commonjs/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/node_modules/tar/dist/commonjs/make-command.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/commonjs/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/node_modules/tar/dist/commonjs/mkdir.js.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/node_modules/tar/dist/commonjs/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/node_modules/tar/dist/commonjs/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/options.d.ts +604 -0
- package/node_modules/tar/dist/commonjs/options.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/options.js +66 -0
- package/node_modules/tar/dist/commonjs/options.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pack.js +544 -0
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/package.json +3 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts +92 -0
- package/node_modules/tar/dist/commonjs/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/parse.js +655 -0
- package/node_modules/tar/dist/commonjs/parse.js.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/node_modules/tar/dist/commonjs/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/pax.js +182 -0
- package/node_modules/tar/dist/commonjs/pax.js.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/node_modules/tar/dist/commonjs/process-umask.js.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/commonjs/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/node_modules/tar/dist/commonjs/read-entry.js.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/node_modules/tar/dist/commonjs/replace.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/commonjs/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/node_modules/tar/dist/commonjs/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/commonjs/types.d.ts +16 -0
- package/node_modules/tar/dist/commonjs/types.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/types.js +70 -0
- package/node_modules/tar/dist/commonjs/types.js.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/node_modules/tar/dist/commonjs/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/node_modules/tar/dist/commonjs/unpack.js.map +1 -0
- package/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/node_modules/tar/dist/commonjs/update.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/update.js +33 -0
- package/node_modules/tar/dist/commonjs/update.js.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/commonjs/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/node_modules/tar/dist/commonjs/warn-method.js.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/node_modules/tar/dist/commonjs/winchars.js.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/node_modules/tar/dist/commonjs/write-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/node_modules/tar/dist/esm/create.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/create.js +76 -0
- package/node_modules/tar/dist/esm/create.js.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/node_modules/tar/dist/esm/cwd-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/node_modules/tar/dist/esm/cwd-error.js.map +1 -0
- package/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/node_modules/tar/dist/esm/extract.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/extract.js +49 -0
- package/node_modules/tar/dist/esm/extract.js.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/node_modules/tar/dist/esm/get-write-flag.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/node_modules/tar/dist/esm/get-write-flag.js.map +1 -0
- package/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/node_modules/tar/dist/esm/header.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/header.js +311 -0
- package/node_modules/tar/dist/esm/header.js.map +1 -0
- package/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/node_modules/tar/dist/esm/index.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/index.js +20 -0
- package/node_modules/tar/dist/esm/index.js.map +1 -0
- package/node_modules/tar/dist/esm/index.min.js +4 -0
- package/node_modules/tar/dist/esm/index.min.js.map +7 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/node_modules/tar/dist/esm/large-numbers.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/node_modules/tar/dist/esm/large-numbers.js.map +1 -0
- package/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/node_modules/tar/dist/esm/list.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/list.js +113 -0
- package/node_modules/tar/dist/esm/list.js.map +1 -0
- package/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/node_modules/tar/dist/esm/make-command.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/make-command.js +48 -0
- package/node_modules/tar/dist/esm/make-command.js.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/node_modules/tar/dist/esm/mkdir.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/node_modules/tar/dist/esm/mkdir.js.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/node_modules/tar/dist/esm/mode-fix.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/node_modules/tar/dist/esm/mode-fix.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/node_modules/tar/dist/esm/normalize-unicode.js.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/node_modules/tar/dist/esm/normalize-windows-path.js.map +1 -0
- package/node_modules/tar/dist/esm/options.d.ts +604 -0
- package/node_modules/tar/dist/esm/options.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/options.js +54 -0
- package/node_modules/tar/dist/esm/options.js.map +1 -0
- package/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pack.js +502 -0
- package/node_modules/tar/dist/esm/pack.js.map +1 -0
- package/node_modules/tar/dist/esm/package.json +3 -0
- package/node_modules/tar/dist/esm/parse.d.ts +92 -0
- package/node_modules/tar/dist/esm/parse.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/parse.js +651 -0
- package/node_modules/tar/dist/esm/parse.js.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/node_modules/tar/dist/esm/path-reservations.js.map +1 -0
- package/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/node_modules/tar/dist/esm/pax.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/pax.js +178 -0
- package/node_modules/tar/dist/esm/pax.js.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/node_modules/tar/dist/esm/process-umask.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/node_modules/tar/dist/esm/process-umask.js.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/node_modules/tar/dist/esm/read-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/node_modules/tar/dist/esm/read-entry.js.map +1 -0
- package/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/node_modules/tar/dist/esm/replace.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/replace.js +221 -0
- package/node_modules/tar/dist/esm/replace.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/node_modules/tar/dist/esm/strip-trailing-slashes.js.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/node_modules/tar/dist/esm/symlink-error.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/node_modules/tar/dist/esm/symlink-error.js.map +1 -0
- package/node_modules/tar/dist/esm/types.d.ts +16 -0
- package/node_modules/tar/dist/esm/types.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/types.js +65 -0
- package/node_modules/tar/dist/esm/types.js.map +1 -0
- package/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/node_modules/tar/dist/esm/unpack.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/unpack.js +891 -0
- package/node_modules/tar/dist/esm/unpack.js.map +1 -0
- package/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/node_modules/tar/dist/esm/update.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/update.js +30 -0
- package/node_modules/tar/dist/esm/update.js.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/node_modules/tar/dist/esm/warn-method.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/node_modules/tar/dist/esm/warn-method.js.map +1 -0
- package/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/node_modules/tar/dist/esm/winchars.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/winchars.js +9 -0
- package/node_modules/tar/dist/esm/winchars.js.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts.map +1 -0
- package/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/node_modules/tar/dist/esm/write-entry.js.map +1 -0
- package/node_modules/tar/package.json +298 -0
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/node_modules/yallist/LICENSE.md +63 -0
- package/node_modules/yallist/README.md +205 -0
- package/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/node_modules/yallist/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/node_modules/yallist/dist/commonjs/index.js.map +1 -0
- package/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/node_modules/yallist/dist/esm/index.d.ts.map +1 -0
- package/node_modules/yallist/dist/esm/index.js +379 -0
- package/node_modules/yallist/dist/esm/index.js.map +1 -0
- package/node_modules/yallist/dist/esm/package.json +3 -0
- package/node_modules/yallist/package.json +68 -0
- package/package.json +7 -1
- package/bin/completion/templates/cds-tmpl.fish +0 -65
- package/bin/completion/templates/cds-tmpl.ps1 +0 -217
- package/bin/completion/templates/cds-tmpl.sh +0 -93
- package/bin/completion/templates/cds-tmpl.zsh +0 -74
- package/node_modules/@cap-js/db-service/lib/recursion-guard.js +0 -40
- package/node_modules/@sap/cds/lib/env/cds-requires.js +0 -327
- package/node_modules/@sap/cds-mtxs/srv/bootstrap.cds +0 -2
- package/node_modules/@sap/cds-mtxs/srv/bootstrap.js +0 -33
- package/node_modules/body-parser/node_modules/content-type/LICENSE +0 -22
- package/node_modules/body-parser/node_modules/content-type/README.md +0 -71
- package/node_modules/body-parser/node_modules/content-type/package.json +0 -52
- package/node_modules/content-disposition/index.js +0 -536
- package/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/content-type/index.js +0 -225
- package/node_modules/negotiator/node_modules/content-type/LICENSE +0 -22
- package/node_modules/negotiator/node_modules/content-type/README.md +0 -71
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/negotiator/node_modules/content-type/package.json +0 -52
- package/node_modules/type-is/node_modules/content-type/LICENSE +0 -22
- package/node_modules/type-is/node_modules/content-type/README.md +0 -71
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/type-is/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/type-is/node_modules/content-type/package.json +0 -52
- /package/lib/init/template/react/files/{vite.config.js.hbs → vite.config.{{extension}}.hbs} +0 -0
- /package/lib/init/template/vue/files/src/{main.js → main.{{extension}}.hbs} +0 -0
- /package/lib/init/template/vue/files/{vite.config.js.hbs → vite.config.{{extension}}.hbs} +0 -0
- /package/{lib/import/openapi → node_modules/@cap-js/openapi/lib/import}/utilities.js +0 -0
- /package/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.d.ts +0 -0
- /package/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js +0 -0
- /package/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js.map +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-mtxs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "SAP Cloud Application Programming Model - Multitenancy library",
|
|
5
5
|
"homepage": "https://cap.cloud.sap/",
|
|
6
6
|
"keywords": [
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"main": "lib/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sap/hdi-deploy": "^5"
|
|
26
|
+
"@sap/hdi-deploy": "^5",
|
|
27
|
+
"tar": "^7"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@sap/cds": ">=9"
|
|
@@ -32,10 +33,12 @@
|
|
|
32
33
|
"requires": {
|
|
33
34
|
"kinds": {
|
|
34
35
|
"multitenancy": {
|
|
35
|
-
"model": [
|
|
36
|
-
"@sap/cds-mtxs/srv/bootstrap"
|
|
37
|
-
],
|
|
38
36
|
"kind": "saas-registry",
|
|
37
|
+
"containerManager": {
|
|
38
|
+
"retries": 10,
|
|
39
|
+
"maxRetryAfter": 5000,
|
|
40
|
+
"lifecycleMaxRetryAfter": 300000
|
|
41
|
+
},
|
|
39
42
|
"[subscription-manager]": {
|
|
40
43
|
"kind": "subscription-manager"
|
|
41
44
|
},
|
|
@@ -43,7 +46,6 @@
|
|
|
43
46
|
},
|
|
44
47
|
"extensibility": {
|
|
45
48
|
"model": [
|
|
46
|
-
"@sap/cds-mtxs/srv/bootstrap",
|
|
47
49
|
"@sap/cds-mtxs/db/extensions"
|
|
48
50
|
],
|
|
49
51
|
"tenantCheckInterval": 10000
|
|
@@ -53,11 +55,7 @@
|
|
|
53
55
|
"@sap/cds-mtxs/db/extensions"
|
|
54
56
|
]
|
|
55
57
|
},
|
|
56
|
-
"toggles": {
|
|
57
|
-
"model": [
|
|
58
|
-
"@sap/cds-mtxs/srv/bootstrap"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
58
|
+
"toggles": {},
|
|
61
59
|
"cds.xt.ModelProviderService": {
|
|
62
60
|
"model": "@sap/cds-mtxs/srv/model-provider"
|
|
63
61
|
},
|
|
@@ -139,12 +137,13 @@
|
|
|
139
137
|
}
|
|
140
138
|
},
|
|
141
139
|
"cds.xt.ModelProviderService-from-sidecar": {
|
|
142
|
-
"kind": "
|
|
140
|
+
"kind": "cds.xt.ModelProviderService"
|
|
143
141
|
},
|
|
144
142
|
"cds.xt.DeploymentService-from-sidecar": {
|
|
145
|
-
"kind": "
|
|
143
|
+
"kind": "cds.xt.DeploymentService"
|
|
146
144
|
},
|
|
147
145
|
"cds.xt.ModelProviderService-in-sidecar": {
|
|
146
|
+
"kind": "cds.xt.ModelProviderService",
|
|
148
147
|
"[development]": {
|
|
149
148
|
"root": "../.."
|
|
150
149
|
},
|
|
@@ -156,7 +155,9 @@
|
|
|
156
155
|
},
|
|
157
156
|
"_in_sidecar": true
|
|
158
157
|
},
|
|
159
|
-
"cds.xt.DeploymentService-in-sidecar": {
|
|
158
|
+
"cds.xt.DeploymentService-in-sidecar": {
|
|
159
|
+
"kind": "cds.xt.DeploymentService"
|
|
160
|
+
}
|
|
160
161
|
}
|
|
161
162
|
},
|
|
162
163
|
"[with-mtx-sidecar]": {
|
|
@@ -5,6 +5,7 @@ const { fetchResiliently, token } = require('../../lib/utils')
|
|
|
5
5
|
const DeploymentService = 'cds.xt.DeploymentService'
|
|
6
6
|
const JobsService = 'cds.xt.JobsService'
|
|
7
7
|
const Tenants = 'cds.xt.Tenants'
|
|
8
|
+
const SUBSCRIBED = 'SUBSCRIBED'
|
|
8
9
|
const { SKIPPED_DB } = require('../jobs-service')
|
|
9
10
|
|
|
10
11
|
// we need to run in multitenancy mode for t0 ops
|
|
@@ -77,8 +78,8 @@ module.exports = class ProvisioningService extends cds.ApplicationService {
|
|
|
77
78
|
const js = await cds.connect.to(JobsService)
|
|
78
79
|
const tx = js.tx({ tenant: context.tenant, user: new cds.User.Privileged() })
|
|
79
80
|
const result = await tx.enqueue(DeploymentService, 'subscribe', [new Set([tenant])], { data, options }, error => {
|
|
80
|
-
if (error) this._sendCallback('FAILED', `Tenant creation failed with error '${error}'`)
|
|
81
|
-
|
|
81
|
+
if (error) return this._sendCallback('FAILED', `Tenant creation failed with error '${error}'`)
|
|
82
|
+
return this._sendCallback('SUCCEEDED', 'Tenant creation succeeded', appUrl)
|
|
82
83
|
})
|
|
83
84
|
if (context.data.eventType === 'UPDATE') {
|
|
84
85
|
return appUrl
|
|
@@ -102,20 +103,20 @@ module.exports = class ProvisioningService extends cds.ApplicationService {
|
|
|
102
103
|
const tenant = this._getSubscribedTenant(context)
|
|
103
104
|
if (tenant) {
|
|
104
105
|
const one = await cds.tx({ tenant: t0 }, tx =>
|
|
105
|
-
tx.run(SELECT.one.from(Tenants).columns(['metadata', 'createdAt', 'modifiedAt']).where({ ID: tenant }))
|
|
106
|
+
tx.run(SELECT.one.from(Tenants).columns(['metadata', 'status', 'createdAt', 'modifiedAt']).where({ ID: tenant }))
|
|
106
107
|
)
|
|
107
108
|
if (!one) cds.error(`Tenant ${tenant} not found`, { status: 404 })
|
|
108
|
-
const { metadata, createdAt, modifiedAt } = one
|
|
109
|
-
return { subscribedTenantId: tenant, ...this._toMetadataJson(metadata, tenant), createdAt, modifiedAt }
|
|
109
|
+
const { metadata, status = 'SUBSCRIBED', createdAt, modifiedAt } = one
|
|
110
|
+
return { subscribedTenantId: tenant, ...this._toMetadataJson(metadata, tenant), status, createdAt, modifiedAt }
|
|
110
111
|
}
|
|
111
112
|
return (await cds.tx({ tenant: t0 }, tx =>
|
|
112
|
-
tx.run(SELECT.from(Tenants).columns(['ID', 'metadata', 'createdAt', 'modifiedAt']))
|
|
113
|
-
)).map(({ ID, metadata, createdAt, modifiedAt }) => ({ subscribedTenantId: ID, ...this._toMetadataJson(metadata, ID), createdAt, modifiedAt }))
|
|
113
|
+
tx.run(SELECT.from(Tenants).columns(['ID', 'metadata', 'status', 'createdAt', 'modifiedAt']))
|
|
114
|
+
)).map(({ ID, metadata, status = 'SUBSCRIBED', createdAt, modifiedAt }) => ({ subscribedTenantId: ID, ...this._toMetadataJson(metadata, ID), status, createdAt, modifiedAt }))
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
async _getTenants(options) {
|
|
117
118
|
const ds = await cds.connect.to(DeploymentService)
|
|
118
|
-
const all = await ds.getTenants(options)
|
|
119
|
+
const all = await ds.getTenants({ ...options, status: SUBSCRIBED })
|
|
119
120
|
if (cds.env.requires[this.name]?.upgrade?.ignoreNonExistingContainers) {
|
|
120
121
|
const containers = await ds.getContainers()
|
|
121
122
|
return all.filter(t => containers.includes(t))
|
|
@@ -189,10 +190,10 @@ module.exports = class ProvisioningService extends cds.ApplicationService {
|
|
|
189
190
|
|
|
190
191
|
return await new Promise((resolve, reject) => {
|
|
191
192
|
const tx = js.tx({ tenant: cds.context.tenant, user: new cds.User.Privileged() })
|
|
192
|
-
const job = tx.enqueue(DeploymentService, 'upgrade', clusters, { options }, async error => {
|
|
193
|
-
if (
|
|
194
|
-
await this._sendCallback('FAILED', `Tenant upgrade failed with error '${
|
|
195
|
-
if (isSync) reject(
|
|
193
|
+
const job = tx.enqueue(DeploymentService, 'upgrade', clusters, { options }, async (message, error) => {
|
|
194
|
+
if (message) {
|
|
195
|
+
await this._sendCallback('FAILED', `Tenant upgrade failed with error '${message}'`)
|
|
196
|
+
if (isSync) reject(error)
|
|
196
197
|
} else {
|
|
197
198
|
await this._sendCallback('SUCCEEDED', 'Tenant upgrade succeeded')
|
|
198
199
|
if (isSync) {
|
|
@@ -13,6 +13,7 @@ service cds.xt.SaasProvisioningService @(impl:'@sap/cds-mtxs/srv/cf/saas-provisi
|
|
|
13
13
|
subscribedSubdomain : String(256);
|
|
14
14
|
subscriptionAppName : String(256); // name of main subscribed application
|
|
15
15
|
eventType: String(64); // "CREATE/UPDATE", indicates if called for new subscription (CREATE) or dependencies update (UPDATE)
|
|
16
|
+
status: cds.xt.TenantStatus;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function dependencies() returns array of { xsappname: String };
|
|
@@ -13,6 +13,7 @@ service cds.xt.SmsProvisioningService @(impl:'@sap/cds-mtxs/srv/cf/sms-provision
|
|
|
13
13
|
key subscribedTenantId : String @assert.format: '^[^\*]+$';
|
|
14
14
|
subscriber: Subscriber;
|
|
15
15
|
eventType: String(64); // "CREATE/UPDATE", indicates if called for new subscription (CREATE) or dependencies update (UPDATE)
|
|
16
|
+
status: cds.xt.TenantStatus;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
//returns array of { xsappname: String };
|
|
@@ -21,10 +21,13 @@ module.exports = (srv) => {
|
|
|
21
21
|
|
|
22
22
|
// Merge extension to one extension csn
|
|
23
23
|
let extCsn
|
|
24
|
-
|
|
24
|
+
const extensions = Array.isArray(extension) ? extension : [extension] // wrap single string/object
|
|
25
|
+
for (let ext of extensions) {
|
|
25
26
|
if (typeof ext === 'string') {
|
|
26
27
|
if (!ext.length) throw new cds.error({ message: 'Missing extension', code: 400 })
|
|
27
|
-
if (_isCSN(ext)) extCsn = _mergeCSN(JSON.parse(ext), extCsn)
|
|
28
|
+
if (_isCSN(ext)) try { extCsn = _mergeCSN(JSON.parse(ext), extCsn) } catch (e) {
|
|
29
|
+
throw new cds.error({ message: `Invalid extension: ${e.message}`, code: 422 })
|
|
30
|
+
}
|
|
28
31
|
else try { extCsn = _mergeCSN(cds.parse.cdl(ext), extCsn) } catch (e) {
|
|
29
32
|
if (e.code === 'ERR_CDS_COMPILATION_FAILURE') throw new cds.error({ message: e.message, code: 422 })
|
|
30
33
|
else throw e
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const EXTENSION_ALLOWLIST = 'extension-allowlist'
|
|
2
2
|
|
|
3
|
-
const PROTECTED_NAMESPACES = ['cds.xt']
|
|
3
|
+
const PROTECTED_NAMESPACES = ['cds.xt', 'cds.core', 'cds.outbox']
|
|
4
4
|
|
|
5
5
|
module.exports.PROTECTED_NAMESPACES = PROTECTED_NAMESPACES
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ module.exports.isBuiltIn = (name) => {
|
|
|
13
13
|
return false
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
module.exports.Allowlist = class Allowlist {
|
|
18
17
|
constructor(mtxConfig, fullCsn) {
|
|
19
18
|
this.allowlist = Allowlist._setupPermissionList(mtxConfig, fullCsn)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const LinterMessage = require('./message')
|
|
2
|
+
const { Allowlist, isBuiltIn } = require('./config')
|
|
3
|
+
|
|
4
|
+
// Checks uploaded CSV data files against the entity 'extension-allowlist'.
|
|
5
|
+
// Only entities that are allowed to be extended may also receive data via CSV.
|
|
6
|
+
|
|
7
|
+
// Maps a CSV data file name to the fully-qualified entity name it provides data for.
|
|
8
|
+
// Mirrors the convention in cds core (cds/lib/dbs/cds-deploy.js _entity4)
|
|
9
|
+
const entityNameFromCsvFile = (file, csn) => {
|
|
10
|
+
const base = file.replace(/\.csv$/i, '')
|
|
11
|
+
const name = base.replace(/-/g, '.')
|
|
12
|
+
if (csn?.definitions?.[name]) return name
|
|
13
|
+
// localization files: 'Books.texts', 'Books.texts_de', 'Books_texts'
|
|
14
|
+
const m = /(.+)[._]texts_?/.exec(name)
|
|
15
|
+
if (m) {
|
|
16
|
+
const target = csn?.definitions?.[m[1]]?.elements?.texts?.target
|
|
17
|
+
if (target) return target
|
|
18
|
+
}
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = class CsvAllowlistChecker {
|
|
23
|
+
|
|
24
|
+
check(csvNames, fullCsn, mtxConfig) {
|
|
25
|
+
// no restriction if no allowlist is configured or no data is uploaded
|
|
26
|
+
if (!Object.keys(mtxConfig ?? {}).length) return []
|
|
27
|
+
if (!csvNames || !csvNames.length) return []
|
|
28
|
+
|
|
29
|
+
const allowList = new Allowlist(mtxConfig, fullCsn)
|
|
30
|
+
const messages = []
|
|
31
|
+
|
|
32
|
+
for (const csvName of csvNames) {
|
|
33
|
+
// ignore hidden/metadata files (e.g. macOS AppleDouble '._*' created by tar);
|
|
34
|
+
// these are never valid entity data files
|
|
35
|
+
if (!csvName || csvName.startsWith('.')) continue
|
|
36
|
+
|
|
37
|
+
const name = entityNameFromCsvFile(csvName, fullCsn)
|
|
38
|
+
|
|
39
|
+
// unknown entity (not resolvable in the model) -> cannot be on the allowlist -> block
|
|
40
|
+
if (!name) {
|
|
41
|
+
messages.push(this._createWarning(csvName, allowList.getList('entity')))
|
|
42
|
+
continue
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// built-in namespaces stay allowed, consistent with model extension checks
|
|
46
|
+
if (isBuiltIn(name)) continue
|
|
47
|
+
|
|
48
|
+
const kind = fullCsn?.definitions?.[name]?.kind ?? 'entity'
|
|
49
|
+
if (!allowList.isAllowed(kind, name)) {
|
|
50
|
+
messages.push(this._createWarning(name, allowList.getList('entity')))
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return messages
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_createWarning(entityName, allowlist = {}) {
|
|
58
|
+
const list = Object.keys(allowlist ?? {})
|
|
59
|
+
const message =
|
|
60
|
+
`Data upload for entity '${entityName}' is not allowed` +
|
|
61
|
+
`. Check entity allowlist: ${list.length > 0 ? list : '<empty list>'}`
|
|
62
|
+
return new LinterMessage(message, { name: entityName })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -4,6 +4,7 @@ const { deduplicateMessages } = require('@sap/cds-compiler')
|
|
|
4
4
|
const NamespaceChecker = require('./namespace')
|
|
5
5
|
const AnnotationsChecker = require('./annotations')
|
|
6
6
|
const AllowlistChecker = require('./allowlist')
|
|
7
|
+
const CsvAllowlistChecker = require('./csv-allowlist')
|
|
7
8
|
const ProtectedNamespaceChecker = require('./protected-namespace')
|
|
8
9
|
|
|
9
10
|
const customLinters = []
|
|
@@ -27,7 +28,7 @@ module.exports.legacyCheck = (env = cds.env) => {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
module.exports.lint = (extCsn, fullCsn, env = cds.env, cloneExt = false) => {
|
|
31
|
+
module.exports.lint = (extCsn, fullCsn, env = cds.env, cloneExt = false, csvNames = []) => {
|
|
31
32
|
const conf = env.requires[EXT_SERVICE_NAME] || env.requires.extensibility || env.mtx || {}
|
|
32
33
|
const linter_options = {}
|
|
33
34
|
let x
|
|
@@ -43,7 +44,8 @@ module.exports.lint = (extCsn, fullCsn, env = cds.env, cloneExt = false) => {
|
|
|
43
44
|
...new ProtectedNamespaceChecker().check(reflectedCsn, reflectedFullCsn, compileBaseDir, linter_options),
|
|
44
45
|
...new NamespaceChecker().check(reflectedCsn, reflectedFullCsn, compileBaseDir, linter_options),
|
|
45
46
|
...new AnnotationsChecker().check(reflectedCsn, reflectedFullCsn, compileBaseDir, linter_options, extCsn),
|
|
46
|
-
...new AllowlistChecker().check(reflectedCsn, reflectedFullCsn, compileBaseDir, linter_options)
|
|
47
|
+
...new AllowlistChecker().check(reflectedCsn, reflectedFullCsn, compileBaseDir, linter_options),
|
|
48
|
+
...new CsvAllowlistChecker().check(csvNames, reflectedFullCsn, linter_options)
|
|
47
49
|
]
|
|
48
50
|
|
|
49
51
|
for (const linter of customLinters) {
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
const LinterMessage = require('./message')
|
|
2
|
-
const { PROTECTED_NAMESPACES } = require('./config')
|
|
2
|
+
const { PROTECTED_NAMESPACES, isBuiltIn } = require('./config')
|
|
3
|
+
|
|
4
|
+
const EXTENSION_ALLOWLIST = 'extension-allowlist'
|
|
3
5
|
|
|
4
6
|
function _protectedNamespaceOf(name) {
|
|
5
7
|
if (!name) return null
|
|
6
8
|
return PROTECTED_NAMESPACES.find(ns => name === ns || name.startsWith(`${ns}.`)) ?? null
|
|
7
9
|
}
|
|
8
10
|
|
|
11
|
+
// Collects all names explicitly listed in the extension-allowlist, so they are
|
|
12
|
+
// allowed even if they fall into a protected namespace.
|
|
13
|
+
function _allowlistedNames(mtxConfig) {
|
|
14
|
+
const names = new Set()
|
|
15
|
+
for (const permission of mtxConfig?.[EXTENSION_ALLOWLIST] ?? []) {
|
|
16
|
+
for (const name of permission.for ?? []) names.add(name)
|
|
17
|
+
}
|
|
18
|
+
return names
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
function locationString(element) {
|
|
10
22
|
const loc = element?.$location
|
|
11
23
|
if (!loc) return ''
|
|
@@ -13,23 +25,67 @@ function locationString(element) {
|
|
|
13
25
|
return loc.col ? `${loc.file}:${line}${loc.col}:` : `${loc.file}:${line}`
|
|
14
26
|
}
|
|
15
27
|
|
|
16
|
-
//
|
|
28
|
+
// Collects all source targets (fully-qualified names) referenced in a query's
|
|
29
|
+
// `from` clause, recursing into joins (`from.args`) and sub-queries
|
|
30
|
+
// (`from.SELECT` / `from.SET.args`).
|
|
31
|
+
function _collectFromTargets(from, acc = []) {
|
|
32
|
+
if (!from || typeof from !== 'object') return acc
|
|
33
|
+
|
|
34
|
+
if (Array.isArray(from.ref) && from.ref.length) {
|
|
35
|
+
const seg = from.ref[0]
|
|
36
|
+
const name = typeof seg === 'string' ? seg : seg?.id
|
|
37
|
+
if (name) acc.push(name)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// joins: from.args is an array of froms
|
|
41
|
+
if (Array.isArray(from.args)) {
|
|
42
|
+
for (const arg of from.args) _collectFromTargets(arg, acc)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// sub-query: from.SELECT is itself a query body with its own from
|
|
46
|
+
if (from.SELECT) _collectFromTargets(from.SELECT.from, acc)
|
|
47
|
+
|
|
48
|
+
// set operation sub-query: from.SET.args is an array of query bodies
|
|
49
|
+
if (from.SET && Array.isArray(from.SET.args)) {
|
|
50
|
+
for (const arg of from.SET.args) _collectFromTargets(arg.SELECT?.from, acc)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return acc
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Rejects defining, extending or annotating artifacts in a protected namespace (e.g. 'cds.xt'),
|
|
57
|
+
// as well as projections/views that read from an artifact in a protected namespace.
|
|
17
58
|
// Runs unconditionally, independent of linter configuration.
|
|
18
59
|
module.exports = class ProtectedNamespaceChecker {
|
|
19
60
|
|
|
20
61
|
// eslint-disable-next-line no-unused-vars
|
|
21
62
|
check(reflectedCsn, fullCsn, compileDir, mtxConfig) {
|
|
22
63
|
const messages = []
|
|
64
|
+
const allowlisted = _allowlistedNames(mtxConfig)
|
|
23
65
|
|
|
24
66
|
for (const name of Object.keys(reflectedCsn.definitions ?? {})) {
|
|
25
|
-
|
|
26
|
-
|
|
67
|
+
const def = reflectedCsn.definitions[name]
|
|
68
|
+
|
|
69
|
+
// name in a protected namespace (built-ins + allowlisted names excluded)
|
|
70
|
+
if (!isBuiltIn(name) && !allowlisted.has(name) && _protectedNamespaceOf(name)) {
|
|
71
|
+
messages.push(this._createWarning(name, def))
|
|
72
|
+
continue // avoid double-counting: name-based block already fired
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// projection/view reading from a protected artifact (allowlist override only, no isBuiltIn)
|
|
76
|
+
const queryBody = def.query?.SELECT ?? def.projection
|
|
77
|
+
if (queryBody) {
|
|
78
|
+
for (const target of _collectFromTargets(queryBody.from)) {
|
|
79
|
+
if (!allowlisted.has(target) && _protectedNamespaceOf(target)) {
|
|
80
|
+
messages.push(this._createExpositionWarning(target, def))
|
|
81
|
+
}
|
|
82
|
+
}
|
|
27
83
|
}
|
|
28
84
|
}
|
|
29
85
|
|
|
30
86
|
for (const extension of reflectedCsn.extensions ?? []) {
|
|
31
87
|
const target = extension.extend ?? extension.annotate
|
|
32
|
-
if (_protectedNamespaceOf(target)) {
|
|
88
|
+
if (!allowlisted.has(target) && _protectedNamespaceOf(target)) {
|
|
33
89
|
messages.push(this._createWarning(target, extension))
|
|
34
90
|
}
|
|
35
91
|
}
|
|
@@ -42,4 +98,10 @@ module.exports = class ProtectedNamespaceChecker {
|
|
|
42
98
|
const message = `Extending, annotating or defining '${name}' in the protected namespace '${namespace}' is not supported in extensions`
|
|
43
99
|
return new LinterMessage(locationString(element) + message, element)
|
|
44
100
|
}
|
|
101
|
+
|
|
102
|
+
_createExpositionWarning(name, element) {
|
|
103
|
+
const namespace = _protectedNamespaceOf(name)
|
|
104
|
+
const message = `Exposing '${name}' from the protected namespace '${namespace}' via a projection/view is not supported in extensions`
|
|
105
|
+
return new LinterMessage(locationString(element) + message, element)
|
|
106
|
+
}
|
|
45
107
|
}
|
|
@@ -2,7 +2,8 @@ const express = require('express')
|
|
|
2
2
|
const cds = require('@sap/cds/lib')
|
|
3
3
|
const { SELECT, DELETE } = cds.ql
|
|
4
4
|
const { fs, path, tar, rimraf, read, readdir, mkdirp, write } = cds.utils
|
|
5
|
-
const
|
|
5
|
+
const utils = require('../lib/utils')
|
|
6
|
+
const { token: authToken, authUrl, iasAuthorizeUrl, iasTokenUrl, IAS_AUTHORIZE_PATH, IAS_TOKEN_PATH, safeUntar, readDataCsv } = utils
|
|
6
7
|
const main = require('./config')
|
|
7
8
|
const linter = require('./extensibility/linter')
|
|
8
9
|
|
|
@@ -18,7 +19,7 @@ const ACTIVE = 2, DRAFT = 1, INACTIVE = 0
|
|
|
18
19
|
|
|
19
20
|
// determine appid for separation of extensions
|
|
20
21
|
//const packageJson = require(main.root + '/package.json');
|
|
21
|
-
const APPID =
|
|
22
|
+
const APPID = utils.getAppId()
|
|
22
23
|
|
|
23
24
|
const conf = () => ({ ...main.env.requires.extensibility, ...cds.env.requires['cds.xt.ExtensibilityService'] })
|
|
24
25
|
|
|
@@ -152,7 +153,12 @@ module.exports = class ExtensibilityService extends cds.ApplicationService {
|
|
|
152
153
|
// REVISIT: string ?
|
|
153
154
|
const sources = typeof extension === 'string' ? Buffer.from(extension, 'base64') : extension
|
|
154
155
|
const root = await fs.promises.mkdtemp(`${TEMP_DIR}${path.sep}extension-`)
|
|
155
|
-
|
|
156
|
+
try {
|
|
157
|
+
await safeUntar(sources, root)
|
|
158
|
+
} catch (e) {
|
|
159
|
+
await rimraf(root)
|
|
160
|
+
throw e
|
|
161
|
+
}
|
|
156
162
|
return { root, archive: sources }
|
|
157
163
|
}
|
|
158
164
|
|
|
@@ -306,7 +312,9 @@ module.exports = class ExtensibilityService extends cds.ApplicationService {
|
|
|
306
312
|
// verify edmx
|
|
307
313
|
cds.compile.to.edmx(extFullCsn, { service: 'all', version: cds.env.odata?.version ?? 'v4' })
|
|
308
314
|
|
|
309
|
-
|
|
315
|
+
const csvNames = await _readExtensionCsvNames(req.data.ID)
|
|
316
|
+
|
|
317
|
+
messages = linter.lint(extCsn, extFullCsn, cds.env, /* clone */ true, csvNames)
|
|
310
318
|
} catch (error) {
|
|
311
319
|
let validationError = error
|
|
312
320
|
if (error.code === 'ERR_CDS_COMPILATION_FAILURE') messages = error.messages
|
|
@@ -318,6 +326,35 @@ module.exports = class ExtensibilityService extends cds.ApplicationService {
|
|
|
318
326
|
}
|
|
319
327
|
})
|
|
320
328
|
|
|
329
|
+
// reads the CSV data file names of the (not yet activated) extension with the given tag.
|
|
330
|
+
// used to validate uploaded data against the entity allowlist.
|
|
331
|
+
async function _readExtensionCsvNames(tag) {
|
|
332
|
+
// CSV deployment globally disabled -> nothing to gate here
|
|
333
|
+
if (conf().activate?.['skip-csv']) return []
|
|
334
|
+
|
|
335
|
+
let entry
|
|
336
|
+
try {
|
|
337
|
+
// mirror the selection in activateExtension: the inactive entry for this tag.
|
|
338
|
+
// tag may be null (untagged push) -> translates to 'tag IS NULL'
|
|
339
|
+
entry = await SELECT.one('sources')
|
|
340
|
+
.from('cds.xt.Extensions')
|
|
341
|
+
.where({ tag: tag ?? null, activated: { '!=': 'database' } })
|
|
342
|
+
.orderBy('timestamp desc')
|
|
343
|
+
} catch (e) {
|
|
344
|
+
DEBUG?.('could not read extension sources for csv validation', tag, e)
|
|
345
|
+
return []
|
|
346
|
+
}
|
|
347
|
+
if (!entry?.sources) return []
|
|
348
|
+
|
|
349
|
+
const root = await fs.promises.mkdtemp(`${TEMP_DIR}${path.sep}extension-`)
|
|
350
|
+
try {
|
|
351
|
+
const { csvs } = await readDataCsv(entry.sources, root)
|
|
352
|
+
return Object.keys(csvs ?? {})
|
|
353
|
+
} finally {
|
|
354
|
+
await rimraf(root)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
321
358
|
this.on('discard', async req => {
|
|
322
359
|
const tenant = _tenant(req)
|
|
323
360
|
if (tenant) cds.context = { tenant }
|
|
@@ -411,16 +448,7 @@ module.exports = class ExtensibilityService extends cds.ApplicationService {
|
|
|
411
448
|
|
|
412
449
|
const query = req.body || {}
|
|
413
450
|
|
|
414
|
-
|
|
415
|
-
const refresh_token = typeof query.refresh_token === 'string' ? query.refresh_token : undefined
|
|
416
|
-
const passcode = typeof query.passcode === 'string' ? query.passcode : undefined
|
|
417
|
-
if (!refresh_token && !passcode)
|
|
418
|
-
throw cds.error('missing passcode or refresh_token', { status: 400 })
|
|
419
|
-
|
|
420
|
-
const form = refresh_token ? { grant_type: 'refresh_token', refresh_token } :
|
|
421
|
-
{ grant_type: 'password', passcode }
|
|
422
|
-
form.scope = `${cred.xsappname}.cds.ExtensionDeveloper`
|
|
423
|
-
const raw = await authToken(cred, { form, subdomain: query.subdomain })
|
|
451
|
+
const raw = _isIas() ? await _iasGrant(cred, query) : await _xsuaaGrant(cred, query)
|
|
424
452
|
const data = JSON.parse(raw)
|
|
425
453
|
if (data.error) return res.status(401).json(data)
|
|
426
454
|
res.json(data)
|
|
@@ -509,9 +537,144 @@ function _passcodeUrl(c, sub) {
|
|
|
509
537
|
return authUrl(c.url, sub, '/passcode').toString()
|
|
510
538
|
}
|
|
511
539
|
|
|
512
|
-
|
|
540
|
+
// True if the configured authentication kind is SAP Cloud Identity Services (IAS).
|
|
541
|
+
function _isIas() {
|
|
542
|
+
return cds.env.requires?.auth?.kind === 'ias'
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// XSUAA login: exchange passcode or refresh_token for a token with the
|
|
546
|
+
// `<xsappname>.cds.ExtensionDeveloper` scope.
|
|
547
|
+
async function _xsuaaGrant(cred, query) {
|
|
548
|
+
const refresh_token = typeof query.refresh_token === 'string' ? query.refresh_token : undefined
|
|
549
|
+
const passcode = typeof query.passcode === 'string' ? query.passcode : undefined
|
|
550
|
+
if (!refresh_token && !passcode)
|
|
551
|
+
throw cds.error('missing passcode or refresh_token', { status: 400 })
|
|
552
|
+
|
|
553
|
+
const form = refresh_token ? { grant_type: 'refresh_token', refresh_token } :
|
|
554
|
+
{ grant_type: 'password', passcode }
|
|
555
|
+
form.scope = `${cred.xsappname}.cds.ExtensionDeveloper`
|
|
556
|
+
return authToken(cred, { form, subdomain: query.subdomain })
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// Resolves the subscriber's IAS login target: `app_tid` (request → subscriber by subdomain
|
|
560
|
+
// → provider binding) and the subscriber's IAS `tenantHost` (undefined → provider host).
|
|
561
|
+
async function _iasLoginTarget(cred, query = {}) {
|
|
562
|
+
const subdomain = typeof query.subdomain === 'string' ? query.subdomain : undefined
|
|
563
|
+
const tenant = subdomain ? await _subscriberTenant(subdomain, cred) : undefined
|
|
564
|
+
const app_tid =
|
|
565
|
+
(typeof query.app_tid === 'string' && query.app_tid) ||
|
|
566
|
+
tenant?.app_tid ||
|
|
567
|
+
cred.app_tid || cred.appTid || cred.zone_uuid // provider tenant
|
|
568
|
+
return { app_tid, tenantHost: tenant?.tenantHost }
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Single DNS label; also prevents LIKE wildcards / JSON quotes leaking into the pattern.
|
|
572
|
+
const SUBDOMAIN_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i
|
|
573
|
+
|
|
574
|
+
// Extracts subdomain/app_tid/tenantHost from registry metadata (nested under `subscriber`
|
|
575
|
+
// or top-level), tolerating JSON key-order / whitespace variations.
|
|
576
|
+
function _subscriberInfo(meta) {
|
|
577
|
+
const s = meta?.subscriber ?? meta
|
|
578
|
+
const subdomain = s?.subaccountSubdomain ?? s?.subscribedSubdomain ?? meta?.subscribedSubdomain
|
|
579
|
+
const app_tid = s?.app_tid ?? meta?.app_tid ?? meta?.subscribedTenantId
|
|
580
|
+
const tenantHost = s?.tenantHost ?? meta?.tenantHost
|
|
581
|
+
return { subdomain, app_tid, tenantHost }
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Looks up a subscribed tenant by subdomain in `cds.xt.Tenants`. Non-fatal; only when
|
|
585
|
+
// multitenancy is configured. Falls back to the IAS `tenantLoginInfo` endpoint (derived
|
|
586
|
+
// from the auth binding) when the registry has no match.
|
|
587
|
+
async function _subscriberTenant(subdomain, cred) {
|
|
588
|
+
if (!cds.env.requires?.multitenancy) return undefined
|
|
589
|
+
if (!SUBDOMAIN_RE.test(subdomain)) return undefined
|
|
590
|
+
try {
|
|
591
|
+
// Pre-filter on the raw subdomain value (robust to JSON formatting); confirm in JS.
|
|
592
|
+
const like = `%"${subdomain}"%`
|
|
593
|
+
const rows = await utils.t0_(
|
|
594
|
+
SELECT.from('cds.xt.Tenants').columns('ID', 'metadata').where('metadata like', like)
|
|
595
|
+
)
|
|
596
|
+
let match
|
|
597
|
+
for (const { ID, metadata } of rows || []) {
|
|
598
|
+
let meta
|
|
599
|
+
try { meta = metadata ? JSON.parse(metadata) : undefined } catch { /* ignore */ }
|
|
600
|
+
const info = _subscriberInfo(meta)
|
|
601
|
+
if (info.subdomain === subdomain) {
|
|
602
|
+
match = { app_tid: info.app_tid || ID, tenantHost: info.tenantHost }
|
|
603
|
+
break
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
DEBUG?.('Resolving subscriber tenant:', { requested_subdomain: subdomain, resolved_app_tid: match?.app_tid, tenant_host: match?.tenantHost, candidates: rows?.length ?? 0 })
|
|
607
|
+
if (match) return match
|
|
608
|
+
} catch (err) {
|
|
609
|
+
DEBUG?.('Failed to resolve subscriber tenant for subdomain from tenant table', subdomain, '-', err.message)
|
|
610
|
+
}
|
|
611
|
+
// Fallback: ask the IAS landscape endpoint for the subscriber's login info.
|
|
612
|
+
DEBUG?.('Trying fallback via tenantLoginInfo')
|
|
613
|
+
const apiHost = utils.tenantLoginInfoHost(cred)
|
|
614
|
+
const info = apiHost && await utils.tenantLoginInfo(apiHost, subdomain)
|
|
615
|
+
if (info) {
|
|
616
|
+
DEBUG?.('Resolved subscriber tenant via tenantLoginInfo:', { requested_subdomain: subdomain, resolved_app_tid: info.app_tid, tenant_host: info.tenantHost, api_host: apiHost })
|
|
617
|
+
return info
|
|
618
|
+
}
|
|
619
|
+
return undefined
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// IAS login: exchange the authorization_code (browser PKCE flow) or a refresh_token
|
|
623
|
+
// for a token. Authorization as `cds.ExtensionDeveloper` comes from AMS policies, not scopes.
|
|
624
|
+
async function _iasGrant(cred, query) {
|
|
625
|
+
const refresh_token = typeof query.refresh_token === 'string' ? query.refresh_token : undefined
|
|
626
|
+
const code = typeof query.authorization_code === 'string' ? query.authorization_code : undefined
|
|
627
|
+
if (!refresh_token && !code)
|
|
628
|
+
throw cds.error('missing authorization_code or refresh_token', { status: 400 })
|
|
629
|
+
|
|
630
|
+
// Redeem the code at the (consumer) tenant that issued it; fall back to the provider host.
|
|
631
|
+
const { app_tid, tenantHost } = await _iasLoginTarget(cred, query)
|
|
632
|
+
|
|
633
|
+
const form = refresh_token
|
|
634
|
+
? { grant_type: 'refresh_token', refresh_token }
|
|
635
|
+
: {
|
|
636
|
+
grant_type: 'authorization_code',
|
|
637
|
+
code,
|
|
638
|
+
...(typeof query.code_verifier === 'string' && { code_verifier: query.code_verifier }),
|
|
639
|
+
...(typeof query.redirect_uri === 'string' && { redirect_uri: query.redirect_uri })
|
|
640
|
+
}
|
|
641
|
+
if (app_tid) form.app_tid = app_tid
|
|
642
|
+
|
|
643
|
+
// mTLS via the provider's X509 client; host is the consumer tenant when resolved, else
|
|
644
|
+
// the fixed provider host (no `subdomain`).
|
|
645
|
+
return authToken(cred, tenantHost
|
|
646
|
+
? { form, endpoint: `https://${tenantHost}${IAS_TOKEN_PATH}` }
|
|
647
|
+
: { form, path: IAS_TOKEN_PATH })
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
async function authMeta(req, res) {
|
|
513
651
|
const cred = cds.env.requires?.auth?.credentials || {}
|
|
514
652
|
try {
|
|
653
|
+
if (_isIas()) {
|
|
654
|
+
// Redirect the browser to the subscriber's own IAS tenant; fall back to the provider host.
|
|
655
|
+
const { app_tid, tenantHost } = await _iasLoginTarget(cred, req.query || {})
|
|
656
|
+
const meta = {
|
|
657
|
+
flow: 'authorization_code',
|
|
658
|
+
pkce: true,
|
|
659
|
+
client_id: cred.clientid,
|
|
660
|
+
scope: 'openid',
|
|
661
|
+
authorization_endpoint: tenantHost ? `https://${tenantHost}${IAS_AUTHORIZE_PATH}` : iasAuthorizeUrl(cred),
|
|
662
|
+
token_endpoint: tenantHost ? `https://${tenantHost}${IAS_TOKEN_PATH}` : iasTokenUrl(cred),
|
|
663
|
+
...(app_tid && { app_tid }) // sent on both authorize and token
|
|
664
|
+
}
|
|
665
|
+
DEBUG?.('IAS login metadata:', {
|
|
666
|
+
client_id: meta.client_id,
|
|
667
|
+
requested_subdomain: req.query?.subdomain,
|
|
668
|
+
app_tid: meta.app_tid,
|
|
669
|
+
binding_app_tid: cred.app_tid || cred.appTid || cred.zone_uuid,
|
|
670
|
+
tenant_host: tenantHost,
|
|
671
|
+
authorization_endpoint: meta.authorization_endpoint,
|
|
672
|
+
token_endpoint: meta.token_endpoint,
|
|
673
|
+
binding_url: cred.url,
|
|
674
|
+
binding_certurl: cred.certurl
|
|
675
|
+
})
|
|
676
|
+
return res.send(meta)
|
|
677
|
+
}
|
|
515
678
|
res.send({ passcode_url: _passcodeUrl(cred, req.query?.subdomain) })
|
|
516
679
|
} catch (err) {
|
|
517
680
|
res.status(err.status || err.statusCode || 500).json({ error: err.message })
|
|
@@ -552,3 +715,4 @@ const _decodeError = (activationError) => {
|
|
|
552
715
|
return value
|
|
553
716
|
})
|
|
554
717
|
}
|
|
718
|
+
|