add unpublish
to shouldPublish
option of transformEntry
function
#170
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the option to unpublish entries that have been processed by the
transformEntry
functionDescription
In addition to
true
andfalse
as options for theshouldPublish
configuration option, this adds aunpublish
option that makes an api call to unpublish the entry being transformed.Motivation and Context
This is for the situation where the validations of one or more content types are changed such that existing entries would now fail validations and not be publishable without updates. If you are releasing a new version of your frontend and know that only entries which pass the updated content model validation changes will work, this is a way to show your content creators and editors which entries need to be updated to work with the updated frontend.
I did this because of a question in the Contentful Community slack: https://contentful-community.slack.com/archives/CDY4JBMTJ/p1551255690020000
Todos
shouldPublish
option into avalidateEntry
function that checks entries to see if they would pass validation and unpublishes only the ones that fail the revalidation.deriveLinkedEntries
andtransformEntriesToType
functions