wp-graphql

GraphQL API for WordPress

GPL-3.0 License

Downloads
304.7K
Stars
3.6K
Committers
154

Bot releases are hidden (Show)

wp-graphql - v0.0.23

Published by jasonbahl almost 7 years ago

Release notes:

Debug Mode

  • You can now add define( 'GRAPHQL_DEBUG', true ); in your wp-config.php to enable more friendly debug errors to be returned in GraphiQL. Many errors that are returned as Internal Server Error by default show more helpful errors with GRAPHQL_DEBUG enabled.

Options Mutations

  • added support for mutating options that have been added to WordPress via the register_setting API

Docs Changes

Testing Updates

  • moved from basic PHPUnit to Codeception (which is still based on PHPUnit, but has some nice features we can take advantage of)
  • updated .coveralls.yml to reflect coverage changes for codeception
  • update Unit Test docs in the main README.md to reflect how to use Codeception
  • updated bin/install-wp-tests.sh to setup a working environment for Codeception
  • added codeception.yml

Router changes

  • Set the default HTTP Status to 200 instead of 403 (403 should only be set for requests that are trying to authenticate, but the authentication is invalid)
  • Make response headers filterable so plugins like WPGraphQL JWT Auth can add custom headers to the response

Misc changes

  • updated .gitignore
  • updated travis.yml
  • update to CONTRIBUTING.md
  • updated version in composer.json
  • Removed unused Type 'CommentAuthorQuery`
  • fixed bug with mediaItem captions
  • added MENU_ORDER as an orderby arg for PostObjectConnection queries
  • added TERM_ORDER as an orderby arg for TermObjectConnection queries
  • Fixed some bugs with various union fields
  • Fixed bug with user nicename queries (thanks @ginatrapani)
wp-graphql - v0.0.22

Published by jasonbahl almost 7 years ago

Bug Fixes

  • Fixes an issue that was causing conflicts with Custom Post Types that have been registered as 'show_in_rest' => 'true'.
  • Fixes missing Capitalized types that were overlooked in the previous release
wp-graphql - v0.0.21

Published by jasonbahl almost 7 years ago

This is probably the biggest release yet!

Lots of good stuff here.

New Features

  • Update GraphQL-PHP
    • v0.9.14 to v0.11.2
    • Replace existing Exceptions with UserError
  • Introduce CLI Scripts
    • One script is available now to generate a static Schema in the IDL format
    • wp graphql generate-static-schema will output a schema.graphql file to the root of the plugin.
    • @todo: more options for different formats (.json, etc), and options for where to output.
  • Add initial support for Options registered via register_setting()
  • Initial implementation of DataLoader (only for Users now, but coming soon to other Types)
  • Introduce new resolver hooks
    • do_action( 'graphql_before_resolve_field' )
    • do_action( 'graphql_after_resolve_field' )
    • apply_filters( 'graphql_resolve_field' ) to allow granular control over how fields resolve.
  • Introduce per-field control over Auth via schema definitions:
    • ex: mark a field 'isPrivate' => true in the Schema to ensure it only resolves to Authenticated users. Additional 'auth' => [] options for more powerful authorization control over the resolvers.

Breaking Changes

  • Error formatting is a bit different.
    • If you were consuming/logging errors, you may need to adjust your consuming code.
    • If you have custom code throwing Exceptions, you may consider throwing UserError instead, as Exceptions will now be returned publicly as "Internal Server Error" as to not expose sensitive server data.
  • Types are all uppercase now.
    • Before we had things like rootQuery and post as a type, now it's RootQuery and Post
    • This might break any queries that were making use of the __typename field, or any fragments or union queries that make use of the ...on Post { } . . .
    • if a query referenced a Type before, it just needs to be capitalized now, like ...on post will now be ...on Post, etc.
  • Comment author field is now a union, instead of returning a User, as it can be a User or a CommentAuthor
{ 
  comment( id:"..." ) { 
    id
    title
    author { 
    ...on CommentAuthor { 
      name 
      } 
      ...on User { 
        name 
      } 
    } 
  }
}

Bug Fixes / Misc. Tweaks

  • replace use of sprintf() with $wpdb->prepare in a few spots
  • formatting of Enum fields
wp-graphql - v0.0.19

Published by jasonbahl about 7 years ago

New Features

Added nodes to connections

Sometimes it makes sense to query for nodes without their edges. Now you can!

All connections that are part of the plugin now have the ability to query the connections edges OR nodes.

For example, you can now get a list of posts like so:

{
  posts {
    pageInfo {
      startCursor
      endCursor
    }
    nodes {
      id
      title
      date
      link
    }
  }
}

Added a "format" arg to some fields

There is now a format Enum arg on the content, title and excerpt fields for postObjects. This enum has 2 values by default, RENDERED and RAW where the default is RENDERED.

This field is intended to be used in conjunction with the App Context that gets passed down the GraphQL Resolve Tree to be able to provide output that matches the context.

RAW is intended to be the raw, unaltered value as stored in the data store. Rendered is intended to be how the data should render in the context it's being requested.

Since there are different render contexts (web, print, mobile, AMP, Facebook Instant Articles, etc), the value that is returned can be changed based on the context. Currently, nothing is changed by the plugin itself based on different contexts, but this opens up the door for folks to be able to provide different content for different contexts, OR provide raw data values as well.

Note: pagination will still work as there is still access to the startCursor and endCursor.

Misc Updates

  • Updated README.md with more info about unit testing and code coverage reporting
  • Updated mediaItem test coverage
  • Sets the global $post when resolving a post and resets it at the end of the GraphQL execution
wp-graphql - v0.0.18

Published by jasonbahl about 7 years ago

New Features

Get single postObjects by Global ID, DB ID and URI

  • This adds a new "uri" field to the objects to be queried for.
  • This adds new RootQuery fields to get posts by URI, {post}Id, or global "id".
  • Ex: the following would return the same post object 3 times:
{
  postById: postBy(id:"cG9zdDoxMDAw") {
    ...postData
  }
  postByPostId: postBy(postId:1000) {
    ...postData
  }
  postByURI: postBy(uri:"hello-world") {
    ...postData
  }
}

fragment postData on post {
  id
  postId
  uri
}

User Mutations

  • CRUD user mutations are introduced (respects authentication/authorization):
mutation createUser {
  createUser( input: {
    clientMutationId: "someId"
    username: "username"
    email: "[email protected]"
  }) {
    user { 
      firstName
      lastName
    }
  }
}

403 Default Header Status
The default header status for responses will be 403. For authenticated requests, the status will be 200. The execution will remain the same, where authorization will occur at the resolve level, but the status change will allow clients to invalidate current users, etc when a request comes back as unauthenticated without getting a full error for the entire request.

Misc Updates

  • Updates graphql-php from 0.9.8 to 0.9.14
  • Fixes a bug with the plugins/themes for connections
  • Fixes some default $args for post connection queries
  • Add a child{Type} to hierarchical postTypeObjects
  • Updates last_name field on user type to lastName (breaking change)

Unit Test Changes

  • Updates to Travis scripts for automated unit testing
  • Updates to phpunit.xml.dist to exclude groups by default
  • Adds some AJAX tests

Documentation

  • Adds readme.txt
  • Adds an initial CONTRIBUTING.md file
  • Updates to the README.md (moving some stuff to the Wiki)
wp-graphql - v0.0.17

Published by jasonbahl about 7 years ago

This is a pretty big update!

Breaking Changes

  • cursor pagination updates for posts/terms/comments.
    • for forward pagination, now use first/after and backward use last/before. Previously things were flipped and a bit buggy. Things are more accurate and stable now.
  • removed related taxonomy/postType fields that were improperly added to the postTypeType and taxonomyType
  • removed taxonomy arg from the TermObjectConnectionArgs
  • moved "ancestors" to only exist on TermObjects for hierarchical taxonomies

Other Changes

  • Adds mediaItem mutations
    • createMediaItem, updateMediaItem and deleteMediaItem are now mutations! Shout out to @hughdevore for this!!
  • update GraphQL-PHP to v0.9.13
  • Misc Readme changes
  • Added apigen.yml for generating code docs (https://wp-graphql.github.io/wp-graphql-api-docs/)
  • updated composer.lock and the composer autoload files
  • move execution of the GraphQL http requests earlier to avoid the unnecessary execution of the "main query"
  • add GET support (although it's a bit funky with some GraphiQL clients still)
  • Fixes comment orderby args
  • Fixes comment parent issue
  • Added TermObjectUnionType
  • Added heaps of unit tests
wp-graphql - v0.0.16

Published by jasonbahl over 7 years ago

  • Adds $_GET support
  • Adds ancestors to postObjects and termObjects

Ancestors of hierarchical taxonomy terms can only be of the same taxonomy, so they can be queried like so:

cateogory( id:"..." ) {
   id
   title
   ancestors {
      id
      name
   }
}

Since postObjects can have ancestors of any postType and that cannot be known until query time, the ancestors are unions and can be queried like so:

page( id:"..." ) {
   ancestors{
       ...on page {
           id
           title
           link
      }
      ...on otherPostType {
          id
          title
          link
      }
   }
}
wp-graphql - v0.0.15

Published by jasonbahl over 7 years ago

Adds initial mutations for terms.

For example:

Create a Category:

mutation createCategory( $clientMutationId:String!, $name:String!, $description:String ) {
  createCategory(
    input: {
      clientMutationId: $clientMutationId
      name: $name
      description: $description
    }
  ) {
    clientMutationId
    category {
      id
      name
      description
    }
  }
}

Update a Category:

mutation updateCategory( $clientMutationId:String!, $id:ID! $description:String ) {
  updateCategory(
    input: {
      clientMutationId: $clientMutationId
      description: $description
      id: $id
    }
  ) {
    clientMutationId
    category {
      id
      name
      description
    }
  }
}

Delete a Category:

mutation deleteCategory( $clientMutationId:String!, $id:ID! ) {
  deleteCategory(
    input: {
      id: $id
      clientMutationId: $clientMutationId
    }
  ) {
    clientMutationId
    category {
      id
      name
    }
  }
}
wp-graphql - v0.0.14

Published by jasonbahl over 7 years ago

Updates translation strings and enforces late escaping on the schema

wp-graphql - v0.0.13

Published by jasonbahl over 7 years ago

This includes a breaking change. Instead of using postTag and postTags for the Schema for the "post_tags" taxonomy, we now use tag and tags

If you're already invested in consuming the GraphQL API using the postTag names, you can add them back like so:

add_action( 'graphql_generate_schema', function() {

	global $wp_taxonomies;

	if ( isset( $wp_taxonomies['post_tag'] ) ) {
		$wp_taxonomies['post_tag']->graphql_single_name = 'postTag';
		$wp_taxonomies['post_tag']->graphql_plural_name = 'postTags';
	}

} );
wp-graphql - v0.0.12

Published by jasonbahl over 7 years ago

wp-graphql - v0.0.11

Published by jasonbahl over 7 years ago

Version number bump

wp-graphql - v0.0.10

Published by jasonbahl over 7 years ago

Fixes issue with Relay files being ignored, and not versioned, in the vendor file.

This will likely change in the future, where we won't version the vendor files directly in this repo, but instead have a build that installs them and creates a downloadable .zip file with the vendor files included. . .but for now, for folks that want to use the plugin and want to download a .zip from github, this is the quickest resolution for that.

wp-graphql - v0.0.9

Published by jasonbahl over 7 years ago

wp-graphql - v0.0.8

Published by jasonbahl over 7 years ago

wp-graphql - v0.0.7

Published by jasonbahl over 7 years ago

wp-graphql - v0.0.6

Published by jasonbahl over 7 years ago

wp-graphql - v0.0.3

Published by jasonbahl almost 8 years ago

Package Rankings
Top 0.97% on Packagist.org
Top 6.68% on Proxy.golang.org
Badges
Extracted from project README
Total Downloads Monthly Downloads Daily Downloads Latest Stable Version License Actions Status Actions Status Coverage Status Backers on Open Collective Sponsors on Open Collective
Related Projects