블로그

⭐️ WordPress 6.6 지원 및 벌크 mutation을 포함한 v3.0 출시

Leonardo Losoviz
작성자: Leonardo Losoviz ·

Gato GraphQL v3.0 이 출시되었습니다. 새로운 기능과 몇 가지 호환성을 깨는 변경 사항이 포함되어 있습니다. 변경 사항의 전체 목록은 GitHub의 릴리스 노트를 확인하세요.

아래에 가장 중요한 업데이트를 정리합니다.

WordPress 6.6과의 호환성 추가

Gato GraphQL 3.0 은 모든 블록을 재컴파일하여 WordPress 6.6과의 호환성을 확보했습니다. (이전 버전에서는 블록이 JS 오류를 발생시킵니다.)

벌크 mutation 필드 추가 (스키마의 모든 mutation에 대응)

Gato GraphQL 3.0 은 스키마의 모든 mutation에 대해 「벌크」 mutation 필드를 추가하여 여러 리소스를 한 번에 변경할 수 있게 합니다.

예를 들어, mutation createPosts(단일 리소스 mutation은 createPost)는 여러 게시물을 생성합니다:

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

벌크 mutation은 WordPress 사이트 관리의 가능성을 넓혀 줍니다. 예를 들어, 다음 GraphQL 쿼리는 createPosts(및 Gato GraphQL PRO가 제공하는 Multiple Query Execution)를 사용하여 게시물을 복제합니다:

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

추가된 벌크 mutation 필드의 목록은 다음과 같습니다:

  • 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

호환성을 깨는 변경: WordPress v6.0 이상 필수

WordPress v6.6 을 지원하기 위해 플러그인의 블록을 WordPress v6.0+ 를 대상으로 재컴파일해야 했습니다.

따라서 v3.0 이후부터 Gato GraphQL은 WordPress v6.0 이상을 필요로 합니다.

호환성을 깨는 변경: 스키마 설정 블록 「Payload Types for Mutations」의 재설정이 필요할 수 있음

스키마 설정 블록 「Payload Types for Mutations」에 새로운 옵션 값 「Do not use payload types for mutations (i.e. return the mutated entity)」가 추가되었습니다. 이로 인해 내부 데이터 구조가 변경되었습니다.

「Do not use payload types for mutations (i.e. return the mutated entity)」 옵션을 선택한 스키마 설정을 생성한 경우, v3.0 으로 업그레이드하면 해당 선택 값이 유실됩니다. 스키마 설정을 편집하여 이 옵션을 다시 선택하고 저장해야 합니다.


뉴스레터 구독하기

Gato GraphQL의 모든 업데이트를 놓치지 마세요.