Skip to content

Commit

Permalink
Merge branch '7.3.x' of github.com:thunder/thunder-distribution into …
Browse files Browse the repository at this point in the history
…update-gin
  • Loading branch information
ol0lll committed Aug 29, 2024
2 parents 2a943b2 + f6902ba commit eb9530f
Show file tree
Hide file tree
Showing 24 changed files with 1,017 additions and 101 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

build:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
mysql:
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
test-max:
needs: build

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
mysql:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:

test-upgrade:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
mysql:
Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:

test-min:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
mysql:
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [7.3.3](https://github.com/thunder/thunder-distribution/tree/7.3.3) 2024-08-22

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.2...7.3.3)

Add search api GraphQl schema and data producer.

## [7.3.2](https://github.com/thunder/thunder-distribution/tree/7.3.2) 2024-08-14

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.1...7.3.2)

* [Issue #3462165: Add focal_point patch](https://www.drupal.org/node/3462165)

## [7.3.1](https://github.com/thunder/thunder-distribution/tree/7.3.1) 2024-06-024

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.0...7.3.1)

Add patches for upstream issues.

* [Issue #3465364: Fatal error when changing password when password_policy_history is enabled](https://www.drupal.org/project/password_policy/issues/3465364)
* [Issue #3455558: There is no visible change to a toggle when pressed (but it does trigger conditional fields, value is saved, etc)](https://www.drupal.org/project/gin/issues/3455558)

## [7.3.0](https://github.com/thunder/thunder-distribution/tree/7.1.0) 2024-06-024

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.2.2...7.3.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ For general help using Thunder, please refer to [the official Thunder documentat

### Community support

For additional help, you can use one of this channel to ask question:
For additional help, you can use one of these channels to ask question:

* [Slack](https://thunder.org/contact-us) (highly recommended for faster support)
* [Twitter](https://twitter.com/ThunderCoreTeam)
Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
},
"drupal/diff": {
"Back button for comparison page": "https://www.drupal.org/files/issues/back_button_for-2853193-4.patch"
},
"drupal/focal_point": {
"Issue #3462165: Preview results in Error: Call to a member function getDefinitions() on null": "https://www.drupal.org/files/issues/2024-07-18/Preview-results-in-Error-3462165.patch"
},
"drupal/gin": {
"Issue #3455558: There is no visible change to a toggle when pressed (but it does trigger conditional fields, value is saved, etc)": "https://www.drupal.org/files/issues/2024-08-06/3455558-Refactor-toggle-styles-mr438.patch"
}
}
},
Expand All @@ -61,10 +67,10 @@
"drupal/diff": "1.7",
"drupal/dropzonejs": "^2.8",
"drupal/empty_fields": "^1.0-alpha1",
"drupal/entity_reference_actions": "^1.1",
"drupal/entity_reference_actions": "^1.1.1",
"drupal/entity_reference_revisions": "^1.3",
"drupal/field_group": "^3.4",
"drupal/focal_point": "^2.1",
"drupal/focal_point": "2.1.1",
"drupal/facets": "^2.0.6",
"drupal/gin": "3.0-rc13",
"drupal/gin_toolbar": "^1.0-rc6",
Expand All @@ -78,14 +84,14 @@
"drupal/media_entity_slideshow": "^2.0-alpha1",
"drupal/media_entity_twitter": "^2.5",
"drupal/media_expire": "^2.6",
"drupal/media_library_media_modify": "^1.0.0-beta16",
"drupal/media_library_media_modify": "^1.0.0",
"drupal/media_file_delete": "^1.2",
"drupal/metatag": "^1.26",
"drupal/metatag_async_widget": "^1.0-alpha2",
"drupal/paragraphs": "^1.12",
"drupal/paragraphs_features": "^2.0.0-beta3",
"drupal/paragraphs_paste": "^2.0-beta3",
"drupal/password_policy": "^4.0",
"drupal/password_policy": "^4.0.3",
"drupal/pathauto": "^1.11",
"drupal/responsive_preview": "^2.1",
"drupal/redirect": "^1.7",
Expand Down
1 change: 0 additions & 1 deletion modules/thunder_gqls/graphql/thunder_menu.base.graphqls
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
type Menu {
id: String!
name: String!

items: [MenuItem]
}

Expand Down
4 changes: 4 additions & 0 deletions modules/thunder_gqls/graphql/thunder_search_api.base.graphqls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type SearchApiResult {
items: [Page!]
total: Int!
}
Empty file.
101 changes: 101 additions & 0 deletions modules/thunder_gqls/src/GraphQL/Buffers/SearchApiResultBuffer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php

namespace Drupal\thunder_gqls\GraphQL\Buffers;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
use Drupal\graphql\GraphQL\Buffers\BufferBase;

/**
* GraphQL Buffer for SearchApi Results.
*/
class SearchApiResultBuffer extends BufferBase {

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;

/**
* EntityBuffer constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager service.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
}

/**
* Add an item to the buffer.
*
* @param string|int|null $index
* The entity type of the given entity ids.
* @param array|int $id
* The entity id(s) to load.
*
* @return \Closure
* The callback to invoke to load the result for this buffer item.
*/
public function add($index, $id) {
$item = new \ArrayObject([
'index' => $index,
'id' => $id,
]);

return $this->createBufferResolver($item);
}

/**
* {@inheritdoc}
*/
protected function getBufferId($item) {
return $item['index'];
}

/**
* {@inheritdoc}
*/
public function resolveBufferArray(array $buffer) {
$index = reset($buffer)['index'];
$ids = array_map(function (\ArrayObject $item) {
return (array) $item['id'];
}, $buffer);

$ids = call_user_func_array('array_merge', $ids);
$ids = array_values(array_unique($ids));

// Load the buffered entities.
/** @var \Drupal\search_api\IndexInterface $index */
$index = $this->entityTypeManager
->getStorage('search_api_index')
->load($index);

$resultSet = $index->loadItemsMultiple($ids);
$entities = [];

foreach ($resultSet as $key => $resultItem) {
if ($resultItem instanceof EntityAdapter) {
$entities[$key] = $resultItem->getEntity();
}
}

return array_map(function ($item) use ($entities) {
if (is_array($item['id'])) {
return array_reduce($item['id'], static function ($carry, $current) use ($entities) {
if (!empty($entities[$current])) {
$carry[] = $entities[$current];
return $carry;
}

return $carry;
}, []);
}

return $entities[$item['id']] ?? NULL;
}, $buffer);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Drupal\graphql\GraphQL\Execution\FieldContext;
use Drupal\taxonomy\TermInterface;
use Drupal\thunder_gqls\Wrappers\EntityListResponse;
use Drupal\thunder_gqls\Wrappers\EntityListResponseInterface;

/**
Expand Down Expand Up @@ -119,7 +118,7 @@ public function resolve(TermInterface $term, string $type, array $bundles, strin
$cacheContext
);

return new EntityListResponse($query);
return $this->entityListResponse($query);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Drupal\thunder_gqls\Plugin\GraphQL\DataProducer;

use Drupal\graphql\GraphQL\Execution\FieldContext;
use Drupal\thunder_gqls\Wrappers\EntityListResponse;
use Drupal\thunder_gqls\Wrappers\EntityListResponseInterface;

/**
Expand Down Expand Up @@ -97,7 +96,7 @@ protected function resolve(string $type, array $bundles, int $offset, int $limit
$cacheContext
);

return new EntityListResponse($query);
return $this->entityListResponse($query);
}

}
Loading

0 comments on commit eb9530f

Please sign in to comment.