⭐️ Dirilis v3.0 dengan dukungan untuk WordPress 6.6, dan bulk mutations
Gato GraphQL v3.0 telah dirilis, berisi fitur-fitur baru dan beberapa breaking changes. Lihat catatan rilis di GitHub untuk daftar lengkap perubahan.
Berikut adalah pembaruan terpenting.
Ditambahkan kompatibilitas dengan WordPress 6.6
Gato GraphQL 3.0 telah mengompilasi ulang semua bloknya, untuk membuatnya kompatibel dengan WordPress 6.6. (Untuk semua versi sebelumnya, blok akan menampilkan error JS.)
Ditambahkan field bulk mutation (untuk semua mutations dalam skema)
Gato GraphQL 3.0 menambahkan field "bulk" mutation untuk semua mutations dalam skema, memungkinkan kita untuk memutasi beberapa resource sekaligus.
Misalnya, mutation createPosts (mutation untuk resource tunggal adalah createPost) akan membuat beberapa post sekaligus:
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 membuka kemungkinan-kemungkinan baru dalam mengelola situs WordPress kita. Misalnya, query GraphQL berikut menggunakan createPosts (dan Multiple Query Execution, yang disediakan oleh Gato GraphQL PRO) untuk menduplikasi post:
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
}
}
}Daftar field bulk mutation yang ditambahkan adalah sebagai berikut:
Root.addCommentToCustomPostsRoot.createCustomPostsRoot.createMediaItemsRoot.createPagesRoot.createPostsRoot.removeFeaturedImageFromCustomPostsRoot.replyCommentsRoot.setCategoriesOnPostsRoot.setFeaturedImageOnCustomPostsRoot.setTagsOnPostsRoot.updateCustomPostsRoot.updatePagesRoot.updatePostsComment.replyWithCommentsCustomPost.addComments
Breaking change: Membutuhkan minimal WordPress v6.0
Untuk mendukung WordPress v6.6, blok-blok dalam plugin harus dikompilasi ulang dengan target WordPress v6.0+.
Oleh karena itu, mulai dari v3.0, Gato GraphQL membutuhkan minimal WordPress v6.0.
Breaking change: Blok schema configuration "Payload Types for Mutations" mungkin perlu dikonfigurasi ulang
Blok schema configuration "Payload Types for Mutations" telah ditambahkan nilai opsi baru: "Do not use payload types for mutations (i.e. return the mutated entity)". Karena alasan ini, struktur data internalnya telah berubah.
Jika Anda telah membuat schema configuration dengan opsi "Do not use payload types for mutations (i.e. return the mutated entity)" yang dipilih, setelah melakukan upgrade ke v3.0 nilai pilihan ini akan hilang. Anda perlu mengedit schema configuration tersebut, memilih opsi ini lagi, dan menyimpannya.