From 33cc4b03d94863d61483533ef6c53875eac8ae14 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Aug 2024 14:51:40 +1200 Subject: [PATCH] API Deprecate GraphQL --- .../Operations/AbstractPublishOperationCreator.php | 9 +++++++++ src/GraphQL/Operations/CopyToStageCreator.php | 9 +++++++++ src/GraphQL/Operations/PublishCreator.php | 4 +++- src/GraphQL/Operations/RollbackCreator.php | 10 ++++++++++ src/GraphQL/Operations/UnpublishCreator.php | 10 ++++++++++ src/GraphQL/Plugins/UnpublishOnDelete.php | 11 +++++++++++ src/GraphQL/Plugins/VersionedDataObject.php | 11 +++++++++++ src/GraphQL/Plugins/VersionedRead.php | 11 +++++++++++ src/GraphQL/Resolvers/VersionFilters.php | 11 +++++++++++ src/GraphQL/Resolvers/VersionedResolver.php | 11 +++++++++++ 10 files changed, 96 insertions(+), 1 deletion(-) diff --git a/src/GraphQL/Operations/AbstractPublishOperationCreator.php b/src/GraphQL/Operations/AbstractPublishOperationCreator.php index 577d7ab9..70b4a859 100644 --- a/src/GraphQL/Operations/AbstractPublishOperationCreator.php +++ b/src/GraphQL/Operations/AbstractPublishOperationCreator.php @@ -23,6 +23,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -32,6 +33,7 @@ /** * Scaffolds a generic update operation for DataObjects. + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it */ abstract class AbstractPublishOperationCreator implements OperationCreator { @@ -41,6 +43,13 @@ abstract class AbstractPublishOperationCreator implements OperationCreator const ACTION_PUBLISH = 'publish'; const ACTION_UNPUBLISH = 'unpublish'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @param SchemaModelInterface $model * @param string $typeName diff --git a/src/GraphQL/Operations/CopyToStageCreator.php b/src/GraphQL/Operations/CopyToStageCreator.php index 46ca27d6..dd8f0cb0 100644 --- a/src/GraphQL/Operations/CopyToStageCreator.php +++ b/src/GraphQL/Operations/CopyToStageCreator.php @@ -13,6 +13,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -25,12 +26,20 @@ * * copy[TypeName]ToStage(ID!, FromVersion!, FromStage!, ToStage!) * + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it */ class CopyToStageCreator implements OperationCreator { use Configurable; use Injectable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @var array * @config diff --git a/src/GraphQL/Operations/PublishCreator.php b/src/GraphQL/Operations/PublishCreator.php index 70f8ea18..f61eedd7 100644 --- a/src/GraphQL/Operations/PublishCreator.php +++ b/src/GraphQL/Operations/PublishCreator.php @@ -3,6 +3,7 @@ namespace SilverStripe\Versioned\GraphQL\Operations; use SilverStripe\GraphQL\Schema\Interfaces\OperationCreator; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -12,10 +13,11 @@ /** * Scaffolds a generic update operation for DataObjects. + * + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it */ class PublishCreator extends AbstractPublishOperationCreator { - /** * @param string $typeName * @return string diff --git a/src/GraphQL/Operations/RollbackCreator.php b/src/GraphQL/Operations/RollbackCreator.php index 86bf9a70..16c35425 100644 --- a/src/GraphQL/Operations/RollbackCreator.php +++ b/src/GraphQL/Operations/RollbackCreator.php @@ -12,6 +12,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -23,12 +24,21 @@ * Scaffolds a "rollback recursive" operation for DataObjects. * * rollback[TypeName](ID!, ToVersion!) + * + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it */ class RollbackCreator implements OperationCreator { use Injectable; use Configurable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @var array * @config diff --git a/src/GraphQL/Operations/UnpublishCreator.php b/src/GraphQL/Operations/UnpublishCreator.php index fb279d0a..1514d546 100644 --- a/src/GraphQL/Operations/UnpublishCreator.php +++ b/src/GraphQL/Operations/UnpublishCreator.php @@ -3,6 +3,7 @@ namespace SilverStripe\Versioned\GraphQL\Operations; use SilverStripe\GraphQL\Schema\Interfaces\OperationCreator; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -12,9 +13,18 @@ /** * Scaffolds a generic update operation for DataObjects. + * + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it */ class UnpublishCreator extends AbstractPublishOperationCreator { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @param string $typeName * @return string diff --git a/src/GraphQL/Plugins/UnpublishOnDelete.php b/src/GraphQL/Plugins/UnpublishOnDelete.php index ed47ddf0..276214e2 100644 --- a/src/GraphQL/Plugins/UnpublishOnDelete.php +++ b/src/GraphQL/Plugins/UnpublishOnDelete.php @@ -15,6 +15,7 @@ use Exception; use Closure; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -22,10 +23,20 @@ return; } +/** + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it + */ class UnpublishOnDelete implements ModelMutationPlugin { const IDENTIFIER = 'unpublishOnDelete'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Plugins/VersionedDataObject.php b/src/GraphQL/Plugins/VersionedDataObject.php index 8a947e46..a72bbf84 100644 --- a/src/GraphQL/Plugins/VersionedDataObject.php +++ b/src/GraphQL/Plugins/VersionedDataObject.php @@ -23,6 +23,7 @@ use SilverStripe\Versioned\Versioned; use Closure; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -30,10 +31,20 @@ return; } +/** + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it + */ class VersionedDataObject implements ModelTypePlugin, SchemaUpdater { const IDENTIFIER = 'versioning'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Plugins/VersionedRead.php b/src/GraphQL/Plugins/VersionedRead.php index 1bce5498..bc13a2fc 100644 --- a/src/GraphQL/Plugins/VersionedRead.php +++ b/src/GraphQL/Plugins/VersionedRead.php @@ -9,6 +9,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -16,10 +17,20 @@ return; } +/** + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it + */ class VersionedRead implements ModelQueryPlugin { const IDENTIFIER = 'readVersion'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Resolvers/VersionFilters.php b/src/GraphQL/Resolvers/VersionFilters.php index 24a3b094..b01e1be9 100644 --- a/src/GraphQL/Resolvers/VersionFilters.php +++ b/src/GraphQL/Resolvers/VersionFilters.php @@ -8,9 +8,20 @@ use SilverStripe\Versioned\Versioned; use InvalidArgumentException; use DateTime; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it + */ class VersionFilters { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * Use this as a fallback where resolver results aren't queried as a DataList, * but rather use DataObject::get_one(). Example: SiteTree::get_by_link(). diff --git a/src/GraphQL/Resolvers/VersionedResolver.php b/src/GraphQL/Resolvers/VersionedResolver.php index a5c08ecb..0200112d 100644 --- a/src/GraphQL/Resolvers/VersionedResolver.php +++ b/src/GraphQL/Resolvers/VersionedResolver.php @@ -21,11 +21,22 @@ use Exception; use Closure; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be removed without equivalent functionality to replace it + */ class VersionedResolver { private static $priority = 1; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); + } + /** * @param DataObject $obj * @param array $args