Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -32,7 +32,7 @@ abstract class _AppQueries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function queries($app)
|
||||
public static function queries($app): array
|
||||
{
|
||||
return [
|
||||
'moduleAccess' => new \IPS\Api\GraphQL\Queries\ModuleAccess($app)
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class _CoverPhotoField
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getDefinition($name)
|
||||
public static function getDefinition($name): array
|
||||
{
|
||||
return [
|
||||
'type' => new ObjectType([
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class _TagsEditField
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getDefinition($name)
|
||||
public static function getDefinition($name): array
|
||||
{
|
||||
return [
|
||||
'type' => new ObjectType([
|
||||
|
||||
@@ -33,10 +33,12 @@ class _GraphQL
|
||||
*
|
||||
* @param string $query The query to execute
|
||||
* @param array $variables Variables to include in query
|
||||
* @param \IPS\Member|NULL $member Member to check or NULL for currently logged in member.
|
||||
* @return array GraphQL response
|
||||
*/
|
||||
public static function execute( string $query, array $variables = [], array $member = NULL )
|
||||
public static function execute( string $query, array $variables = [], ?\IPS\Member $member = NULL )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
/* Register our GraphQL library */
|
||||
\IPS\IPS::$PSR0Namespaces['GraphQL'] = \IPS\ROOT_PATH . "/system/3rd_party/graphql-php";
|
||||
|
||||
@@ -49,7 +51,7 @@ class _GraphQL
|
||||
$query,
|
||||
NULL, // $rootValue
|
||||
[
|
||||
'member' => \IPS\Member::loggedIn()
|
||||
'member' => $member
|
||||
], // $context
|
||||
$variables
|
||||
);
|
||||
|
||||
@@ -38,8 +38,9 @@ class _ModuleAccess
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +57,7 @@ class _ModuleAccess
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\core\Stream
|
||||
* @return \IPS\Application
|
||||
*/
|
||||
public function resolve($val, $args, $context)
|
||||
{
|
||||
|
||||
@@ -47,25 +47,25 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return QueryType
|
||||
* @return \IPS\Api\GraphQL\Types\QueryType
|
||||
*/
|
||||
public static function query()
|
||||
public static function query(): \IPS\Api\GraphQL\Types\QueryType
|
||||
{
|
||||
return self::$query ?: (self::$query = new \IPS\Api\GraphQL\Types\QueryType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MutationType
|
||||
* @return \IPS\Api\GraphQL\Types\MutationType
|
||||
*/
|
||||
public static function mutation()
|
||||
public static function mutation(): \IPS\Api\GraphQL\Types\MutationType
|
||||
{
|
||||
return self::$mutation ?: (self::$mutation = new \IPS\Api\GraphQL\Types\MutationType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ItemStateType
|
||||
* @return \IPS\Api\GraphQL\Types\ItemStateType
|
||||
*/
|
||||
public static function itemState()
|
||||
public static function itemState(): \IPS\Api\GraphQL\Types\ItemStateType
|
||||
{
|
||||
return self::$itemState ?: (self::$itemState = new \IPS\Api\GraphQL\Types\ItemStateType());
|
||||
}
|
||||
@@ -73,47 +73,47 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return ImageType
|
||||
*/
|
||||
public static function image()
|
||||
public static function image(): \IPS\Api\GraphQL\Types\ImageType
|
||||
{
|
||||
return self::$image ?: (self::$image = new \IPS\Api\GraphQL\Types\ImageType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReputationType
|
||||
* @return \IPS\Api\GraphQL\Types\ReputationType
|
||||
*/
|
||||
public static function reputation()
|
||||
public static function reputation(): \IPS\Api\GraphQL\Types\ReputationType
|
||||
{
|
||||
return self::$reputation ?: (self::$reputation = new \IPS\Api\GraphQL\Types\ReputationType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RichTextType
|
||||
* @return \IPS\Api\GraphQL\Types\RichTextType
|
||||
*/
|
||||
public static function richText()
|
||||
public static function richText(): \IPS\Api\GraphQL\Types\RichTextType
|
||||
{
|
||||
return self::$richText ?: (self::$richText = new \IPS\Api\GraphQL\Types\RichTextType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return URLType
|
||||
* @return \IPS\Api\GraphQL\Types\UrlType
|
||||
*/
|
||||
public static function url()
|
||||
public static function url(): \IPS\Api\GraphQL\Types\UrlType
|
||||
{
|
||||
return self::$url ?: (self::$url = new \IPS\Api\GraphQL\Types\UrlType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FollowType
|
||||
* @return \IPS\Api\GraphQL\Types\FollowType
|
||||
*/
|
||||
public static function follow()
|
||||
public static function follow(): \IPS\Api\GraphQL\Types\FollowType
|
||||
{
|
||||
return self::$follow ?: (self::$follow = new \IPS\Api\GraphQL\Types\FollowType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ModuleAccessType
|
||||
* @return \IPS\Api\GraphQL\Types\ModuleAccessType
|
||||
*/
|
||||
public static function moduleAccess()
|
||||
public static function moduleAccess(): \IPS\Api\GraphQL\Types\ModuleAccessType
|
||||
{
|
||||
return self::$moduleAccess ?: (self::$moduleAccess = new \IPS\Api\GraphQL\Types\ModuleAccessType());
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\IDType
|
||||
*/
|
||||
public static function id()
|
||||
public static function id(): \GraphQL\Type\Definition\IDType
|
||||
{
|
||||
return Type::id();
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\StringType
|
||||
*/
|
||||
public static function string()
|
||||
public static function string(): \GraphQL\Type\Definition\StringType
|
||||
{
|
||||
return Type::string();
|
||||
}
|
||||
@@ -137,7 +137,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\IntType
|
||||
*/
|
||||
public static function int()
|
||||
public static function int(): \GraphQL\Type\Definition\IntType
|
||||
{
|
||||
return Type::int();
|
||||
}
|
||||
@@ -145,7 +145,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\FloatType
|
||||
*/
|
||||
public static function float()
|
||||
public static function float(): \GraphQL\Type\Definition\FloatType
|
||||
{
|
||||
return Type::float();
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\BooleanType
|
||||
*/
|
||||
public static function boolean()
|
||||
public static function boolean(): \GraphQL\Type\Definition\BooleanType
|
||||
{
|
||||
return Type::boolean();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\ListOfType
|
||||
*/
|
||||
public static function listOf($type)
|
||||
public static function listOf($type): \GraphQL\Type\Definition\ListOfType
|
||||
{
|
||||
return new ListOfType($type);
|
||||
}
|
||||
@@ -169,12 +169,12 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return \GraphQL\Type\Definition\EnumType
|
||||
*/
|
||||
public static function eNum($config)
|
||||
public static function eNum($config): \GraphQL\Type\Definition\EnumType
|
||||
{
|
||||
return new EnumType($config);
|
||||
}
|
||||
|
||||
public static function inputObjectType($config)
|
||||
public static function inputObjectType($config): \GraphQL\Type\Definition\InputObjectType
|
||||
{
|
||||
return new InputObjectType($config);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class _TypeRegistry
|
||||
* @param Type $type
|
||||
* @return NonNull
|
||||
*/
|
||||
public static function nonNull($type)
|
||||
public static function nonNull($type): \GraphQL\Type\Definition\NonNull
|
||||
{
|
||||
return new NonNull($type);
|
||||
}
|
||||
|
||||
@@ -84,13 +84,10 @@ class _MutationType extends ObjectType
|
||||
}
|
||||
|
||||
return $mutationResolvers;
|
||||
|
||||
$mutationClass = new $className;
|
||||
return $mutationClass->resolve($val, $args, $context, $info);
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_RESOLVE', '3S291/2', 405 );
|
||||
throw new \IPS\Api\Exception( 'NO_RESOLVE', '3S291/2_graphl', 405 );
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -131,10 +131,24 @@ class _OAuthClient extends \IPS\Node\Model
|
||||
'toggles' => array(
|
||||
'invision' => array( 'oauth_grant_types_invision', 'oauth_invision_endpoint' ),
|
||||
'wordpress' => array( 'oauth_wordpress_endpoint' ),
|
||||
'confidential' => array( 'oauth_grant_types_confidential', 'oauth_redirect_uris', 'oauth_choose_scopes', 'oauth_header_oauth_access_tokens', 'oauth_access_token_length', 'oauth_tab_oauth_scopes' ),
|
||||
'public' => array( 'oauth_grant_types_public', 'oauth_redirect_uris', 'oauth_choose_scopes', 'oauth_header_oauth_access_tokens', 'oauth_access_token_length', 'oauth_tab_oauth_scopes' ),
|
||||
'confidential' => array( 'oauth_grant_types_confidential', 'oauth_redirect_uris', 'oauth_choose_scopes', 'oauth_header_oauth_access_tokens', 'oauth_access_token_length', 'oauth_tab_oauth_scopes','oauth_api_access', ),
|
||||
'public' => array( 'oauth_grant_types_public', 'oauth_redirect_uris', 'oauth_choose_scopes', 'oauth_header_oauth_access_tokens', 'oauth_access_token_length', 'oauth_tab_oauth_scopes', 'oauth_api_access' ),
|
||||
)
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'oauth_api_access', $this->api_access ? $this->api_access : 'rest', TRUE, array(
|
||||
'options' => array(
|
||||
'rest' => 'oauth_api_type_rest',
|
||||
'graphql' => 'oauth_api_type_graphql',
|
||||
'both' => 'oauth_api_type_both',
|
||||
),
|
||||
'toggles' => array(
|
||||
'rest' => array( 'oauth_tab_oauth_scopes', 'oauth_choose_scopes' ),
|
||||
'both' => array( 'oauth_tab_oauth_scopes', 'oauth_choose_scopes' ),
|
||||
'graphql' => array( '' ),
|
||||
)
|
||||
), NULL, NULL, NULL, 'oauth_api_access' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'oauth_invision_grant_type', $this->client_id ? $this->grant_types : 'authorization_code', NULL, array(
|
||||
'options' => array(
|
||||
'authorization_code' => 'invision_grant_type_server_authorization_code',
|
||||
@@ -304,6 +318,7 @@ class _OAuthClient extends \IPS\Node\Model
|
||||
$values['oauth_access_token_length'] = 168;
|
||||
$values['oauth_use_refresh_tokens'] = TRUE;
|
||||
$values['oauth_refresh_token_length'] = 28;
|
||||
$values['oauth_api_access'] = 'rest';
|
||||
$values['scopes'] = array(
|
||||
array(
|
||||
'name' => array( 'key' => 'profile', 'desc' => \IPS\Member::loggedIn()->language()->get('oauth_default_scope_profile') ),
|
||||
@@ -330,6 +345,7 @@ class _OAuthClient extends \IPS\Node\Model
|
||||
$values['oauth_access_token_length'] = 168;
|
||||
$values['oauth_use_refresh_tokens'] = TRUE;
|
||||
$values['oauth_refresh_token_length'] = 28;
|
||||
$values['oauth_api_access'] = 'rest';
|
||||
$values['scopes'] = array(
|
||||
array(
|
||||
'name' => array( 'key' => 'email', 'desc' => \IPS\Member::loggedIn()->language()->get('oauth_default_scope_email') ),
|
||||
@@ -342,6 +358,11 @@ class _OAuthClient extends \IPS\Node\Model
|
||||
$values['oauth_type'] = 'wordpress';
|
||||
$values['oauth_pkce'] = 'none';
|
||||
}
|
||||
elseif ( $values['oauth_api_access'] === 'graphql' )
|
||||
{
|
||||
$values['oauth_choose_scopes'] = FALSE;
|
||||
$values['scopes'] = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$values['oauth_type'] = NULL;
|
||||
@@ -412,6 +433,19 @@ class _OAuthClient extends \IPS\Node\Model
|
||||
/* Return */
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the custom badge for each row
|
||||
*
|
||||
* @return NULL|array Null for no badge, or an array of badge data (0 => CSS class type, 1 => language string, 2 => optional raw HTML to show instead of language string)
|
||||
*/
|
||||
public function get__badge()
|
||||
{
|
||||
return array(
|
||||
0 => 'ipsBadge ipsBadge_neutral ipsPos_right ipsMargin_right:half',
|
||||
1 => 'api_access_' . $this->api_access,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* [Node] Get Description
|
||||
|
||||
Reference in new issue
Block a user