To underpin active development in SAP Business Technology Platform and SAP S/4HANA, we at the SAP Cloud SDK for JavaScript always keep our APIs up to date and provide developers easy access to the latest features of cloud solutions by SAP.
To better achieve this mission we regularly review and improve the design of the JavaScript SDK. In the Q4 of 2021, we announced our new Release Policy and the next major version bump from 1.x to 2.x.
It’s time to announce we have reached a public Beta of 2.0 release of the SAP Cloud SDK for JavaScript.
What awaits you in the SAP Cloud SDK for JavaScript 2.0?
As modular as ever
The SDK design gets more modular to let you use only what you need and keep your dependencies under control. Check our guide on how to organize your imports and find new packages.
Thanks to better modularity we improved the exports strategy with only public APIs explicitly exposed. It means:
- less possibility to accidentally tap into internal APIs
- better IDE experience with meaningful suggestions and faster autocompletion
ECMAScript 2019 is now the default compilation target
We increased the TypeScript compilation target to ECMAScript 2019 (ES10) to rip the benefit of
- smaller bundle size
- performance gains
- cleaner code
Previously we used ECMAScript 2009 (ES5) for compatibility with earlier Node versions. We highly recommend using Node 12 or above to make sure you do not experience any compilation or run time errors.
We removed lots of deprecated code
More than 100 deprecated methods were removed. We carefully crafted a list of replacements for deprecated methods for a quick and painless upgrade. If you have not replaced them yet – just do it now.
Our CLI is deprecated, archived, and not recommended for future use
Once a popular tool the SDK’s CLI ran out of its value and is now replaced with a continuously updated samples repository. This repository provides you with starter projects for different common scenarios like SAP BTP Cloud Foundry, Kubernetes, Cloud Application Programming model, and more. The projects are fully configured and tested via an automated CI pipeline.
Mind, this change does not relate to OData and OpenAPI code generator CLIs. You can use them as before to generated typed clients out of respective specefications. We removed some rarely used and non-vital generator options, otherwise they behave as before.
Improved package size thanks to removing Moment.js from dependencies
Well, you will still need Moment.js if you are using our typed client libraries but for packages like @sap-cloud-sdk/connectivity
it is not the case any longer. We currently work on a flexible middleware approach to serialization and plan to make Temporal a default middleware as soon as it reaches the stage 4 proposal. We will keep this profound update to the next major version bump.
Redesigned Execute
API
We slightly redesigned Execute
API to make it more consistent with multiple use-cases, streamline parameters naming, and unify request configuration.
In the new API, you can either pass a destination object or options to let the SDK fetch the destination. Only for the latter case, a change would be needed:
//Version 1.X.Y
MyEntity.requestBuillder().getAll().execute(
{ destinationName: 'myDestination', userJwt: 'yourJwt' },
{ useCache: true }
);
//Version 2.0.0
MyEntity.requestBuillder().getAll().execute({
destinationName: 'myDestination',
jwt: 'yourJwt',
useCache: true
});
The above changes apply not only to execute()
method of SDK’s request builders but also to executeHttpRequest()
, getDestination()
, and executeRaw()
. Refer to our upgrade guide for more details.
How to try the Beta release of the SAP Cloud SDK for JavaScript 2.0?
We published the Beta of the SDK 2.0 release to npm. Install it by adding @beta
after the package name, for example npm install @sap-cloud-sdk/generator@beta
. Check our upgrade guide to find new packages like @sap-cloud-sdk/connectivity
.
Because of technical limitations, we can not provide pregenerted libraries for the Beta release of the SDK. You can use code generators to generate a typed client library yourself. We are working on providing independently versioned library modules which should allow us to fix this inconvenience with future releases.
Documentation
The majority of APIs and SDK concepts did not change that means the existing documentation still applies to SDK 2.0. Where changes were made you will find convenient tabs highlighting the difference between the previous and current major versions. Check the example below for the visual cue of how it looks like:
How long does it take to upgrade?
We estimate the upgrade effort for an average project to be around 1 day for developers experienced with the SDK. It of course might depend on the project size and feature adoption but the complexity follows a log n distribution and should not take more than a week for large and complex projects.
We encourage upgrading as soon as the GA release is available. The 1.x branch will not be actively maintained after 2.0 reaches GA. You can expect only critical security vulnerabilities to be patched in the next 6 months after the new major version is released.
We plan to achieve the General Availability of the SDK 2.0 release by February 10, 2022. The release date is provisional and can be moved.
Where do I learn more and get help?
- This upgrade guide is the best starting point when switching to the SAP Cloud SDK for JavaScript 2.0
- To give feedback about public Beta or report issues, please, use our GitHub repository.
- Look for 2.0 tabs in the developer documentation.
What’s next?
Go ahead and try the Beta release of the SAP Cloud SDK for JavaScript 2.0. We are looking forward to hearing your feedback and making the transition to a new version as smooth as possible.
Expect major version bumps more frequently than they happened in the past. We must always catch up and often anticipate the enormous speed of cloud ecosystem development at SAP for your benefit and convenience.
If you have 3 minutes to spare take our survey! We value your feedback and every response brings us a smile.