Skip to content

Commit 215fd10

Browse files
committed
stash progress
1 parent e808f00 commit 215fd10

13 files changed

+63
-20633
lines changed

src/CoreSchemaFilters.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ public static function filter_connection_query_args( array $query_args, Abstract
5959
$payload = FWP()->api->process_request( $fwp_args );
6060

6161
return [
62-
'post__in' => ! empty( $payload['results'] ) ? $payload['results'] : [ 'no_results' ], // We use 'no_results' as a special value to indicate that the facet has no results.
63-
'fields' => 'ids',
62+
'post__in' => ! empty( $payload['results'] ) ? $payload['results'] : [ 'no_results' ], // We use 'no_results' as a special value to indicate that the facet has no results.
63+
'fields' => 'ids',
64+
'__fwp_payload' => $payload,
6465
];
6566
}
6667

@@ -79,6 +80,10 @@ public static function filter_connection_query( $query, AbstractConnectionResolv
7980

8081
$query_args = $resolver->get_query_args();
8182

83+
/**
84+
* Store the payload on the query object so that it can be accessed in the connection.
85+
*/
86+
8287
// If FWP finds no results, return null.
8388
if ( isset( $query_args['post__in'] ) && 'no_results' === $query_args['post__in'][0] ) {
8489
$resolver->set_query_arg( 'post__in', [] );

src/Type/Input/FacetsInput.php

+31
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
namespace WPGraphQL\FacetWP\Type\Input;
1010

1111
use WPGraphQL;
12+
use WPGraphQL\AppContext;
13+
use WPGraphQL\FacetWP\Type\WPInterface\FacetConfig;
1214
use WPGraphQL\FacetWP\Vendor\AxeWP\GraphQL\Abstracts\InputType;
1315

1416
/**
@@ -41,9 +43,38 @@ public static function register(): void {
4143
'description' => __( 'Filter by FacetWP facets.', 'wpgraphql-facetwp' ),
4244
],
4345
);
46+
47+
self::register_edge_field( $post_type_obj );
4448
}
4549
}
4650

51+
/**
52+
* Register the edge field for the connection.
53+
*
54+
* @param \WP_Post_Type $post_type_obj The post type object.
55+
*/
56+
public static function register_edge_field( \WP_Post_Type $post_type_obj ): void {
57+
register_graphql_edge_field(
58+
'RootQuery',
59+
$post_type_obj->graphql_single_name,
60+
'activeFacets',
61+
[
62+
'type' => [ 'list_of' => FacetConfig::get_type_name() ],
63+
'description' => __( 'The active facets on this connection', 'wpgraphql-facetwp' ),
64+
'resolve' => static function ( $source, array $args, AppContext $context ) {
65+
$keys = array_keys( (array) $source );
66+
foreach ( $keys as $key ) {
67+
error_log( $key . ': ' . gettype( $source[ $key ] ) );
68+
}
69+
error_log( $source['node']::class );
70+
error_log( $source['connection']::class );
71+
error_log( print_r( $source['node'], true ) );
72+
return [];
73+
},
74+
]
75+
);
76+
}
77+
4778
/**
4879
* {@inheritDoc}
4980
*/

tests/wpunit/AccessFunctionsTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public function setUp(): void {
1818
$settings = get_option( 'graphql_general_settings' );
1919
$settings['public_introspection_enabled'] = 'on';
2020
update_option( 'graphql_general_settings', $settings );
21-
22-
$this->clearFacets();
2321
}
2422

2523
/**
@@ -28,8 +26,6 @@ public function setUp(): void {
2826
public function tearDown(): void {
2927
delete_option( 'graphql_general_settings' );
3028

31-
$this->clearFacets();
32-
3329
parent::tearDown();
3430
}
3531

tests/wpunit/CheckboxFacetTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ public function getQuery() : string {
140140
return '
141141
query GetPostsByFacet( $where: RootQueryToPostConnectionWhereArgs ) {
142142
posts( where: $where ) {
143+
edges {
144+
activeFacets{
145+
type
146+
name
147+
}
148+
}
143149
nodes {
144150
databaseId
145151
title

vendor/autoload.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222

2323
require_once __DIR__ . '/composer/autoload_real.php';
2424

25-
return ComposerAutoloaderInita808aacd30a48beb897daf0a9480d602::getLoader();
25+
return ComposerAutoloaderInit66fb134fc8ebefe7caa9380cdecf7bb2::getLoader();

vendor/composer/autoload_classmap.php

-3,643
Large diffs are not rendered by default.

vendor/composer/autoload_files.php

-50
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,5 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9-
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
10-
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
11-
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
12-
'3937806105cc8e221b8fa8db5b70d2f2' => $vendorDir . '/wp-cli/mustangostang-spyc/includes/functions.php',
13-
'be01b9b16925dcb22165c40b46681ac6' => $vendorDir . '/wp-cli/php-cli-tools/lib/cli/cli.php',
14-
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
15-
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
16-
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
17-
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
18-
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
19-
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
20-
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
21-
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
22-
'e3b2795a8a512b6083af088fb53afe6c' => $vendorDir . '/codeception/codeception/functions.php',
23-
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
24-
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
25-
'60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
26-
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
27-
'72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',
28-
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
29-
'23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
30-
'ac949ce40a981819ba132473518a9a31' => $vendorDir . '/wp-cli/wp-config-transformer/src/WPConfigTransformer.php',
31-
'2a3c2110e8e0295330dc3d11a4cbc4cb' => $vendorDir . '/php-webdriver/webdriver/lib/Exception/TimeoutException.php',
32-
'8a0ad02df6a5087f2c380f8fd52db273' => $vendorDir . '/wp-cli/cache-command/cache-command.php',
33-
'b66d29757fcb2fb7a9608d068e3716b0' => $vendorDir . '/wp-cli/checksum-command/checksum-command.php',
34-
'5deaf6ce9c8bbdfb65104c7e938d5875' => $vendorDir . '/wp-cli/config-command/config-command.php',
35-
'68c39b88215b6cf7a0da164166670ef9' => $vendorDir . '/wp-cli/core-command/core-command.php',
36-
'7654e00bf0e632580764400bd8293a9c' => $vendorDir . '/wp-cli/cron-command/cron-command.php',
37-
'c65f753375faee349b7adc48c2ee7cc2' => $vendorDir . '/wp-cli/db-command/db-command.php',
38-
'021d3a13471556f0b57038d679f7f8ea' => $vendorDir . '/wp-cli/embed-command/embed-command.php',
39-
'f3f0199a3ecd9f501d0a3b361bd2f61c' => $vendorDir . '/wp-cli/entity-command/entity-command.php',
40-
'f958dca3f412fd7975da1700912a9321' => $vendorDir . '/wp-cli/eval-command/eval-command.php',
41-
'5c6ec5cff8f9d625772c8ed147f6b894' => $vendorDir . '/wp-cli/export-command/export-command.php',
42-
'3f201033d5aceb2293314273be88f7c6' => $vendorDir . '/wp-cli/extension-command/extension-command.php',
43-
'ffb465a494c3101218c4417180c2c9a2' => $vendorDir . '/wp-cli/i18n-command/i18n-command.php',
44-
'30cbb6e4122dc988e494c6b9c0438233' => $vendorDir . '/wp-cli/import-command/import-command.php',
45-
'ace0d205db7f4135ec32132a0076d555' => $vendorDir . '/wp-cli/language-command/language-command.php',
46-
'1c88c1eff05217a8cac80c64c9ac2080' => $vendorDir . '/wp-cli/maintenance-mode-command/maintenance-mode-command.php',
47-
'5e099d3cac677dd2bec1003ea7707745' => $vendorDir . '/wp-cli/media-command/media-command.php',
48-
'ba366f96f4fddbdef61ad7a862b44f61' => $vendorDir . '/wp-cli/package-command/package-command.php',
49-
'f399c1c8d0c787d5c94c09884cdd9762' => $vendorDir . '/wp-cli/rewrite-command/rewrite-command.php',
50-
'080fadd667195d055c5a23386f270261' => $vendorDir . '/wp-cli/role-command/role-command.php',
51-
'd979c11fe80ba96ae3037b43429fe546' => $vendorDir . '/wp-cli/scaffold-command/scaffold-command.php',
52-
'8ecb13f8bbc22b1b34d12b14ec01077a' => $vendorDir . '/wp-cli/search-replace-command/search-replace-command.php',
53-
'9f04dd0aa5d67ec75a75c88c345a079e' => $vendorDir . '/wp-cli/server-command/server-command.php',
54-
'129d58fa8151374aceb8571bcaa97504' => $vendorDir . '/wp-cli/shell-command/shell-command.php',
55-
'8519779bbb65eeb842af2f629ce7b6f8' => $vendorDir . '/wp-cli/super-admin-command/super-admin-command.php',
56-
'1f05372afcc7d0c51a305cef1d56dd01' => $vendorDir . '/wp-cli/widget-command/widget-command.php',
57-
'41ac945ee97c4f5461ef1c0ccb568262' => $vendorDir . '/lucatume/wp-browser/src/tad/WPBrowser/utils.php',
58-
'a708c649c455d50aa08b5043a5737509' => $vendorDir . '/lucatume/wp-browser/src/tad/WPBrowser/wp-polyfills.php',
599
'2624831776b6fbc9c15e25c2fb7f42d3' => $baseDir . '/access-functions.php',
6010
);

vendor/composer/autoload_namespaces.php

-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9-
'cli' => array($vendorDir . '/wp-cli/php-cli-tools/lib'),
10-
'WP_CLI\\' => array($vendorDir . '/wp-cli/wp-cli/php'),
11-
'Oxymel' => array($vendorDir . '/nb/oxymel'),
12-
'Mustache' => array($vendorDir . '/mustache/mustache/src'),
13-
'Hautelook' => array($vendorDir . '/bordoni/phpass/src'),
14-
'Behat\\Gherkin' => array($vendorDir . '/behat/gherkin/src'),
159
);

vendor/composer/autoload_psr4.php

-80
Original file line numberDiff line numberDiff line change
@@ -6,86 +6,6 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9-
'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'),
10-
'tad\\' => array($vendorDir . '/lucatume/wp-browser/src/tad'),
11-
'mikehaertl\\shellcommand\\' => array($vendorDir . '/mikehaertl/php-shellcommand/src'),
12-
'lucatume\\WPBrowser\\' => array($vendorDir . '/lucatume/wp-browser/src'),
13-
'eftec\\bladeone\\' => array($vendorDir . '/eftec/bladeone/lib'),
14-
'WP_CLI\\MaintenanceMode\\' => array($vendorDir . '/wp-cli/maintenance-mode-command/src'),
15-
'WP_CLI\\I18n\\' => array($vendorDir . '/wp-cli/i18n-command/src'),
16-
'WP_CLI\\Embeds\\' => array($vendorDir . '/wp-cli/embed-command/src'),
179
'WPGraphQL\\FacetWP\\' => array($baseDir . '/src'),
18-
'VariableAnalysis\\' => array($vendorDir . '/sirbrillig/phpcs-variable-analysis/VariableAnalysis'),
19-
'VRia\\Utils\\' => array($vendorDir . '/vria/nodiacritic/src'),
20-
'Tests\\WPGraphQL\\FacetWP\\' => array($baseDir . '/tests/_support'),
21-
'Tests\\WPGraphQL\\' => array($vendorDir . '/wp-graphql/wp-graphql-testcase/src'),
22-
'SzepeViktor\\PHPStan\\WordPress\\' => array($vendorDir . '/szepeviktor/phpstan-wordpress/src'),
23-
'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'),
24-
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
25-
'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
26-
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
27-
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
28-
'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
29-
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
30-
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
31-
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
32-
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
33-
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
34-
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
35-
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
36-
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
37-
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
38-
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
39-
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
40-
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
41-
'Symfony\\Component\\DomCrawler\\' => array($vendorDir . '/symfony/dom-crawler'),
42-
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
43-
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
44-
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
45-
'Symfony\\Component\\BrowserKit\\' => array($vendorDir . '/symfony/browser-kit'),
46-
'SlevomatCodingStandard\\' => array($vendorDir . '/slevomat/coding-standard/SlevomatCodingStandard'),
47-
'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
48-
'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
49-
'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
50-
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
51-
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
52-
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
53-
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
54-
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
55-
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
56-
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
57-
'PhpCoveralls\\' => array($vendorDir . '/php-coveralls/php-coveralls/src'),
58-
'Peast\\test\\' => array($vendorDir . '/mck89/peast/test/Peast'),
59-
'Peast\\' => array($vendorDir . '/mck89/peast/lib/Peast'),
60-
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
61-
'PHPStan\\ExtensionInstaller\\' => array($vendorDir . '/phpstan/extension-installer/src'),
62-
'Mustangostang\\' => array($vendorDir . '/wp-cli/mustangostang-spyc/src'),
63-
'MikeMcLin\\WpPassword\\' => array($vendorDir . '/mikemclin/laravel-wp-password/src'),
64-
'LightnCandy\\' => array($vendorDir . '/zordius/lightncandy/src'),
65-
'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
66-
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/support'),
67-
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
68-
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
69-
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
70-
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
71-
'Gettext\\Languages\\' => array($vendorDir . '/gettext/languages/src'),
72-
'Gettext\\' => array($vendorDir . '/gettext/gettext/src'),
73-
'Flow\\JSONPath\\' => array($vendorDir . '/softcreatr/jsonpath/src'),
74-
'Facebook\\WebDriver\\' => array($vendorDir . '/php-webdriver/webdriver/lib'),
75-
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
76-
'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'),
77-
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
78-
'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
79-
'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
80-
'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
81-
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
82-
'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
83-
'Composer\\MetadataMinifier\\' => array($vendorDir . '/composer/metadata-minifier/src'),
84-
'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
85-
'Composer\\' => array($vendorDir . '/composer/composer/src/Composer'),
86-
'Codeception\\PHPUnit\\' => array($vendorDir . '/codeception/phpunit-wrapper/src'),
87-
'Codeception\\Extension\\' => array($vendorDir . '/codeception/codeception/ext'),
88-
'Codeception\\' => array($vendorDir . '/codeception/codeception/src/Codeception', $vendorDir . '/codeception/stub/src', $vendorDir . '/lucatume/wp-browser/src/Codeception'),
89-
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
9010
'AxeWP\\GraphQL\\' => array($vendorDir . '/axepress/wp-graphql-plugin-boilerplate/src'),
9111
);

vendor/composer/autoload_real.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInita808aacd30a48beb897daf0a9480d602
5+
class ComposerAutoloaderInit66fb134fc8ebefe7caa9380cdecf7bb2
66
{
77
private static $loader;
88

@@ -24,16 +24,16 @@ public static function getLoader()
2424

2525
require __DIR__ . '/platform_check.php';
2626

27-
spl_autoload_register(array('ComposerAutoloaderInita808aacd30a48beb897daf0a9480d602', 'loadClassLoader'), true, true);
27+
spl_autoload_register(array('ComposerAutoloaderInit66fb134fc8ebefe7caa9380cdecf7bb2', 'loadClassLoader'), true, true);
2828
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29-
spl_autoload_unregister(array('ComposerAutoloaderInita808aacd30a48beb897daf0a9480d602', 'loadClassLoader'));
29+
spl_autoload_unregister(array('ComposerAutoloaderInit66fb134fc8ebefe7caa9380cdecf7bb2', 'loadClassLoader'));
3030

3131
require __DIR__ . '/autoload_static.php';
32-
call_user_func(\Composer\Autoload\ComposerStaticInita808aacd30a48beb897daf0a9480d602::getInitializer($loader));
32+
call_user_func(\Composer\Autoload\ComposerStaticInit66fb134fc8ebefe7caa9380cdecf7bb2::getInitializer($loader));
3333

3434
$loader->register(true);
3535

36-
$filesToLoad = \Composer\Autoload\ComposerStaticInita808aacd30a48beb897daf0a9480d602::$files;
36+
$filesToLoad = \Composer\Autoload\ComposerStaticInit66fb134fc8ebefe7caa9380cdecf7bb2::$files;
3737
$requireFile = static function ($fileIdentifier, $file) {
3838
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
3939
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

0 commit comments

Comments
 (0)