From 6bf6a11d0fc4ba8f2ea0be5a245c48487f11bb67 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Aug 2024 16:56:25 +1200 Subject: [PATCH] API Deprecate GraphQL --- code/GraphQL/FileFilter.php | 11 +++++++++++ code/GraphQL/Notice.php | 7 +++++++ code/GraphQL/Resolvers/AssetAdminResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FieldResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FileTypeResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FolderTypeResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/PublicationResolver.php | 11 +++++++++++ code/GraphQL/Schema/Builder.php | 11 +++++++++++ 8 files changed, 84 insertions(+) diff --git a/code/GraphQL/FileFilter.php b/code/GraphQL/FileFilter.php index 60c215e78..3c96f2f3b 100644 --- a/code/GraphQL/FileFilter.php +++ b/code/GraphQL/FileFilter.php @@ -10,9 +10,20 @@ use SilverStripe\Forms\DateField; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\Filterable; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class FileFilter { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * Caution: Does NOT enforce canView permissions * diff --git a/code/GraphQL/Notice.php b/code/GraphQL/Notice.php index ad8aa3732..856b193e4 100644 --- a/code/GraphQL/Notice.php +++ b/code/GraphQL/Notice.php @@ -2,9 +2,13 @@ namespace SilverStripe\AssetAdmin\GraphQL; +use SilverStripe\Dev\Deprecation; + /** * Represents a notice related to a graphql Action. This could be a failure, * warning, or recoverable query (e.g. "are you sure you want to publish this item?") + * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ class Notice { @@ -34,6 +38,9 @@ class Notice */ public function __construct($message, $noticeType, $ids = []) { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); $this->message = $message; $this->noticeType = $noticeType; $this->ids = $ids; diff --git a/code/GraphQL/Resolvers/AssetAdminResolver.php b/code/GraphQL/Resolvers/AssetAdminResolver.php index 642552fbb..37df051b8 100644 --- a/code/GraphQL/Resolvers/AssetAdminResolver.php +++ b/code/GraphQL/Resolvers/AssetAdminResolver.php @@ -16,9 +16,20 @@ use SilverStripe\ORM\Filterable; use SilverStripe\Versioned\Versioned; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class AssetAdminResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + public static function resolveFileInterfaceType($object) { if ($object instanceof Folder) { diff --git a/code/GraphQL/Resolvers/FieldResolver.php b/code/GraphQL/Resolvers/FieldResolver.php index 21d293012..f358223ed 100644 --- a/code/GraphQL/Resolvers/FieldResolver.php +++ b/code/GraphQL/Resolvers/FieldResolver.php @@ -5,9 +5,20 @@ use GraphQL\Type\Definition\ResolveInfo; use SilverStripe\GraphQL\Schema\DataObject\FieldAccessor; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class FieldResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + public static function resolve($obj, array $args, array $context, ResolveInfo $info) { $field = $info->fieldName; diff --git a/code/GraphQL/Resolvers/FileTypeResolver.php b/code/GraphQL/Resolvers/FileTypeResolver.php index aecd7049a..8e4ee4289 100644 --- a/code/GraphQL/Resolvers/FileTypeResolver.php +++ b/code/GraphQL/Resolvers/FileTypeResolver.php @@ -12,11 +12,22 @@ use SilverStripe\Assets\Folder; use SilverStripe\Assets\Storage\AssetContainer; use SilverStripe\Core\Injector\Injectable; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class FileTypeResolver { use Injectable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + private static $dependencies = [ 'ThumbnailGenerator' => '%$SilverStripe\AssetAdmin\Model\ThumbnailGenerator.graphql' ]; diff --git a/code/GraphQL/Resolvers/FolderTypeResolver.php b/code/GraphQL/Resolvers/FolderTypeResolver.php index a67183fa4..cd9fd4d49 100644 --- a/code/GraphQL/Resolvers/FolderTypeResolver.php +++ b/code/GraphQL/Resolvers/FolderTypeResolver.php @@ -19,9 +19,20 @@ use Exception; use Closure; use SilverStripe\ORM\DataQuery; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class FolderTypeResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @param Folder $object * @param array $args diff --git a/code/GraphQL/Resolvers/PublicationResolver.php b/code/GraphQL/Resolvers/PublicationResolver.php index e7aa2f25a..f0b6b0623 100644 --- a/code/GraphQL/Resolvers/PublicationResolver.php +++ b/code/GraphQL/Resolvers/PublicationResolver.php @@ -11,12 +11,23 @@ use SilverStripe\Versioned\RecursivePublishable; use SilverStripe\Versioned\Versioned; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class PublicationResolver { const ACTION_PUBLISH = 'publish'; const ACTION_UNPUBLISH = 'unpublish'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + public static function resolvePublishFiles(...$params) { return PublicationResolver::resolvePublicationOperation(PublicationResolver::ACTION_PUBLISH, ...$params); diff --git a/code/GraphQL/Schema/Builder.php b/code/GraphQL/Schema/Builder.php index 023ce348e..5ca3e28fa 100644 --- a/code/GraphQL/Schema/Builder.php +++ b/code/GraphQL/Schema/Builder.php @@ -8,13 +8,24 @@ use SilverStripe\GraphQL\Schema\Schema; use SilverStripe\GraphQL\Schema\Type\Enum; use SilverStripe\ORM\ArrayLib; +use SilverStripe\Dev\Deprecation; if (!interface_exists(SchemaUpdater::class)) { return; } +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class Builder implements SchemaUpdater { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + public static function updateSchema(Schema $schema): void { $categoryValues = array_map(function ($category) {