shopify_draft_proxy/proxy/products
Read-only Products foundation for the Gleam port.
The module currently covers Shopify-like no-data behavior for
product-adjacent query roots plus the first seeded product(id:) detail
read. Stateful product lifecycle, variants, inventory, collections,
publications, selling plans, and metafields land in later passes before the
TS product runtime can be removed.
Types
pub type MutationOutcome {
MutationOutcome(
data: json.Json,
store: store.Store,
identity: synthetic_identity.SyntheticIdentityRegistry,
staged_resource_ids: List(String),
log_drafts: List(mutation_helpers.LogDraft),
)
}
Constructors
-
MutationOutcome( data: json.Json, store: store.Store, identity: synthetic_identity.SyntheticIdentityRegistry, staged_resource_ids: List(String), log_drafts: List(mutation_helpers.LogDraft), )
pub type ProductsError {
ParseFailed(root_field.RootFieldError)
}
Constructors
-
ParseFailed(root_field.RootFieldError)
Values
pub fn handle_products_query(
store: store.Store,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, ProductsError)
pub fn handle_query_request(
proxy: proxy_state.DraftProxy,
request: proxy_state.Request,
parsed: parse_operation.ParsedOperation,
primary_root_field: String,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> #(proxy_state.Response, proxy_state.DraftProxy)
pub fn is_products_mutation_root(name: String) -> Bool
pub fn is_products_query_root(name: String) -> Bool
pub fn local_has_product_id(
proxy: proxy_state.DraftProxy,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Bool
True iff any string variable in the request points at a product
already present in local state, or at a proxy-synthetic gid. This
gates LiveHybrid passthrough for cold upstream product /
productByIdentifier reads while keeping staged read-after-write
flows fully local.
pub fn process(
store: store.Store,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, ProductsError)
pub fn process_mutation(
store: store.Store,
identity: synthetic_identity.SyntheticIdentityRegistry,
request_path: String,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(MutationOutcome, ProductsError)
pub fn product_source(
product: types.ProductRecord,
) -> graphql_helpers.SourceValue
pub fn product_variant_source(
store: store.Store,
variant: types.ProductVariantRecord,
) -> graphql_helpers.SourceValue
pub fn serialize_collection_node_by_id(
store: store.Store,
id: String,
selections: List(ast.Selection),
fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_product_node_by_id(
store: store.Store,
id: String,
selections: List(ast.Selection),
fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_product_option_node_by_id(
store: store.Store,
id: String,
selections: List(ast.Selection),
fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_product_option_value_node_by_id(
store: store.Store,
id: String,
selections: List(ast.Selection),
fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_selling_plan_node_by_id(
store: store.Store,
id: String,
selections: List(ast.Selection),
fragments: dict.Dict(String, ast.Definition),
) -> json.Json