Ondrej PolesnyPublished on Dec 14, 2021
So let’s start with the Delivery SDK.
The previous versions of the Delivery SDK were working great feature-wise. But the new frameworks and industry trends have created a couple of problems for the SDK.
With these points in mind, the new SDK:
- Got rid of RxJS and Parse5 dependencies.
But you can still parse rich texts. For Node environments, you just need an additional package.
- Is one-third of the previous version size.
When minimized, it’s around 25kB and therefore well suitable for client-side usage.
- Uses types instead of classes.
You can directly serialize and deserialize the retrieved objects:
Even if you don’t plan to handle the serialization yourself, frameworks like Next.js do it internally. With the new SDK, you simply don’t need to think about it, and it will work.
Using types also allowed us to completely remove TypeResolvers and make the DeliveryClient in it so much cleaner and more readable:
- Comes with improved rich text resolution.
The resolvers are no longer hidden in class definitions. You get direct and isolated control over the rendered content on the rich text element level:
- Provides content model structure via Model Generator.
Your content queries no longer need string literals or magic constants for codenames. The model generator will output both types and content model structure that contains all codenames:
The Management SDK shares the dependency on the
kontent-core package with the Delivery SDK, so the related benefits apply here too. The SDK bundle is smaller, no longer needs RxJS and Parse5, and uses types instead of classes. But there are also other improvements:
- Support of collections management
You can now list and modify collections:
Note: See Kontent docs for details on working with collections in Management API
- Searchable values on custom elements
Custom elements store various types of data, like GPS coordinates, in various formats, like JSON or XML. However, it may be beneficial to let content editors find content items based on a specific string describing the custom elements’ data. In this example, we’re storing the street and city among the GPS coordinates solely for the purpose of searching:
- Subpages element
If you’re using Web Spotlight, you need to use Subpages element to build the website content tree. The SDK now supports the
ISubpagesElementand you can use it the same way as the linked items element.
- Uploading assets via URL
Often during migrations, the scripts needed to download assets and upload them to Kontent from local storage. Now, you can upload assets from URLs directly:
Note: You can check more info in the SDK Readme on GitHub.
And remember, all these improvements are also available in the Kontent CLI :-)
Just imagine that you remove all TypeResolvers, codename constant, and easily serialize all content in your project. Sounds good, right? :-)
Upgrade the dependencies: