-module(admin@types). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/admin/types.gleam"). -export([remove_edges_and_nodes/1, reshape_images/2, image_edge_to_json/1, image_connection_to_json/1, image_edges_decoder/0, image_connection_decoder/0, media_preview_image_status_to_json/1, media_preview_image_to_json/1, media_preview_image_status_decoder/0, media_preview_image_decoder/0, media_content_type_to_json/1, media_content_type_decoder/0, count_precision_to_json/1, count_to_json/1, count_precision_decoder/0, count_decoder/0, sort_key_decoder/0, sort_key_from_string/1, sort_key_to_json/1, merchandise_decoder/0, pagination_to_json/1, pagination_decoder/0, product_to_json/1, product_edge_to_json/1, product_connection_to_json/1, price_range_to_json/1, product_decoder/0, product_edges_decoder/0, product_connection_decoder/0, get_products_query_decoder/0, price_range_decoder/0, cost_decoder/0, cart_decoder/0, cart_item_edge_decoder/0, cart_item_connection_decoder/0, shopify_cart_decoder/0]). -export_type([get_products_query/0, product_connection/0, product_edge/0, product/0, product_price_range/0, product_compare_at_price_range/0, product_variant/0, product_variant_connection/0, product_variant_edge/0, selected_option/0, media_connection/0, media_edge/0, media/0, preview/0, image/0, seo/0, variants_count/0, media_preview_image/0, media_preview_image_status/0, media_content_type/0, featured_media/0, count/0, count_precision/0, 'maybe'/1, connection/1, edge/1, price_range/0, cost/0, products/0, shopify_collection/0, sort_key/0, cart/0, shopify_cart/0, shopify_cart_cost/0, cart_item/0, merchandise/0, cart_product/0, pagination/0, product_option/0, money/0]). -type get_products_query() :: {get_products_query, connection(product())}. -type product_connection() :: {product_connection, connection(product())}. -type product_edge() :: {product_edge, edge(product())}. -type product() :: {product, binary(), binary(), binary(), gleam@option:option(integer()), gleam@option:option(binary()), gleam@option:option(binary()), binary(), list(product_option()), product_price_range(), gleam@option:option(product_compare_at_price_range()), product_variant_connection(), gleam@option:option(media()), media_connection(), gleam@option:option(seo()), list(binary()), binary(), binary(), gleam@option:option(binary()), variants_count()}. -type product_price_range() :: {product_price_range, money(), money()}. -type product_compare_at_price_range() :: {product_compare_at_price_range, gleam@option:option(money()), gleam@option:option(money())}. -type product_variant() :: {product_variant, binary(), binary(), boolean(), list(selected_option()), binary()}. -type product_variant_connection() :: {product_variant_connection, list(product_variant_edge())}. -type product_variant_edge() :: {product_variant_edge, product_variant()}. -type selected_option() :: {selected_option, binary(), binary()}. -type media_connection() :: {media_connection, list(media_edge())}. -type media_edge() :: {media_edge, media()}. -type media() :: {media, binary(), binary(), gleam@option:option(binary()), gleam@option:option(preview())}. -type preview() :: {preview, gleam@option:option(image()), binary()}. -type image() :: {image, binary(), binary(), gleam@option:option(binary()), gleam@option:option(integer()), gleam@option:option(integer()), gleam@option:option(binary())}. -type seo() :: {seo, gleam@option:option(binary()), gleam@option:option(binary())}. -type variants_count() :: {variants_count, integer(), binary()}. -type media_preview_image() :: {media_preview_image, gleam@option:option(image()), media_preview_image_status()}. -type media_preview_image_status() :: failed | processing | ready | uploaded. -type media_content_type() :: external_video | image_content | model3_d | video. -type featured_media() :: {featured_media, binary(), media_content_type(), gleam@option:option(binary()), gleam@option:option(media_preview_image())}. -type count() :: {count, integer(), count_precision()}. -type count_precision() :: at_least | exact. -type 'maybe'(GZE) :: {'maybe', gleam@option:option(GZE)}. -type connection(GZF) :: {connection, list(edge(GZF))}. -type edge(GZG) :: {edge, GZG}. -type price_range() :: {price_range, money(), money()}. -type cost() :: {cost, money()}. -type products() :: {products, list(product())}. -type shopify_collection() :: {shopify_collection, binary(), binary(), binary(), seo(), binary()}. -type sort_key() :: inventory_total | title | product_type | vendor | updated_at | created_at | published_at | price | id | relevance. -type cart() :: {cart, gleam@option:option(binary()), binary(), gleam@option:option(shopify_cart_cost()), integer(), list(cart_item())}. -type shopify_cart() :: {shopify_cart, gleam@option:option(binary()), binary(), gleam@option:option(shopify_cart_cost()), connection(cart_item()), integer()}. -type shopify_cart_cost() :: {shopify_cart_cost, money(), money(), money()}. -type cart_item() :: {cart_item, gleam@option:option(binary()), integer(), cost(), merchandise()}. -type merchandise() :: {merchandise, binary(), binary(), list(selected_option()), cart_product()}. -type cart_product() :: {cart_product, binary(), binary(), binary(), image()}. -type pagination() :: {pagination, boolean(), boolean(), binary(), binary()}. -type product_option() :: {product_option, binary(), binary(), list(binary())}. -type money() :: {money, binary(), binary()}. -file("src/admin/types.gleam", 7). -spec remove_edges_and_nodes(connection(GZH)) -> list(GZH). remove_edges_and_nodes(Array) -> _pipe = erlang:element(2, Array), gleam@list:map(_pipe, fun(Nodes) -> erlang:element(2, Nodes) end). -file("src/admin/types.gleam", 76). -spec last_split(binary(), binary()) -> {ok, {binary(), binary()}} | {error, nil}. last_split(Str, Separator) -> Reversed_str = gleam@string:reverse(Str), Reversed_separator = gleam@string:reverse(Separator), case gleam@string:split_once(Reversed_str, Reversed_separator) of {ok, {After_reversed, Before_reversed}} -> Before = gleam@string:reverse(Before_reversed), After = gleam@string:reverse(After_reversed), {ok, {Before, After}}; {error, _} -> {error, nil} end. -file("src/admin/types.gleam", 64). -spec get_filename(binary()) -> binary(). get_filename(Url) -> Path_segment = case last_split(Url, <<"/"/utf8>>) of {ok, {_, After}} -> After; {error, _} -> Url end, case last_split(Path_segment, <<"."/utf8>>) of {ok, {Before, _}} -> Before; {error, _} -> Path_segment end. -file("src/admin/types.gleam", 46). -spec reshape_images(connection(image()), binary()) -> list(image()). reshape_images(Images, Product_title) -> Flattened = remove_edges_and_nodes(Images), _pipe = Flattened, gleam@list:map( _pipe, fun(Image) -> New_alt_text = case erlang:element(4, Image) of none -> Filename = get_filename(erlang:element(2, Image)), <<<>/binary, Filename/binary>>; {some, Text} -> Text end, {image, erlang:element(2, Image), erlang:element(3, Image), {some, New_alt_text}, erlang:element(5, Image), erlang:element(6, Image), erlang:element(7, Image)} end ). -file("src/admin/types.gleam", 439). -spec selected_option_to_json(selected_option()) -> gleam@json:json(). selected_option_to_json(Selected_option) -> {selected_option, Name, Value} = Selected_option, gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(Name)}, {<<"value"/utf8>>, gleam@json:string(Value)}] ). -file("src/admin/types.gleam", 359). -spec product_variant_to_json(product_variant()) -> gleam@json:json(). product_variant_to_json(Product_variant) -> {product_variant, Id, Title, Available_for_sale, Selected_options, Price} = Product_variant, gleam@json:object( [{<<"id"/utf8>>, gleam@json:string(Id)}, {<<"title"/utf8>>, gleam@json:string(Title)}, {<<"availableForSale"/utf8>>, gleam@json:bool(Available_for_sale)}, {<<"selectedOptions"/utf8>>, gleam@json:array( Selected_options, fun selected_option_to_json/1 )}, {<<"price"/utf8>>, gleam@json:string(Price)}] ). -file("src/admin/types.gleam", 421). -spec product_variant_edge_to_json(product_variant_edge()) -> gleam@json:json(). product_variant_edge_to_json(Product_variant_edge) -> {product_variant_edge, Node} = Product_variant_edge, gleam@json:object([{<<"node"/utf8>>, product_variant_to_json(Node)}]). -file("src/admin/types.gleam", 398). -spec product_variant_connection_to_json(product_variant_connection()) -> gleam@json:json(). product_variant_connection_to_json(Product_variant_connection) -> {product_variant_connection, Edges} = Product_variant_connection, gleam@json:object( [{<<"edges"/utf8>>, gleam@json:array(Edges, fun product_variant_edge_to_json/1)}] ). -file("src/admin/types.gleam", 447). -spec selected_option_decoder() -> gleam@dynamic@decode:decoder(selected_option()). selected_option_decoder() -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"value"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Value) -> gleam@dynamic@decode:success({selected_option, Name, Value}) end ) end ). -file("src/admin/types.gleam", 376). -spec product_variant_decoder() -> gleam@dynamic@decode:decoder(product_variant()). product_variant_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"title"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Title) -> gleam@dynamic@decode:field( <<"availableForSale"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Available_for_sale) -> gleam@dynamic@decode:field( <<"selectedOptions"/utf8>>, gleam@dynamic@decode:list( selected_option_decoder() ), fun(Selected_options) -> gleam@dynamic@decode:field( <<"price"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Price) -> gleam@dynamic@decode:success( {product_variant, Id, Title, Available_for_sale, Selected_options, Price} ) end ) end ) end ) end ) end ). -file("src/admin/types.gleam", 430). -spec product_variant_edge_decoder() -> gleam@dynamic@decode:decoder(product_variant_edge()). product_variant_edge_decoder() -> gleam@dynamic@decode:field( <<"node"/utf8>>, product_variant_decoder(), fun(Node) -> gleam@dynamic@decode:success({product_variant_edge, Node}) end ). -file("src/admin/types.gleam", 407). -spec product_variant_connection_decoder() -> gleam@dynamic@decode:decoder(product_variant_connection()). product_variant_connection_decoder() -> gleam@dynamic@decode:field( <<"edges"/utf8>>, gleam@dynamic@decode:list(product_variant_edge_decoder()), fun(Edges) -> gleam@dynamic@decode:success({product_variant_connection, Edges}) end ). -file("src/admin/types.gleam", 550). -spec image_to_json(image()) -> gleam@json:json(). image_to_json(Image) -> {image, Url, Id, Alt_text, Width, Height, Thumbhash} = Image, gleam@json:object( [{<<"url"/utf8>>, gleam@json:string(Url)}, {<<"id"/utf8>>, gleam@json:string(Id)}, {<<"altText"/utf8>>, case Alt_text of none -> gleam@json:null(); {some, Value} -> gleam@json:string(Value) end}, {<<"width"/utf8>>, case Width of none -> gleam@json:null(); {some, Value@1} -> gleam@json:int(Value@1) end}, {<<"height"/utf8>>, case Height of none -> gleam@json:null(); {some, Value@2} -> gleam@json:int(Value@2) end}, {<<"thumbhash"/utf8>>, case Thumbhash of none -> gleam@json:null(); {some, Value@3} -> gleam@json:string(Value@3) end}] ). -file("src/admin/types.gleam", 39). -spec image_edge_to_json(edge(image())) -> gleam@json:json(). image_edge_to_json(Edge) -> {edge, Node} = Edge, gleam@json:object([{<<"node"/utf8>>, image_to_json(Node)}]). -file("src/admin/types.gleam", 32). -spec image_connection_to_json(connection(image())) -> gleam@json:json(). image_connection_to_json(Connection) -> {connection, Edges} = Connection, gleam@json:object( [{<<"edges"/utf8>>, gleam@json:array(Edges, fun image_edge_to_json/1)}] ). -file("src/admin/types.gleam", 522). -spec preview_to_json(preview()) -> gleam@json:json(). preview_to_json(Preview) -> {preview, Image, Status} = Preview, gleam@json:object([{<<"image"/utf8>>, case Image of none -> gleam@json:null(); {some, Value} -> image_to_json(Value) end}, {<<"status"/utf8>>, gleam@json:string(Status)}]). -file("src/admin/types.gleam", 494). -spec media_to_json(media()) -> gleam@json:json(). media_to_json(Media) -> {media, Id, Media_content_type, Alt, Preview} = Media, gleam@json:object( [{<<"id"/utf8>>, gleam@json:string(Id)}, {<<"mediaContentType"/utf8>>, gleam@json:string(Media_content_type)}, {<<"alt"/utf8>>, case Alt of none -> gleam@json:null(); {some, Value} -> gleam@json:string(Value) end}, {<<"preview"/utf8>>, case Preview of none -> gleam@json:null(); {some, Value@1} -> preview_to_json(Value@1) end}] ). -file("src/admin/types.gleam", 473). -spec media_edge_to_json(media_edge()) -> gleam@json:json(). media_edge_to_json(Media_edge) -> {media_edge, Node} = Media_edge, gleam@json:object([{<<"node"/utf8>>, media_to_json(Node)}]). -file("src/admin/types.gleam", 457). -spec media_connection_to_json(media_connection()) -> gleam@json:json(). media_connection_to_json(Media_connection) -> {media_connection, Edges} = Media_connection, gleam@json:object( [{<<"edges"/utf8>>, gleam@json:array(Edges, fun media_edge_to_json/1)}] ). -file("src/admin/types.gleam", 574). -spec image_decoder() -> gleam@dynamic@decode:decoder(image()). image_decoder() -> gleam@dynamic@decode:field( <<"url"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Url) -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"altText"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Alt_text) -> gleam@dynamic@decode:field( <<"width"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_int/1} ), fun(Width) -> gleam@dynamic@decode:field( <<"height"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_int/1} ), fun(Height) -> gleam@dynamic@decode:field( <<"thumbhash"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Thumbhash) -> gleam@dynamic@decode:success( {image, Url, Id, Alt_text, Width, Height, Thumbhash} ) end ) end ) end ) end ) end ) end ). -file("src/admin/types.gleam", 27). -spec image_edges_decoder() -> gleam@dynamic@decode:decoder(edge(image())). image_edges_decoder() -> gleam@dynamic@decode:field( <<"node"/utf8>>, image_decoder(), fun(Node) -> gleam@dynamic@decode:success({edge, Node}) end ). -file("src/admin/types.gleam", 22). -spec image_connection_decoder() -> gleam@dynamic@decode:decoder(connection(image())). image_connection_decoder() -> gleam@dynamic@decode:field( <<"edges"/utf8>>, gleam@dynamic@decode:list(image_edges_decoder()), fun(Edges) -> gleam@dynamic@decode:success({connection, Edges}) end ). -file("src/admin/types.gleam", 533). -spec preview_decoder() -> gleam@dynamic@decode:decoder(preview()). preview_decoder() -> gleam@dynamic@decode:field( <<"image"/utf8>>, gleam@dynamic@decode:optional(image_decoder()), fun(Image) -> gleam@dynamic@decode:field( <<"status"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Status) -> gleam@dynamic@decode:success({preview, Image, Status}) end ) end ). -file("src/admin/types.gleam", 510). -spec media_decoder() -> gleam@dynamic@decode:decoder(media()). media_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"mediaContentType"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Media_content_type) -> gleam@dynamic@decode:field( <<"alt"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Alt) -> gleam@dynamic@decode:field( <<"preview"/utf8>>, gleam@dynamic@decode:optional(preview_decoder()), fun(Preview) -> gleam@dynamic@decode:success( {media, Id, Media_content_type, Alt, Preview} ) end ) end ) end ) end ). -file("src/admin/types.gleam", 480). -spec media_edge_decoder() -> gleam@dynamic@decode:decoder(media_edge()). media_edge_decoder() -> gleam@dynamic@decode:field( <<"node"/utf8>>, media_decoder(), fun(Node) -> gleam@dynamic@decode:success({media_edge, Node}) end ). -file("src/admin/types.gleam", 464). -spec media_connection_decoder() -> gleam@dynamic@decode:decoder(media_connection()). media_connection_decoder() -> gleam@dynamic@decode:field( <<"edges"/utf8>>, gleam@dynamic@decode:list(media_edge_decoder()), fun(Edges) -> gleam@dynamic@decode:success({media_connection, Edges}) end ). -file("src/admin/types.gleam", 588). -spec seo_to_json(seo()) -> gleam@json:json(). seo_to_json(Seo) -> {seo, Description, Title} = Seo, gleam@json:object([{<<"description"/utf8>>, case Description of none -> gleam@json:null(); {some, Value} -> gleam@json:string(Value) end}, {<<"title"/utf8>>, case Title of none -> gleam@json:null(); {some, Value@1} -> gleam@json:string(Value@1) end}]). -file("src/admin/types.gleam", 602). -spec seo_decoder() -> gleam@dynamic@decode:decoder(seo()). seo_decoder() -> gleam@dynamic@decode:field( <<"description"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Description) -> gleam@dynamic@decode:field( <<"title"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Title) -> gleam@dynamic@decode:success({seo, Description, Title}) end ) end ). -file("src/admin/types.gleam", 612). -spec variants_count_to_json(variants_count()) -> gleam@json:json(). variants_count_to_json(Variants_count) -> {variants_count, Count, Precision} = Variants_count, gleam@json:object( [{<<"count"/utf8>>, gleam@json:int(Count)}, {<<"precision"/utf8>>, gleam@json:string(Precision)}] ). -file("src/admin/types.gleam", 620). -spec variants_count_decoder() -> gleam@dynamic@decode:decoder(variants_count()). variants_count_decoder() -> gleam@dynamic@decode:field( <<"count"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Count) -> gleam@dynamic@decode:field( <<"precision"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Precision) -> gleam@dynamic@decode:success( {variants_count, Count, Precision} ) end ) end ). -file("src/admin/types.gleam", 656). -spec media_preview_image_status_to_json(media_preview_image_status()) -> gleam@json:json(). media_preview_image_status_to_json(Media_preview_image_status) -> case Media_preview_image_status of failed -> gleam@json:string(<<"FAILED"/utf8>>); processing -> gleam@json:string(<<"PROCESSING"/utf8>>); ready -> gleam@json:string(<<"READY"/utf8>>); uploaded -> gleam@json:string(<<"UPLOADED"/utf8>>) end. -file("src/admin/types.gleam", 630). -spec media_preview_image_to_json(media_preview_image()) -> gleam@json:json(). media_preview_image_to_json(Media_preview_image) -> {media_preview_image, Image, Status} = Media_preview_image, gleam@json:object([{<<"image"/utf8>>, case Image of none -> gleam@json:null(); {some, Value} -> image_to_json(Value) end}, {<<"status"/utf8>>, media_preview_image_status_to_json(Status)}]). -file("src/admin/types.gleam", 667). -spec media_preview_image_status_decoder() -> gleam@dynamic@decode:decoder(media_preview_image_status()). media_preview_image_status_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"FAILED"/utf8>> -> gleam@dynamic@decode:success(failed); <<"PROCESSING"/utf8>> -> gleam@dynamic@decode:success(processing); <<"READY"/utf8>> -> gleam@dynamic@decode:success(ready); <<"UPLOADED"/utf8>> -> gleam@dynamic@decode:success(uploaded); _ -> gleam@dynamic@decode:failure( failed, <<"MediaPreviewImageStatus"/utf8>> ) end end ). -file("src/admin/types.gleam", 643). -spec media_preview_image_decoder() -> gleam@dynamic@decode:decoder(media_preview_image()). media_preview_image_decoder() -> gleam@dynamic@decode:field( <<"image"/utf8>>, gleam@dynamic@decode:optional(image_decoder()), fun(Image) -> gleam@dynamic@decode:field( <<"status"/utf8>>, media_preview_image_status_decoder(), fun(Status) -> gleam@dynamic@decode:success( {media_preview_image, Image, Status} ) end ) end ). -file("src/admin/types.gleam", 687). -spec media_content_type_to_json(media_content_type()) -> gleam@json:json(). media_content_type_to_json(Media_content_type) -> case Media_content_type of external_video -> gleam@json:string(string:uppercase(<<"EXTERNAL_VIDEO"/utf8>>)); image_content -> gleam@json:string(string:uppercase(<<"IMAGE"/utf8>>)); model3_d -> gleam@json:string(string:uppercase(<<"MODEL_3D"/utf8>>)); video -> gleam@json:string(string:uppercase(<<"VIDEO"/utf8>>)) end. -file("src/admin/types.gleam", 698). -spec media_content_type_decoder() -> gleam@dynamic@decode:decoder(media_content_type()). media_content_type_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"EXTERNAL_VIDEO"/utf8>> -> gleam@dynamic@decode:success(external_video); <<"IMAGE"/utf8>> -> gleam@dynamic@decode:success(image_content); <<"MODEL_3D"/utf8>> -> gleam@dynamic@decode:success(model3_d); <<"VIDEO"/utf8>> -> gleam@dynamic@decode:success(video); _ -> gleam@dynamic@decode:failure( image_content, <<"MediaContentType"/utf8>> ) end end ). -file("src/admin/types.gleam", 741). -spec count_precision_to_json(count_precision()) -> gleam@json:json(). count_precision_to_json(Count_precision) -> case Count_precision of at_least -> gleam@json:string(<<"AT_LEAST"/utf8>>); exact -> gleam@json:string(<<"EXACT"/utf8>>) end. -file("src/admin/types.gleam", 722). -spec count_to_json(count()) -> gleam@json:json(). count_to_json(Count) -> {count, Count@1, Precision} = Count, gleam@json:object( [{<<"count"/utf8>>, gleam@json:int(Count@1)}, {<<"precision"/utf8>>, count_precision_to_json(Precision)}] ). -file("src/admin/types.gleam", 748). -spec count_precision_decoder() -> gleam@dynamic@decode:decoder(count_precision()). count_precision_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"AT_LEAST"/utf8>> -> gleam@dynamic@decode:success(at_least); <<"EXACT"/utf8>> -> gleam@dynamic@decode:success(exact); _ -> gleam@dynamic@decode:failure( at_least, <<"CountPrecision"/utf8>> ) end end ). -file("src/admin/types.gleam", 730). -spec count_decoder() -> gleam@dynamic@decode:decoder(count()). count_decoder() -> gleam@dynamic@decode:field( <<"count"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Count) -> gleam@dynamic@decode:field( <<"precision"/utf8>>, count_precision_decoder(), fun(Precision) -> gleam@dynamic@decode:success({count, Count, Precision}) end ) end ). -file("src/admin/types.gleam", 833). -spec sort_key_decoder() -> gleam@dynamic@decode:decoder(sort_key()). sort_key_decoder() -> gleam@dynamic@decode:then( {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Variant) -> case Variant of <<"INVENTORY_TOTAL"/utf8>> -> gleam@dynamic@decode:success(inventory_total); <<"TITLE"/utf8>> -> gleam@dynamic@decode:success(title); <<"PRODUCT_TYPE"/utf8>> -> gleam@dynamic@decode:success(product_type); <<"VENDOR"/utf8>> -> gleam@dynamic@decode:success(vendor); <<"UPDATED_AT"/utf8>> -> gleam@dynamic@decode:success(updated_at); <<"CREATED_AT"/utf8>> -> gleam@dynamic@decode:success(created_at); <<"PUBLISHED_AT"/utf8>> -> gleam@dynamic@decode:success(published_at); <<"PRICE"/utf8>> -> gleam@dynamic@decode:success(price); <<"ID"/utf8>> -> gleam@dynamic@decode:success(id); <<"RELEVANCE"/utf8>> -> gleam@dynamic@decode:success(relevance); _ -> gleam@dynamic@decode:failure(created_at, <<"SortKey"/utf8>>) end end ). -file("src/admin/types.gleam", 850). -spec sort_key_from_string(binary()) -> gleam@option:option(sort_key()). sort_key_from_string(Value) -> case Value of <<"title"/utf8>> -> {some, title}; <<"product_type"/utf8>> -> {some, product_type}; <<"vendor"/utf8>> -> {some, vendor}; <<"updated_at"/utf8>> -> {some, updated_at}; <<"created_at"/utf8>> -> {some, created_at}; <<"published_at"/utf8>> -> {some, published_at}; <<"inventory_total"/utf8>> -> {some, inventory_total}; <<"price"/utf8>> -> {some, price}; <<"id"/utf8>> -> {some, id}; <<"relevance"/utf8>> -> {some, relevance}; _ -> none end. -file("src/admin/types.gleam", 866). -spec sort_key_to_json(sort_key()) -> gleam@json:json(). sort_key_to_json(Sort_key) -> case Sort_key of title -> gleam@json:string(string:uppercase(<<"title"/utf8>>)); product_type -> gleam@json:string(string:uppercase(<<"product_type"/utf8>>)); vendor -> gleam@json:string(string:uppercase(<<"vendor"/utf8>>)); updated_at -> gleam@json:string(string:uppercase(<<"updated_at"/utf8>>)); created_at -> gleam@json:string(string:uppercase(<<"created_at"/utf8>>)); published_at -> gleam@json:string(string:uppercase(<<"published_at"/utf8>>)); inventory_total -> gleam@json:string(string:uppercase(<<"inventory_total"/utf8>>)); price -> gleam@json:string(string:uppercase(<<"price"/utf8>>)); id -> gleam@json:string(string:uppercase(<<"id"/utf8>>)); relevance -> gleam@json:string(string:uppercase(<<"relevance"/utf8>>)) end. -file("src/admin/types.gleam", 989). -spec cart_product_decoder() -> gleam@dynamic@decode:decoder(cart_product()). cart_product_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"handle"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Handle) -> gleam@dynamic@decode:field( <<"title"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Title) -> gleam@dynamic@decode:field( <<"featuredImage"/utf8>>, image_decoder(), fun(Featured_image) -> gleam@dynamic@decode:success( {cart_product, Id, Handle, Title, Featured_image} ) end ) end ) end ) end ). -file("src/admin/types.gleam", 974). -spec merchandise_decoder() -> gleam@dynamic@decode:decoder(merchandise()). merchandise_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"title"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Title) -> gleam@dynamic@decode:field( <<"selectedOptions"/utf8>>, gleam@dynamic@decode:list(selected_option_decoder()), fun(Selected_options) -> gleam@dynamic@decode:field( <<"product"/utf8>>, cart_product_decoder(), fun(Product) -> gleam@dynamic@decode:success( {merchandise, Id, Title, Selected_options, Product} ) end ) end ) end ) end ). -file("src/admin/types.gleam", 1006). -spec pagination_to_json(pagination()) -> gleam@json:json(). pagination_to_json(Pagination) -> {pagination, Has_next_page, Has_previous_page, Start_cursor, End_cursor} = Pagination, gleam@json:object( [{<<"hasNextPage"/utf8>>, gleam@json:bool(Has_next_page)}, {<<"hasPreviousPage"/utf8>>, gleam@json:bool(Has_previous_page)}, {<<"startCursor"/utf8>>, gleam@json:string(Start_cursor)}, {<<"endCursor"/utf8>>, gleam@json:string(End_cursor)}] ). -file("src/admin/types.gleam", 1017). -spec pagination_decoder() -> gleam@dynamic@decode:decoder(pagination()). pagination_decoder() -> gleam@dynamic@decode:field( <<"hasNextPage"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Has_next_page) -> gleam@dynamic@decode:field( <<"hasPreviousPage"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_bool/1}, fun(Has_previous_page) -> gleam@dynamic@decode:field( <<"startCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Start_cursor) -> gleam@dynamic@decode:field( <<"endCursor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(End_cursor) -> gleam@dynamic@decode:success( {pagination, Has_next_page, Has_previous_page, Start_cursor, End_cursor} ) end ) end ) end ) end ). -file("src/admin/types.gleam", 1034). -spec product_option_to_json(product_option()) -> gleam@json:json(). product_option_to_json(Product_option) -> {product_option, Id, Name, Values} = Product_option, gleam@json:object( [{<<"id"/utf8>>, gleam@json:string(Id)}, {<<"name"/utf8>>, gleam@json:string(Name)}, {<<"values"/utf8>>, gleam@json:array(Values, fun gleam@json:string/1)}] ). -file("src/admin/types.gleam", 1043). -spec product_option_decoder() -> gleam@dynamic@decode:decoder(product_option()). product_option_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"name"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Name) -> gleam@dynamic@decode:field( <<"values"/utf8>>, gleam@dynamic@decode:list( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Values) -> gleam@dynamic@decode:success( {product_option, Id, Name, Values} ) end ) end ) end ). -file("src/admin/types.gleam", 1054). -spec money_to_json(money()) -> gleam@json:json(). money_to_json(Money) -> {money, Amount, Currency_code} = Money, gleam@json:object( [{<<"amount"/utf8>>, gleam@json:string(Amount)}, {<<"currencyCode"/utf8>>, gleam@json:string(Currency_code)}] ). -file("src/admin/types.gleam", 289). -spec product_price_range_to_json(product_price_range()) -> gleam@json:json(). product_price_range_to_json(Product_price_range) -> {product_price_range, Max_variant_price, Min_variant_price} = Product_price_range, gleam@json:object( [{<<"maxVariantPrice"/utf8>>, money_to_json(Max_variant_price)}, {<<"minVariantPrice"/utf8>>, money_to_json(Min_variant_price)}] ). -file("src/admin/types.gleam", 313). -spec product_compare_at_price_range_to_json(product_compare_at_price_range()) -> gleam@json:json(). product_compare_at_price_range_to_json(Product_compare_at_price_range) -> {product_compare_at_price_range, Max_variant_compare_at_price, Min_variant_compare_at_price} = Product_compare_at_price_range, gleam@json:object( [{<<"maxVariantCompareAtPrice"/utf8>>, case Max_variant_compare_at_price of none -> gleam@json:null(); {some, Value} -> money_to_json(Value) end}, {<<"minVariantCompareAtPrice"/utf8>>, case Min_variant_compare_at_price of none -> gleam@json:null(); {some, Value@1} -> money_to_json(Value@1) end}] ). -file("src/admin/types.gleam", 158). -spec product_to_json(product()) -> gleam@json:json(). product_to_json(Product) -> {product, Id, Handle, Title, Total_inventory, Description, Description_html, Vendor, Options, Price_range_v2, Compare_at_price_range, Variants, Featured_media, Media, Seo, Tags, Updated_at, Created_at, Published_at, Variants_count} = Product, gleam@json:object( [{<<"id"/utf8>>, gleam@json:string(Id)}, {<<"handle"/utf8>>, gleam@json:string(Handle)}, {<<"title"/utf8>>, gleam@json:string(Title)}, {<<"totalInventory"/utf8>>, case Total_inventory of none -> gleam@json:null(); {some, Value} -> gleam@json:int(Value) end}, {<<"description"/utf8>>, case Description of none -> gleam@json:null(); {some, Value@1} -> gleam@json:string(Value@1) end}, {<<"descriptionHtml"/utf8>>, case Description_html of none -> gleam@json:null(); {some, Value@2} -> gleam@json:string(Value@2) end}, {<<"vendor"/utf8>>, gleam@json:string(Vendor)}, {<<"options"/utf8>>, gleam@json:array(Options, fun product_option_to_json/1)}, {<<"priceRangeV2"/utf8>>, product_price_range_to_json(Price_range_v2)}, {<<"compareAtPriceRange"/utf8>>, case Compare_at_price_range of none -> gleam@json:null(); {some, Value@3} -> product_compare_at_price_range_to_json(Value@3) end}, {<<"variants"/utf8>>, product_variant_connection_to_json(Variants)}, {<<"featuredMedia"/utf8>>, case Featured_media of none -> gleam@json:null(); {some, Value@4} -> media_to_json(Value@4) end}, {<<"media"/utf8>>, media_connection_to_json(Media)}, {<<"seo"/utf8>>, case Seo of none -> gleam@json:null(); {some, Value@5} -> seo_to_json(Value@5) end}, {<<"tags"/utf8>>, gleam@json:array(Tags, fun gleam@json:string/1)}, {<<"updatedAt"/utf8>>, gleam@json:string(Updated_at)}, {<<"createdAt"/utf8>>, gleam@json:string(Created_at)}, {<<"publishedAt"/utf8>>, case Published_at of none -> gleam@json:null(); {some, Value@6} -> gleam@json:string(Value@6) end}, {<<"variantsCount"/utf8>>, variants_count_to_json(Variants_count)}] ). -file("src/admin/types.gleam", 127). -spec product_edge_to_json(edge(product())) -> gleam@json:json(). product_edge_to_json(Edge) -> {edge, Node} = Edge, gleam@json:object([{<<"node"/utf8>>, product_to_json(Node)}]). -file("src/admin/types.gleam", 120). -spec product_connection_to_json(connection(product())) -> gleam@json:json(). product_connection_to_json(Connection) -> {connection, Edges} = Connection, gleam@json:object( [{<<"edges"/utf8>>, gleam@json:array(Edges, fun product_edge_to_json/1)}] ). -file("src/admin/types.gleam", 783). -spec price_range_to_json(price_range()) -> gleam@json:json(). price_range_to_json(Price_range) -> {price_range, Max_variant_price, Min_variant_price} = Price_range, gleam@json:object( [{<<"maxVariantPrice"/utf8>>, money_to_json(Max_variant_price)}, {<<"minVariantPrice"/utf8>>, money_to_json(Min_variant_price)}] ). -file("src/admin/types.gleam", 1062). -spec money_decoder() -> gleam@dynamic@decode:decoder(money()). money_decoder() -> gleam@dynamic@decode:field( <<"amount"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Amount) -> gleam@dynamic@decode:field( <<"currencyCode"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Currency_code) -> gleam@dynamic@decode:success({money, Amount, Currency_code}) end ) end ). -file("src/admin/types.gleam", 300). -spec product_price_range_decoder() -> gleam@dynamic@decode:decoder(product_price_range()). product_price_range_decoder() -> gleam@dynamic@decode:field( <<"maxVariantPrice"/utf8>>, money_decoder(), fun(Max_variant_price) -> gleam@dynamic@decode:field( <<"minVariantPrice"/utf8>>, money_decoder(), fun(Min_variant_price) -> gleam@dynamic@decode:success( {product_price_range, Max_variant_price, Min_variant_price} ) end ) end ). -file("src/admin/types.gleam", 332). -spec product_compare_at_price_range_decoder() -> gleam@dynamic@decode:decoder(product_compare_at_price_range()). product_compare_at_price_range_decoder() -> gleam@dynamic@decode:field( <<"maxVariantCompareAtPrice"/utf8>>, gleam@dynamic@decode:optional(money_decoder()), fun(Max_variant_compare_at_price) -> gleam@dynamic@decode:field( <<"minVariantCompareAtPrice"/utf8>>, gleam@dynamic@decode:optional(money_decoder()), fun(Min_variant_compare_at_price) -> gleam@dynamic@decode:success( {product_compare_at_price_range, Max_variant_compare_at_price, Min_variant_compare_at_price} ) end ) end ). -file("src/admin/types.gleam", 224). -spec product_decoder() -> gleam@dynamic@decode:decoder(product()). product_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Id) -> gleam@dynamic@decode:field( <<"handle"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Handle) -> gleam@dynamic@decode:field( <<"title"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Title) -> gleam@dynamic@decode:field( <<"totalInventory"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_int/1} ), fun(Total_inventory) -> gleam@dynamic@decode:field( <<"description"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Description) -> gleam@dynamic@decode:field( <<"descriptionHtml"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Description_html) -> gleam@dynamic@decode:field( <<"vendor"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Vendor) -> gleam@dynamic@decode:field( <<"options"/utf8>>, gleam@dynamic@decode:list( product_option_decoder( ) ), fun(Options) -> gleam@dynamic@decode:field( <<"priceRangeV2"/utf8>>, product_price_range_decoder( ), fun( Price_range_v2 ) -> gleam@dynamic@decode:field( <<"compareAtPriceRange"/utf8>>, gleam@dynamic@decode:optional( product_compare_at_price_range_decoder( ) ), fun( Compare_at_price_range ) -> gleam@dynamic@decode:field( <<"variants"/utf8>>, product_variant_connection_decoder( ), fun( Variants ) -> gleam@dynamic@decode:field( <<"featuredMedia"/utf8>>, gleam@dynamic@decode:optional( media_decoder( ) ), fun( Featured_media ) -> gleam@dynamic@decode:field( <<"media"/utf8>>, media_connection_decoder( ), fun( Media ) -> gleam@dynamic@decode:field( <<"seo"/utf8>>, gleam@dynamic@decode:optional( seo_decoder( ) ), fun( Seo ) -> gleam@dynamic@decode:field( <<"tags"/utf8>>, gleam@dynamic@decode:list( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun( Tags ) -> gleam@dynamic@decode:field( <<"updatedAt"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun( Updated_at ) -> gleam@dynamic@decode:field( <<"createdAt"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun( Created_at ) -> gleam@dynamic@decode:field( <<"publishedAt"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun( Published_at ) -> gleam@dynamic@decode:field( <<"variantsCount"/utf8>>, variants_count_decoder( ), fun( Variants_count ) -> gleam@dynamic@decode:success( {product, Id, Handle, Title, Total_inventory, Description, Description_html, Vendor, Options, Price_range_v2, Compare_at_price_range, Variants, Featured_media, Media, Seo, Tags, Updated_at, Created_at, Published_at, Variants_count} ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ) end ). -file("src/admin/types.gleam", 115). -spec product_edges_decoder() -> gleam@dynamic@decode:decoder(edge(product())). product_edges_decoder() -> gleam@dynamic@decode:field( <<"node"/utf8>>, product_decoder(), fun(Node) -> gleam@dynamic@decode:success({edge, Node}) end ). -file("src/admin/types.gleam", 110). -spec product_connection_decoder() -> gleam@dynamic@decode:decoder(connection(product())). product_connection_decoder() -> gleam@dynamic@decode:field( <<"edges"/utf8>>, gleam@dynamic@decode:list(product_edges_decoder()), fun(Edges) -> gleam@dynamic@decode:success({connection, Edges}) end ). -file("src/admin/types.gleam", 97). -spec get_products_query_decoder() -> gleam@dynamic@decode:decoder(get_products_query()). get_products_query_decoder() -> gleam@dynamic@decode:field( <<"products"/utf8>>, product_connection_decoder(), fun(Products) -> gleam@dynamic@decode:success({get_products_query, Products}) end ). -file("src/admin/types.gleam", 791). -spec price_range_decoder() -> gleam@dynamic@decode:decoder(price_range()). price_range_decoder() -> gleam@dynamic@decode:field( <<"maxVariantPrice"/utf8>>, money_decoder(), fun(Max_variant_price) -> gleam@dynamic@decode:field( <<"minVariantPrice"/utf8>>, money_decoder(), fun(Min_variant_price) -> gleam@dynamic@decode:success( {price_range, Max_variant_price, Min_variant_price} ) end ) end ). -file("src/admin/types.gleam", 801). -spec cost_decoder() -> gleam@dynamic@decode:decoder(cost()). cost_decoder() -> gleam@dynamic@decode:field( <<"totalAmount"/utf8>>, money_decoder(), fun(Total_amount) -> gleam@dynamic@decode:success({cost, Total_amount}) end ). -file("src/admin/types.gleam", 937). -spec shopify_cart_cost_decoder() -> gleam@dynamic@decode:decoder(shopify_cart_cost()). shopify_cart_cost_decoder() -> gleam@dynamic@decode:field( <<"totalAmount"/utf8>>, money_decoder(), fun(Total_amount) -> gleam@dynamic@decode:field( <<"subtotalAmount"/utf8>>, money_decoder(), fun(Subtotal_amount) -> gleam@dynamic@decode:field( <<"totalTaxAmount"/utf8>>, money_decoder(), fun(Total_tax_amount) -> gleam@dynamic@decode:success( {shopify_cart_cost, Total_amount, Subtotal_amount, Total_tax_amount} ) end ) end ) end ). -file("src/admin/types.gleam", 957). -spec cart_item_decoder() -> gleam@dynamic@decode:decoder(cart_item()). cart_item_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Id) -> gleam@dynamic@decode:field( <<"quantity"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Quantity) -> gleam@dynamic@decode:field( <<"cost"/utf8>>, cost_decoder(), fun(Cost) -> gleam@dynamic@decode:field( <<"merchandise"/utf8>>, merchandise_decoder(), fun(Merchandise) -> gleam@dynamic@decode:success( {cart_item, Id, Quantity, Cost, Merchandise} ) end ) end ) end ) end ). -file("src/admin/types.gleam", 891). -spec cart_decoder() -> gleam@dynamic@decode:decoder(cart()). cart_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Id) -> gleam@dynamic@decode:field( <<"checkoutUrl"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Checkout_url) -> gleam@dynamic@decode:field( <<"cost"/utf8>>, gleam@dynamic@decode:optional( shopify_cart_cost_decoder() ), fun(Cost) -> gleam@dynamic@decode:field( <<"totalQuantity"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Total_quantity) -> gleam@dynamic@decode:field( <<"lines"/utf8>>, gleam@dynamic@decode:list( cart_item_decoder() ), fun(Lines) -> gleam@dynamic@decode:success( {cart, Id, Checkout_url, Cost, Total_quantity, Lines} ) end ) end ) end ) end ) end ). -file("src/admin/types.gleam", 910). -spec cart_item_edge_decoder() -> gleam@dynamic@decode:decoder(edge(cart_item())). cart_item_edge_decoder() -> gleam@dynamic@decode:field( <<"node"/utf8>>, cart_item_decoder(), fun(Node) -> gleam@dynamic@decode:success({edge, Node}) end ). -file("src/admin/types.gleam", 915). -spec cart_item_connection_decoder() -> gleam@dynamic@decode:decoder(connection(cart_item())). cart_item_connection_decoder() -> gleam@dynamic@decode:field( <<"edges"/utf8>>, gleam@dynamic@decode:list(cart_item_edge_decoder()), fun(Edges) -> gleam@dynamic@decode:success({connection, Edges}) end ). -file("src/admin/types.gleam", 920). -spec shopify_cart_decoder() -> gleam@dynamic@decode:decoder(shopify_cart()). shopify_cart_decoder() -> gleam@dynamic@decode:field( <<"id"/utf8>>, gleam@dynamic@decode:optional( {decoder, fun gleam@dynamic@decode:decode_string/1} ), fun(Id) -> gleam@dynamic@decode:field( <<"checkoutUrl"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_string/1}, fun(Checkout_url) -> gleam@dynamic@decode:field( <<"cost"/utf8>>, gleam@dynamic@decode:optional( shopify_cart_cost_decoder() ), fun(Cost) -> gleam@dynamic@decode:field( <<"lines"/utf8>>, cart_item_connection_decoder(), fun(Lines) -> gleam@dynamic@decode:field( <<"totalQuantity"/utf8>>, {decoder, fun gleam@dynamic@decode:decode_int/1}, fun(Total_quantity) -> gleam@dynamic@decode:success( {shopify_cart, Id, Checkout_url, Cost, Lines, Total_quantity} ) end ) end ) end ) end ) end ).