cap-utils
An npx tool that drops worked example files into an existing CAP project, including a test.http to fire requests at what it added, for exploring CAP features you then extend yourself.
Aimed at exploring CAP features inside your own project rather than reading them in a sample repository; the README is explicit that you are meant to extend what it writes.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1, contributes to 1@lorenzobigsmaintainer
Before choosing this
Conditions
PracticalFunctional boundary
Last released April 2024.
What it declares
Every artifact
- Type
- Generator
- Origin
- Independently maintained
- Runtime
- build time
As a generator
- Generates
- Code or test data
- Run with
- Its own command
- Distributed through
- npm
Connections
Whole applications to read rather than snippets to copy
Download
Install
npm add cap-utilsDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from lorenzobigs/cap-utils under ISC, readCap Utilities
This npx tools provides a set of example files to explore SAP Cloud Application Programming features.
How to use
It's simple! Open the terminal in your CAP Project root directory and run
npx cap-utils
Your project will be updated. Run
cds watch
and use the test.http to run some test. You are very encouraged to explore and extend the example files!
If you don't know how to initialize a SAP CAP Project: Jumpstart guide in SAP CAPire
Keep in mind that from 1.0.7 version the service were enhanced with scope protection. To add a local mock user copy the auth section from package-for-cap.json into your package.json and run :
cds watch --profile development
The development profile will inject a mock user with the required scope to consume the service. You can use the same user to access to the webapp.
Additional Modules
In version 1.0.4 it has been added a feature to add extra modules to your app.
npx cap-utils --add <extra_module_1>,<extra_module_2>...
Available modules:
- ui5 --> add a basic UI5 freestyle application in your project
- mta --> add sample files for mta based deployment on Cloud Foundry runtime
- profiling --> add a section in your package.json with cds profiles
- ext --> add a section in your package.json external odata source and sample files to implement it.
- test --> add test sample files and scripts
Suggested Extension in your IDE
| Visual Studio / SAP BAS |
|---|
| "sapse.vscode-cds" |
| "dbaeumer.vscode-eslint" |
| "humao.rest-client" |
| "qwtel.sqlite-viewer" |
| "mechatroner.rainbow-csv" |
History
Notes
Refactoring of external,mta and profiling features. Main features are still the same.
Notes
Some changes on the presentation layer
Notes
Typo fix in *service.cds on role definition for entity restrictions
Notes
In version 1.2.0 there were added sample files to run unit tests on the application. Ensure to add the required devDependencies. The feature can be used with:
npx cap-utils --add testThen run:
npm testNotes
In version 1.1.1 there were added sample files to consume an external odata service exposed as entity of the internal catalog service. The feature can be used with:
npx cap-utils --add extOther 5
Notes
From version 1.0.11 you can modify your package.json to add a cds profiling section.
In version 1.0.7 sample files for xsuaa,html5-repo,hana,mta based deployment were added:
- valid-service.cds were changed to add scope protection on srv
- test.http were modified to add Basic authentication for local testing
- xs-security.json: it will add scope base authorizations
- xs-security-cc.json : it will add a client credential user with authorizations to consume srv
- mta.yaml : enable the app for a Cloud Foundry deployment.
Others providing
Compare all 2 on the Reference apps page →- cds-incidents-samplecds-incidents-sampleA cds add plugin that drops the incidents-app model into a project, so the reference model arrives by a command rather than by copying a repository.independent, capcds add plugin adding the incidents-app model to a project
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- First seen.
For your agent
- Ref
artifact:lorenzobigs-cap-utils- JSON
- /artifacts/lorenzobigs-cap-utils.json
- MCP
- Connecting an agent