Current section

Files

Jump to
chrobot src protocol@runtime.erl
Raw

src/protocol@runtime.erl

-module(protocol@runtime).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([encode__script_id/1, decode__script_id/1, encode__serialization_options_serialization/1, decode__serialization_options_serialization/1, encode__serialization_options/1, decode__serialization_options/1, encode__deep_serialized_value_type/1, decode__deep_serialized_value_type/1, encode__deep_serialized_value/1, decode__deep_serialized_value/1, encode__remote_object_id/1, decode__remote_object_id/1, encode__unserializable_value/1, decode__unserializable_value/1, encode__remote_object_type/1, decode__remote_object_type/1, encode__remote_object_subtype/1, decode__remote_object_subtype/1, encode__remote_object/1, decode__remote_object/1, encode__property_descriptor/1, decode__property_descriptor/1, encode__internal_property_descriptor/1, decode__internal_property_descriptor/1, encode__call_argument/1, decode__call_argument/1, encode__execution_context_id/1, decode__execution_context_id/1, encode__execution_context_description/1, decode__execution_context_description/1, encode__timestamp/1, decode__timestamp/1, encode__time_delta/1, decode__time_delta/1, encode__call_frame/1, decode__call_frame/1, encode__stack_trace/1, encode__exception_details/1, decode__stack_trace/1, decode__exception_details/1, decode__await_promise_response/1, decode__call_function_on_response/1, decode__compile_script_response/1, decode__evaluate_response/1, decode__get_properties_response/1, decode__global_lexical_scope_names_response/1, decode__query_objects_response/1, decode__run_script_response/1, await_promise/4, call_function_on/10, compile_script/5, disable/1, discard_console_entries/1, enable/1, evaluate/9, get_properties/3, global_lexical_scope_names/2, query_objects/3, release_object/2, release_object_group/2, run_if_waiting_for_debugger/1, run_script/9, set_async_call_stack_depth/2, add_binding/3, remove_binding/2]).
-export_type([script_id/0, serialization_options/0, serialization_options_serialization/0, deep_serialized_value/0, deep_serialized_value_type/0, remote_object_id/0, unserializable_value/0, remote_object/0, remote_object_type/0, remote_object_subtype/0, property_descriptor/0, internal_property_descriptor/0, call_argument/0, execution_context_id/0, execution_context_description/0, exception_details/0, timestamp/0, time_delta/0, call_frame/0, stack_trace/0, await_promise_response/0, call_function_on_response/0, compile_script_response/0, evaluate_response/0, get_properties_response/0, global_lexical_scope_names_response/0, query_objects_response/0, run_script_response/0]).
-type script_id() :: {script_id, binary()}.
-type serialization_options() :: {serialization_options,
serialization_options_serialization(),
gleam@option:option(integer()),
gleam@option:option(gleam@dict:dict(binary(), binary()))}.
-type serialization_options_serialization() :: serialization_options_serialization_deep |
serialization_options_serialization_json |
serialization_options_serialization_id_only.
-type deep_serialized_value() :: {deep_serialized_value,
deep_serialized_value_type(),
gleam@option:option(gleam@dynamic:dynamic_()),
gleam@option:option(binary()),
gleam@option:option(integer())}.
-type deep_serialized_value_type() :: deep_serialized_value_type_undefined |
deep_serialized_value_type_null |
deep_serialized_value_type_string |
deep_serialized_value_type_number |
deep_serialized_value_type_boolean |
deep_serialized_value_type_bigint |
deep_serialized_value_type_regexp |
deep_serialized_value_type_date |
deep_serialized_value_type_symbol |
deep_serialized_value_type_array |
deep_serialized_value_type_object |
deep_serialized_value_type_function |
deep_serialized_value_type_map |
deep_serialized_value_type_set |
deep_serialized_value_type_weakmap |
deep_serialized_value_type_weakset |
deep_serialized_value_type_error |
deep_serialized_value_type_proxy |
deep_serialized_value_type_promise |
deep_serialized_value_type_typedarray |
deep_serialized_value_type_arraybuffer |
deep_serialized_value_type_node |
deep_serialized_value_type_window |
deep_serialized_value_type_generator.
-type remote_object_id() :: {remote_object_id, binary()}.
-type unserializable_value() :: {unserializable_value, binary()}.
-type remote_object() :: {remote_object,
remote_object_type(),
gleam@option:option(remote_object_subtype()),
gleam@option:option(binary()),
gleam@option:option(gleam@dynamic:dynamic_()),
gleam@option:option(unserializable_value()),
gleam@option:option(binary()),
gleam@option:option(remote_object_id())}.
-type remote_object_type() :: remote_object_type_object |
remote_object_type_function |
remote_object_type_undefined |
remote_object_type_string |
remote_object_type_number |
remote_object_type_boolean |
remote_object_type_symbol |
remote_object_type_bigint.
-type remote_object_subtype() :: remote_object_subtype_array |
remote_object_subtype_null |
remote_object_subtype_node |
remote_object_subtype_regexp |
remote_object_subtype_date |
remote_object_subtype_map |
remote_object_subtype_set |
remote_object_subtype_weakmap |
remote_object_subtype_weakset |
remote_object_subtype_iterator |
remote_object_subtype_generator |
remote_object_subtype_error |
remote_object_subtype_proxy |
remote_object_subtype_promise |
remote_object_subtype_typedarray |
remote_object_subtype_arraybuffer |
remote_object_subtype_dataview |
remote_object_subtype_webassemblymemory |
remote_object_subtype_wasmvalue.
-type property_descriptor() :: {property_descriptor,
binary(),
gleam@option:option(remote_object()),
gleam@option:option(boolean()),
gleam@option:option(remote_object()),
gleam@option:option(remote_object()),
boolean(),
boolean(),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(remote_object())}.
-type internal_property_descriptor() :: {internal_property_descriptor,
binary(),
gleam@option:option(remote_object())}.
-type call_argument() :: {call_argument,
gleam@option:option(gleam@dynamic:dynamic_()),
gleam@option:option(unserializable_value()),
gleam@option:option(remote_object_id())}.
-type execution_context_id() :: {execution_context_id, integer()}.
-type execution_context_description() :: {execution_context_description,
execution_context_id(),
binary(),
binary(),
gleam@option:option(gleam@dict:dict(binary(), binary()))}.
-type exception_details() :: {exception_details,
integer(),
binary(),
integer(),
integer(),
gleam@option:option(script_id()),
gleam@option:option(binary()),
gleam@option:option(stack_trace()),
gleam@option:option(remote_object()),
gleam@option:option(execution_context_id())}.
-type timestamp() :: {timestamp, float()}.
-type time_delta() :: {time_delta, float()}.
-type call_frame() :: {call_frame,
binary(),
script_id(),
binary(),
integer(),
integer()}.
-type stack_trace() :: {stack_trace,
gleam@option:option(binary()),
list(call_frame()),
gleam@option:option(stack_trace())}.
-type await_promise_response() :: {await_promise_response,
remote_object(),
gleam@option:option(exception_details())}.
-type call_function_on_response() :: {call_function_on_response,
remote_object(),
gleam@option:option(exception_details())}.
-type compile_script_response() :: {compile_script_response,
gleam@option:option(script_id()),
gleam@option:option(exception_details())}.
-type evaluate_response() :: {evaluate_response,
remote_object(),
gleam@option:option(exception_details())}.
-type get_properties_response() :: {get_properties_response,
list(property_descriptor()),
gleam@option:option(list(internal_property_descriptor())),
gleam@option:option(exception_details())}.
-type global_lexical_scope_names_response() :: {global_lexical_scope_names_response,
list(binary())}.
-type query_objects_response() :: {query_objects_response, remote_object()}.
-type run_script_response() :: {run_script_response,
remote_object(),
gleam@option:option(exception_details())}.
-spec encode__script_id(script_id()) -> gleam@json:json().
encode__script_id(Value__) ->
case Value__ of
{script_id, Inner_value__} ->
gleam@json:string(Inner_value__)
end.
-spec decode__script_id(gleam@dynamic:dynamic_()) -> {ok, script_id()} |
{error, list(gleam@dynamic:decode_error())}.
decode__script_id(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {script_id, Field@0} end,
fun gleam@dynamic:string/1
))(_pipe).
-spec encode__serialization_options_serialization(
serialization_options_serialization()
) -> gleam@json:json().
encode__serialization_options_serialization(Value__) ->
_pipe = case Value__ of
serialization_options_serialization_deep ->
<<"deep"/utf8>>;
serialization_options_serialization_json ->
<<"json"/utf8>>;
serialization_options_serialization_id_only ->
<<"idOnly"/utf8>>
end,
gleam@json:string(_pipe).
-spec decode__serialization_options_serialization(gleam@dynamic:dynamic_()) -> {ok,
serialization_options_serialization()} |
{error, list(gleam@dynamic:decode_error())}.
decode__serialization_options_serialization(Value__) ->
case gleam@dynamic:string(Value__) of
{ok, <<"deep"/utf8>>} ->
{ok, serialization_options_serialization_deep};
{ok, <<"json"/utf8>>} ->
{ok, serialization_options_serialization_json};
{ok, <<"idOnly"/utf8>>} ->
{ok, serialization_options_serialization_id_only};
{error, Error} ->
{error, Error};
{ok, Other} ->
{error,
[{decode_error,
<<"valid enum property"/utf8>>,
Other,
[<<"enum decoder"/utf8>>]}]}
end.
-spec encode__serialization_options(serialization_options()) -> gleam@json:json().
encode__serialization_options(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"serialization"/utf8>>,
encode__serialization_options_serialization(
erlang:element(2, Value__)
)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(3, Value__),
fun(Inner_value__) ->
{<<"maxDepth"/utf8>>, gleam@json:int(Inner_value__)}
end
),
chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(4, Value__),
fun(Inner_value__@1) ->
{<<"additionalParameters"/utf8>>,
begin
_pipe@2 = maps:to_list(Inner_value__@1),
_pipe@3 = gleam@list:map(
_pipe@2,
fun(I) ->
{erlang:element(1, I),
gleam@json:string(erlang:element(2, I))}
end
),
gleam@json:object(_pipe@3)
end}
end
)
end
).
-spec decode__serialization_options(gleam@dynamic:dynamic_()) -> {ok,
serialization_options()} |
{error, list(gleam@dynamic:decode_error())}.
decode__serialization_options(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"serialization"/utf8>>,
fun decode__serialization_options_serialization/1
))(Value__),
fun(Serialization) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"maxDepth"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Max_depth) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"additionalParameters"/utf8>>,
gleam@dynamic:dict(
fun gleam@dynamic:string/1,
fun gleam@dynamic:string/1
)
))(Value__),
fun(Additional_parameters) ->
{ok,
{serialization_options,
Serialization,
Max_depth,
Additional_parameters}}
end
)
end
)
end
).
-spec encode__deep_serialized_value_type(deep_serialized_value_type()) -> gleam@json:json().
encode__deep_serialized_value_type(Value__) ->
_pipe = case Value__ of
deep_serialized_value_type_undefined ->
<<"undefined"/utf8>>;
deep_serialized_value_type_null ->
<<"null"/utf8>>;
deep_serialized_value_type_string ->
<<"string"/utf8>>;
deep_serialized_value_type_number ->
<<"number"/utf8>>;
deep_serialized_value_type_boolean ->
<<"boolean"/utf8>>;
deep_serialized_value_type_bigint ->
<<"bigint"/utf8>>;
deep_serialized_value_type_regexp ->
<<"regexp"/utf8>>;
deep_serialized_value_type_date ->
<<"date"/utf8>>;
deep_serialized_value_type_symbol ->
<<"symbol"/utf8>>;
deep_serialized_value_type_array ->
<<"array"/utf8>>;
deep_serialized_value_type_object ->
<<"object"/utf8>>;
deep_serialized_value_type_function ->
<<"function"/utf8>>;
deep_serialized_value_type_map ->
<<"map"/utf8>>;
deep_serialized_value_type_set ->
<<"set"/utf8>>;
deep_serialized_value_type_weakmap ->
<<"weakmap"/utf8>>;
deep_serialized_value_type_weakset ->
<<"weakset"/utf8>>;
deep_serialized_value_type_error ->
<<"error"/utf8>>;
deep_serialized_value_type_proxy ->
<<"proxy"/utf8>>;
deep_serialized_value_type_promise ->
<<"promise"/utf8>>;
deep_serialized_value_type_typedarray ->
<<"typedarray"/utf8>>;
deep_serialized_value_type_arraybuffer ->
<<"arraybuffer"/utf8>>;
deep_serialized_value_type_node ->
<<"node"/utf8>>;
deep_serialized_value_type_window ->
<<"window"/utf8>>;
deep_serialized_value_type_generator ->
<<"generator"/utf8>>
end,
gleam@json:string(_pipe).
-spec decode__deep_serialized_value_type(gleam@dynamic:dynamic_()) -> {ok,
deep_serialized_value_type()} |
{error, list(gleam@dynamic:decode_error())}.
decode__deep_serialized_value_type(Value__) ->
case gleam@dynamic:string(Value__) of
{ok, <<"undefined"/utf8>>} ->
{ok, deep_serialized_value_type_undefined};
{ok, <<"null"/utf8>>} ->
{ok, deep_serialized_value_type_null};
{ok, <<"string"/utf8>>} ->
{ok, deep_serialized_value_type_string};
{ok, <<"number"/utf8>>} ->
{ok, deep_serialized_value_type_number};
{ok, <<"boolean"/utf8>>} ->
{ok, deep_serialized_value_type_boolean};
{ok, <<"bigint"/utf8>>} ->
{ok, deep_serialized_value_type_bigint};
{ok, <<"regexp"/utf8>>} ->
{ok, deep_serialized_value_type_regexp};
{ok, <<"date"/utf8>>} ->
{ok, deep_serialized_value_type_date};
{ok, <<"symbol"/utf8>>} ->
{ok, deep_serialized_value_type_symbol};
{ok, <<"array"/utf8>>} ->
{ok, deep_serialized_value_type_array};
{ok, <<"object"/utf8>>} ->
{ok, deep_serialized_value_type_object};
{ok, <<"function"/utf8>>} ->
{ok, deep_serialized_value_type_function};
{ok, <<"map"/utf8>>} ->
{ok, deep_serialized_value_type_map};
{ok, <<"set"/utf8>>} ->
{ok, deep_serialized_value_type_set};
{ok, <<"weakmap"/utf8>>} ->
{ok, deep_serialized_value_type_weakmap};
{ok, <<"weakset"/utf8>>} ->
{ok, deep_serialized_value_type_weakset};
{ok, <<"error"/utf8>>} ->
{ok, deep_serialized_value_type_error};
{ok, <<"proxy"/utf8>>} ->
{ok, deep_serialized_value_type_proxy};
{ok, <<"promise"/utf8>>} ->
{ok, deep_serialized_value_type_promise};
{ok, <<"typedarray"/utf8>>} ->
{ok, deep_serialized_value_type_typedarray};
{ok, <<"arraybuffer"/utf8>>} ->
{ok, deep_serialized_value_type_arraybuffer};
{ok, <<"node"/utf8>>} ->
{ok, deep_serialized_value_type_node};
{ok, <<"window"/utf8>>} ->
{ok, deep_serialized_value_type_window};
{ok, <<"generator"/utf8>>} ->
{ok, deep_serialized_value_type_generator};
{error, Error} ->
{error, Error};
{ok, Other} ->
{error,
[{decode_error,
<<"valid enum property"/utf8>>,
Other,
[<<"enum decoder"/utf8>>]}]}
end.
-spec encode__deep_serialized_value(deep_serialized_value()) -> gleam@json:json().
encode__deep_serialized_value(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"type"/utf8>>,
encode__deep_serialized_value_type(
erlang:element(2, Value__)
)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(3, Value__),
fun(Inner_value__) ->
{<<"value"/utf8>>,
chrobot@internal@utils:alert_encode_dynamic(
Inner_value__
)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(4, Value__),
fun(Inner_value__@1) ->
{<<"objectId"/utf8>>, gleam@json:string(Inner_value__@1)}
end
),
chrobot@internal@utils:add_optional(
_pipe@2,
erlang:element(5, Value__),
fun(Inner_value__@2) ->
{<<"weakLocalObjectReference"/utf8>>,
gleam@json:int(Inner_value__@2)}
end
)
end
).
-spec decode__deep_serialized_value(gleam@dynamic:dynamic_()) -> {ok,
deep_serialized_value()} |
{error, list(gleam@dynamic:decode_error())}.
decode__deep_serialized_value(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"type"/utf8>>,
fun decode__deep_serialized_value_type/1
))(Value__),
fun(Type_) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"value"/utf8>>,
fun gleam@dynamic:dynamic/1
))(Value__),
fun(Value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"objectId"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Object_id) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"weakLocalObjectReference"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Weak_local_object_reference) ->
{ok,
{deep_serialized_value,
Type_,
Value,
Object_id,
Weak_local_object_reference}}
end
)
end
)
end
)
end
).
-spec encode__remote_object_id(remote_object_id()) -> gleam@json:json().
encode__remote_object_id(Value__) ->
case Value__ of
{remote_object_id, Inner_value__} ->
gleam@json:string(Inner_value__)
end.
-spec decode__remote_object_id(gleam@dynamic:dynamic_()) -> {ok,
remote_object_id()} |
{error, list(gleam@dynamic:decode_error())}.
decode__remote_object_id(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {remote_object_id, Field@0} end,
fun gleam@dynamic:string/1
))(_pipe).
-spec encode__unserializable_value(unserializable_value()) -> gleam@json:json().
encode__unserializable_value(Value__) ->
case Value__ of
{unserializable_value, Inner_value__} ->
gleam@json:string(Inner_value__)
end.
-spec decode__unserializable_value(gleam@dynamic:dynamic_()) -> {ok,
unserializable_value()} |
{error, list(gleam@dynamic:decode_error())}.
decode__unserializable_value(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {unserializable_value, Field@0} end,
fun gleam@dynamic:string/1
))(_pipe).
-spec encode__remote_object_type(remote_object_type()) -> gleam@json:json().
encode__remote_object_type(Value__) ->
_pipe = case Value__ of
remote_object_type_object ->
<<"object"/utf8>>;
remote_object_type_function ->
<<"function"/utf8>>;
remote_object_type_undefined ->
<<"undefined"/utf8>>;
remote_object_type_string ->
<<"string"/utf8>>;
remote_object_type_number ->
<<"number"/utf8>>;
remote_object_type_boolean ->
<<"boolean"/utf8>>;
remote_object_type_symbol ->
<<"symbol"/utf8>>;
remote_object_type_bigint ->
<<"bigint"/utf8>>
end,
gleam@json:string(_pipe).
-spec decode__remote_object_type(gleam@dynamic:dynamic_()) -> {ok,
remote_object_type()} |
{error, list(gleam@dynamic:decode_error())}.
decode__remote_object_type(Value__) ->
case gleam@dynamic:string(Value__) of
{ok, <<"object"/utf8>>} ->
{ok, remote_object_type_object};
{ok, <<"function"/utf8>>} ->
{ok, remote_object_type_function};
{ok, <<"undefined"/utf8>>} ->
{ok, remote_object_type_undefined};
{ok, <<"string"/utf8>>} ->
{ok, remote_object_type_string};
{ok, <<"number"/utf8>>} ->
{ok, remote_object_type_number};
{ok, <<"boolean"/utf8>>} ->
{ok, remote_object_type_boolean};
{ok, <<"symbol"/utf8>>} ->
{ok, remote_object_type_symbol};
{ok, <<"bigint"/utf8>>} ->
{ok, remote_object_type_bigint};
{error, Error} ->
{error, Error};
{ok, Other} ->
{error,
[{decode_error,
<<"valid enum property"/utf8>>,
Other,
[<<"enum decoder"/utf8>>]}]}
end.
-spec encode__remote_object_subtype(remote_object_subtype()) -> gleam@json:json().
encode__remote_object_subtype(Value__) ->
_pipe = case Value__ of
remote_object_subtype_array ->
<<"array"/utf8>>;
remote_object_subtype_null ->
<<"null"/utf8>>;
remote_object_subtype_node ->
<<"node"/utf8>>;
remote_object_subtype_regexp ->
<<"regexp"/utf8>>;
remote_object_subtype_date ->
<<"date"/utf8>>;
remote_object_subtype_map ->
<<"map"/utf8>>;
remote_object_subtype_set ->
<<"set"/utf8>>;
remote_object_subtype_weakmap ->
<<"weakmap"/utf8>>;
remote_object_subtype_weakset ->
<<"weakset"/utf8>>;
remote_object_subtype_iterator ->
<<"iterator"/utf8>>;
remote_object_subtype_generator ->
<<"generator"/utf8>>;
remote_object_subtype_error ->
<<"error"/utf8>>;
remote_object_subtype_proxy ->
<<"proxy"/utf8>>;
remote_object_subtype_promise ->
<<"promise"/utf8>>;
remote_object_subtype_typedarray ->
<<"typedarray"/utf8>>;
remote_object_subtype_arraybuffer ->
<<"arraybuffer"/utf8>>;
remote_object_subtype_dataview ->
<<"dataview"/utf8>>;
remote_object_subtype_webassemblymemory ->
<<"webassemblymemory"/utf8>>;
remote_object_subtype_wasmvalue ->
<<"wasmvalue"/utf8>>
end,
gleam@json:string(_pipe).
-spec decode__remote_object_subtype(gleam@dynamic:dynamic_()) -> {ok,
remote_object_subtype()} |
{error, list(gleam@dynamic:decode_error())}.
decode__remote_object_subtype(Value__) ->
case gleam@dynamic:string(Value__) of
{ok, <<"array"/utf8>>} ->
{ok, remote_object_subtype_array};
{ok, <<"null"/utf8>>} ->
{ok, remote_object_subtype_null};
{ok, <<"node"/utf8>>} ->
{ok, remote_object_subtype_node};
{ok, <<"regexp"/utf8>>} ->
{ok, remote_object_subtype_regexp};
{ok, <<"date"/utf8>>} ->
{ok, remote_object_subtype_date};
{ok, <<"map"/utf8>>} ->
{ok, remote_object_subtype_map};
{ok, <<"set"/utf8>>} ->
{ok, remote_object_subtype_set};
{ok, <<"weakmap"/utf8>>} ->
{ok, remote_object_subtype_weakmap};
{ok, <<"weakset"/utf8>>} ->
{ok, remote_object_subtype_weakset};
{ok, <<"iterator"/utf8>>} ->
{ok, remote_object_subtype_iterator};
{ok, <<"generator"/utf8>>} ->
{ok, remote_object_subtype_generator};
{ok, <<"error"/utf8>>} ->
{ok, remote_object_subtype_error};
{ok, <<"proxy"/utf8>>} ->
{ok, remote_object_subtype_proxy};
{ok, <<"promise"/utf8>>} ->
{ok, remote_object_subtype_promise};
{ok, <<"typedarray"/utf8>>} ->
{ok, remote_object_subtype_typedarray};
{ok, <<"arraybuffer"/utf8>>} ->
{ok, remote_object_subtype_arraybuffer};
{ok, <<"dataview"/utf8>>} ->
{ok, remote_object_subtype_dataview};
{ok, <<"webassemblymemory"/utf8>>} ->
{ok, remote_object_subtype_webassemblymemory};
{ok, <<"wasmvalue"/utf8>>} ->
{ok, remote_object_subtype_wasmvalue};
{error, Error} ->
{error, Error};
{ok, Other} ->
{error,
[{decode_error,
<<"valid enum property"/utf8>>,
Other,
[<<"enum decoder"/utf8>>]}]}
end.
-spec encode__remote_object(remote_object()) -> gleam@json:json().
encode__remote_object(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"type"/utf8>>,
encode__remote_object_type(erlang:element(2, Value__))}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(3, Value__),
fun(Inner_value__) ->
{<<"subtype"/utf8>>,
encode__remote_object_subtype(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(4, Value__),
fun(Inner_value__@1) ->
{<<"className"/utf8>>, gleam@json:string(Inner_value__@1)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
erlang:element(5, Value__),
fun(Inner_value__@2) ->
{<<"value"/utf8>>,
chrobot@internal@utils:alert_encode_dynamic(
Inner_value__@2
)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
erlang:element(6, Value__),
fun(Inner_value__@3) ->
{<<"unserializableValue"/utf8>>,
encode__unserializable_value(Inner_value__@3)}
end
),
_pipe@5 = chrobot@internal@utils:add_optional(
_pipe@4,
erlang:element(7, Value__),
fun(Inner_value__@4) ->
{<<"description"/utf8>>, gleam@json:string(Inner_value__@4)}
end
),
chrobot@internal@utils:add_optional(
_pipe@5,
erlang:element(8, Value__),
fun(Inner_value__@5) ->
{<<"objectId"/utf8>>,
encode__remote_object_id(Inner_value__@5)}
end
)
end
).
-spec decode__remote_object(gleam@dynamic:dynamic_()) -> {ok, remote_object()} |
{error, list(gleam@dynamic:decode_error())}.
decode__remote_object(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"type"/utf8>>, fun decode__remote_object_type/1))(
Value__
),
fun(Type_) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"subtype"/utf8>>,
fun decode__remote_object_subtype/1
))(Value__),
fun(Subtype) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"className"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Class_name) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"value"/utf8>>,
fun gleam@dynamic:dynamic/1
))(Value__),
fun(Value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"unserializableValue"/utf8>>,
fun decode__unserializable_value/1
))(Value__),
fun(Unserializable_value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"description"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Description) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"objectId"/utf8>>,
fun decode__remote_object_id/1
))(Value__),
fun(Object_id) ->
{ok,
{remote_object,
Type_,
Subtype,
Class_name,
Value,
Unserializable_value,
Description,
Object_id}}
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-spec encode__property_descriptor(property_descriptor()) -> gleam@json:json().
encode__property_descriptor(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"name"/utf8>>,
gleam@json:string(erlang:element(2, Value__))},
{<<"configurable"/utf8>>,
gleam@json:bool(erlang:element(7, Value__))},
{<<"enumerable"/utf8>>,
gleam@json:bool(erlang:element(8, Value__))}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(3, Value__),
fun(Inner_value__) ->
{<<"value"/utf8>>, encode__remote_object(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(4, Value__),
fun(Inner_value__@1) ->
{<<"writable"/utf8>>, gleam@json:bool(Inner_value__@1)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
erlang:element(5, Value__),
fun(Inner_value__@2) ->
{<<"get"/utf8>>, encode__remote_object(Inner_value__@2)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
erlang:element(6, Value__),
fun(Inner_value__@3) ->
{<<"set"/utf8>>, encode__remote_object(Inner_value__@3)}
end
),
_pipe@5 = chrobot@internal@utils:add_optional(
_pipe@4,
erlang:element(9, Value__),
fun(Inner_value__@4) ->
{<<"wasThrown"/utf8>>, gleam@json:bool(Inner_value__@4)}
end
),
_pipe@6 = chrobot@internal@utils:add_optional(
_pipe@5,
erlang:element(10, Value__),
fun(Inner_value__@5) ->
{<<"isOwn"/utf8>>, gleam@json:bool(Inner_value__@5)}
end
),
chrobot@internal@utils:add_optional(
_pipe@6,
erlang:element(11, Value__),
fun(Inner_value__@6) ->
{<<"symbol"/utf8>>, encode__remote_object(Inner_value__@6)}
end
)
end
).
-spec decode__property_descriptor(gleam@dynamic:dynamic_()) -> {ok,
property_descriptor()} |
{error, list(gleam@dynamic:decode_error())}.
decode__property_descriptor(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"name"/utf8>>, fun gleam@dynamic:string/1))(
Value__
),
fun(Name) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"value"/utf8>>,
fun decode__remote_object/1
))(Value__),
fun(Value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"writable"/utf8>>,
fun gleam@dynamic:bool/1
))(Value__),
fun(Writable) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"get"/utf8>>,
fun decode__remote_object/1
))(Value__),
fun(Get) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"set"/utf8>>,
fun decode__remote_object/1
))(Value__),
fun(Set) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"configurable"/utf8>>,
fun gleam@dynamic:bool/1
))(Value__),
fun(Configurable) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"enumerable"/utf8>>,
fun gleam@dynamic:bool/1
))(Value__),
fun(Enumerable) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"wasThrown"/utf8>>,
fun gleam@dynamic:bool/1
))(Value__),
fun(Was_thrown) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"isOwn"/utf8>>,
fun gleam@dynamic:bool/1
))(
Value__
),
fun(
Is_own
) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"symbol"/utf8>>,
fun decode__remote_object/1
))(
Value__
),
fun(
Symbol
) ->
{ok,
{property_descriptor,
Name,
Value,
Writable,
Get,
Set,
Configurable,
Enumerable,
Was_thrown,
Is_own,
Symbol}}
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-spec encode__internal_property_descriptor(internal_property_descriptor()) -> gleam@json:json().
encode__internal_property_descriptor(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"name"/utf8>>,
gleam@json:string(erlang:element(2, Value__))}],
chrobot@internal@utils:add_optional(
_pipe,
erlang:element(3, Value__),
fun(Inner_value__) ->
{<<"value"/utf8>>, encode__remote_object(Inner_value__)}
end
)
end
).
-spec decode__internal_property_descriptor(gleam@dynamic:dynamic_()) -> {ok,
internal_property_descriptor()} |
{error, list(gleam@dynamic:decode_error())}.
decode__internal_property_descriptor(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"name"/utf8>>, fun gleam@dynamic:string/1))(
Value__
),
fun(Name) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"value"/utf8>>,
fun decode__remote_object/1
))(Value__),
fun(Value) ->
{ok, {internal_property_descriptor, Name, Value}}
end
)
end
).
-spec encode__call_argument(call_argument()) -> gleam@json:json().
encode__call_argument(Value__) ->
gleam@json:object(
begin
_pipe = [],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(2, Value__),
fun(Inner_value__) ->
{<<"value"/utf8>>,
chrobot@internal@utils:alert_encode_dynamic(
Inner_value__
)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(3, Value__),
fun(Inner_value__@1) ->
{<<"unserializableValue"/utf8>>,
encode__unserializable_value(Inner_value__@1)}
end
),
chrobot@internal@utils:add_optional(
_pipe@2,
erlang:element(4, Value__),
fun(Inner_value__@2) ->
{<<"objectId"/utf8>>,
encode__remote_object_id(Inner_value__@2)}
end
)
end
).
-spec decode__call_argument(gleam@dynamic:dynamic_()) -> {ok, call_argument()} |
{error, list(gleam@dynamic:decode_error())}.
decode__call_argument(Value__) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"value"/utf8>>,
fun gleam@dynamic:dynamic/1
))(Value__),
fun(Value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"unserializableValue"/utf8>>,
fun decode__unserializable_value/1
))(Value__),
fun(Unserializable_value) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"objectId"/utf8>>,
fun decode__remote_object_id/1
))(Value__),
fun(Object_id) ->
{ok,
{call_argument,
Value,
Unserializable_value,
Object_id}}
end
)
end
)
end
).
-spec encode__execution_context_id(execution_context_id()) -> gleam@json:json().
encode__execution_context_id(Value__) ->
case Value__ of
{execution_context_id, Inner_value__} ->
gleam@json:int(Inner_value__)
end.
-spec decode__execution_context_id(gleam@dynamic:dynamic_()) -> {ok,
execution_context_id()} |
{error, list(gleam@dynamic:decode_error())}.
decode__execution_context_id(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {execution_context_id, Field@0} end,
fun gleam@dynamic:int/1
))(_pipe).
-spec encode__execution_context_description(execution_context_description()) -> gleam@json:json().
encode__execution_context_description(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"id"/utf8>>,
encode__execution_context_id(erlang:element(2, Value__))},
{<<"origin"/utf8>>,
gleam@json:string(erlang:element(3, Value__))},
{<<"name"/utf8>>, gleam@json:string(erlang:element(4, Value__))}],
chrobot@internal@utils:add_optional(
_pipe,
erlang:element(5, Value__),
fun(Inner_value__) ->
{<<"auxData"/utf8>>,
begin
_pipe@1 = maps:to_list(Inner_value__),
_pipe@2 = gleam@list:map(
_pipe@1,
fun(I) ->
{erlang:element(1, I),
gleam@json:string(erlang:element(2, I))}
end
),
gleam@json:object(_pipe@2)
end}
end
)
end
).
-spec decode__execution_context_description(gleam@dynamic:dynamic_()) -> {ok,
execution_context_description()} |
{error, list(gleam@dynamic:decode_error())}.
decode__execution_context_description(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"id"/utf8>>, fun decode__execution_context_id/1))(
Value__
),
fun(Id) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"origin"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Origin) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"name"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Name) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"auxData"/utf8>>,
gleam@dynamic:dict(
fun gleam@dynamic:string/1,
fun gleam@dynamic:string/1
)
))(Value__),
fun(Aux_data) ->
{ok,
{execution_context_description,
Id,
Origin,
Name,
Aux_data}}
end
)
end
)
end
)
end
).
-spec encode__timestamp(timestamp()) -> gleam@json:json().
encode__timestamp(Value__) ->
case Value__ of
{timestamp, Inner_value__} ->
gleam@json:float(Inner_value__)
end.
-spec decode__timestamp(gleam@dynamic:dynamic_()) -> {ok, timestamp()} |
{error, list(gleam@dynamic:decode_error())}.
decode__timestamp(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {timestamp, Field@0} end,
fun gleam@dynamic:float/1
))(_pipe).
-spec encode__time_delta(time_delta()) -> gleam@json:json().
encode__time_delta(Value__) ->
case Value__ of
{time_delta, Inner_value__} ->
gleam@json:float(Inner_value__)
end.
-spec decode__time_delta(gleam@dynamic:dynamic_()) -> {ok, time_delta()} |
{error, list(gleam@dynamic:decode_error())}.
decode__time_delta(Value__) ->
_pipe = Value__,
(gleam@dynamic:decode1(
fun(Field@0) -> {time_delta, Field@0} end,
fun gleam@dynamic:float/1
))(_pipe).
-spec encode__call_frame(call_frame()) -> gleam@json:json().
encode__call_frame(Value__) ->
gleam@json:object(
[{<<"functionName"/utf8>>,
gleam@json:string(erlang:element(2, Value__))},
{<<"scriptId"/utf8>>, encode__script_id(erlang:element(3, Value__))},
{<<"url"/utf8>>, gleam@json:string(erlang:element(4, Value__))},
{<<"lineNumber"/utf8>>, gleam@json:int(erlang:element(5, Value__))},
{<<"columnNumber"/utf8>>,
gleam@json:int(erlang:element(6, Value__))}]
).
-spec decode__call_frame(gleam@dynamic:dynamic_()) -> {ok, call_frame()} |
{error, list(gleam@dynamic:decode_error())}.
decode__call_frame(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"functionName"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Function_name) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"scriptId"/utf8>>,
fun decode__script_id/1
))(Value__),
fun(Script_id) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"url"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Url) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"lineNumber"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Line_number) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"columnNumber"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Column_number) ->
{ok,
{call_frame,
Function_name,
Script_id,
Url,
Line_number,
Column_number}}
end
)
end
)
end
)
end
)
end
).
-spec encode__stack_trace(stack_trace()) -> gleam@json:json().
encode__stack_trace(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"callFrames"/utf8>>,
gleam@json:array(
erlang:element(3, Value__),
fun encode__call_frame/1
)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(2, Value__),
fun(Inner_value__) ->
{<<"description"/utf8>>, gleam@json:string(Inner_value__)}
end
),
chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(4, Value__),
fun(Inner_value__@1) ->
{<<"parent"/utf8>>, encode__stack_trace(Inner_value__@1)}
end
)
end
).
-spec encode__exception_details(exception_details()) -> gleam@json:json().
encode__exception_details(Value__) ->
gleam@json:object(
begin
_pipe = [{<<"exceptionId"/utf8>>,
gleam@json:int(erlang:element(2, Value__))},
{<<"text"/utf8>>, gleam@json:string(erlang:element(3, Value__))},
{<<"lineNumber"/utf8>>,
gleam@json:int(erlang:element(4, Value__))},
{<<"columnNumber"/utf8>>,
gleam@json:int(erlang:element(5, Value__))}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
erlang:element(6, Value__),
fun(Inner_value__) ->
{<<"scriptId"/utf8>>, encode__script_id(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
erlang:element(7, Value__),
fun(Inner_value__@1) ->
{<<"url"/utf8>>, gleam@json:string(Inner_value__@1)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
erlang:element(8, Value__),
fun(Inner_value__@2) ->
{<<"stackTrace"/utf8>>,
encode__stack_trace(Inner_value__@2)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
erlang:element(9, Value__),
fun(Inner_value__@3) ->
{<<"exception"/utf8>>,
encode__remote_object(Inner_value__@3)}
end
),
chrobot@internal@utils:add_optional(
_pipe@4,
erlang:element(10, Value__),
fun(Inner_value__@4) ->
{<<"executionContextId"/utf8>>,
encode__execution_context_id(Inner_value__@4)}
end
)
end
).
-spec decode__stack_trace(gleam@dynamic:dynamic_()) -> {ok, stack_trace()} |
{error, list(gleam@dynamic:decode_error())}.
decode__stack_trace(Value__) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"description"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Description) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"callFrames"/utf8>>,
gleam@dynamic:list(fun decode__call_frame/1)
))(Value__),
fun(Call_frames) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"parent"/utf8>>,
fun decode__stack_trace/1
))(Value__),
fun(Parent) ->
{ok,
{stack_trace, Description, Call_frames, Parent}}
end
)
end
)
end
).
-spec decode__exception_details(gleam@dynamic:dynamic_()) -> {ok,
exception_details()} |
{error, list(gleam@dynamic:decode_error())}.
decode__exception_details(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"exceptionId"/utf8>>, fun gleam@dynamic:int/1))(
Value__
),
fun(Exception_id) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"text"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Text) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"lineNumber"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Line_number) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"columnNumber"/utf8>>,
fun gleam@dynamic:int/1
))(Value__),
fun(Column_number) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"scriptId"/utf8>>,
fun decode__script_id/1
))(Value__),
fun(Script_id) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"url"/utf8>>,
fun gleam@dynamic:string/1
))(Value__),
fun(Url) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"stackTrace"/utf8>>,
fun decode__stack_trace/1
))(Value__),
fun(Stack_trace) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exception"/utf8>>,
fun decode__remote_object/1
))(Value__),
fun(Exception) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"executionContextId"/utf8>>,
fun decode__execution_context_id/1
))(
Value__
),
fun(
Execution_context_id
) ->
{ok,
{exception_details,
Exception_id,
Text,
Line_number,
Column_number,
Script_id,
Url,
Stack_trace,
Exception,
Execution_context_id}}
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
).
-spec decode__await_promise_response(gleam@dynamic:dynamic_()) -> {ok,
await_promise_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__await_promise_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"result"/utf8>>, fun decode__remote_object/1))(
Value__
),
fun(Result) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok, {await_promise_response, Result, Exception_details}}
end
)
end
).
-spec decode__call_function_on_response(gleam@dynamic:dynamic_()) -> {ok,
call_function_on_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__call_function_on_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"result"/utf8>>, fun decode__remote_object/1))(
Value__
),
fun(Result) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok, {call_function_on_response, Result, Exception_details}}
end
)
end
).
-spec decode__compile_script_response(gleam@dynamic:dynamic_()) -> {ok,
compile_script_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__compile_script_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"scriptId"/utf8>>,
fun decode__script_id/1
))(Value__),
fun(Script_id) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok,
{compile_script_response, Script_id, Exception_details}}
end
)
end
).
-spec decode__evaluate_response(gleam@dynamic:dynamic_()) -> {ok,
evaluate_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__evaluate_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"result"/utf8>>, fun decode__remote_object/1))(
Value__
),
fun(Result) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok, {evaluate_response, Result, Exception_details}}
end
)
end
).
-spec decode__get_properties_response(gleam@dynamic:dynamic_()) -> {ok,
get_properties_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__get_properties_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"result"/utf8>>,
gleam@dynamic:list(fun decode__property_descriptor/1)
))(Value__),
fun(Result) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"internalProperties"/utf8>>,
gleam@dynamic:list(
fun decode__internal_property_descriptor/1
)
))(Value__),
fun(Internal_properties) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok,
{get_properties_response,
Result,
Internal_properties,
Exception_details}}
end
)
end
)
end
).
-spec decode__global_lexical_scope_names_response(gleam@dynamic:dynamic_()) -> {ok,
global_lexical_scope_names_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__global_lexical_scope_names_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(
<<"names"/utf8>>,
gleam@dynamic:list(fun gleam@dynamic:string/1)
))(Value__),
fun(Names) -> {ok, {global_lexical_scope_names_response, Names}} end
).
-spec decode__query_objects_response(gleam@dynamic:dynamic_()) -> {ok,
query_objects_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__query_objects_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"objects"/utf8>>, fun decode__remote_object/1))(
Value__
),
fun(Objects) -> {ok, {query_objects_response, Objects}} end
).
-spec decode__run_script_response(gleam@dynamic:dynamic_()) -> {ok,
run_script_response()} |
{error, list(gleam@dynamic:decode_error())}.
decode__run_script_response(Value__) ->
gleam@result:'try'(
(gleam@dynamic:field(<<"result"/utf8>>, fun decode__remote_object/1))(
Value__
),
fun(Result) ->
gleam@result:'try'(
(gleam@dynamic:optional_field(
<<"exceptionDetails"/utf8>>,
fun decode__exception_details/1
))(Value__),
fun(Exception_details) ->
{ok, {run_script_response, Result, Exception_details}}
end
)
end
).
-spec await_promise(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
remote_object_id(),
gleam@option:option(boolean()),
gleam@option:option(boolean())
) -> {ok, await_promise_response()} | {error, chrome:request_error()}.
await_promise(Callback__, Promise_object_id, Return_by_value, Generate_preview) ->
gleam@result:'try'(
Callback__(
<<"Runtime.awaitPromise"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"promiseObjectId"/utf8>>,
encode__remote_object_id(Promise_object_id)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
Return_by_value,
fun(Inner_value__) ->
{<<"returnByValue"/utf8>>,
gleam@json:bool(Inner_value__)}
end
),
chrobot@internal@utils:add_optional(
_pipe@1,
Generate_preview,
fun(Inner_value__@1) ->
{<<"generatePreview"/utf8>>,
gleam@json:bool(Inner_value__@1)}
end
)
end
)}
),
fun(Result__) -> _pipe@2 = decode__await_promise_response(Result__),
gleam@result:replace_error(_pipe@2, protocol_error) end
).
-spec call_function_on(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
binary(),
gleam@option:option(remote_object_id()),
gleam@option:option(list(call_argument())),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(execution_context_id()),
gleam@option:option(binary())
) -> {ok, call_function_on_response()} | {error, chrome:request_error()}.
call_function_on(
Callback__,
Function_declaration,
Object_id,
Arguments,
Silent,
Return_by_value,
User_gesture,
Await_promise,
Execution_context_id,
Object_group
) ->
gleam@result:'try'(
Callback__(
<<"Runtime.callFunctionOn"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"functionDeclaration"/utf8>>,
gleam@json:string(Function_declaration)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
Object_id,
fun(Inner_value__) ->
{<<"objectId"/utf8>>,
encode__remote_object_id(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
Arguments,
fun(Inner_value__@1) ->
{<<"arguments"/utf8>>,
gleam@json:array(
Inner_value__@1,
fun encode__call_argument/1
)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
Silent,
fun(Inner_value__@2) ->
{<<"silent"/utf8>>,
gleam@json:bool(Inner_value__@2)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
Return_by_value,
fun(Inner_value__@3) ->
{<<"returnByValue"/utf8>>,
gleam@json:bool(Inner_value__@3)}
end
),
_pipe@5 = chrobot@internal@utils:add_optional(
_pipe@4,
User_gesture,
fun(Inner_value__@4) ->
{<<"userGesture"/utf8>>,
gleam@json:bool(Inner_value__@4)}
end
),
_pipe@6 = chrobot@internal@utils:add_optional(
_pipe@5,
Await_promise,
fun(Inner_value__@5) ->
{<<"awaitPromise"/utf8>>,
gleam@json:bool(Inner_value__@5)}
end
),
_pipe@7 = chrobot@internal@utils:add_optional(
_pipe@6,
Execution_context_id,
fun(Inner_value__@6) ->
{<<"executionContextId"/utf8>>,
encode__execution_context_id(
Inner_value__@6
)}
end
),
chrobot@internal@utils:add_optional(
_pipe@7,
Object_group,
fun(Inner_value__@7) ->
{<<"objectGroup"/utf8>>,
gleam@json:string(Inner_value__@7)}
end
)
end
)}
),
fun(Result__) -> _pipe@8 = decode__call_function_on_response(Result__),
gleam@result:replace_error(_pipe@8, protocol_error) end
).
-spec compile_script(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
binary(),
binary(),
boolean(),
gleam@option:option(execution_context_id())
) -> {ok, compile_script_response()} | {error, chrome:request_error()}.
compile_script(
Callback__,
Expression,
Source_url,
Persist_script,
Execution_context_id
) ->
gleam@result:'try'(
Callback__(
<<"Runtime.compileScript"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"expression"/utf8>>,
gleam@json:string(Expression)},
{<<"sourceURL"/utf8>>,
gleam@json:string(Source_url)},
{<<"persistScript"/utf8>>,
gleam@json:bool(Persist_script)}],
chrobot@internal@utils:add_optional(
_pipe,
Execution_context_id,
fun(Inner_value__) ->
{<<"executionContextId"/utf8>>,
encode__execution_context_id(Inner_value__)}
end
)
end
)}
),
fun(Result__) -> _pipe@1 = decode__compile_script_response(Result__),
gleam@result:replace_error(_pipe@1, protocol_error) end
).
-spec disable(fun((binary(), gleam@option:option(any())) -> QMK)) -> QMK.
disable(Callback__) ->
Callback__(<<"Runtime.disable"/utf8>>, none).
-spec discard_console_entries(
fun((binary(), gleam@option:option(any())) -> QMO)
) -> QMO.
discard_console_entries(Callback__) ->
Callback__(<<"Runtime.discardConsoleEntries"/utf8>>, none).
-spec enable(fun((binary(), gleam@option:option(any())) -> QMS)) -> QMS.
enable(Callback__) ->
Callback__(<<"Runtime.enable"/utf8>>, none).
-spec evaluate(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
binary(),
gleam@option:option(binary()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(execution_context_id()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean())
) -> {ok, evaluate_response()} | {error, chrome:request_error()}.
evaluate(
Callback__,
Expression,
Object_group,
Include_command_line_api,
Silent,
Context_id,
Return_by_value,
User_gesture,
Await_promise
) ->
gleam@result:'try'(
Callback__(
<<"Runtime.evaluate"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"expression"/utf8>>,
gleam@json:string(Expression)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
Object_group,
fun(Inner_value__) ->
{<<"objectGroup"/utf8>>,
gleam@json:string(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
Include_command_line_api,
fun(Inner_value__@1) ->
{<<"includeCommandLineAPI"/utf8>>,
gleam@json:bool(Inner_value__@1)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
Silent,
fun(Inner_value__@2) ->
{<<"silent"/utf8>>,
gleam@json:bool(Inner_value__@2)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
Context_id,
fun(Inner_value__@3) ->
{<<"contextId"/utf8>>,
encode__execution_context_id(
Inner_value__@3
)}
end
),
_pipe@5 = chrobot@internal@utils:add_optional(
_pipe@4,
Return_by_value,
fun(Inner_value__@4) ->
{<<"returnByValue"/utf8>>,
gleam@json:bool(Inner_value__@4)}
end
),
_pipe@6 = chrobot@internal@utils:add_optional(
_pipe@5,
User_gesture,
fun(Inner_value__@5) ->
{<<"userGesture"/utf8>>,
gleam@json:bool(Inner_value__@5)}
end
),
chrobot@internal@utils:add_optional(
_pipe@6,
Await_promise,
fun(Inner_value__@6) ->
{<<"awaitPromise"/utf8>>,
gleam@json:bool(Inner_value__@6)}
end
)
end
)}
),
fun(Result__) -> _pipe@7 = decode__evaluate_response(Result__),
gleam@result:replace_error(_pipe@7, protocol_error) end
).
-spec get_properties(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
remote_object_id(),
gleam@option:option(boolean())
) -> {ok, get_properties_response()} | {error, chrome:request_error()}.
get_properties(Callback__, Object_id, Own_properties) ->
gleam@result:'try'(
Callback__(
<<"Runtime.getProperties"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"objectId"/utf8>>,
encode__remote_object_id(Object_id)}],
chrobot@internal@utils:add_optional(
_pipe,
Own_properties,
fun(Inner_value__) ->
{<<"ownProperties"/utf8>>,
gleam@json:bool(Inner_value__)}
end
)
end
)}
),
fun(Result__) -> _pipe@1 = decode__get_properties_response(Result__),
gleam@result:replace_error(_pipe@1, protocol_error) end
).
-spec global_lexical_scope_names(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
gleam@option:option(execution_context_id())
) -> {ok, global_lexical_scope_names_response()} |
{error, chrome:request_error()}.
global_lexical_scope_names(Callback__, Execution_context_id) ->
gleam@result:'try'(
Callback__(
<<"Runtime.globalLexicalScopeNames"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [],
chrobot@internal@utils:add_optional(
_pipe,
Execution_context_id,
fun(Inner_value__) ->
{<<"executionContextId"/utf8>>,
encode__execution_context_id(Inner_value__)}
end
)
end
)}
),
fun(Result__) ->
_pipe@1 = decode__global_lexical_scope_names_response(Result__),
gleam@result:replace_error(_pipe@1, protocol_error)
end
).
-spec query_objects(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
remote_object_id(),
gleam@option:option(binary())
) -> {ok, query_objects_response()} | {error, chrome:request_error()}.
query_objects(Callback__, Prototype_object_id, Object_group) ->
gleam@result:'try'(
Callback__(
<<"Runtime.queryObjects"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"prototypeObjectId"/utf8>>,
encode__remote_object_id(Prototype_object_id)}],
chrobot@internal@utils:add_optional(
_pipe,
Object_group,
fun(Inner_value__) ->
{<<"objectGroup"/utf8>>,
gleam@json:string(Inner_value__)}
end
)
end
)}
),
fun(Result__) -> _pipe@1 = decode__query_objects_response(Result__),
gleam@result:replace_error(_pipe@1, protocol_error) end
).
-spec release_object(
fun((binary(), gleam@option:option(gleam@json:json())) -> QPM),
remote_object_id()
) -> QPM.
release_object(Callback__, Object_id) ->
Callback__(
<<"Runtime.releaseObject"/utf8>>,
{some,
gleam@json:object(
[{<<"objectId"/utf8>>, encode__remote_object_id(Object_id)}]
)}
).
-spec release_object_group(
fun((binary(), gleam@option:option(gleam@json:json())) -> QPR),
binary()
) -> QPR.
release_object_group(Callback__, Object_group) ->
Callback__(
<<"Runtime.releaseObjectGroup"/utf8>>,
{some,
gleam@json:object(
[{<<"objectGroup"/utf8>>, gleam@json:string(Object_group)}]
)}
).
-spec run_if_waiting_for_debugger(
fun((binary(), gleam@option:option(any())) -> QPW)
) -> QPW.
run_if_waiting_for_debugger(Callback__) ->
Callback__(<<"Runtime.runIfWaitingForDebugger"/utf8>>, none).
-spec run_script(
fun((binary(), gleam@option:option(gleam@json:json())) -> {ok,
gleam@dynamic:dynamic_()} |
{error, chrome:request_error()}),
script_id(),
gleam@option:option(execution_context_id()),
gleam@option:option(binary()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean()),
gleam@option:option(boolean())
) -> {ok, run_script_response()} | {error, chrome:request_error()}.
run_script(
Callback__,
Script_id,
Execution_context_id,
Object_group,
Silent,
Include_command_line_api,
Return_by_value,
Generate_preview,
Await_promise
) ->
gleam@result:'try'(
Callback__(
<<"Runtime.runScript"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"scriptId"/utf8>>,
encode__script_id(Script_id)}],
_pipe@1 = chrobot@internal@utils:add_optional(
_pipe,
Execution_context_id,
fun(Inner_value__) ->
{<<"executionContextId"/utf8>>,
encode__execution_context_id(Inner_value__)}
end
),
_pipe@2 = chrobot@internal@utils:add_optional(
_pipe@1,
Object_group,
fun(Inner_value__@1) ->
{<<"objectGroup"/utf8>>,
gleam@json:string(Inner_value__@1)}
end
),
_pipe@3 = chrobot@internal@utils:add_optional(
_pipe@2,
Silent,
fun(Inner_value__@2) ->
{<<"silent"/utf8>>,
gleam@json:bool(Inner_value__@2)}
end
),
_pipe@4 = chrobot@internal@utils:add_optional(
_pipe@3,
Include_command_line_api,
fun(Inner_value__@3) ->
{<<"includeCommandLineAPI"/utf8>>,
gleam@json:bool(Inner_value__@3)}
end
),
_pipe@5 = chrobot@internal@utils:add_optional(
_pipe@4,
Return_by_value,
fun(Inner_value__@4) ->
{<<"returnByValue"/utf8>>,
gleam@json:bool(Inner_value__@4)}
end
),
_pipe@6 = chrobot@internal@utils:add_optional(
_pipe@5,
Generate_preview,
fun(Inner_value__@5) ->
{<<"generatePreview"/utf8>>,
gleam@json:bool(Inner_value__@5)}
end
),
chrobot@internal@utils:add_optional(
_pipe@6,
Await_promise,
fun(Inner_value__@6) ->
{<<"awaitPromise"/utf8>>,
gleam@json:bool(Inner_value__@6)}
end
)
end
)}
),
fun(Result__) -> _pipe@7 = decode__run_script_response(Result__),
gleam@result:replace_error(_pipe@7, protocol_error) end
).
-spec set_async_call_stack_depth(
fun((binary(), gleam@option:option(gleam@json:json())) -> QRA),
integer()
) -> QRA.
set_async_call_stack_depth(Callback__, Max_depth) ->
Callback__(
<<"Runtime.setAsyncCallStackDepth"/utf8>>,
{some,
gleam@json:object(
[{<<"maxDepth"/utf8>>, gleam@json:int(Max_depth)}]
)}
).
-spec add_binding(
fun((binary(), gleam@option:option(gleam@json:json())) -> QRF),
binary(),
gleam@option:option(binary())
) -> QRF.
add_binding(Callback__, Name, Execution_context_name) ->
Callback__(
<<"Runtime.addBinding"/utf8>>,
{some,
gleam@json:object(
begin
_pipe = [{<<"name"/utf8>>, gleam@json:string(Name)}],
chrobot@internal@utils:add_optional(
_pipe,
Execution_context_name,
fun(Inner_value__) ->
{<<"executionContextName"/utf8>>,
gleam@json:string(Inner_value__)}
end
)
end
)}
).
-spec remove_binding(
fun((binary(), gleam@option:option(gleam@json:json())) -> QRM),
binary()
) -> QRM.
remove_binding(Callback__, Name) ->
Callback__(
<<"Runtime.removeBinding"/utf8>>,
{some, gleam@json:object([{<<"name"/utf8>>, gleam@json:string(Name)}])}
).