@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
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
} = require('./xssec')
|
|
12
12
|
|
|
13
13
|
module.exports = function ias_auth(config) {
|
|
14
|
-
// cds.
|
|
14
|
+
// cds.requires.auth.known_claims is not an official config!
|
|
15
15
|
const { kind, credentials, config: serviceConfig = {}, known_claims = KNOWN_CLAIMS, xsuaa = 'xsuaa' } = config
|
|
16
16
|
const skipped_attrs = known_claims.reduce((a, x) => ((a[x] = 1), a), {})
|
|
17
17
|
|
|
@@ -54,8 +54,8 @@ module.exports = function ias_auth(config) {
|
|
|
54
54
|
// xsuaa fallback allows to also accept XSUAA tokens during migration to IAS
|
|
55
55
|
// automatically enabled if xsuaa credentials are available
|
|
56
56
|
let xsuaa_service, xsuaa_user_factory
|
|
57
|
-
if (cds.
|
|
58
|
-
const { credentials: xsuaa_credentials, config: xsuaa_serviceConfig = {} } = cds.
|
|
57
|
+
if (cds.requires[xsuaa]?.credentials) {
|
|
58
|
+
const { credentials: xsuaa_credentials, config: xsuaa_serviceConfig = {} } = cds.requires[xsuaa]
|
|
59
59
|
xsuaa_service = new XsuaaService(xsuaa_credentials, xsuaa_serviceConfig)
|
|
60
60
|
const get_xsuaa_user_factory = require('./jwt-auth')._get_user_factory
|
|
61
61
|
xsuaa_user_factory = get_xsuaa_user_factory(xsuaa_credentials, xsuaa_credentials.xsappname, 'xsuaa')
|
|
@@ -86,46 +86,47 @@ module.exports = function ias_auth(config) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function get_user_factory(credentials, skipped_attrs) {
|
|
89
|
+
const enforce_provider_tenant = cds.env.requires.auth?.enforce_provider_tenant !== false
|
|
90
|
+
|
|
89
91
|
return function user_factory(securityContext) {
|
|
90
92
|
const tokenInfo = securityContext.token
|
|
91
93
|
const payload = tokenInfo.getPayload()
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*/
|
|
95
|
+
let id = payload.sub
|
|
96
|
+
|
|
97
|
+
const roles = {}
|
|
98
|
+
if (Array.isArray(payload.ias_apis)) payload.ias_apis.forEach(r => (roles[r] = 1))
|
|
99
|
+
delete roles['system-user']
|
|
100
|
+
delete roles['internal-user']
|
|
100
101
|
|
|
101
102
|
const clientid = tokenInfo.getClientId()
|
|
102
|
-
|
|
103
|
+
// An explicit identity type supersedes the legacy client/subject heuristic; unknown types fail closed.
|
|
104
|
+
const is_system_user = payload.sap_id_type == null ? !!clientid && clientid === payload.sub : payload.sap_id_type === 'app'
|
|
105
|
+
if (is_system_user) {
|
|
103
106
|
//> grant_type === client_credentials or x509
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return user
|
|
107
|
+
id = 'system'
|
|
108
|
+
roles['system-user'] = 1
|
|
109
|
+
const provider_tenant = credentials.app_tid ?? credentials.zone_uuid
|
|
110
|
+
const is_provider_tenant = !!provider_tenant && tokenInfo.getZoneId() === provider_tenant
|
|
111
|
+
if (clientid && clientid === credentials.clientid && (!enforce_provider_tenant || is_provider_tenant))
|
|
112
|
+
roles['internal-user'] = 1
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
// add all unknown attributes to req.user.attr in order to keep public API small
|
|
114
115
|
const attr = {}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
if (!('system-user' in roles)) {
|
|
117
|
+
// add all unknown attributes to req.user.attr in order to keep public API small
|
|
118
|
+
for (const key in payload) {
|
|
119
|
+
if (key in skipped_attrs)
|
|
120
|
+
continue // REVISIT: Why do we need to do that?
|
|
121
|
+
else attr[key] = payload[key]
|
|
122
|
+
}
|
|
123
|
+
// same api as xsuaa-auth for easier migration
|
|
124
|
+
if (attr.user_name) attr.logonName = attr.user_name
|
|
125
|
+
if (attr.given_name) attr.givenName = attr.given_name
|
|
126
|
+
if (attr.family_name) attr.familyName = attr.family_name
|
|
119
127
|
}
|
|
120
128
|
|
|
121
|
-
|
|
122
|
-
// REVISIT: looks like wrong direction to me, btw
|
|
123
|
-
// same api as xsuaa-auth for easier migration
|
|
124
|
-
if (attr.user_name) attr.logonName = attr.user_name
|
|
125
|
-
if (attr.given_name) attr.givenName = attr.given_name
|
|
126
|
-
if (attr.family_name) attr.familyName = attr.family_name
|
|
127
|
-
|
|
128
|
-
const user = new cds.User({ id: payload.sub, attr, authInfo: securityContext })
|
|
129
|
+
const user = new cds.User({ id, roles, attr, authInfo: securityContext })
|
|
129
130
|
return user
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -160,8 +161,10 @@ const KNOWN_CLAIMS = Object.values({
|
|
|
160
161
|
SAP_GLOBAL_ZONE_ID: 'zone_uuid',
|
|
161
162
|
// GROUPS: 'groups', //> do not exclude
|
|
162
163
|
AUTHORIZATION_PARTY: 'azp',
|
|
164
|
+
SAP_ID_TYPE: 'sap_id_type',
|
|
163
165
|
CNF: 'cnf',
|
|
164
166
|
CNF_X5T: 'x5t#S256',
|
|
165
167
|
// own
|
|
166
|
-
APP_TENANT_ID: 'app_tid'
|
|
168
|
+
APP_TENANT_ID: 'app_tid',
|
|
169
|
+
IAS_APIS: 'ias_apis'
|
|
167
170
|
})
|
|
@@ -51,6 +51,7 @@ module.exports = function jwt_auth(config) {
|
|
|
51
51
|
|
|
52
52
|
function get_user_factory(credentials, xsappname, kind) {
|
|
53
53
|
xsappname = xsappname + '.'
|
|
54
|
+
const enforce_provider_tenant = cds.env.requires.auth?.enforce_provider_tenant !== false
|
|
54
55
|
|
|
55
56
|
return function user_factory(securityContext) {
|
|
56
57
|
const tokenInfo = securityContext.token
|
|
@@ -70,7 +71,10 @@ function get_user_factory(credentials, xsappname, kind) {
|
|
|
70
71
|
if (payload.grant_type in { client_credentials: 1, client_x509: 1 }) {
|
|
71
72
|
id = 'system'
|
|
72
73
|
roles['system-user'] = 1
|
|
73
|
-
|
|
74
|
+
const clientid = tokenInfo.getClientId()
|
|
75
|
+
const is_provider_tenant = !!credentials.tenantid && tokenInfo.getZoneId() === credentials.tenantid
|
|
76
|
+
if (clientid && clientid === credentials.clientid && (!enforce_provider_tenant || is_provider_tenant))
|
|
77
|
+
roles['internal-user'] = 1
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
const attr = { ...payload['xs.user.attributes'] }
|
|
@@ -7,7 +7,7 @@ class MockedUsers {
|
|
|
7
7
|
const tenants = this.tenants = options.tenants || {}
|
|
8
8
|
const users = this.users = options.users || {}
|
|
9
9
|
for (let [k,v] of Object.entries(users)) {
|
|
10
|
-
if (!cds.
|
|
10
|
+
if (!cds.requires.multitenancy) delete v.tenant
|
|
11
11
|
if (typeof v === 'boolean') continue
|
|
12
12
|
if (typeof v === 'string') v = { password:v }
|
|
13
13
|
let id = _configured(v).id || k
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const { pipeline } = require('node:stream/promises')
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const SELECT = require('../../ql/SELECT')
|
|
5
|
-
const PROD = process.env.NODE_ENV === 'production'
|
|
1
|
+
const { pipeline } = require ('node:stream/promises')
|
|
2
|
+
const express = require ('express')
|
|
3
|
+
const cds = require ('../../index')
|
|
6
4
|
const LOG = cds.log ('hcql')
|
|
7
5
|
|
|
8
6
|
|
|
@@ -11,11 +9,12 @@ class HCQLAdapter extends require('./http') {
|
|
|
11
9
|
get router() {
|
|
12
10
|
const bpo = this.body_parser_options
|
|
13
11
|
const router = super.router
|
|
14
|
-
.get ('
|
|
12
|
+
.get ('/', this.describe.bind(this))
|
|
15
13
|
.use (express.json(bpo)) //> for application/json -> cqn
|
|
16
14
|
.use (express.text(bpo)) //> for text/plain -> cql -> cqn
|
|
17
|
-
.use (
|
|
18
|
-
|
|
15
|
+
.use (log_request)
|
|
16
|
+
if (process.env.NODE_ENV !== 'production')
|
|
17
|
+
router.use (['/:entity/:id','/:entity'], this.shortcut.bind(this))
|
|
19
18
|
router.use ('/:event', this.action.bind(this))
|
|
20
19
|
router.use (this.query.bind(this))
|
|
21
20
|
return router
|
|
@@ -23,23 +22,63 @@ class HCQLAdapter extends require('./http') {
|
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
|
-
* Handler for
|
|
25
|
+
* Handler for /?describe requests.
|
|
26
|
+
* @type {express.RequestHandler}
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
LOG.info (req.method,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
); next()
|
|
33
|
-
}
|
|
28
|
+
describe (req, res) {
|
|
29
|
+
LOG.info (req.method, decodeURI (req.baseUrl + req.path), {...req.query})
|
|
30
|
+
const srv = this.service, response = { service: srv.name }
|
|
31
|
+
const { describe } = req.query
|
|
34
32
|
|
|
33
|
+
// Handle special describe requests like $csn
|
|
34
|
+
if (describe === '$csn') return res.json (
|
|
35
|
+
cds.minify (this.service.model, response)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
// If no entities or actions are requested, return a service summary.
|
|
39
|
+
const entities = Object.keys(srv.entities)
|
|
40
|
+
const actions = Object.keys(srv.actions)
|
|
41
|
+
if (!describe) return res.json ({ ...response, entities, actions })
|
|
42
|
+
|
|
43
|
+
// Otherwise, return the description for the specified entities or actions.
|
|
44
|
+
const chosen = describe === 'all' ? [ ...entities, ...actions ] : describe.split(',')
|
|
45
|
+
chosen.forEach (each => {
|
|
46
|
+
const d = srv.entities[each] || srv.actions[each]
|
|
47
|
+
if (!d) return (response.unknown??=[]).push(each)
|
|
48
|
+
const section = response [d.kind === 'entity' ? 'entities' : 'actions'] ??= {}
|
|
49
|
+
const spec = section[each] = { kind: d.kind }
|
|
50
|
+
if (d.elements) spec.elements = squeezed (d.elements)
|
|
51
|
+
if (d.params) spec.params = squeezed (d.params)
|
|
52
|
+
if (d.returns) spec.returns = Object.values(squeezed ([d.returns]))[0]
|
|
53
|
+
})
|
|
54
|
+
return res.json (response)
|
|
55
|
+
|
|
56
|
+
// Helper function to squeeze elements for concise representation
|
|
57
|
+
function squeezed (elements, fks) {
|
|
58
|
+
const response = {}
|
|
59
|
+
for (let e of elements) {
|
|
60
|
+
if (e['@odata.foreignKey4']) continue
|
|
61
|
+
if (e.target) {
|
|
62
|
+
let local = e.target.slice (srv.name.length + 1)
|
|
63
|
+
if (!srv.entities[local]) continue
|
|
64
|
+
}
|
|
65
|
+
let spec = response[e.name] = {}
|
|
66
|
+
if (e.key && !fks) spec.key = true
|
|
67
|
+
if (e.items) { spec = spec.items = {}; e = e.items }
|
|
68
|
+
if (e.type) spec.type =
|
|
69
|
+
e.isComposition ? `Composition of ${e.is2many ? 'many ':''}${local(e.target)}` :
|
|
70
|
+
e.isAssociation ? `Association to ${e.is2many ? 'many ':''}${local(e.target)}` :
|
|
71
|
+
e.type.replace(/^cds\./,'')
|
|
72
|
+
if (e.length) spec.type += `(${e.length})`
|
|
73
|
+
if (e.elements) spec.elements = squeezed (e.elements)
|
|
74
|
+
if (e.foreignKeys) spec.elements = squeezed (e.foreignKeys, 'fks')
|
|
75
|
+
}
|
|
76
|
+
return response
|
|
77
|
+
}
|
|
78
|
+
function local (name) {
|
|
79
|
+
return name.startsWith(srv.name+'.') ? name.slice (srv.name.length + 1) : name
|
|
80
|
+
}
|
|
35
81
|
|
|
36
|
-
/**
|
|
37
|
-
* Return the CSN as schema in response to /<srv>/$csn requests
|
|
38
|
-
* @type {express.RequestHandler}
|
|
39
|
-
*/
|
|
40
|
-
schema (_, res) {
|
|
41
|
-
let csn = cds.minify (this.service.model, { service: this.service.name })
|
|
42
|
-
return res.json (csn)
|
|
43
82
|
}
|
|
44
83
|
|
|
45
84
|
|
|
@@ -47,30 +86,44 @@ class HCQLAdapter extends require('./http') {
|
|
|
47
86
|
* Handler for REST-style convenience shortcuts like GET /Books/201
|
|
48
87
|
* @type {express.RequestHandler}
|
|
49
88
|
*/
|
|
50
|
-
|
|
51
|
-
let { entity, id } = req.params, tail, body = req.body
|
|
52
|
-
if (entity in
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
89
|
+
shortcut (req, res, next) {
|
|
90
|
+
let { entity, id } = req.params, tail, body = req.body, srv =this.service
|
|
91
|
+
if (entity in srv.actions) return this.action (req, res, next)
|
|
92
|
+
|
|
93
|
+
if (req.method === 'GET') {
|
|
94
|
+
if (entity.includes(' ')) [,entity,tail] = /^(\w+)( .*)?/.exec(entity)
|
|
95
|
+
else if (id?.includes(' ')) [,id,tail] = /^(\w+)( .*)/.exec(id)
|
|
96
|
+
else if (typeof body === 'string') [tail,body] = [body,undefined]
|
|
97
|
+
const { SELECT } = cds.ql
|
|
98
|
+
const q = req.body = tail?.length ? id ? SELECT (`from ${entity} [${id}] ${tail}`)
|
|
99
|
+
: SELECT (`from ${entity} ${tail}`)
|
|
100
|
+
: {SELECT: subject('from') }
|
|
101
|
+
if (id !== undefined) q.SELECT.one = true //> ensures we reply 404 instead of 200 or 204
|
|
102
|
+
if (typeof body === 'object') Object.assign (q.SELECT, body)
|
|
103
|
+
if (typeof body === 'string') {
|
|
104
|
+
let { from, ...clauses } = SELECT(`from x ${body}`).SELECT // eslint-disable-line no-unused-vars
|
|
105
|
+
Object.assign (q.SELECT, clauses)
|
|
106
|
+
}
|
|
107
|
+
} else if (typeof body === 'string') {
|
|
108
|
+
throw new cds.error (400, `Request body cannot be a string for ${req.method} requests.`)
|
|
109
|
+
} else {
|
|
110
|
+
switch (req.method) {
|
|
111
|
+
case 'POST': req.body = {INSERT:{ ...subject('into'), entries: [{...req.query,...body}] }}; break
|
|
112
|
+
case 'PUT': req.body = {UPSERT:{ ...subject('into'), entries: [{...req.query,...body}] }}; break
|
|
113
|
+
case 'PATCH': req.body = {UPDATE:{ ...subject('entity'), data: {...req.query,...body} }}; break
|
|
114
|
+
case 'DELETE': req.body = {DELETE:{ ...subject('from') }}; break
|
|
67
115
|
}
|
|
68
|
-
case 'POST': req.body = INSERT.into (entity) .entries ({...req.query,...req.body}); break
|
|
69
|
-
case 'PUT': req.body = UPSERT.into (entity) .entries ({...req.query,...req.body}); break
|
|
70
|
-
case 'PATCH': req.body = UPDATE (entity, id) .with ({...req.query,...req.body}); break
|
|
71
|
-
case 'DELETE': req.body = DELETE.from (entity, id); break
|
|
72
116
|
}
|
|
73
117
|
return next()
|
|
118
|
+
|
|
119
|
+
/** Resolve the query's subject; expanding given id to {ID:id}, if any. */
|
|
120
|
+
function subject (clause) {
|
|
121
|
+
if (!id) return {[clause]: {ref:[entity]}}
|
|
122
|
+
let target = srv.entities[entity] || cds.error (400, `Couldn't resolve target entity: ${entity}`)
|
|
123
|
+
let keys = Object.keys (target.keys)
|
|
124
|
+
if (keys.length !== 1) cds.error (400, `Target entity ${entity} must have exactly one key`)
|
|
125
|
+
return {[clause]: {ref:[{ id:entity, where:[{ref:keys},'=',{val:id}] }]}, one:true }
|
|
126
|
+
}
|
|
74
127
|
}
|
|
75
128
|
|
|
76
129
|
|
|
@@ -83,68 +136,122 @@ class HCQLAdapter extends require('./http') {
|
|
|
83
136
|
if (!(event in this.service.actions)) return next() //> CRUD /:entity/:id
|
|
84
137
|
if (!(req.method in {GET:1,POST:2})) return next(501) //> only GET and POST allowed
|
|
85
138
|
const data = { ...req.query, ...req.body }
|
|
86
|
-
return this.exec ({ event, data
|
|
139
|
+
return this.exec ({ event, data, req, res }) .catch (next)
|
|
87
140
|
}
|
|
88
141
|
|
|
89
142
|
|
|
90
143
|
/**
|
|
91
|
-
* Handler for all CRUD requests.
|
|
144
|
+
* Handler for all CRUD requests with CQN or CQL queries.
|
|
92
145
|
* @type {express.RequestHandler}
|
|
93
146
|
*/
|
|
94
147
|
query (req, res, next) {
|
|
95
148
|
|
|
96
|
-
//
|
|
97
|
-
const
|
|
149
|
+
// Get query from request body
|
|
150
|
+
const body = req.body || cds.error (400, `Request body is missing.`)
|
|
151
|
+
const cqn = body.cqn || parse(body.cql) || parse(body) || body
|
|
152
|
+
const q = this.valid (cqn)
|
|
153
|
+
const $ = q[q.kind] // SELECT, INSERT, UPDATE, DELETE, ...
|
|
98
154
|
|
|
99
|
-
//
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
if (!t || t._unresolved) throw cds.error (400, 'Cannot determine target entity of query.', { query:q })
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Apply request headers
|
|
106
|
-
const $ = q.SELECT
|
|
107
|
-
if ($) {
|
|
108
|
-
if (req.get('Accept-Language')) $.localized = true
|
|
109
|
-
if (req.get('X-Total-Count')) $.count = true
|
|
110
|
-
}
|
|
155
|
+
// Apply additional request parameters to the query if present
|
|
156
|
+
if (req.get('X-Total-Count')) $.count = true
|
|
157
|
+
if (req.body.args) q.args = req.body.args
|
|
111
158
|
|
|
112
|
-
// Turn SELECT where $search(...)
|
|
113
|
-
if (
|
|
159
|
+
// Turn SELECT where $search(...) into SELECT.search = [...]
|
|
160
|
+
if ($.where?.[0].func === '$search') {
|
|
114
161
|
$.search = $.where[0].args
|
|
115
162
|
if ($.where.length === 1) delete $.where
|
|
116
163
|
else $.where.splice (0, $.where[1] === '>' ? 4 : 2)
|
|
117
164
|
}
|
|
118
165
|
|
|
119
|
-
// Deviate to streaming if
|
|
120
|
-
if (q.stream && req.headers.accept?.includes
|
|
121
|
-
|
|
122
|
-
return this.service.run (()=> q.bind (this.service) .stream() .then (stream => {
|
|
123
|
-
res.set ('content-type', 'application/octet-stream')
|
|
124
|
-
return pipeline (stream, res)
|
|
125
|
-
})) .catch (next)
|
|
166
|
+
// Deviate to streaming if client accepts octet-stream
|
|
167
|
+
if ($.stream || q.stream && req.headers.accept?.includes('application/octet-stream'))
|
|
168
|
+
return this.stream(q,req) .catch (next)
|
|
126
169
|
|
|
127
170
|
// Regular handling for non-streaming queries
|
|
128
|
-
return this.exec
|
|
171
|
+
return this.exec(q,req) .catch (next)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Validates a received and parsed query in CQN format.
|
|
177
|
+
* @returns {object|undefined} the validated query or undefined if invalid
|
|
178
|
+
*/
|
|
179
|
+
valid (qry) {
|
|
180
|
+
const q = cds.ql(qry) || cds.error (400, `Not a valid query:`, q)
|
|
181
|
+
if (q.SET) cds.error (400, `UNIONs are not supported.`)
|
|
182
|
+
|
|
183
|
+
const $ = q[q.kind] || cds.error (400, `Not a valid query:`, q)
|
|
184
|
+
|
|
185
|
+
const has_subselect = $.from?.SELECT
|
|
186
|
+
|| $.columns?.some(x => x.SELECT)
|
|
187
|
+
|| $.having?.some(x => x.SELECT)
|
|
188
|
+
|| $.where?.some(x => x.SELECT)
|
|
189
|
+
if (has_subselect) cds.error (400, `SUBSELECTs are not supported.`)
|
|
190
|
+
if ($.from?.join) cds.error (400, `JOINs are not supported.`)
|
|
191
|
+
|
|
192
|
+
const srv = this.service
|
|
193
|
+
if (srv.definition && cds.infer.target(q,srv)?.kind !== 'entity')
|
|
194
|
+
cds.error (400, `Couldn't resolve target entity for query:`, q)
|
|
195
|
+
|
|
196
|
+
const {allows} = cds.env.protocols.hcql
|
|
197
|
+
if (q.SELECT || q.INSERT || q.UPSERT) ;
|
|
198
|
+
else if (q.UPDATE && !allows.UPDATE.many) is_one(q,'entity')
|
|
199
|
+
else if (q.DELETE && !allows.DELETE.many) is_one(q,'from')
|
|
200
|
+
|
|
201
|
+
return q // looks good
|
|
202
|
+
|
|
203
|
+
/** Ensure it's a to-one query */
|
|
204
|
+
function is_one (q,subject) {
|
|
205
|
+
let keys = new Set (Object.keys(q._target.keys)) // expects q._target has been inferred before
|
|
206
|
+
let where = q[q.kind][subject]?.ref?.[0]?.where || $.where
|
|
207
|
+
if (where?.length === 1 && where[0]?.val != undefined) return true //> ok
|
|
208
|
+
if (where) for (;;) {
|
|
209
|
+
let [ref,op,val,and] = where
|
|
210
|
+
if (op !== '=' && op != '==') break
|
|
211
|
+
if (ref?.ref == undefined) break; else keys.delete(ref.ref[0])
|
|
212
|
+
if (val?.val == undefined) break
|
|
213
|
+
if (!and) {
|
|
214
|
+
if (keys.size === 0) return true //> ok
|
|
215
|
+
else break
|
|
216
|
+
}
|
|
217
|
+
if (and.toLowerCase() !== 'and') break
|
|
218
|
+
else where = where.slice(4)
|
|
219
|
+
}
|
|
220
|
+
throw new cds.error(403, `${q.kind} is allowed for single records only`) //> not ok
|
|
221
|
+
}
|
|
129
222
|
}
|
|
130
223
|
|
|
131
224
|
|
|
132
225
|
/**
|
|
133
226
|
* Central method to dispatch requests to the service and replying outcomes back to the client.
|
|
134
|
-
* @param {
|
|
227
|
+
* @param {{ event, data }} qed a query of request details
|
|
135
228
|
* @param {express.Request} req the HTTP request object
|
|
136
229
|
* @param {express.Response} res the HTTP response object
|
|
137
|
-
* @returns {Promise<any>} results from service dispatch
|
|
230
|
+
* @returns {Promise<any>} results from service dispatch
|
|
138
231
|
*/
|
|
139
|
-
async exec (
|
|
140
|
-
const request = new cds.Request (
|
|
141
|
-
const
|
|
142
|
-
if (res.headersSent) return
|
|
143
|
-
if (
|
|
232
|
+
async exec (qed, req = qed.req, res = qed.res || req.res) {
|
|
233
|
+
const request = new cds.Request (qed.event ? qed : { query:qed, req, res })
|
|
234
|
+
const results = await this.service.dispatch (request)
|
|
235
|
+
if (res.headersSent) return //> response already sent by custom code
|
|
236
|
+
if (results?.$count !== undefined) res.set ('X-Total-Count', results.$count)
|
|
144
237
|
if (request.event === 'CREATE') res.status(201)
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
238
|
+
if (request.messages == null && results == null)
|
|
239
|
+
return qed.SELECT?.one ? cds.error(404) : res.sendStatus(204)
|
|
240
|
+
else res.json (this.response4 ({ data: results, messages: request.messages }))
|
|
241
|
+
return results
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Central method to execute streaming requests.
|
|
247
|
+
* @param {express.Request} req the HTTP request object
|
|
248
|
+
* @param {express.Response} res the HTTP response object
|
|
249
|
+
* @returns {Promise<void>} as returned by the streaming pipeline
|
|
250
|
+
*/
|
|
251
|
+
async stream (q, req, res = req.res) {
|
|
252
|
+
const stream = await this.service.run (()=> q.bind(this.service).stream())
|
|
253
|
+
res.set ('content-type', 'application/octet-stream')
|
|
254
|
+
return pipeline (stream, res)
|
|
148
255
|
}
|
|
149
256
|
|
|
150
257
|
|
|
@@ -167,4 +274,48 @@ class HCQLAdapter extends require('./http') {
|
|
|
167
274
|
}
|
|
168
275
|
}
|
|
169
276
|
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Parses the request body as a CQL query if it is a string.
|
|
280
|
+
* Returns the CQN or the original object if it is not a string.
|
|
281
|
+
*/
|
|
282
|
+
const parse = Object.assign (x => {
|
|
283
|
+
if (typeof x === 'string') try { return parse.cql(x) } catch(e) {
|
|
284
|
+
throw new cds.error (400, `Failed to parse CQL query: ${e.message}`, { query:x, cause:e })
|
|
285
|
+
}
|
|
286
|
+
else return x
|
|
287
|
+
}, { cql: (
|
|
288
|
+
cds.env.ql.parser === 'cds-compiler' ? cds.parse.cql :
|
|
289
|
+
cds.env.ql.parser === 'compatible' ? require('../../ql/core').cql :
|
|
290
|
+
cds.env.ql.parser === 'cap.core' ? require('../../ql/core').cql :
|
|
291
|
+
cds.parse.cql
|
|
292
|
+
)})
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Request logging middleware for HCQL adapter. Wrapped into an immediately
|
|
297
|
+
* invoked function expression (IIFE) to keep outline views clean and tidy.
|
|
298
|
+
*/
|
|
299
|
+
const log_request = (()=>{
|
|
300
|
+
|
|
301
|
+
const { YELLOW, GREEN, RESET, enabled:colors } = cds.utils.colors
|
|
302
|
+
const { inspect:cqn, decodeURI } = cds.utils, o = { colors, depth:11 }
|
|
303
|
+
const cql = x => {
|
|
304
|
+
let [cmd] = /^SELECT|INSERT|UPDATE|UPSERT|DELETE|CALL/i.exec(x) || ['']
|
|
305
|
+
return YELLOW + cmd.toUpperCase() + GREEN + x.slice(cmd.length) + RESET
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** @type {express.RequestHandler} */
|
|
309
|
+
return function log_request (req, res, next) {
|
|
310
|
+
LOG.info (req.method, decodeURI (req.baseUrl + req.path), (
|
|
311
|
+
typeof req.body === 'object' ? cqn(req.body,o) :
|
|
312
|
+
typeof req.body === 'string' ? cql(req.body) :
|
|
313
|
+
req.body ?? ''
|
|
314
|
+
))
|
|
315
|
+
next()
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
})()
|
|
319
|
+
|
|
320
|
+
|
|
170
321
|
module.exports = HCQLAdapter
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
const cds = require('../../index'), {i18n} = cds
|
|
2
2
|
const express = require('express')
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The HTTP adapter for CDS services.
|
|
6
|
+
* @import {Service} from '../cds.Service.js'
|
|
7
|
+
*/
|
|
5
8
|
class HttpAdapter {
|
|
6
9
|
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* Constructs and returns a new express.Router
|
|
9
|
-
* @param {
|
|
13
|
+
* @param {Service} srv - The service instance
|
|
10
14
|
* @param {object} [o] - Options for the adapter
|
|
11
15
|
* @returns {express.Router} The constructed router
|
|
12
16
|
*/
|
|
@@ -73,7 +77,7 @@ class HttpAdapter {
|
|
|
73
77
|
const rr = d['@requires'] || d['@restrict']?.map(r => r.to).flat().filter(r => r)
|
|
74
78
|
const roles = rr?.length ? Array.isArray(rr) ? rr : [rr] : (
|
|
75
79
|
process.env.NODE_ENV === 'production' &&
|
|
76
|
-
cds.
|
|
80
|
+
cds.requires.auth?.restrict_all_services !== false &&
|
|
77
81
|
['authenticated-user']
|
|
78
82
|
)
|
|
79
83
|
return super.authorize = roles && function check_roles (req, res, next) {
|
|
@@ -68,7 +68,12 @@ class Protocols {
|
|
|
68
68
|
if (impl[0] === '.') impl = __dirname+impl.slice(1)
|
|
69
69
|
else impl = require.resolve(impl,{paths:[cds.root]})
|
|
70
70
|
impl = conf.impl = require(impl)
|
|
71
|
-
|
|
71
|
+
if (impl.default) impl = conf.impl = impl.default
|
|
72
|
+
} catch (e) {
|
|
73
|
+
if (e.code === 'MODULE_NOT_FOUND' && e.message.includes(impl))
|
|
74
|
+
cds.error `Cannot find impl for protocol adapter: ${impl}`
|
|
75
|
+
else throw e
|
|
76
|
+
}
|
|
72
77
|
adapter = cached[kind] = impl.prototype ? new impl(srv, conf) : impl(srv, conf)
|
|
73
78
|
if (!adapter) continue
|
|
74
79
|
}
|
|
@@ -101,7 +106,7 @@ class Protocols {
|
|
|
101
106
|
* @returns {{ kind:string, path:string }[]} Array of { kind, path } objects
|
|
102
107
|
*/
|
|
103
108
|
endpoints4 (srv, o = srv.options) {
|
|
104
|
-
const def = srv.definition || {}
|
|
109
|
+
const def = srv.definition || srv || {}
|
|
105
110
|
if (def.kind !== 'service') return [] //> no endpoints, e.g. for cds.db
|
|
106
111
|
|
|
107
112
|
// get @protocol annotations from service definition
|
|
@@ -60,7 +60,7 @@ class CoreService {
|
|
|
60
60
|
}()
|
|
61
61
|
if (req.errors) throw req.reject()
|
|
62
62
|
}
|
|
63
|
-
else if (req.event in (req.target?.actions ?? srv.actions)) throw _unhandled(this,req)
|
|
63
|
+
else if (!srv.mocked && req.event in (req.target?.actions ?? srv.actions)) throw _unhandled(this,req)
|
|
64
64
|
|
|
65
65
|
// .after handlers run in parallel
|
|
66
66
|
handlers = this.handlers.after.filter (h => h.for(req))
|
|
@@ -104,8 +104,8 @@ const _ensure_target = (srv,req) => {
|
|
|
104
104
|
const _ensure_fqn = (x,p,srv, name = x[p]) => {
|
|
105
105
|
if (name.id) return _ensure_fqn (name,'id', srv, name.id)
|
|
106
106
|
if (srv.model) {
|
|
107
|
+
if (name in srv.entities) return x[p] = srv.entities[name].name // service local name
|
|
107
108
|
if (name in srv.model.definitions) return // already an fqn
|
|
108
|
-
if (name in srv.entities) return x[p] = srv.entities[name].name
|
|
109
109
|
}
|
|
110
110
|
if (srv.isDatabaseService) return // db services allow unknown entities, e.g. 'sqlite.schema'
|
|
111
111
|
if (!name.startsWith(srv.namespace+'.')) x[p] = `${srv.namespace}.${name}`
|
|
@@ -202,6 +202,43 @@ exports.write = function write (file, data, o) {
|
|
|
202
202
|
return exports.mkdirp (dirname(f)).then (()=> fs.promises.writeFile (f,data,o))
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
const { setTimeout: sleep } = require('node:timers/promises')
|
|
206
|
+
exports.lock = async function (file, retries = 10, delay = 20) {
|
|
207
|
+
file = resolve (cds.root, file)
|
|
208
|
+
const { open, unlink } = fs.promises
|
|
209
|
+
for (let i = 0; i < retries; i++) try {
|
|
210
|
+
const handle = await open (file+'.lock', 'wx')
|
|
211
|
+
await handle.close()
|
|
212
|
+
return {release:() => unlink (file+'.lock') .catch (err => {
|
|
213
|
+
if (err.code !== 'ENOENT') throw err // ignore if already deleted
|
|
214
|
+
})}
|
|
215
|
+
} catch (err) {
|
|
216
|
+
if (err.code === 'EEXIST') await sleep (delay)
|
|
217
|
+
else throw err
|
|
218
|
+
}
|
|
219
|
+
throw new Error('Could not acquire lock: connection timed out')
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
exports.edit = async function (json_file, callback, ifAbsent = ()=>({})) {
|
|
224
|
+
json_file = resolve (cds.root, json_file)
|
|
225
|
+
const lock = await exports.lock (json_file)
|
|
226
|
+
try {
|
|
227
|
+
const { readFile:read, writeFile:write, rename } = fs.promises
|
|
228
|
+
const data = await read (json_file, 'utf8') .then (JSON.parse, ifAbsent)
|
|
229
|
+
const edited = callback(data); if (!edited) return
|
|
230
|
+
const json = JSON.stringify (edited, null, 2)
|
|
231
|
+
const temp_file = `${json_file}.${process.pid}.tmp`
|
|
232
|
+
await write (temp_file, json, 'utf8')
|
|
233
|
+
await rename (temp_file, json_file)
|
|
234
|
+
} catch (error) {
|
|
235
|
+
throw new cds.error (`Failed to update ${json_file}!`, {cause: error})
|
|
236
|
+
} finally {
|
|
237
|
+
await lock.release()
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
205
242
|
exports.append = function append (file, data, o) {
|
|
206
243
|
if (arguments.length === 1) return {to:(...path) => append(join(...path), data)}
|
|
207
244
|
const f = resolve (cds.root,file)
|
|
@@ -4,7 +4,7 @@ const cds = require('..')
|
|
|
4
4
|
|
|
5
5
|
const SEPARATOR = /[,;\t]/
|
|
6
6
|
|
|
7
|
-
exports.parse = cds.parse.csv
|
|
7
|
+
exports.parse = (...args) => cds.parse.csv (...args)
|
|
8
8
|
|
|
9
9
|
exports.serialize = function (rows, columns, bom = '\ufeff') {
|
|
10
10
|
let csv = bom + (columns || Object.keys(rows[0])).join(';') + "\n"
|
|
@@ -23,7 +23,7 @@ exports.readHeader = async function (inStream, o = { ignoreComments: true }) {
|
|
|
23
23
|
return false
|
|
24
24
|
}
|
|
25
25
|
[delimiter] = SEPARATOR.exec(line) || [';']
|
|
26
|
-
cols = line.split(delimiter).map(each => each.trim()).filter(each => each.length)
|
|
26
|
+
cols = line.split(delimiter).map(each => each.trim().replace(/^"(.*)"$/, '$1')).filter(each => each.length)
|
|
27
27
|
readLine.close() // signal that we have seen enough --> this only ends the readLine interface
|
|
28
28
|
}
|
|
29
29
|
return true
|