⭐️ Veröffentlicht v3.0 mit Unterstützung für WordPress 6.6 und Bulk Mutations
Gato GraphQL v3.0 wurde veröffentlicht und enthält neue Funktionen sowie einige Breaking Changes. Schau dir die Release Notes auf GitHub für die vollständige Liste der Änderungen an.
Im Folgenden die wichtigsten Updates.
Kompatibilität mit WordPress 6.6 hinzugefügt
Gato GraphQL 3.0 hat alle seine Blöcke neu kompiliert, um sie mit WordPress 6.6 kompatibel zu machen. (Bei allen früheren Versionen werfen Blöcke einen JS-Fehler.)
Bulk Mutation-Felder hinzugefügt (für alle Mutations im Schema)
Gato GraphQL 3.0 fügt Bulk Mutation-Felder für alle Mutations im Schema hinzu und erlaubt es uns, mehrere Ressourcen gleichzeitig zu mutieren.
Zum Beispiel wird die Mutation createPosts (die Mutation für eine einzelne Ressource ist createPost) mehrere Beiträge erstellen:
mutation CreatePosts {
createPosts(inputs: [
{
title: "First post"
contentAs: {
html: "This is the content for the first post"
}
},
{
title: "Second post"
contentAs: {
html: "Here is another content, for another post"
}
excerpt: "The cup is within reach"
},
{
title: "Third post"
contentAs: {
html: "This is yet another piece of content"
},
authorBy: {
id: 1
},
status: draft
}
]) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
post {
id
title
content
excerpt
author {
name
}
status
}
}
}Bulk Mutations eröffnen neue Möglichkeiten für die Verwaltung unserer WordPress-Website. Zum Beispiel verwendet die folgende GraphQL-Query createPosts (und Multiple Query Execution, bereitgestellt von Gato GraphQL PRO), um Beiträge zu duplizieren:
query ExportPostData
{
postsToDuplicate: posts {
rawTitle
rawContent
rawExcerpt
postInput: _echo(value: {
title: $__rawTitle
contentAs: {
html: $__rawContent
},
excerpt: $__rawExcerpt
})
@export(as: "postInputs", type: LIST)
@remove
}
}
mutation CreatePosts
@depends(on: "ExportPostData")
{
createPosts(inputs: $postInputs) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
post {
id
title
content
excerpt
}
}
}Die Liste der hinzugefügten Bulk Mutation-Felder lautet wie folgt:
Root.addCommentToCustomPostsRoot.createCustomPostsRoot.createMediaItemsRoot.createPagesRoot.createPostsRoot.removeFeaturedImageFromCustomPostsRoot.replyCommentsRoot.setCategoriesOnPostsRoot.setFeaturedImageOnCustomPostsRoot.setTagsOnPostsRoot.updateCustomPostsRoot.updatePagesRoot.updatePostsComment.replyWithCommentsCustomPost.addComments
Breaking change: Erfordert mindestens WordPress v6.0
Um WordPress v6.6 zu unterstützen, mussten die Blöcke im Plugin neu kompiliert werden, mit WordPress v6.0+ als Zielversion.
Daher erfordert Gato GraphQL ab v3.0 mindestens WordPress v6.0.
Breaking change: Der Schema-Konfigurationsblock „Payload Types for Mutations" muss möglicherweise neu konfiguriert werden
Dem Schema-Konfigurationsblock „Payload Types for Mutations" wurde ein neuer Optionswert hinzugefügt: „Do not use payload types for mutations (i.e. return the mutated entity)". Aus diesem Grund hat sich seine interne Datenstruktur geändert.
Wenn du eine Schema-Konfiguration mit der ausgewählten Option „Do not use payload types for mutations (i.e. return the mutated entity)" erstellt hast, geht dieser Auswahlwert nach dem Upgrade auf v3.0 verloren. Du musst die Schema-Konfiguration bearbeiten, diese Option erneut auswählen und speichern.