GraphQL
view release on metacpan or search on metacpan
lib/GraphQL/AsyncIterator.pm view on Meta::CPAN
has promise_code => (is => 'ro', isa => PromiseCode);
=head1 METHODS
=head2 publish(@values)
Resolves the relevant promise with C<@values>.
=cut
has _values_queue => (is => 'ro', isa => ArrayRef, default => sub { [] });
has _next_promise => (is => 'rw', isa => Maybe[Promise]);
method publish(@values) {
$self->_emit('resolve', \@values);
}
method _promisify((Enum[qw(resolve reject)]) $method, $data) {
return $data if is_Promise($data);
$self->promise_code->{$method}->(@$data);
}
lib/GraphQL/AsyncIterator.pm view on Meta::CPAN
}
=head2 map_then($then, $catch)
Adds the handlers to this object's list of handlers, which will be
attached to promises returned by L</next_p>. Returns self.
=cut
has _handler_frames => (
is => 'ro', isa => ArrayRef[ArrayRef[CodeLike]], default => sub {[]},
);
method map_then(Maybe[CodeLike] $then, Maybe[CodeLike] $catch = undef) {
push @{$self->_handler_frames}, [ $then, $catch ];
$self;
}
__PACKAGE__->meta->make_immutable();
1;
lib/GraphQL/Directive.pm view on Meta::CPAN
ARGUMENT_DEFINITION
INTERFACE
UNION
ENUM
ENUM_VALUE
INPUT_OBJECT
INPUT_FIELD_DEFINITION
=cut
has locations => (is => 'ro', isa => ArrayRef[Enum[@LOCATIONS]], required => 1);
=head2 args
Hash-ref of arguments. See L<GraphQL::Type::Library/FieldMapInput>.
=cut
has args => (is => 'thunked', isa => FieldMapInput, required => 1);
=head1 METHODS
lib/GraphQL/Error.pm view on Meta::CPAN
=cut
has original_error => (is => 'ro', isa => Any);
=head2 locations
Array-ref of L<GraphQL::Type::Library/DocumentLocation>s.
=cut
has locations => (is => 'ro', isa => ArrayRef[DocumentLocation]);
=head2 path
Array-ref of L<GraphQL::Type::Library/StrNameValid>s or C<Int>s describing
the path from the top operation (being either fields, or a List offset).
=cut
has path => (is => 'ro', isa => ArrayRef[StrNameValid | Int]);
=head2 extensions
Hash-ref of L<GraphQL::Type::Library/JSONable>s providing additional
information.
=cut
has extensions => (is => 'ro', isa => Optional[HashRef[JSONable]]);
=head1 METHODS
=head2 is
Is the supplied scalar an error object?
=cut
method is(Any $item) :ReturnType(Bool) { ref $item eq __PACKAGE__ }
lib/GraphQL/PubSub.pm view on Meta::CPAN
The optional second "error" callback is called as a method on the object
when an exception is thrown by the first callback. If not given, the
default is for the subscription to be cancelled with L</unsubscribe>. The
error callback will be called with values of the channel, the original
callback (to enable unsubscribing), the exception thrown, then the values
passed to the original callback. Any exceptions will be ignored.
=cut
has _subscriptions => (is => 'ro', isa => HashRef, default => sub { {} });
method _default_error_callback(Str $channel, CodeLike $callback, Any $exception, @values) {
eval { $self->unsubscribe($channel, $callback) };
}
method subscribe(Str $channel, CodeLike $callback, Maybe[CodeLike] $error_callback = undef) {
$self->_subscriptions->{$channel}{$callback} = [
$callback,
$error_callback || \&_default_error_callback,
];
( run in 0.560 second using v1.01-cache-2.11-cpan-5f2e87ce722 )