Blog

⭐️ WordPress 6.6 desteği ve toplu mutations ile v3.0 yayınlandı

Leonardo Losoviz
Yazan: Leonardo Losoviz ·

Gato GraphQL v3.0 yeni özellikler ve birkaç breaking change içeren sürümüyle yayınlandı. Değişikliklerin tam listesi için GitHub'daki sürüm notlarına göz atın.

Aşağıda en önemli güncellemeler yer almaktadır.

WordPress 6.6 ile uyumluluk eklendi

Gato GraphQL 3.0, tüm bloklarını WordPress 6.6 ile uyumlu hale getirmek için yeniden derledi. (Önceki tüm sürümlerde bloklar JS hatası verecektir.)

Toplu mutation alanları eklendi (şemadaki tüm mutations için)

Gato GraphQL 3.0, şemadaki tüm mutations için "toplu" mutation alanları ekleyerek birden fazla kaynağı aynı anda değiştirmemizi sağlıyor.

Örneğin, createPosts mutation'ı (tek kaynak mutation'ı createPost) birden fazla gönderi oluşturacaktır:

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
    }
  }
}

Toplu mutations, WordPress sitemizi yönetmek için yeni olanaklar sunar. Örneğin, aşağıdaki GraphQL query'si gönderileri çoğaltmak amacıyla createPosts (ve Gato GraphQL PRO tarafından sağlanan Multiple Query Execution) kullanır:

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
    }
  }
}

Eklenen toplu mutation alanlarının listesi şu şekildedir:

  • Root.addCommentToCustomPosts
  • Root.createCustomPosts
  • Root.createMediaItems
  • Root.createPages
  • Root.createPosts
  • Root.removeFeaturedImageFromCustomPosts
  • Root.replyComments
  • Root.setCategoriesOnPosts
  • Root.setFeaturedImageOnCustomPosts
  • Root.setTagsOnPosts
  • Root.updateCustomPosts
  • Root.updatePages
  • Root.updatePosts
  • Comment.replyWithComments
  • CustomPost.addComments

Breaking change: En az WordPress v6.0 gereklidir

WordPress v6.6 desteği sağlamak için eklentideki blokların WordPress v6.0+ hedeflenerek yeniden derlenmesi gerekti.

Bu nedenle, v3.0 sürümünden itibaren Gato GraphQL en az WordPress v6.0 gerektirmektedir.

Breaking change: "Payload Types for Mutations" şema yapılandırma bloğunun yeniden yapılandırılması gerekebilir

"Payload Types for Mutations" şema yapılandırma bloğuna yeni bir seçenek değeri eklendi: "Do not use payload types for mutations (i.e. return the mutated entity)". Bu nedenle iç veri yapısı değişti.

"Do not use payload types for mutations (i.e. return the mutated entity)" seçeneği işaretlenmiş bir şema yapılandırması oluşturduysanız, v3.0 sürümüne yükselttikten sonra bu seçim değeri kaybolacaktır. Şema yapılandırmasını düzenleyip bu seçeneği tekrar seçmeniz ve kaydetmeniz gerekmektedir.


Bültenimize abone olun

Gato GraphQL'deki tüm güncellemelerden haberdar olun.