Skip to content

Commit

Permalink
chore: update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Jan 12, 2023
1 parent f76cf0b commit 561ab94
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 46 deletions.
24 changes: 13 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# Changelog

## Unreleased
- chore: update Composer dependencies.
- chore: switch `poolshark/wp-graphql-stubs` for `axepress/wp-graphql-stubs`
- chore: stub `FWP()` and FacetWP class properties.
- chore: change stubfile extensions to `.php`.
- dev: add explicit support for PHP 8.1.
- dev: use `camelCase` for FacetQueryArgs field names by default. Fields using `snake_case` have been deprecated and will be removed in a future version.
## v0.4.1
This _minor_ release introduces WPGraphQL-specific field properties to the Facet configuration array and adds the corresponding `get_graphql_allowed_facets()` access function. It also deprecates the usage `snake_case` autogenerated field names in the `FacetQueryArgs` input type in favor of `camelCase`, and adds explicit support for PHP 8.1.

- feat: add `show_in_graphql` and `graphql_field_name` to the Facet configuration.
- feat: add explicit PHP 8.1 support.
- feat: deprecate usage of `snake_case` field names in `FacetQueryArgs` input type, in favor of `camelCase`.
- dev: add `get_graphql_allowed_facets()` access function.
- dev: allow for (programmatically) overwriting GraphQL-specific field properties.
- dev: refactor facet input types to use the `graphql_type` config property generated by `FacetRegistry::get_facet_input_type()`.
- dev: add the following WordPress filters: `graphql_facetwp_facet_input_type`.
- tests: chang `FWPGraphQLTestCase.php::register_facet()` add facet instead of replace it.
- chore: update Composer dependencies.
- chore: replace `poolshark/wp-graphql-stubs` dev dependency with `axepress/wp-graphql-stubs`
- chore: stub `FWP()` function and `FacetWP` class properties.
- chore: change stubfile extensions to `.php`.
- tests: change `FWPGraphQLTestCase.php::register_facet()` to add a new facet instead of replace it.

## v.0.4.0
## v0.4.0
This _major_ release refactors the underlying PHP codebase, bringing with it support for the latest versions of WPGraphQL and FacetWP. Care has been taken to ensure there are _no breaking changes_ to the GraphQL schema.

- feat!: Refactor plugin PHP classes and codebase structure to follow ecosystem patterns.
- feat!: Bump minimum version of WPGraphQL to `v1.6.0`.
- feat!: Bump minimum version of WPGraphQL to `v1.6.1`.
- feat!: Bump minimum PHP version to `v7.4`.
- feat!: Bump minimum FacetWP version to `v4.0`.
- fix: Implement `WPVIP` PHP coding standards.
Expand Down
71 changes: 36 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This plugin has been tested and is functional with SearchWP.
* WordPress 5.4.1+
* WPGraphQL 1.6.0+ (1.9.0+ recommended)
* FacetWP 4.0

## Quick Install

1. Install & activate [WPGraphQL](https://www.wpgraphql.com/).
Expand Down Expand Up @@ -90,9 +91,9 @@ query GetPostsByFacet( $query: FacetQueryArgs, $after: String, $search: String,
}
posts ( # The results of the facet query. Can be filtered by WPGraphQL connection where args
first: 10,
after: $after,
where: { search: $search, orderby: $orderBy}
) {
after: $after,
where: { search: $search, orderby: $orderBy}
) {
pageInfo {
hasNextPage
endCursor
Expand All @@ -112,41 +113,41 @@ Support for WooCommerce Products can be added with following configuration:

```php
add_action( 'graphql_register_types', function () {
register_graphql_facet_type( 'product' );
register_graphql_facet_type( 'product' );
});

add_filter( 'facetwp_graphql_facet_connection_config',
function ( array $default_graphql_config, array $config ) {
$type = $config['type'];
$singular = $config['singular'];
$field = $config['field'];
$plural = $config['plural'];

return [
'fromType' => $field,
'toType' => $singular,
'fromFieldName' => lcfirst( $plural ),
'connectionArgs' => Products::get_connection_args(),
'resolveNode' => function ( $node, $_args, $context) use ( $type ) {
return $context->get_loader( $type )->load_deferred( $node->ID );
},
'resolve' => function ( $source, $args, $context, $info ) use ( $type ) {
$resolver = new PostObjectConnectionResolver( $source, $args, $context, $info, $type);

if ( $type === 'product' ) {
$resolver = Products::set_ordering_query_args( $resolver, $args );
}

if( ! empty( $source['results'] ) ) {
$resolver->->set_query_arg( 'post__in', $source['results'] );
}

return $resolver ->get_connection();
},
];
},
100,
2
function ( array $default_graphql_config, array $config ) {
$type = $config['type'];
$singular = $config['singular'];
$field = $config['field'];
$plural = $config['plural'];

return [
'fromType' => $field,
'toType' => $singular,
'fromFieldName' => lcfirst( $plural ),
'connectionArgs' => Products::get_connection_args(),
'resolveNode' => function ( $node, $_args, $context) use ( $type ) {
return $context->get_loader( $type )->load_deferred( $node->ID );
},
'resolve' => function ( $source, $args, $context, $info ) use ( $type ) {
$resolver = new PostObjectConnectionResolver( $source, $args, $context, $info, $type);

if ( $type === 'product' ) {
$resolver = Products::set_ordering_query_args( $resolver, $args );
}

if( ! empty( $source['results'] ) ) {
$resolver->->set_query_arg( 'post__in', $source['results'] );
}

return $resolver ->get_connection();
},
];
},
100,
2
);
```

Expand Down

0 comments on commit 561ab94

Please sign in to comment.