@sap/cds-dk 10.0.6 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +10 -0
- package/bin/build.js +20 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +15 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +592 -80
- package/bin/completion/scripts/cds.fish +568 -0
- package/bin/completion/scripts/cds.ps1 +329 -0
- package/bin/completion/scripts/cds.sh +261 -0
- package/bin/completion/scripts/cds.zsh +230 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +208 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +7 -1
- package/bin/deploy/options.js +25 -0
- package/{lib → bin}/deploy/to-hana/hana.js +8 -8
- package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
- package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
- package/bin/deploy/to-sql.js +0 -2
- package/bin/export.js +35 -5
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +6 -0
- package/bin/init.js +5 -24
- package/bin/inspect.js +6 -0
- package/bin/login.js +26 -20
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/up.js +14 -11
- package/{lib → bin}/upgrade/constants.js +1 -1
- package/bin/{upgrade.js → upgrade/index.js} +2 -2
- package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
- package/{lib → bin}/upgrade/preflight/index.js +1 -1
- package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
- package/{lib → bin}/upgrade/steps/install.js +1 -1
- package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/removals.js +1 -1
- package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/verify.js +1 -1
- package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
- package/{lib → bin}/upgrade/util/pom.js +2 -2
- package/{lib → bin}/upgrade/util/prompt.js +1 -1
- package/bin/util/containerize.js +8 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +17 -9
- package/{lib → bin}/watch/livereload-connect.js +1 -1
- package/{lib → bin}/watch/vite-watch.js +1 -1
- package/{lib → bin}/watch/watched.js +2 -2
- package/lib/build/constants.js +1 -1
- package/lib/build/plugins/fiori/index.js +31 -2
- package/lib/build/plugins/internal.js +4 -2
- package/lib/build/plugins/mtx-sidecar/index.js +7 -8
- package/lib/build/plugins/nodejs/index.js +64 -7
- package/lib/compile/to_asyncapi.js +1 -1
- package/lib/env/schema.js +16 -0
- package/lib/env/schemas/cds-rc.js +1 -76
- package/lib/import/importapi.js +2 -3
- package/lib/import/message.js +0 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +2 -2
- package/lib/init/merge.js +123 -280
- package/lib/init/plugin.js +3 -1
- package/lib/init/projectReader.js +22 -6
- package/lib/init/registries/xs-app.js +3 -5
- package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ai/index.js +14 -2
- package/lib/init/template/ams/index.js +2 -2
- package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/app-frontend/index.js +4 -4
- package/lib/init/template/application-logging/index.js +2 -2
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/index.js +8 -3
- package/lib/init/template/attachments/files/package.json.hbs +1 -1
- package/lib/init/template/attachments/index.js +2 -2
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
- package/lib/init/template/cloud-logging/index.js +2 -2
- package/lib/init/template/completion/completionSetup.js +36 -39
- package/lib/init/template/connectivity/index.js +2 -2
- package/lib/init/template/data/as-csv.js +15 -5
- package/lib/init/template/data/as-json.js +114 -42
- package/lib/init/template/data/index.js +16 -2
- package/lib/init/template/destination/index.js +2 -2
- package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
- package/lib/init/template/dynatrace/index.js +2 -2
- package/lib/init/template/enterprise-messaging/index.js +2 -2
- package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
- package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
- package/lib/init/template/extensibility/index.js +3 -3
- package/lib/init/template/github-actions/index.js +2 -2
- package/lib/init/template/hana/index.js +3 -2
- package/lib/init/template/hana-serverless/files/db/package.json +14 -0
- package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
- package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
- package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
- package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
- package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
- package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
- package/lib/init/template/hana-serverless/index.js +184 -0
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
- package/lib/init/template/html5-repo/index.js +18 -14
- package/lib/init/template/http/index.js +123 -26
- package/lib/init/template/ias/index.js +2 -2
- package/lib/init/template/kafka/index.js +2 -2
- package/lib/init/template/kyma/index.js +7 -5
- package/lib/init/template/malware-scanner/index.js +2 -2
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -3
- package/lib/init/template/nodejs/index.js +4 -2
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
- package/lib/init/template/portal/index.js +13 -8
- package/lib/init/template/postgres/index.js +2 -2
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/sample/files/db/currencies.cds +2 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
- package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
- package/lib/init/template/workzone-standard/index.js +5 -5
- package/lib/init/template/xsuaa/index.js +20 -2
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/auth_manager.js +103 -37
- package/lib/mtx/params.js +3 -2
- package/lib/mtx/settings_manager.js +45 -28
- package/lib/mtx/tenant_action.js +0 -1
- package/lib/mtx/util/credentials.js +62 -0
- package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
- package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
- package/node_modules/@cap-js/openapi/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +64 -0
- package/node_modules/@sap/cds/app/index.js +5 -4
- package/node_modules/@sap/cds/eslint.config.mjs +1 -0
- package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
- package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
- package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
- package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
- package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
- package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
- package/node_modules/@sap/cds/lib/plugins.js +9 -5
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
- package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
- package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
- package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
- package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
- package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
- package/node_modules/@sap/cds/libx/http/location.js +3 -3
- package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
- package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
- package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
- package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
- package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
- package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
- package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
- package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
- package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
- package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
- package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
- package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
- package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
- package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
- package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
- package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
- package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
- package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
- package/node_modules/@sap/xsenv/package.json +10 -7
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
- package/node_modules/hdb/lib/protocol/Connection.js +1 -0
- package/node_modules/hdb/package.json +3 -2
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/negotiator/package.json +16 -10
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/sax/lib/sax.js +27 -9
- package/node_modules/sax/package.json +1 -1
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +5 -5
- package/bin/completion/scripts/cds-bash.sh +0 -20
- package/bin/completion/scripts/cds-fish.fish +0 -13
- package/bin/completion/scripts/cds-ps.ps1 +0 -19
- package/bin/completion/scripts/cds-zsh.sh +0 -13
- package/lib/deploy/index.js +0 -25
- package/lib/import/asyncapi/importAsyncAPI.js +0 -33
- package/lib/import/asyncapi/index.js +0 -18
- package/lib/import/asyncapi/parserContext.js +0 -372
- package/lib/import/asyncapi/utils.js +0 -49
- package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
- package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
- package/node_modules/negotiator/HISTORY.md +0 -114
- /package/{lib → bin}/upgrade/context.js +0 -0
- /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
- /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
- /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
- /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
- /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
- /package/{lib → bin}/watch/livereload-server.js +0 -0
- /package/{lib → bin}/watch/node-watch.js +0 -0
- /package/{lib → bin}/watch/open.js +0 -0
- /package/{lib → bin}/watch/watcher.js +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const READ_QUERY = /* GraphQL */ `
|
|
2
|
-
query ($key: String!, $value: String!) {
|
|
3
|
-
applicationTemplates(filter: { key: $key, query: $value }) {
|
|
4
|
-
data {
|
|
5
|
-
id
|
|
6
|
-
name
|
|
7
|
-
description
|
|
8
|
-
placeholders {
|
|
9
|
-
name
|
|
10
|
-
description
|
|
11
|
-
}
|
|
12
|
-
applicationInput
|
|
13
|
-
labels
|
|
14
|
-
webhooks {
|
|
15
|
-
type
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
const CREATE_MUTATION = /* GraphQL */ `
|
|
23
|
-
mutation ($input: ApplicationTemplateInput!) {
|
|
24
|
-
result: createApplicationTemplate(in: $input) {
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
labels
|
|
28
|
-
applicationInput
|
|
29
|
-
applicationNamespace
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
const UPDATE_MUTATION = /* GraphQL */ `
|
|
35
|
-
mutation ($id: ID!, $input: ApplicationTemplateUpdateInput!) {
|
|
36
|
-
result: updateApplicationTemplate(id: $id, in: $input) {
|
|
37
|
-
id
|
|
38
|
-
name
|
|
39
|
-
labels
|
|
40
|
-
description
|
|
41
|
-
applicationInput
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
const DELETE_MUTATION = /* GraphQL */ `
|
|
47
|
-
mutation ($id: ID!) {
|
|
48
|
-
result: deleteApplicationTemplate(id: $id) {
|
|
49
|
-
id
|
|
50
|
-
name
|
|
51
|
-
description
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
module.exports = {
|
|
57
|
-
READ_QUERY,
|
|
58
|
-
CREATE_MUTATION,
|
|
59
|
-
UPDATE_MUTATION,
|
|
60
|
-
DELETE_MUTATION
|
|
61
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
const cds = require('@sap/cds')
|
|
4
|
-
const DEBUG = cds.debug('mtx') //Note: cds.debug returns false for @sap/cds@(< 6.2)
|
|
5
|
-
|
|
6
|
-
module.exports.build = async function (options) {
|
|
7
|
-
const { project } = options
|
|
8
|
-
const env = cds.env
|
|
9
|
-
const root = cds.root
|
|
10
|
-
try {
|
|
11
|
-
cds.root = project
|
|
12
|
-
cds.env = cds.env.for('cds', project)
|
|
13
|
-
options.dest = path.join(project, cds.env.build.target, 'ext')
|
|
14
|
-
await new ExtensionBuilder(options).run()
|
|
15
|
-
} finally {
|
|
16
|
-
cds.root = root
|
|
17
|
-
cds.env = env
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
class ExtensionBuilder {
|
|
22
|
-
constructor(options) {
|
|
23
|
-
this._files = []
|
|
24
|
-
this._options = options
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async run() {
|
|
28
|
-
const { project, dest } = this._options
|
|
29
|
-
|
|
30
|
-
// clean any existing content
|
|
31
|
-
await fs.promises.rm(dest, { force: true, recursive: true })
|
|
32
|
-
|
|
33
|
-
// check existence of appPackage folder only
|
|
34
|
-
const appPackageFolder = this._getAppPackageFolder()
|
|
35
|
-
if (!fs.existsSync(path.join(project, appPackageFolder))) {
|
|
36
|
-
throw new Error(`The SaaS application base model '${appPackageFolder}' is missing.`)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// full compile of the extension using base model - ensuring consistency
|
|
40
|
-
const modelFolders = cds.resolve('*', false).filter(p => !p.startsWith('@sap/cds-mtx'))
|
|
41
|
-
DEBUG && DEBUG(`Extension model folders: ${modelFolders}`)
|
|
42
|
-
|
|
43
|
-
// throws an error if no model is found -> e.code === MODEL_NOT_FOUND
|
|
44
|
-
const model = await cds.load(modelFolders)
|
|
45
|
-
|
|
46
|
-
// extension CSN using parsed format
|
|
47
|
-
const extModel = await cds.load(this._resolveExtensionFiles(model, project), { flavor: 'parsed' })
|
|
48
|
-
if (extModel.requires) {
|
|
49
|
-
extModel.requires.length = 0
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const csn = cds.compile.to.json(extModel)
|
|
53
|
-
await this._write(csn, path.join(dest, 'extension.csn'))
|
|
54
|
-
await this._collectLanguageBundles(extModel, path.join(dest, 'i18n'))
|
|
55
|
-
|
|
56
|
-
const files = Object.keys(await cds.deploy.resources(model))
|
|
57
|
-
if (files.length > 0) {
|
|
58
|
-
const dataDest = path.join(dest, 'data')
|
|
59
|
-
await Promise.all(
|
|
60
|
-
files
|
|
61
|
-
.filter(file => /\.csv$/.test(file))
|
|
62
|
-
.map(csv => this._copy(csv, path.join(dataDest, path.basename(csv))))
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
await this._copy(path.join(project, 'package.json'), path.join(dest, 'package.json'))
|
|
66
|
-
// add all resources contained in 'gen/ext' folder
|
|
67
|
-
await this._writeTarFile(path.join(project, cds.env.build.target, 'extension.tgz'), dest)
|
|
68
|
-
|
|
69
|
-
DEBUG && DEBUG('build output:\n' + this._files.map(file => ` ${path.relative(project, file)}`).join('\n'))
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
_getAppPackageFolder() {
|
|
73
|
-
return path.join('node_modules', cds.env.extends || '_base');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
_resolveExtensionFiles(model, project) {
|
|
77
|
-
const node_modules = path.join(project, 'node_modules')
|
|
78
|
-
const paths = model['$sources'].reduce((acc, file) => {
|
|
79
|
-
if (file.startsWith(project) && !file.startsWith(node_modules)) {
|
|
80
|
-
acc.push(file)
|
|
81
|
-
}
|
|
82
|
-
return acc
|
|
83
|
-
}, [])
|
|
84
|
-
|
|
85
|
-
return paths
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async _write(data, dest) {
|
|
89
|
-
this._files.push(dest)
|
|
90
|
-
await fs.promises.mkdir(path.dirname(dest), { recursive: true })
|
|
91
|
-
await fs.promises.writeFile(dest, typeof data === "object" && !Buffer.isBuffer(data) ? JSON.stringify(data, null, 2) : data)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async _copy(src, dest) {
|
|
95
|
-
this._files.push(dest)
|
|
96
|
-
await fs.promises.mkdir(path.dirname(dest), { recursive: true })
|
|
97
|
-
await fs.promises.copyFile(src, dest)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async _writeTarFile(tarFile, root, resources) {
|
|
101
|
-
const { tar } = cds.utils
|
|
102
|
-
await tar.czfd(tarFile, root, resources)
|
|
103
|
-
this._files.push(tarFile)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async _collectLanguageBundles(model, dest) {
|
|
107
|
-
// collect effective i18n properties...
|
|
108
|
-
let bundles = {}
|
|
109
|
-
const bundleGenerator = cds.localize.bundles4(model)
|
|
110
|
-
if (bundleGenerator && bundleGenerator[Symbol.iterator]) {
|
|
111
|
-
for (let [locale, bundle] of bundleGenerator) {
|
|
112
|
-
// fallback bundle has the name ""
|
|
113
|
-
if (typeof locale === 'string') {
|
|
114
|
-
bundles[locale] = bundle
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// omit bundles in case the fallback bundle is the only existing entry
|
|
119
|
-
const keys = Object.keys(bundles)
|
|
120
|
-
if (keys.length === 1 && keys[0] === "" && Object.keys(bundles[keys[0]]).length === 0) {
|
|
121
|
-
bundles = {}
|
|
122
|
-
}
|
|
123
|
-
// copied from ../compile/i18n.js
|
|
124
|
-
const { file: base = 'i18n' } = cds.env.i18n
|
|
125
|
-
if (Object.keys(bundles).length > 0) {
|
|
126
|
-
await this._write(bundles, path.join(dest, base + '.json'))
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const cds = require('@sap/cds')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const fs = require('fs').promises
|
|
4
|
-
const mtxAdapter = require('./mtx-adapter')
|
|
5
|
-
const { build } = require('./extension-project-builder')
|
|
6
|
-
module.exports.DEFAULT_TAG = 'migrated'
|
|
7
|
-
|
|
8
|
-
module.exports.getExtensionTag = function (filename, tagRegexString, defaultTag = module.exports.DEFAULT_TAG) {
|
|
9
|
-
if (!tagRegexString) return defaultTag
|
|
10
|
-
const regex = new RegExp(tagRegexString)
|
|
11
|
-
const match = filename.match(regex)
|
|
12
|
-
return match?.[1] ? match[1] : defaultTag
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports.createProjects = async function (mtxExtension, dir, tagRegex, defaultTag = module.exports.DEFAULT_TAG) {
|
|
16
|
-
|
|
17
|
-
const validTags = []
|
|
18
|
-
|
|
19
|
-
const extensions = _splitExtensionByTag(mtxExtension, tagRegex, defaultTag)
|
|
20
|
-
|
|
21
|
-
for (const [tag, extension] of Object.entries(extensions)) {
|
|
22
|
-
|
|
23
|
-
const projectFolder = path.join(dir, tag)
|
|
24
|
-
try {
|
|
25
|
-
await fs.rm(projectFolder, { recursive: true, force: true })
|
|
26
|
-
} catch {
|
|
27
|
-
// ignore
|
|
28
|
-
}
|
|
29
|
-
await fs.mkdir(projectFolder, { recursive: true })
|
|
30
|
-
// extension is a map of files
|
|
31
|
-
await mtxAdapter.writeFilesFromMap(Array.from(extension), projectFolder)
|
|
32
|
-
// overwrite package.json
|
|
33
|
-
await _writePackageJson(projectFolder, tag, '_base')
|
|
34
|
-
|
|
35
|
-
// keep in mind to avoid parallel execution !! - use runner from old mtx?
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
await build({ project: projectFolder })
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (error.code !== 'MODEL_NOT_FOUND') throw error
|
|
41
|
-
// ignore extensions with no model
|
|
42
|
-
continue
|
|
43
|
-
}
|
|
44
|
-
validTags.push(tag)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return validTags
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _splitExtensionByTag(mtxExtension, tagRegex, defaultTag) {
|
|
51
|
-
|
|
52
|
-
const result = {}
|
|
53
|
-
|
|
54
|
-
// create separate tags
|
|
55
|
-
for (const [file, content] of mtxExtension) {
|
|
56
|
-
if (!file.startsWith('node_modules')) {
|
|
57
|
-
const tag = module.exports.getExtensionTag(file, tagRegex, defaultTag)
|
|
58
|
-
if (!result[tag]) result[tag] = new Map()
|
|
59
|
-
result[tag].set(file, content)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// add node modules to each project to allow build
|
|
64
|
-
for (const [file, content] of mtxExtension) {
|
|
65
|
-
if (file.startsWith('node_modules')) {
|
|
66
|
-
for (const tag in result) {
|
|
67
|
-
result[tag].set(file, content)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return result
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function _writePackageJson(dir, name, main) {
|
|
76
|
-
const packageJson = {
|
|
77
|
-
"name": name,
|
|
78
|
-
"version": "1.0.0",
|
|
79
|
-
"description": "Generated extension project",
|
|
80
|
-
"cds": {
|
|
81
|
-
"extends": main
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// add compiler settings from main
|
|
86
|
-
packageJson.cds.cdsc = cds.env.cdsc
|
|
87
|
-
|
|
88
|
-
await fs.writeFile(path.join(dir, 'package.json'), JSON.stringify(packageJson, 2))
|
|
89
|
-
}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
const cds = require('@sap/cds')
|
|
2
|
-
|
|
3
|
-
const { fs, path } = cds.utils
|
|
4
|
-
const tempDir = fs.realpathSync(require('os').tmpdir());
|
|
5
|
-
const LOG = cds.log('mtx')
|
|
6
|
-
|
|
7
|
-
module.exports.getDbId = async () => {
|
|
8
|
-
LOG.info('Retrieving database ID from existing containers...')
|
|
9
|
-
const hana = require('@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr').defaultInstance()
|
|
10
|
-
const all = await hana.getAll()
|
|
11
|
-
const foundDbId = all.length ? all[0].credentials?.database_id : null
|
|
12
|
-
LOG.info('Found database ID:', foundDbId || 'none')
|
|
13
|
-
return foundDbId
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports.getAllTenantIds = async () => {
|
|
17
|
-
|
|
18
|
-
const hana = require('@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr').defaultInstance()
|
|
19
|
-
|
|
20
|
-
// copied from mtx
|
|
21
|
-
const META_TENANT_REGEX = /TENANT-(.*)-META/i
|
|
22
|
-
const MT_LIB_TENANT_REGEX = /MT_LIB_TENANT-(.*)/i
|
|
23
|
-
const GLOBAL_DATA_META_TENANT = '__META__'
|
|
24
|
-
function _tenantFilter(tenantId, index, allTenants) {
|
|
25
|
-
const t0 = cds.env.requires.multitenancy?.t0 ?? 't0'
|
|
26
|
-
return tenantId
|
|
27
|
-
&& !META_TENANT_REGEX.test(tenantId)
|
|
28
|
-
&& !MT_LIB_TENANT_REGEX.test(tenantId)
|
|
29
|
-
&& tenantId.toLowerCase() !== GLOBAL_DATA_META_TENANT.toLowerCase()
|
|
30
|
-
&& tenantId !== t0
|
|
31
|
-
&& allTenants.includes(_prefixTenant(tenantId))
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// TODO remove duplicates resulting from multiple bindings
|
|
35
|
-
// replaces Tenant.getAllTenantIds()
|
|
36
|
-
return (await hana.getAll()).reduce((result, t) => [ ...result, t.labels.tenant_id[0]] , []).filter(_tenantFilter)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _prefixTenant(tenantId) {
|
|
40
|
-
return `TENANT-${tenantId}-META`
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports.getMetaTenantName = (tenant) => {
|
|
44
|
-
return _prefixTenant(tenant)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports.getMetadata = async (tenant) => {
|
|
48
|
-
return getMetadata(tenant)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function getMetadata(tenant, type = 'onboarding') {
|
|
52
|
-
|
|
53
|
-
// replaces Tenant.getMetadata(tenant)
|
|
54
|
-
const CONTENT_METADATA_QUERY = 'SELECT CONTENT FROM TENANT_METADATA WHERE ID = ? AND DOMAIN = ? LIMIT 1'
|
|
55
|
-
const domain = cds.env.mtx && cds.env.mtx.domain || '__default__'
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const result = (await cds.tx({ tenant: _prefixTenant(tenant) }, tx => tx.run(CONTENT_METADATA_QUERY, [type, domain])))
|
|
59
|
-
const CONTENT = result?.[0]?.CONTENT || result?.[0]?.content // small tribute to sqlite for testing
|
|
60
|
-
if (type === 'onboarding') {
|
|
61
|
-
const metadata = CONTENT ? JSON.parse(CONTENT) : {}
|
|
62
|
-
// more robust behaviour
|
|
63
|
-
if (!metadata.subscribedTenantId) metadata.subscribedTenantId = tenant
|
|
64
|
-
return metadata
|
|
65
|
-
} else {
|
|
66
|
-
return CONTENT ? JSON.parse(CONTENT) : null
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
} catch (error) {
|
|
70
|
-
LOG.error('Failed to query metadata for tenant', tenant, '(domain:', domain, '):', error)
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports.saveMetadata = async (tenant, type, data) => {
|
|
76
|
-
const domain = cds.env.mtx && cds.env.mtx.domain || '__default__'
|
|
77
|
-
const statement = 'UPSERT TENANT_METADATA (ID, CONTENT, DOMAIN) VALUES(?, ?, ?) WHERE ID = ? AND DOMAIN = ?';
|
|
78
|
-
await cds.tx({ tenant: _prefixTenant(tenant) }, tx => tx.run(statement, [type, JSON.stringify(data), domain, type, domain]))
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const COMPILED_FILES = {
|
|
82
|
-
CSN_NODE: 'csn_node.json', // deprecated
|
|
83
|
-
CSN: 'csn.json',
|
|
84
|
-
ODATA_CSN: 'odata_csn.json',
|
|
85
|
-
I18N: '_i18n/i18n.json'
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const MODEL_TYPE = {
|
|
89
|
-
base: 'base',
|
|
90
|
-
extension: 'extension',
|
|
91
|
-
compiled: 'compiled',
|
|
92
|
-
migration: 'migration'
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
module.exports.getCsn = async (tenant) => {
|
|
96
|
-
|
|
97
|
-
const CONTENT_FILE_QUERY = 'SELECT CONTENT FROM TENANT_FILES WHERE TYPE = ? AND FILENAME = ? AND DOMAIN = ? LIMIT 1';
|
|
98
|
-
|
|
99
|
-
const domain = cds.env.mtx && cds.env.mtx.domain || '__default__'
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const result = (await cds.tx({ tenant: _prefixTenant(tenant) }, tx => tx.run(CONTENT_FILE_QUERY, [MODEL_TYPE.compiled, COMPILED_FILES.CSN_NODE, domain])))
|
|
103
|
-
const { CONTENT } = result && result[0] || {}
|
|
104
|
-
return CONTENT ? JSON.parse(CONTENT) : null
|
|
105
|
-
|
|
106
|
-
} catch (error) {
|
|
107
|
-
this.logger.error(`Failed to query collectedSources for tenant '${tenant}' (domain: ${domain}): ${error}`)
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// const loadedModel = await Tenant.getModel(tenant, 'collectedSources');
|
|
112
|
-
// return JSON.parse(loadedModel);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// replaces Content.getExtension(tenant)
|
|
116
|
-
module.exports.getExtension = async (tenant) => {
|
|
117
|
-
|
|
118
|
-
function _isModelFile(filename) {
|
|
119
|
-
const BASE_MODEL_EXTENSION_PROJECT_FILTER = /(.*\.cds$|.*\.csn$|.*\/csn.json$|^csn.json$|.*\/i18n(|_.*)(\.json|\.properties)$)/
|
|
120
|
-
return BASE_MODEL_EXTENSION_PROJECT_FILTER.test(filename);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function _convertToExtensionProject(files) {
|
|
124
|
-
const BASE_MODEL_NAME = '_base'
|
|
125
|
-
const basemodelFiles = new Map();
|
|
126
|
-
|
|
127
|
-
for (const [file, content] of files) {
|
|
128
|
-
if (_isModelFile(file)) {
|
|
129
|
-
const prefixedPath = path.join('node_modules', BASE_MODEL_NAME, file);
|
|
130
|
-
basemodelFiles.set(prefixedPath, content);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return basemodelFiles;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async function readFiles(modelType) {
|
|
138
|
-
const MODEL_FILE_QUERY = 'SELECT FILENAME, CONTENT, TYPE FROM TENANT_FILES WHERE TYPE = ? AND DOMAIN = ?';
|
|
139
|
-
const domain = cds.env.mtx && cds.env.mtx.domain || '__default__'
|
|
140
|
-
try {
|
|
141
|
-
const files = (await cds.tx({ tenant: _prefixTenant(tenant) }, tx => tx.run(MODEL_FILE_QUERY, [modelType, domain])));
|
|
142
|
-
return files.map(({ FILENAME, CONTENT }) => [FILENAME, CONTENT.toString('utf-8')]);
|
|
143
|
-
|
|
144
|
-
} catch (error) {
|
|
145
|
-
LOG.error('Failed to query extensions for tenant', tenant, '(domain:', domain, '):', error);
|
|
146
|
-
throw error;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const extensions = await readFiles(MODEL_TYPE.extension);
|
|
151
|
-
if (!extensions?.length) return // return nothing if no extensions exist
|
|
152
|
-
|
|
153
|
-
const base = await readFiles(MODEL_TYPE.base);
|
|
154
|
-
|
|
155
|
-
return [...extensions, ..._convertToExtensionProject(base)]
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
module.exports.hasExtensions = async (tenant) => {
|
|
159
|
-
if (!(await module.exports.wasOldMtx())) return false
|
|
160
|
-
const MODEL_FILE_QUERY = 'SELECT FILENAME FROM TENANT_FILES WHERE TYPE = ? AND DOMAIN = ?';
|
|
161
|
-
const domain = cds.env.mtx && cds.env.mtx.domain || '__default__'
|
|
162
|
-
try {
|
|
163
|
-
const files = (await cds.tx({ tenant: _prefixTenant(tenant) }, tx => tx.run(MODEL_FILE_QUERY, ['extension', domain])));
|
|
164
|
-
return files.length
|
|
165
|
-
} catch (error) {
|
|
166
|
-
LOG.debug('Upgrade check: No @sap/mtx (old mtx) extensions found for tenant', tenant, '(domain:', domain, '):', error);
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const wasOldMtx = []
|
|
172
|
-
|
|
173
|
-
// use this before automatic tenant list update in upgrade
|
|
174
|
-
module.exports.wasOldMtx = async () => {
|
|
175
|
-
if (!wasOldMtx.length) {
|
|
176
|
-
if (cds.env.requires.db?.credentials?.sm_url) { // old mtx was service-manager based
|
|
177
|
-
const hana = require('@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr').defaultInstance()
|
|
178
|
-
try {
|
|
179
|
-
wasOldMtx.push(!!(await hana.get('__META__')))
|
|
180
|
-
} catch (error) {
|
|
181
|
-
if (error.status === 404) wasOldMtx.push(false)
|
|
182
|
-
else throw error
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
wasOldMtx.push(false)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return wasOldMtx[0]
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
module.exports.isMigrated = async (tenant) => {
|
|
192
|
-
return getMetadata(tenant, 'migrated')
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
module.exports.getMigrationParameters = async (tenant) => {
|
|
196
|
-
return getMetadata(tenant, 'migrationParameters')
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
module.exports.setMigrated = async (tenant, tagRule, defaultTag, force) => {
|
|
200
|
-
const timestamp = new Date();
|
|
201
|
-
const timestampIso = timestamp.toISOString();
|
|
202
|
-
const data = {
|
|
203
|
-
timestamp: timestampIso
|
|
204
|
-
}
|
|
205
|
-
await module.exports.saveMetadata(tenant, 'migrated', data)
|
|
206
|
-
await module.exports.saveMetadata(tenant, 'migrationParameters', { tagRule, defaultTag, force })
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function unixPath(filename) {
|
|
210
|
-
return filename.replace(/\\/g, '/');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
module.exports.writeFilesFromMap = async (files, baseDir) => {
|
|
214
|
-
for (const [filename, content] of files) {
|
|
215
|
-
const unixFilename = unixPath(filename);
|
|
216
|
-
const absoluteFilename = path.resolve(baseDir, unixFilename);
|
|
217
|
-
|
|
218
|
-
if (absoluteFilename.includes(baseDir)) {
|
|
219
|
-
//this.logger.debug(`Writing file: ${absoluteFilename}`);
|
|
220
|
-
await fs.promises.mkdir(path.dirname(absoluteFilename), { recursive: true });
|
|
221
|
-
await fs.promises.writeFile(absoluteFilename, content);
|
|
222
|
-
} else {
|
|
223
|
-
//this.logger.debug(`Do not write file outside of target: ${absoluteFilename}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
module.exports.mkdirTemp = async () => {
|
|
229
|
-
return fs.promises.mkdtemp(`${tempDir}${path.sep}`);
|
|
230
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
1.0.0 / 2024-08-31
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
* Drop support for node <18
|
|
5
|
-
* Added an option preferred encodings array #59
|
|
6
|
-
|
|
7
|
-
0.6.3 / 2022-01-22
|
|
8
|
-
==================
|
|
9
|
-
|
|
10
|
-
* Revert "Lazy-load modules from main entry point"
|
|
11
|
-
|
|
12
|
-
0.6.2 / 2019-04-29
|
|
13
|
-
==================
|
|
14
|
-
|
|
15
|
-
* Fix sorting charset, encoding, and language with extra parameters
|
|
16
|
-
|
|
17
|
-
0.6.1 / 2016-05-02
|
|
18
|
-
==================
|
|
19
|
-
|
|
20
|
-
* perf: improve `Accept` parsing speed
|
|
21
|
-
* perf: improve `Accept-Charset` parsing speed
|
|
22
|
-
* perf: improve `Accept-Encoding` parsing speed
|
|
23
|
-
* perf: improve `Accept-Language` parsing speed
|
|
24
|
-
|
|
25
|
-
0.6.0 / 2015-09-29
|
|
26
|
-
==================
|
|
27
|
-
|
|
28
|
-
* Fix including type extensions in parameters in `Accept` parsing
|
|
29
|
-
* Fix parsing `Accept` parameters with quoted equals
|
|
30
|
-
* Fix parsing `Accept` parameters with quoted semicolons
|
|
31
|
-
* Lazy-load modules from main entry point
|
|
32
|
-
* perf: delay type concatenation until needed
|
|
33
|
-
* perf: enable strict mode
|
|
34
|
-
* perf: hoist regular expressions
|
|
35
|
-
* perf: remove closures getting spec properties
|
|
36
|
-
* perf: remove a closure from media type parsing
|
|
37
|
-
* perf: remove property delete from media type parsing
|
|
38
|
-
|
|
39
|
-
0.5.3 / 2015-05-10
|
|
40
|
-
==================
|
|
41
|
-
|
|
42
|
-
* Fix media type parameter matching to be case-insensitive
|
|
43
|
-
|
|
44
|
-
0.5.2 / 2015-05-06
|
|
45
|
-
==================
|
|
46
|
-
|
|
47
|
-
* Fix comparing media types with quoted values
|
|
48
|
-
* Fix splitting media types with quoted commas
|
|
49
|
-
|
|
50
|
-
0.5.1 / 2015-02-14
|
|
51
|
-
==================
|
|
52
|
-
|
|
53
|
-
* Fix preference sorting to be stable for long acceptable lists
|
|
54
|
-
|
|
55
|
-
0.5.0 / 2014-12-18
|
|
56
|
-
==================
|
|
57
|
-
|
|
58
|
-
* Fix list return order when large accepted list
|
|
59
|
-
* Fix missing identity encoding when q=0 exists
|
|
60
|
-
* Remove dynamic building of Negotiator class
|
|
61
|
-
|
|
62
|
-
0.4.9 / 2014-10-14
|
|
63
|
-
==================
|
|
64
|
-
|
|
65
|
-
* Fix error when media type has invalid parameter
|
|
66
|
-
|
|
67
|
-
0.4.8 / 2014-09-28
|
|
68
|
-
==================
|
|
69
|
-
|
|
70
|
-
* Fix all negotiations to be case-insensitive
|
|
71
|
-
* Stable sort preferences of same quality according to client order
|
|
72
|
-
* Support Node.js 0.6
|
|
73
|
-
|
|
74
|
-
0.4.7 / 2014-06-24
|
|
75
|
-
==================
|
|
76
|
-
|
|
77
|
-
* Handle invalid provided languages
|
|
78
|
-
* Handle invalid provided media types
|
|
79
|
-
|
|
80
|
-
0.4.6 / 2014-06-11
|
|
81
|
-
==================
|
|
82
|
-
|
|
83
|
-
* Order by specificity when quality is the same
|
|
84
|
-
|
|
85
|
-
0.4.5 / 2014-05-29
|
|
86
|
-
==================
|
|
87
|
-
|
|
88
|
-
* Fix regression in empty header handling
|
|
89
|
-
|
|
90
|
-
0.4.4 / 2014-05-29
|
|
91
|
-
==================
|
|
92
|
-
|
|
93
|
-
* Fix behaviors when headers are not present
|
|
94
|
-
|
|
95
|
-
0.4.3 / 2014-04-16
|
|
96
|
-
==================
|
|
97
|
-
|
|
98
|
-
* Handle slashes on media params correctly
|
|
99
|
-
|
|
100
|
-
0.4.2 / 2014-02-28
|
|
101
|
-
==================
|
|
102
|
-
|
|
103
|
-
* Fix media type sorting
|
|
104
|
-
* Handle media types params strictly
|
|
105
|
-
|
|
106
|
-
0.4.1 / 2014-01-16
|
|
107
|
-
==================
|
|
108
|
-
|
|
109
|
-
* Use most specific matches
|
|
110
|
-
|
|
111
|
-
0.4.0 / 2014-01-09
|
|
112
|
-
==================
|
|
113
|
-
|
|
114
|
-
* Remove preferred prefix from methods
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|