Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0c5f3dc
FEATURE: Replace t3n/graphql dependency with custom implementation
Sebobo Jan 14, 2025
0d53fb7
TASK: Fix various type issues in queries
Sebobo Jan 23, 2025
bd85a10
BUGFIX: Similar assets module was missing theme variables
Sebobo Jan 23, 2025
2e90a0c
TASK: Enable similar assets query with new api
Sebobo Jan 23, 2025
c9a67f1
TASK: Add missing typename to fixtures
Sebobo Jan 23, 2025
9482807
TASK: Make assetVariants query work in new api
Sebobo Jan 23, 2025
05371ae
BUGFIX: Error when parsing changed assets
Sebobo Jan 23, 2025
e8949c1
TASK: Implement updateAsset in new api
Sebobo Jan 23, 2025
77df58c
FEATURE: Implement domain mutations in new GrahpQL adapter
Sebobo Feb 13, 2025
9d0d87e
TASK: Bump required node version for building frontend assets
Sebobo Mar 31, 2025
01bd99e
FEATURE: Introduce retry handler to better handle graphql and network…
Sebobo Mar 31, 2025
f56f1b7
TASK: Fix wwision types package versions
Sebobo Mar 31, 2025
f35f4b9
BUGFIX: Only poll for changes if feature flag is enabled
Sebobo Apr 24, 2025
7cadb2c
TASK: Make upload asset work with new graphql adapter
Sebobo Apr 1, 2025
6499745
TASK: Make replace asset work with new graphql adapter
Sebobo May 14, 2025
1d09889
TASK: Update wwwision types dependencies
Sebobo May 21, 2025
ec300c2
TASK: Code cleanup
Sebobo May 21, 2025
a067c50
TASK: Generate new graphql schema based on PHP types
Sebobo May 21, 2025
e53cfbc
TASK: Move package to root folder
Sebobo May 21, 2025
c7536e4
Merge branch 'main' into feature/custom-graphql-adapter
Sebobo May 21, 2025
a8e547a
TASK: Update yarn to latest
Sebobo May 21, 2025
1de4548
BUGFIX: Solve phpstan issues
Sebobo May 21, 2025
b959178
TASK: Update github action images
Sebobo May 21, 2025
d069f88
TASK: Remove commented code
Sebobo May 22, 2025
10358f2
TASK: Set desired phpstan version for CI
Sebobo May 22, 2025
79a03e2
TASK: Prevent lockfile changes in CI
Sebobo May 22, 2025
dee7661
TASK: Solve linting issues
Sebobo May 22, 2025
e8e9481
BUGFIX: Asset collection mutations
Sebobo May 22, 2025
324e36c
TASK: Implement basic mutation tests
Sebobo May 22, 2025
e79048f
TASK: More functional tests and fixes
Sebobo May 23, 2025
c104820
TASK: Unit tests CI step
Sebobo May 23, 2025
02170aa
BUGFIX: Generate graphql schema with custom resolvers
Sebobo May 26, 2025
ec9fec2
TASK: Get testcafe e2e tests to run again
Sebobo May 26, 2025
2fc1d73
TASK: Resolve linter issue
Sebobo May 26, 2025
ffb0fee
TASK: Fix dns resolver issue with testcafe
Sebobo May 27, 2025
f741467
TASK: Configure baseuri for e2e tests
Sebobo May 27, 2025
56e6dff
TASK: Start dev server in CI with tsx
Sebobo May 27, 2025
15eb7a2
TASK: Hide create schema command in command list
Sebobo May 27, 2025
1b7cc34
TASK: Fix codestyle
Sebobo May 27, 2025
6246482
TASK: Revert some temporary changes from development
Sebobo May 27, 2025
d9ff8b1
TASK: Bump phpstan level to 3
Sebobo May 27, 2025
b982378
BUGFIX: Allow removing items from clipboard again
Sebobo May 27, 2025
5747bec
BUGFIX: Only flush clipboard if confirmed
Sebobo May 27, 2025
b813187
TASK: Update compiled assets
Sebobo May 27, 2025
13919ca
TASK: Apply suggestions from code review
Sebobo May 27, 2025
7cf7f27
TASK: Better explain custom resolvers
Sebobo May 27, 2025
e980301
TASK: Remove unused code
Sebobo May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
Plugin.js binary
Plugin.css binary

/Resources/Private/JavaScript export-ignore
/Tests export-ignore
/packages export-ignore
/.yarn export-ignore
/.env export-ignore
/.github export-ignore
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [ main ]

env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
PACKAGE_FOLDER: media-ui

jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -50,6 +54,7 @@ jobs:
uses: php-actions/phpstan@v3
with:
php_version: 8.1
version: 2.1.17
command: analyse
path: 'Classes/'

Expand All @@ -64,10 +69,14 @@ jobs:
fail-fast: false
matrix:
php-versions: ['8.1']
flow-versions: ['7.3']
flow-versions: ['8.3']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set package branch name
run: echo "PACKAGE_TARGET_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
working-directory: .

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -78,7 +87,7 @@ jobs:
ini-values: opcache.fast_shutdown=0

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: dependencies-composer-${{ hashFiles('composer.json') }}
Expand All @@ -87,14 +96,17 @@ jobs:
run: |
git clone https://github.com/neos/flow-base-distribution.git -b ${{ matrix.flow-versions }} ${FLOW_FOLDER}
cd ${FLOW_FOLDER}
composer require --no-update --no-interaction flowpack/media-ui
composer require --no-update --no-interaction flowpack/entity-usage:"^1.1"
composer require --no-update --no-interaction flowpack/entity-usage-databasestorage:"^0.1"

git -C ../${{ env.PACKAGE_FOLDER }} checkout -b build
composer config repositories.package '{ "type": "path", "url": "../${{ env.PACKAGE_FOLDER }}", "options": { "symlink": false } }'
composer require --no-update --no-interaction flowpack/media-ui:"dev-build as dev-${PACKAGE_TARGET_VERSION}"

- name: Install distribution
- name: Composer Install
run: |
cd ${FLOW_FOLDER}
composer install --no-interaction --no-progress
rm -rf Packages/Application/Flowpack.Media.Ui
cp -r ../media-ui Packages/Application/Flowpack.Media.Ui
composer update --no-interaction --no-progress

- name: Run Unit tests
run: |
Expand Down Expand Up @@ -126,6 +138,7 @@ jobs:
env:
# Solves error when parcel tries to count cpus via lscpu
PARCEL_WORKERS: 1
DEBUG: 'testcafe:tested-app:*'

runs-on: ubuntu-latest

Expand All @@ -146,11 +159,11 @@ jobs:
run: yarn build:plugin

- name: Run TestCafe
run: yarn test:github-actions
run: yarn test:e2e:github-actions

- name: Archive failure screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: e2e-failure-screenshots
path: screenshots
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ node_modules
!.yarn/releases
!.yarn/sdks
!.yarn/versions
Packages
vendor
composer.lock
yarn-error.log
/.parcel-cache
.cache

#
# Compiled assets.
#
.cache
Resources/Private/JavaScript/dev-server/dist
yarn-error.log
/packages/dev-server/dist

#
# editors / IDEs
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extension": ["ts"],
"spec": "Resources/Private/JavaScript/**/*.spec.ts",
"spec": "packages/**/*.spec.ts",
"require": "ts-node/register"
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
15 changes: 8 additions & 7 deletions .testcaferc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"browsers": {
"path": "chromium",
"path": "firefox",
"cmd": "--window-size=1280,720"
},
"src": ["Resources/Private/JavaScript/media-module/tests/**/*.ts"],
"appCommand": "yarn ts-node --project Resources/Private/JavaScript/dev-server/tsconfig.json Resources/Private/JavaScript/dev-server/src/server.ts",
"src": ["packages/media-module/tests/**/*.ts"],
"appCommand": "yarn dev:test",
"appInitDelay": 2000,
"screenshots": {
"takeOnFails": true
},
"debugOnFail": false,
"stopOnFirstFail": true,
"hostname": "localhost",
"hostname": "127.0.0.1",
"baseUrl": "http://127.0.0.1:8000",
"retryTestPages": true,
"pageLoadTimeout": 10000,
"pageRequestTimeout": 60000,
"skipJsErrors": {
"stack": "/.*chrome-extension.*/ig"
}
"skipJsErrors": true
}
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

948 changes: 948 additions & 0 deletions .yarn/releases/yarn-4.9.1.cjs

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ enableGlobalCache: true

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-4.9.1.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function remove(JoinPointInterface $joinPoint): void
$persistenceManager = ObjectAccess::getProperty($assetCollectionRepository, 'persistenceManager', true);

$deleteRecursively = static function (AssetCollection $collection) use (&$deleteRecursively, $persistenceManager, $assetCollectionRepository) {
/** @noinspection PhpUndefinedMethodInspection */
$childCollections = $assetCollectionRepository->findByParent($collection);
foreach ($childCollections as $childCollection) {
$deleteRecursively($childCollection);
Expand Down
5 changes: 2 additions & 3 deletions Classes/Command/AssetCollectionsCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ public function hierarchyCommand(): void

public function setParentCommand(string $assetCollectionIdentifier, string $parentAssetCollectionIdentifier): void
{
/** @var AssetCollection $assetCollection */
/** @var HierarchicalAssetCollectionInterface $assetCollection */
$assetCollection = $this->assetCollectionRepository->findByIdentifier($assetCollectionIdentifier);
/** @var AssetCollection $parentAssetCollection */
/** @var HierarchicalAssetCollectionInterface $parentAssetCollection */
$parentAssetCollection = $this->assetCollectionRepository->findByIdentifier($parentAssetCollectionIdentifier);
/** @var HierarchicalAssetCollectionInterface $assetCollection */
$assetCollection->setParent($parentAssetCollection);
$this->assetCollectionRepository->update($assetCollection);
$this->assetCollectionService->updatePathForNestedAssetCollections($assetCollection);
Expand Down
63 changes: 63 additions & 0 deletions Classes/Command/MediaUiCommandController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

declare(strict_types=1);

namespace Flowpack\Media\Ui\Command;

/*
* This file is part of the Flowpack.Media.Ui package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

use Flowpack\Media\Ui\GraphQL\MediaApi;
use Flowpack\Media\Ui\GraphQL\Middleware\GraphQLMiddleware;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\Package\PackageManager;
use Neos\Utility\Files;
use Wwwision\TypesGraphQL\GraphQLGenerator;

#[Flow\Scope('singleton')]
class MediaUiCommandController extends CommandController
{

#[Flow\Inject]
protected PackageManager $packageManager;

/**
* @var GraphQLMiddleware
*/
#[Flow\Inject('Flowpack.Media.Ui:GraphQLMiddleware')]
protected $mediaApiMiddleware;

/**
* @internal only for development
*/
public function createSchemaCommand(): void
{
$this->outputLine('Creating GraphQL schema...');

$generator = new GraphQLGenerator();
$schema = $generator->generate(
MediaApi::class,
$this->mediaApiMiddleware->getCustomResolvers(),
)->render();

$path = Files::concatenatePaths([
$this->packageManager->getPackage('Flowpack.Media.Ui')->getPackagePath(),
'Resources',
'Private',
'GraphQL',
'schema.root.graphql',
]);

file_put_contents($path, $schema);

$this->outputFormatted('GraphQL schema created at: %s', [$path]);
}
}
4 changes: 1 addition & 3 deletions Classes/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
use Neos\Fusion\View\FusionView;
use Neos\Neos\Controller\Module\AbstractModuleController;

/**
* @Flow\Scope("singleton")
*/
#[Flow\Scope('singleton')]
class MediaController extends AbstractModuleController
{
/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Model/AssetSource/NeosAssetProxyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ final class NeosAssetProxyRepository implements AssetProxyRepositoryInterface, S
SupportsCollectionsInterface, SupportsTaggingInterface
{
/**
* @Flow\Inject
* @var ObjectManagerInterface
*/
#[Flow\Inject]
protected $objectManager;

/**
* @Flow\Inject
* @var EntityManagerInterface
*/
#[Flow\Inject]
protected $entityManager;

/**
Expand Down Expand Up @@ -308,7 +308,7 @@ private function filterOutAssetsWithAssetCollections(QueryInterface $query): Que
return $query;
}

private function filterOutAssetsWithOtherMediaTypes(QueryInterface $query)
private function filterOutAssetsWithOtherMediaTypes(QueryInterface $query): QueryInterface
{
$constraints = $query->getConstraint();
return $query->matching(
Expand Down
6 changes: 6 additions & 0 deletions Classes/Domain/Model/Dto/AssetUsageDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ final class AssetUsageDetails implements \JsonSerializable
{

private string $label;
/**
* @var array<string, string>
*/
private array $metadata;
private string $url;

Expand All @@ -39,6 +42,9 @@ public function getLabel(): string
return $this->label;
}

/**
* @return array<string, string>
*/
public function getMetadata(): array
{
return $this->metadata;
Expand Down
34 changes: 16 additions & 18 deletions Classes/Domain/Model/Dto/MutationResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,44 @@

namespace Flowpack\Media\Ui\Domain\Model\Dto;

use Flowpack\Media\Ui\GraphQL\Types\MutationResponseMessages;
use Neos\Flow\Annotations as Flow;

/**
* @Flow\Proxy(false)
*/
#[Flow\Proxy(false)]
class MutationResult implements \JsonSerializable
{

private bool $success;
private ?array $messages;
private ?array $data;
public function __construct(
public readonly bool $success,
public readonly ?MutationResponseMessages $messages = null,
) {
}

public function __construct(bool $success, array $messages = null, array $data = null)
public static function success(): self
{
$this->success = $success;
$this->messages = $messages;
$this->data = $data;
return new self(true);
}

public function isSuccess(): bool
public static function error(array $array): self
{
return $this->success;
return new self(false, MutationResponseMessages::fromArray($array));
}

public function getMessages(): ?array
public function isSuccess(): bool
{
return $this->messages;
return $this->success;
}

public function getData(): ?array
public function getMessages(): ?MutationResponseMessages
{
return $this->data;
return $this->messages ?? MutationResponseMessages::empty();
}

public function toArray(): array
{
return [
'success' => $this->success,
'messages' => $this->messages,
'data' => $this->data,
'messages' => $this->getMessages(),
];
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/HierarchicalAssetCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public function getTitle();
public function getTags();

/**
* @return AssetCollection|null
* @return HierarchicalAssetCollectionInterface|null
*/
public function getParent();

/**
* @return void
*/
public function setParent(?AssetCollection $parent);
public function setParent(?HierarchicalAssetCollectionInterface $parent);

/**
* @return void
Expand Down
Loading