1.0.5 (2022-07-19)
Features
- adds initAsync (b4ffa22)
Tag Name: v1.0.5
Release Date: 7/19/2022
Payload CMSPayload CMS is a modern, self-hosted headless content management system built with TypeScript, Node.js, and MongoDB. It's designed specifically for developers who want full control over their content management system while maintaining a powerful admin interface for content editors.
Payload CMS v1.0.5 introduces a new initAsync method that allows for asynchronous initialization of the CMS. This is particularly useful for scenarios where you need to perform asynchronous operations during the initialization process. The update maintains backward compatibility while providing more flexibility for developers working with asynchronous code.
initAsync method for asynchronous initialization of Payload CMSonInit for better TypeScript supportNo migration is required for this release. The new initAsync method is provided as an additional option alongside the existing initialization method, ensuring backward compatibility.
If you wish to use the new asynchronous initialization:
// Before (synchronous)
payload.init({
// config options
});
// After (asynchronous)
await payload.initAsync({
// config options
});
Your existing code using the synchronous init method will continue to work without changes.
This is a minor feature release that adds functionality without breaking changes. It's safe to upgrade from v1.0.4 to v1.0.5 without concerns about backward compatibility.
To upgrade:
npm install [email protected]
# or
yarn add [email protected]
Consider adopting the new initAsync method if your application would benefit from asynchronous initialization, particularly if you need to wait for external resources or perform other async operations during startup.
No specific bug fixes were included in this release.
The primary feature in this release is the addition of the initAsync method, which enables asynchronous initialization of Payload CMS. This method allows developers to:
Example usage:
// Async initialization
const payload = await payload.initAsync({
secret: 'your-secret-key',
mongoURL: 'your-mongo-connection-string',
// other config options
});
// Now you can be sure initialization is complete
console.log('Payload initialized successfully');
This complements the existing synchronous initialization method, giving developers more flexibility in how they structure their application startup.
No security fixes were included in this release.
No specific performance improvements were documented in this release.
This release introduces asynchronous initialization capabilities to Payload CMS through the new initAsync method. While this is a relatively small addition in terms of code changes, it provides significant flexibility for developers working with modern JavaScript/TypeScript applications where asynchronous patterns are common.
The update to the onInit type definition improves TypeScript support, making the developer experience more robust when working with initialization hooks.
Overall, this release enhances Payload's API without disrupting existing implementations, making it a safe and beneficial upgrade for most users.