line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphQL::Role::Leaf; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
9506
|
use 5.014; |
|
18
|
|
|
|
|
70
|
|
4
|
18
|
|
|
18
|
|
728
|
use strict; |
|
18
|
|
|
|
|
42
|
|
|
18
|
|
|
|
|
396
|
|
5
|
18
|
|
|
18
|
|
92
|
use warnings; |
|
18
|
|
|
|
|
543
|
|
|
18
|
|
|
|
|
521
|
|
6
|
18
|
|
|
18
|
|
99
|
use Moo::Role; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
95
|
|
7
|
18
|
|
|
18
|
|
11529
|
use GraphQL::MaybeTypeCheck; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
134
|
|
8
|
18
|
|
|
18
|
|
101
|
use Types::Standard -all; |
|
18
|
|
|
|
|
47
|
|
|
18
|
|
|
|
|
149
|
|
9
|
18
|
|
|
18
|
|
856078
|
use GraphQL::Debug qw(_debug); |
|
18
|
|
|
|
|
49
|
|
|
18
|
|
|
|
|
1906
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
12
|
18
|
|
|
18
|
|
137
|
use constant DEBUG => $ENV{GRAPHQL_DEBUG}; |
|
18
|
|
|
|
|
44
|
|
|
18
|
|
|
|
|
1621
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
GraphQL::Role::Leaf - GraphQL "leaf" object role |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
with qw(GraphQL::Role::Leaf); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# or runtime |
23
|
|
|
|
|
|
|
Role::Tiny->apply_roles_to_object($foo, qw(GraphQL::Role::Leaf)); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Allows type constraints for leaf objects. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
method _complete_value( |
32
|
|
|
|
|
|
|
HashRef $context, |
33
|
|
|
|
|
|
|
ArrayRef[HashRef] $nodes, |
34
|
|
|
|
|
|
|
HashRef $info, |
35
|
|
|
|
|
|
|
ArrayRef $path, |
36
|
|
|
|
|
|
|
Any $result, |
37
|
1111
|
50
|
|
1111
|
|
2374
|
) { |
|
1111
|
50
|
|
|
|
2299
|
|
|
1111
|
50
|
|
|
|
1574
|
|
|
1111
|
50
|
|
|
|
2545
|
|
|
1111
|
50
|
|
|
|
2255
|
|
|
1111
|
50
|
|
|
|
7980
|
|
|
1111
|
50
|
|
|
|
14367
|
|
|
1111
|
|
|
|
|
7436
|
|
|
1111
|
|
|
|
|
7377
|
|
|
1111
|
|
|
|
|
6746
|
|
38
|
1111
|
|
|
|
|
1362
|
DEBUG and _debug('Leaf._complete_value', $self->to_string, $result); |
39
|
1111
|
|
|
|
|
3146
|
my $serialised = $self->perl_to_graphql($result); |
40
|
1106
|
50
|
|
|
|
6458
|
die GraphQL::Error->new(message => "Expected a value of type '@{[$self->to_string]}' but received: '$result'.\n$@") if $@; |
|
0
|
|
|
|
|
0
|
|
41
|
1106
|
|
|
|
|
4081
|
+{ data => $serialised }; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |