-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide entry id for transform and derive functions (#1212)
For all transformation functions (`transformEntries`, `deriveLinkedEntries` and `transformEntriesToType`) we provide the entry id of the entry in scope in the call signature of the transform callbacks. This allows for cross checking the id with any other source, or more custom validations within scope. We opted-in for an wrapping object as a third parameter to eventually enrich the callback with further data in the future. **Example:** (more in the updated readme) ```js module.exports = function (migration) { migration.transformEntries({ contentType: 'newsArticle', from: ['author', 'authorCity'], to: ['byline'], transformEntryForLocale: function (fromFields, currentLocale, {id}) { if(id === '<specific-entry-id>') { return; } if (currentLocale === 'de-DE') { return; } const newByline = `${fromFields.author[currentLocale]} ${fromFields.authorCity[currentLocale]}`; return { byline: newByline }; } }); }; ```
- Loading branch information
Showing
7 changed files
with
171 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters