@sap/cds-dk 10.0.7 → 10.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +14 -0
- package/bin/build.js +21 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +16 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +603 -80
- package/bin/completion/scripts/cds.fish +620 -0
- package/bin/completion/scripts/cds.ps1 +403 -0
- package/bin/completion/scripts/cds.sh +327 -0
- package/bin/completion/scripts/cds.zsh +296 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +217 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +11 -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/env.js +4 -1
- package/bin/export.js +44 -6
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +9 -0
- package/bin/init.js +6 -24
- package/bin/inspect.js +8 -0
- package/bin/lint.js +5 -3
- package/bin/login.js +26 -20
- package/bin/minify.js +6 -1
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/repl.js +11 -2
- package/bin/run.js +12 -1
- package/bin/serve.js +13 -2
- package/bin/up.js +17 -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 +10 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +24 -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/build/util.js +2 -4
- 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 +117 -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/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/db-service/CHANGELOG.md +17 -0
- package/node_modules/@cap-js/db-service/lib/common/generic-pool.js +4 -7
- package/node_modules/@cap-js/db-service/lib/cqn2pql.js +1 -1
- package/node_modules/@cap-js/db-service/lib/cqn2sql.js +15 -11
- package/node_modules/@cap-js/db-service/lib/cqn4sql.js +119 -19
- package/node_modules/@cap-js/db-service/lib/infer/index.js +27 -16
- package/node_modules/@cap-js/db-service/lib/recursion-guard.js +40 -0
- package/node_modules/@cap-js/db-service/lib/search.js +1 -1
- package/node_modules/@cap-js/db-service/package.json +1 -1
- package/node_modules/@cap-js/sqlite/CHANGELOG.md +19 -0
- package/node_modules/@cap-js/sqlite/lib/SQLiteService.js +110 -14
- package/node_modules/@cap-js/sqlite/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +57 -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/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/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 +75 -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 +48 -18
- 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 +4 -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 +15 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +10 -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/db/flattening.js +4 -3
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/flattening.js +17 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +20 -0
- package/node_modules/@sap/cds-compiler/lib/transform/fioriTreeViews.js +12 -1
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +7 -2
- package/node_modules/@sap/cds-compiler/lib/transform/odata/adaptAnnotationRefs.js +11 -5
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +48 -10
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +49 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +26 -5
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +37 -16
- package/node_modules/@sap/cds-mtxs/lib/utils.js +23 -7
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +63 -8
- package/node_modules/@sap/cds-mtxs/srv/cf/saas-provisioning-service.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/sms-provisioning-service.js +23 -3
- package/node_modules/@sap/cds-mtxs/srv/extensibility/compat/update.js +15 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +2 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/config.js +2 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +2 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/protected-namespace.js +45 -0
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +30 -16
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +49 -10
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +28 -4
- package/node_modules/@sap/cds-mtxs/srv/plugins/common.js +19 -12
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr.js +6 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/serverless.js +271 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +7 -10
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker-pool.js +212 -0
- package/node_modules/@sap/cds-mtxs/srv/worker/job-worker.js +61 -0
- 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/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 +2 -2
- 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 -454
- package/lib/import/asyncapi/utils.js +0 -49
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- 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
- /package/node_modules/@sap/cds-mtxs/srv/worker/{pool.js → model-worker-pool.js} +0 -0
- /package/node_modules/@sap/cds-mtxs/srv/worker/{load.js → model-worker.js} +0 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# This file was generated from bin/completion/templates/cds-tmpl.ps1 by
|
|
2
|
+
# 'cds completion --generate' and is written to bin/completion/scripts/cds.ps1.
|
|
3
|
+
#
|
|
4
|
+
# Do not edit directly — modify the template and regenerate.
|
|
5
|
+
#
|
|
6
|
+
# All static completion data is stored in a single hashtable ($_CDS_COMPLETIONS)
|
|
7
|
+
# for O(1) lookup. The ScriptBlock registered with Register-ArgumentCompleter
|
|
8
|
+
# follows the same fastest-first strategy as the bash/zsh templates:
|
|
9
|
+
# 1. Top-level commands — when cursor is on the subcommand token.
|
|
10
|
+
# 2. Shortcut resolution — single-char alias → canonical command name.
|
|
11
|
+
# 3. Flags — when $wordToComplete starts with '-'.
|
|
12
|
+
# 3.5. Option values — static values for known flags (e.g. --to sqlite).
|
|
13
|
+
# 3.6. Comma values — comma-separable list (e.g. cds add ai,hana).
|
|
14
|
+
# 4. Positionals — static known values per subcommand.
|
|
15
|
+
# 4.5. File sentinel — files only (flags shown only when $wordToComplete starts with '-').
|
|
16
|
+
# 5. Dynamic fallback — calls 'cds completion' for everything else.
|
|
17
|
+
|
|
18
|
+
$_CDS_COMMAND = "cds"
|
|
19
|
+
|
|
20
|
+
# Completion data map:
|
|
21
|
+
# __commands — array of all top-level subcommand names
|
|
22
|
+
# __shortcuts — hashtable of shortcut → canonical command name
|
|
23
|
+
# __positionals — hashtable of command → array of known positional string values
|
|
24
|
+
# __optionValues — hashtable of command → hashtable of flag → array of values,
|
|
25
|
+
# or one of the file sentinels ':file', ':dir', ':file:ext1,ext2', ':file+dir:ext1,ext2'
|
|
26
|
+
# __commaCases — hashtable of command → hashtable of flag → array of comma-separable values
|
|
27
|
+
# <cmd> — array of flags/options for that subcommand (used by step 3)
|
|
28
|
+
$_CDS_COMPLETIONS = @{
|
|
29
|
+
'__commands' = @('add', 'bind', 'build', 'compile', 'completion', 'debug', 'deploy', 'env', 'eval', 'export', 'gen', 'help', 'import', 'init', 'inspect', 'lint', 'login', 'logout', 'minify', 'mock', 'parse', 'pull', 'push', 'repl', 'run', 'serve', 'subscribe', 'test', 'unsubscribe', 'up', 'upgrade', 'upgrade-tenant', 'version', 'watch');
|
|
30
|
+
'__shortcuts' = @{
|
|
31
|
+
'i' = 'init';
|
|
32
|
+
'a' = 'add';
|
|
33
|
+
'y' = 'bind';
|
|
34
|
+
'm' = 'import';
|
|
35
|
+
'c' = 'compile';
|
|
36
|
+
'p' = 'parse';
|
|
37
|
+
's' = 'serve';
|
|
38
|
+
'w' = 'watch';
|
|
39
|
+
'e' = 'env';
|
|
40
|
+
'b' = 'build';
|
|
41
|
+
'd' = 'deploy';
|
|
42
|
+
'l' = 'login';
|
|
43
|
+
'o' = 'logout';
|
|
44
|
+
't' = 'test';
|
|
45
|
+
'v' = 'version';
|
|
46
|
+
'h' = 'help';
|
|
47
|
+
'r' = 'repl'
|
|
48
|
+
};
|
|
49
|
+
'__positionals' = @{
|
|
50
|
+
'help' = @('add', 'bind', 'build', 'compile', 'completion', 'debug', 'deploy', 'env', 'eval', 'export', 'gen', 'help', 'import', 'init', 'inspect', 'lint', 'login', 'logout', 'minify', 'mock', 'parse', 'pull', 'push', 'repl', 'run', 'serve', 'subscribe', 'test', 'unsubscribe', 'up', 'upgrade', 'upgrade-tenant', 'version', 'watch')
|
|
51
|
+
};
|
|
52
|
+
'__optionValues' = @{
|
|
53
|
+
'bind' = @{
|
|
54
|
+
'--on' = @('cf', 'k8s');
|
|
55
|
+
'--for' = @('development', 'hybrid', 'production');
|
|
56
|
+
'-4' = @('development', 'hybrid', 'production');
|
|
57
|
+
'--out' = ':file';
|
|
58
|
+
'--output-file' = ':file';
|
|
59
|
+
'--credentials' = ':file:json';
|
|
60
|
+
'-c' = ':file:json'
|
|
61
|
+
};
|
|
62
|
+
'build' = @{
|
|
63
|
+
'--for' = @('hana', 'helm', 'java', 'mtx', 'mtx-extension', 'mtx-sidecar', 'nodejs');
|
|
64
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
65
|
+
'--project' = ':dir';
|
|
66
|
+
'--dest' = ':dir';
|
|
67
|
+
'--src' = ':dir'
|
|
68
|
+
};
|
|
69
|
+
'compile' = @{
|
|
70
|
+
'--to' = @('asyncapi', 'cdl', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'hana', 'hdbtable', 'json', 'openapi', 'sql', 'xsuaa', 'yml');
|
|
71
|
+
'--for' = @('odata', 'sql');
|
|
72
|
+
'--dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
73
|
+
'--sql-dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
74
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
75
|
+
'--odata-version' = @('4.0', '4.01');
|
|
76
|
+
'--flavor' = @('files', 'inferred', 'parsed', 'sources', 'xtended');
|
|
77
|
+
'--service' = @('all');
|
|
78
|
+
'--lang' = @('all');
|
|
79
|
+
'--dest' = ':dir';
|
|
80
|
+
'--openapi:config-file' = ':file:json';
|
|
81
|
+
'_' = ':file+dir:cds,json'
|
|
82
|
+
};
|
|
83
|
+
'completion' = @{
|
|
84
|
+
'--shell' = @('bash', 'fish', 'gitbash', 'ps', 'zsh')
|
|
85
|
+
};
|
|
86
|
+
'deploy' = @{
|
|
87
|
+
'--to' = @('hana', 'sqlite');
|
|
88
|
+
'--on' = @('cf', 'k8s');
|
|
89
|
+
'--for' = @('development', 'hybrid', 'production');
|
|
90
|
+
'-4' = @('development', 'hybrid', 'production');
|
|
91
|
+
'--vcap-file' = ':file:json';
|
|
92
|
+
'--delta-from' = ':file:json';
|
|
93
|
+
'_' = ':file+dir:cds,json'
|
|
94
|
+
};
|
|
95
|
+
'env' = @{
|
|
96
|
+
'--for' = @('development', 'hybrid', 'production');
|
|
97
|
+
'-4' = @('development', 'hybrid', 'production')
|
|
98
|
+
};
|
|
99
|
+
'export' = @{
|
|
100
|
+
'--as' = @('cdl', 'csn');
|
|
101
|
+
'--for' = @('mvn', 'npm');
|
|
102
|
+
'_' = ':file+dir:cds,json';
|
|
103
|
+
'--to' = ':dir'
|
|
104
|
+
};
|
|
105
|
+
'import' = @{
|
|
106
|
+
'--from' = @('asyncapi', 'edmx', 'openapi');
|
|
107
|
+
'--as' = @('cds', 'csn', 'json');
|
|
108
|
+
'--out' = ':dir';
|
|
109
|
+
'-o' = ':dir';
|
|
110
|
+
'_' = ':file:json,xml,edmx'
|
|
111
|
+
};
|
|
112
|
+
'init' = @{
|
|
113
|
+
'--java:package' = ':dir';
|
|
114
|
+
'--base' = ':dir'
|
|
115
|
+
};
|
|
116
|
+
'inspect' = @{
|
|
117
|
+
'--kind' = @('aspect', 'entity', 'service', 'type');
|
|
118
|
+
'--list' = @('all', 'associations', 'compositions', 'elements', 'ids', 'keys', 'names', 'sources');
|
|
119
|
+
'-l' = @('all', 'associations', 'compositions', 'elements', 'ids', 'keys', 'names', 'sources');
|
|
120
|
+
'_' = ':file+dir:cds,json'
|
|
121
|
+
};
|
|
122
|
+
'lint' = @{
|
|
123
|
+
'_' = ':file+dir:js,ts,cds'
|
|
124
|
+
};
|
|
125
|
+
'minify' = @{
|
|
126
|
+
'_' = ':file+dir:cds,json'
|
|
127
|
+
};
|
|
128
|
+
'parse' = @{
|
|
129
|
+
'--to' = @('asyncapi', 'cdl', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'hana', 'hdbtable', 'json', 'openapi', 'sql', 'xsuaa', 'yml');
|
|
130
|
+
'--for' = @('odata', 'sql');
|
|
131
|
+
'--dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
132
|
+
'--sql-dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
133
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
134
|
+
'--odata-version' = @('4.0', '4.01');
|
|
135
|
+
'--flavor' = @('files', 'inferred', 'parsed', 'sources', 'xtended');
|
|
136
|
+
'--service' = @('all');
|
|
137
|
+
'--lang' = @('all');
|
|
138
|
+
'--dest' = ':dir';
|
|
139
|
+
'--openapi:config-file' = ':file:json';
|
|
140
|
+
'_' = ':file+dir:cds,json'
|
|
141
|
+
};
|
|
142
|
+
'repl' = @{
|
|
143
|
+
'--use' = @('entities', 'ql', 'services', 'xl');
|
|
144
|
+
'-u' = @('entities', 'ql', 'services', 'xl');
|
|
145
|
+
'_' = ':dir';
|
|
146
|
+
'--run' = ':dir';
|
|
147
|
+
'-r' = ':dir'
|
|
148
|
+
};
|
|
149
|
+
'run' = @{
|
|
150
|
+
'--to' = @('fiori', 'odata', 'rest');
|
|
151
|
+
'-2' = @('fiori', 'odata', 'rest');
|
|
152
|
+
'_' = ':dir';
|
|
153
|
+
'--from' = ':dir';
|
|
154
|
+
'-f' = ':dir';
|
|
155
|
+
'--with' = ':dir';
|
|
156
|
+
'-w' = ':dir'
|
|
157
|
+
};
|
|
158
|
+
'serve' = @{
|
|
159
|
+
'--to' = @('fiori', 'odata', 'rest');
|
|
160
|
+
'-2' = @('fiori', 'odata', 'rest');
|
|
161
|
+
'_' = ':dir';
|
|
162
|
+
'--from' = ':dir';
|
|
163
|
+
'-f' = ':dir';
|
|
164
|
+
'--with' = ':dir';
|
|
165
|
+
'-w' = ':dir'
|
|
166
|
+
};
|
|
167
|
+
'up' = @{
|
|
168
|
+
'--to' = @('cf', 'k8s');
|
|
169
|
+
'--overlay' = ':file:mtaext'
|
|
170
|
+
};
|
|
171
|
+
'version' = @{
|
|
172
|
+
'--omit' = @('dev', 'optional', 'peer')
|
|
173
|
+
};
|
|
174
|
+
'watch' = @{
|
|
175
|
+
'--to' = @('fiori', 'odata', 'rest');
|
|
176
|
+
'-2' = @('fiori', 'odata', 'rest');
|
|
177
|
+
'--experimental-hot-reload' = @('false', 'true');
|
|
178
|
+
'--livereload' = @('false');
|
|
179
|
+
'_' = ':dir';
|
|
180
|
+
'--from' = ':dir';
|
|
181
|
+
'-f' = ':dir';
|
|
182
|
+
'--with' = ':dir';
|
|
183
|
+
'-w' = ':dir';
|
|
184
|
+
'--include' = ':dir';
|
|
185
|
+
'--exclude' = ':dir'
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
'__commaCases' = @{
|
|
189
|
+
'add' = @{
|
|
190
|
+
'_' = @('ai', 'ams', 'app-frontend', 'application-logging', 'approuter', 'attachments', 'audit-logging', 'cf-manifest', 'cjs', 'cloud-logging', 'completion', 'connectivity', 'console', 'data', 'destination', 'dynatrace', 'enterprise-messaging', 'enterprise-messaging-shared', 'event-mesh', 'event-mesh-shared', 'extensibility', 'extension', 'file-based-messaging', 'github-actions', 'h2', 'hana', 'hana-serverless', 'handler', 'html5-repo', 'http', 'ias', 'initial', 'kafka', 'kyma', 'lint', 'liquibase', 'local-messaging', 'malware-scanner', 'mta', 'mtx', 'multitenancy', 'notifications', 'pipeline', 'portal', 'postgres', 'react', 'redis', 'redis-messaging', 'sample', 'side-by-side-extensibility', 'sqlite', 'telemetry', 'test', 'tiny-sample', 'toggles', 'typer', 'typescript', 'ui5', 'vue', 'workzone', 'workzone-standard', 'xsuaa')
|
|
191
|
+
};
|
|
192
|
+
'init' = @{
|
|
193
|
+
'--add' = @('ai', 'ams', 'app-frontend', 'application-logging', 'approuter', 'attachments', 'audit-logging', 'cf-manifest', 'cjs', 'cloud-logging', 'completion', 'connectivity', 'console', 'data', 'destination', 'dynatrace', 'enterprise-messaging', 'enterprise-messaging-shared', 'event-mesh', 'event-mesh-shared', 'extensibility', 'extension', 'file-based-messaging', 'github-actions', 'h2', 'hana', 'hana-serverless', 'handler', 'html5-repo', 'http', 'ias', 'initial', 'kafka', 'kyma', 'lint', 'liquibase', 'local-messaging', 'malware-scanner', 'mta', 'mtx', 'multitenancy', 'notifications', 'pipeline', 'portal', 'postgres', 'react', 'redis', 'redis-messaging', 'sample', 'side-by-side-extensibility', 'sqlite', 'telemetry', 'test', 'tiny-sample', 'toggles', 'typer', 'typescript', 'ui5', 'vue', 'workzone', 'workzone-standard', 'xsuaa')
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
'add' = @('--base', '--cdm', '--cloudevents', '--composition-records', '--content-type', '--data:for', '--dry', '--filter', '--for', '--for-app', '--force', '--into', '--java:mvn', '--keys-only', '--out', '--package', '--plan', '--records', '--sap', '--shell', '--unified-runtime', '--with-telemetry', '--y');
|
|
197
|
+
'bind' = @('--credentials', '--exec', '--for', '--kind', '--no-create-service-key', '--on', '--out', '--output-file', '--to', '--to-app-services');
|
|
198
|
+
'build' = @('--dest', '--for', '--log-level', '--no-clean', '--no-ws-pack', '--options-model', '--opts', '--project', '--src', '--ws', '--ws-pack');
|
|
199
|
+
'compile' = @('--all', '--asyncapi:merged', '--beta', '--clean', '--conceptual', '--dest', '--dialect', '--docs', '--files', '--flavor', '--for', '--from', '--lang', '--locations', '--log-level', '--min', '--odata-version', '--openapi:config-file', '--openapi:diagram', '--openapi:servers', '--openapi:url', '--parse', '--plain', '--resolved', '--service', '--sort', '--sources', '--sql-dialect', '--to');
|
|
200
|
+
'completion' = @('--add', '--curr', '--generate', '--line', '--prev', '--profile', '--remove', '--shell');
|
|
201
|
+
'debug' = @('--cf', '--force', '--host', '--k8s', '--no-devtools', '--port');
|
|
202
|
+
'deploy' = @('--auto-undeploy', '--delta-from', '--dry', '--for', '--model-only', '--no-build', '--no-save', '--on', '--out', '--resolve-bindings', '--script', '--store-credentials', '--to', '--tunnel-address', '--vcap-file', '--with-auto-schema-evolution', '--with-mocks', '--xdry');
|
|
203
|
+
'env' = @('--for', '--json', '--keys', '--list', '--mocked', '--process-env', '--properties', '--raw', '--resolve-bindings', '--sources');
|
|
204
|
+
'eval' = @();
|
|
205
|
+
'export' = @('--artifact', '--as', '--cleanse', '--data', '--debug', '--dry', '--for', '--from', '--inspect', '--keep', '--mvn', '--plugin', '--reuse', '--services', '--skip', '--texts', '--to');
|
|
206
|
+
'help' = @();
|
|
207
|
+
'import' = @('--as', '--asyncapi', '--config', '--data-product', '--dependencies', '--destination', '--dry', '--edmx', '--for', '--force', '--from', '--group', '--include-namespaces', '--into-namespace', '--keep-namespace', '--name', '--no-copy', '--no-save', '--odata', '--odata-v2-annotations', '--openapi', '--out', '--resolve-bindings', '--rfc', '--services');
|
|
208
|
+
'init' = @('--add', '--base', '--force', '--java', '--java:mvn', '--java:package', '--lint:custom', '--lint:custom:example', '--no-db', '--nodejs', '--verbose');
|
|
209
|
+
'inspect' = @('--kind', '--list', '--stats');
|
|
210
|
+
'lint' = @('--cache', '--cache-file', '--cache-location', '--cache-strategy', '--color', '--concurrency', '--config', '--debug', '--env-info', '--exit-on-fatal-error', '--ext', '--fix', '--fix-dry-run', '--fix-type', '--flag', '--format', '--global', '--help', '--ignore-pattern', '--init', '--inspect-config', '--max-warnings', '--mcp', '--no-color', '--no-config-lookup', '--no-error-on-unmatched-pattern', '--no-ignore', '--no-inline-config', '--no-warn-ignored', '--output-file', '--parser', '--parser-options', '--pass-on-no-patterns', '--pass-on-unpruned-suppressions', '--plugin', '--print-config', '--prune-suppressions', '--quiet', '--report-unused-disable-directives', '--report-unused-disable-directives-severity', '--report-unused-inline-configs', '--rule', '--stats', '--stdin', '--stdin-filename', '--suppress-all', '--suppress-rule', '--suppressions-location', '--version');
|
|
211
|
+
'login' = @('--client', '--mtls', '--passcode', '--plain', '--save-refresh-token', '--subdomain', '--user');
|
|
212
|
+
'logout' = @('--clear-invalid', '--delete-settings', '--subdomain', '--url');
|
|
213
|
+
'minify' = @('--cleanse', '--debug', '--dry', '--inspect', '--keep', '--skip');
|
|
214
|
+
'mock' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
215
|
+
'parse' = @('--all', '--asyncapi:merged', '--beta', '--clean', '--conceptual', '--dest', '--dialect', '--docs', '--files', '--flavor', '--for', '--from', '--lang', '--locations', '--log-level', '--min', '--odata-version', '--openapi:config-file', '--openapi:diagram', '--openapi:servers', '--openapi:url', '--parse', '--plain', '--resolved', '--service', '--sort', '--sources', '--sql-dialect', '--to');
|
|
216
|
+
'pull' = @('--client', '--from', '--mtls', '--passcode', '--subdomain', '--user');
|
|
217
|
+
'push' = @('--async', '--client', '--mtls', '--passcode', '--subdomain', '--sync', '--to', '--user');
|
|
218
|
+
'repl' = @('--ql', '--run', '--use');
|
|
219
|
+
'run' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
220
|
+
'serve' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
221
|
+
'subscribe' = @('--body', '--local', '--resolve-bindings', '--to', '--user');
|
|
222
|
+
'test' = @('--exclude', '--failed', '--files', '--include', '--list', '--passed', '--quiet', '--recent', '--silent', '--timeout', '--unmute', '--verbose', '--workers');
|
|
223
|
+
'unsubscribe' = @('--from', '--local', '--resolve-bindings', '--user');
|
|
224
|
+
'up' = @('--namespace', '--overlay', '--to');
|
|
225
|
+
'upgrade' = @('--at', '--fix', '--local', '--report', '--resolve-bindings', '--user');
|
|
226
|
+
'upgrade-tenant' = @('--at', '--local', '--resolve-bindings', '--user');
|
|
227
|
+
'version' = @('--abs', '--all', '--depth', '--info', '--json', '--markdown', '--omit');
|
|
228
|
+
'watch' = @('--debug', '--exclude', '--experimental-hot-reload', '--ext', '--in-memory', '--in-memory?', '--include', '--inspect', '--inspect-brk', '--livereload', '--open', '--port', '--with-mocks', '--with-mtx')
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
# $wordToComplete : the token currently being typed (may be empty if cursor is after a space)
|
|
232
|
+
# $commandAst : the full parsed command AST; .CommandElements is the token array
|
|
233
|
+
# $cursorPosition : byte offset of the cursor in the command string
|
|
234
|
+
Register-ArgumentCompleter -Native -CommandName $_CDS_COMMAND -ScriptBlock {
|
|
235
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
236
|
+
|
|
237
|
+
$map = $_CDS_COMPLETIONS
|
|
238
|
+
$cmdSegments = $commandAst.CommandElements
|
|
239
|
+
if ($null -eq $wordToComplete) { $wordToComplete = '' }
|
|
240
|
+
|
|
241
|
+
# Helper: emit file/dir completions for a sentinel value.
|
|
242
|
+
# Sentinel formats: ':file' (any file), ':dir' (directories only),
|
|
243
|
+
# ':file:ext1,ext2' (files with specific extensions),
|
|
244
|
+
# ':file+dir:ext1,ext2' (files with extensions + directories).
|
|
245
|
+
# Uses relative paths (preserving any typed prefix) so the completed text stays short.
|
|
246
|
+
function _CdsFileComplete($sentinel, $word) {
|
|
247
|
+
$base = if ($word) { $word } else { '' }
|
|
248
|
+
$search = if ($word) { "$word*" } else { '*' }
|
|
249
|
+
$inclDirs = $sentinel -like ':file+dir:*'
|
|
250
|
+
# Parse extension list from ':file:cds,json' or ':file+dir:cds,json' → @('.cds', '.json')
|
|
251
|
+
$exts = if ($sentinel -like ':file:*' -or $inclDirs) {
|
|
252
|
+
($sentinel -replace '^:file(\+dir)?:', '').Split(',') | ForEach-Object { ".$_" }
|
|
253
|
+
} else { $null }
|
|
254
|
+
if ($sentinel -eq ':dir') {
|
|
255
|
+
Get-ChildItem -Path $search -Directory -ErrorAction SilentlyContinue |
|
|
256
|
+
ForEach-Object {
|
|
257
|
+
$rel = $base + $_.Name
|
|
258
|
+
[System.Management.Automation.CompletionResult]::new($rel, $_.Name, 'ProviderItem', $_.Name)
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
Get-ChildItem -Path $search -File -ErrorAction SilentlyContinue |
|
|
262
|
+
Where-Object { $null -eq $exts -or $exts -contains $_.Extension } |
|
|
263
|
+
ForEach-Object {
|
|
264
|
+
$rel = $base + $_.Name
|
|
265
|
+
[System.Management.Automation.CompletionResult]::new($rel, $_.Name, 'ProviderItem', $_.Name)
|
|
266
|
+
}
|
|
267
|
+
if ($inclDirs) {
|
|
268
|
+
Get-ChildItem -Path $search -Directory -ErrorAction SilentlyContinue |
|
|
269
|
+
ForEach-Object {
|
|
270
|
+
$rel = $base + $_.Name
|
|
271
|
+
[System.Management.Automation.CompletionResult]::new($rel, $_.Name, 'ProviderContainer', $_.Name)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
# Step 1: top-level command completion — cursor is on the subcommand token itself.
|
|
278
|
+
# Either no subcommand yet (count=1) or the user is still typing it (count=2, partial match).
|
|
279
|
+
$isTopLevel = $cmdSegments.Count -eq 1 -or ($cmdSegments.Count -eq 2 -and $wordToComplete -ne '' -and $cmdSegments[1].Extent.Text -eq $wordToComplete)
|
|
280
|
+
if ($isTopLevel) {
|
|
281
|
+
foreach ($cmd in $map['__commands']) {
|
|
282
|
+
if ($cmd.StartsWith($wordToComplete)) {
|
|
283
|
+
[System.Management.Automation.CompletionResult]::new($cmd, $cmd, 'ParameterValue', $cmd)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
# Step 2: resolve shortcut to canonical command name so the rest of the
|
|
290
|
+
# logic only needs to handle canonical names.
|
|
291
|
+
$subCmd = $cmdSegments[1].Extent.Text
|
|
292
|
+
$resolved = $map['__shortcuts'][$subCmd]
|
|
293
|
+
if ($null -ne $resolved) { $subCmd = $resolved }
|
|
294
|
+
|
|
295
|
+
# Compute $previousWord — the token immediately before the cursor.
|
|
296
|
+
# When $wordToComplete is empty the cursor is after a space, so the last completed
|
|
297
|
+
# token is the previous word. When non-empty the cursor is mid-token, so look one
|
|
298
|
+
# further back. EndOffset filtering keeps only tokens that end before the cursor.
|
|
299
|
+
$prevCandidates = $cmdSegments | Where-Object { $_.Extent.EndOffset -le $cursorPosition }
|
|
300
|
+
$previousWord = if ($wordToComplete -eq '') {
|
|
301
|
+
($prevCandidates | Select-Object -Last 1).Extent.Text
|
|
302
|
+
} else {
|
|
303
|
+
($prevCandidates | Select-Object -Last 2 | Select-Object -First 1).Extent.Text
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
# Step 3: flag/option completion — triggered when $wordToComplete starts with '-'.
|
|
307
|
+
if ($wordToComplete.StartsWith('-')) {
|
|
308
|
+
$entry = $map[$subCmd]
|
|
309
|
+
if ($null -ne $entry) {
|
|
310
|
+
foreach ($opt in $entry) {
|
|
311
|
+
if ($opt.StartsWith($wordToComplete)) {
|
|
312
|
+
[System.Management.Automation.CompletionResult]::new($opt, $opt, 'ParameterValue', $opt)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
# Step 3.5: option-value completion — triggered when the previous word is a known option.
|
|
320
|
+
$optVals = $map['__optionValues'][$subCmd]
|
|
321
|
+
if ($null -ne $optVals) {
|
|
322
|
+
$entry = $optVals[$previousWord]
|
|
323
|
+
if ($null -ne $entry) {
|
|
324
|
+
if ($entry -eq ':dir' -or $entry -eq ':file' -or $entry -like ':file:*' -or $entry -like ':file+dir:*') {
|
|
325
|
+
_CdsFileComplete $entry $wordToComplete
|
|
326
|
+
} else {
|
|
327
|
+
foreach ($val in $entry) {
|
|
328
|
+
if ($val.StartsWith($wordToComplete)) {
|
|
329
|
+
[System.Management.Automation.CompletionResult]::new($val, $val, 'ParameterValue', $val)
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
# Step 3.6: comma-separated option-value completion.
|
|
338
|
+
$commaVals = $map['__commaCases'][$subCmd]
|
|
339
|
+
if ($null -ne $commaVals) {
|
|
340
|
+
# Primary lookup: previous word is the option flag (e.g. '--add').
|
|
341
|
+
$entry = $commaVals[$previousWord]
|
|
342
|
+
if ($null -eq $entry -and $previousWord.EndsWith(',')) {
|
|
343
|
+
# Space-separated continuation: user typed "cds add ai, <tab>" so $previousWord="ai,"
|
|
344
|
+
# and $wordToComplete is empty. Scan backwards through segments to find the flag.
|
|
345
|
+
$prevSegs = @($cmdSegments | ForEach-Object { $_.Extent.Text })
|
|
346
|
+
$prevIdx = [array]::LastIndexOf($prevSegs, $previousWord) - 1
|
|
347
|
+
while ($prevIdx -ge 0 -and -not $prevSegs[$prevIdx].StartsWith('-')) { $prevIdx-- }
|
|
348
|
+
if ($prevIdx -ge 0) { $entry = $commaVals[$prevSegs[$prevIdx]] }
|
|
349
|
+
}
|
|
350
|
+
# Positional fallback: previous word is not a flag (it's the subcommand or a value).
|
|
351
|
+
if ($null -eq $entry -and -not $previousWord.StartsWith('-')) {
|
|
352
|
+
$entry = $commaVals['_']
|
|
353
|
+
}
|
|
354
|
+
if ($null -ne $entry) {
|
|
355
|
+
# For space-separated comma continuation, fold previousWord into the prefix/alreadyUsed.
|
|
356
|
+
$spaceComma = $previousWord.EndsWith(',')
|
|
357
|
+
$commaWord = if ($spaceComma) { $previousWord + $wordToComplete } else { $wordToComplete }
|
|
358
|
+
$parts = $commaWord.Split(',')
|
|
359
|
+
$prefix = if ($parts.Count -gt 1) { ($parts[0..($parts.Count-2)] -join ',') + ',' } else { '' }
|
|
360
|
+
$partial = $parts[-1]
|
|
361
|
+
$alreadyUsed = @{}
|
|
362
|
+
foreach ($u in $parts[0..($parts.Count-2)]) { if ($u) { $alreadyUsed[$u] = $true } }
|
|
363
|
+
foreach ($val in $entry) {
|
|
364
|
+
if (-not $alreadyUsed.ContainsKey($val) -and $val.StartsWith($partial)) {
|
|
365
|
+
# When space-separated (prev="ai,"), PS replaces only $wordToComplete (=''),
|
|
366
|
+
# so return just $val — the prefix is already on the line.
|
|
367
|
+
$full = if ($spaceComma) { $val } else { $prefix + $val }
|
|
368
|
+
[System.Management.Automation.CompletionResult]::new($full, $val, 'ParameterValue', $val)
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
# Step 4: static string positionals (e.g. cds help <tab>).
|
|
376
|
+
$positionals = $map['__positionals'][$subCmd]
|
|
377
|
+
if ($null -ne $positionals) {
|
|
378
|
+
$matched = $false
|
|
379
|
+
foreach ($pos in $positionals) {
|
|
380
|
+
if ($pos.StartsWith($wordToComplete)) {
|
|
381
|
+
[System.Management.Automation.CompletionResult]::new($pos, $pos, 'ParameterValue', $pos)
|
|
382
|
+
$matched = $true
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if ($matched) { return }
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
# Step 4.5: default file sentinel — files only, no flags appended.
|
|
389
|
+
$defaultFile = $map['__optionValues'][$subCmd]?['_']
|
|
390
|
+
if ($null -ne $defaultFile) {
|
|
391
|
+
_CdsFileComplete $defaultFile $wordToComplete
|
|
392
|
+
return
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
# Step 5: dynamic fallback — calls 'cds completion' for subcommands whose arguments
|
|
396
|
+
# cannot be determined statically (e.g. service names, model names, unknown flags).
|
|
397
|
+
# Single-quoting $previousWord/$wordToComplete prevents bare word 'h' from being
|
|
398
|
+
# interpreted as the 'help' shortcut by the completion handler.
|
|
399
|
+
$options = & $_CDS_COMMAND completion --shell ps --prev "'$previousWord'" --curr "'$wordToComplete'" --line "'$commandAst'"
|
|
400
|
+
foreach ($option in $options) {
|
|
401
|
+
[System.Management.Automation.CompletionResult]::new($option, $option, 'ParameterValue', $option)
|
|
402
|
+
}
|
|
403
|
+
}
|