@sap/wing-service-explorer
Overview
Wing-service-explorer is an npm package that provides the ability to explore SAP services.
This Readme file explains how to setup the development environment, how the development process and tests are performed, and how to release the feature in Nexus.
Usage
To add this package as a dependency in your package.json file, under the "dependencies" section, add the following dependency: "@sap/wing-service-explorer": [Version]
API
Wing-service-explorer exposes 3 different objects for 3 different SAP systems:
ServiceURLExplorer
This object exposes APIs for exploration of systems and services defined as OData odata_gen in the account destination list.
getDestinations
Returns a list of destinations filtered with WebIDEUsage = odata_gen
isFullUrlDestination
Gets as an input a destination object (received from the getDestinations API) and returns true if this is a destination to a system
or a service (i.e. if the destination includes a property named full_url and its value is true).
getMetadata
Gets as an input a ConnectionDetails object (which contains the details to connect to a service) and returns the metadata (XML format)
which the service exposes.
APIHubExplorer
This object exposes APIs for exploration of APIs from the APIHub system.
getDestinations
Returns a list of destinations filtered by WebIDEUsage = apihub_catalog
getListOfAPIs
Gets as an input a destination object (received from the getDestinations API) and returns a list of APIs exposed by the APIHub system.
getApiKey
Gets as an input a destination object and user authetication details (user/password) and returns the user's API key from the APIHub system. (Required for getting the API metadata.)
getMetadata
Gets as an input a ConnectionDetails object (which contains the details to connect to an API) and returns the metadata (XML format)
which the API exposes.
Note: The APIHub requires a definition of 2 destinations. The first one for the APIHub system and the second for the API sandbox.
ExtensionFactoryExplorer
This object exposes APIs for exploration of systems exposed by the Extension Factory.
getDestinations
Returns a list of destinations which contain an additional property named XFSystemName.
Development Process
GIT and GitHub
- Open Git Bash, go to the local repository directory and sync with the remote repository.
- Develop in a Local branch.
- Create a new descriptive branch
git checkout -b my-local-branch-name
OR rename the previous one git branch -m my-local-branch-name
. - Make sure my-local-branch-name is NOT master and that there is no existing branch with this name.
- Sync with the remote repository.
- Fetch the code from the master branch by running
git fetch; git merge
.
- Make your local changes.
- Run
npm install
to install dependencies. - Run
npm run test
to compile the typescript code to JS and run tests.
- Commit and push.
- Do not push directly to master !!!
- Commit your changes and push to create a new branch on GitHub by running
git push origin my-local-branch-name
- On consecutive commits DO NOT use
commit ammend
. You should create a new commit and push to the same feature branch again. This will add an extra commit to your pull request and retrigger the voters.
- Open the repository on GitHub and go to Code > Branches.
- Open a pull request.
- Click next to your branch.
- Edit the pull request name with BLI or BCP. For example: "BLI DEVXCORE-123: my new feature" or "BCP 1670451810: Fix my bug".
- A new branch my-local-branch-name is created in the GitHub repository.
- The new code should enable all voters and code review to pass successsfully.
- Update the existing pull request.
- Stage your changes and create a new commit.
- Perform Git fetch
- Perform Git merge on origin/master - merge your changes with the most updated master branch.
- Push your changes to your my-local-branch-name (Git push origin my-local-branch-name).
- Merge the pull request.
- If all voters passed (XMake + JaaS Voter) click (which should become green).
- If your pull request contains several commits, you can put them together in one commit from GitHub by selecting the option from the Merge dropdown list.
- Delete your branch.
Tests and Coverage
- Run
npm run test
to run the Unit tests written in Mocha as well as the coverage test.
Release
- Bump the version in the exposed ports github file.
- Use XMAKE Release Job (Stage and promote) to upload a new version to Nexus (based on master).
The XMAKE Release Job currently runs automatically on merge.
3 The newly released version location in [nexus]
(http://nexus.wdf.sap.corp:8081/nexus/content/repositories/build.releases/com/sap/npm/wing-service-explorer/)