shopify_draft_proxy/proxy/apps

Apps billing/access draft runtime.

Pass 16 lands the six query roots (app, appByHandle, appByKey, appInstallation, appInstallations, currentAppInstallation) plus the per-record source projections needed to serve them.

Pass 17 lands the ten mutation roots (appUninstall, appRevokeAccessScopes, delegateAccessTokenCreate / Destroy, appPurchaseOneTimeCreate, appSubscriptionCreate / Cancel / LineItemUpdate / TrialExtend, appUsageRecordCreate) plus the supporting plumbing (MutationOutcome, process_mutation, ensure_current_installation, confirmation_url, token_hash, token_preview).

Note: the read path is pure of the store. Mutations thread (store, identity) forward and may auto-create a default app installation when one isn’t registered yet.

Types

Errors specific to the apps handler. Mirrors WebhooksError.

pub type AppsError {
  ParseFailed(root_field.RootFieldError)
}

Constructors

Outcome of an apps mutation. Mirrors the saved-search/webhook-subscription outcome shape: a JSON envelope ({"data": ...} or {"errors": ...}), the updated store and identity registry, and the staged GIDs.

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

User-error payload emitted on a mutation failure. Mirrors the apps UserError shape in TS: an optional code and a path that defaults to an empty list.

pub type UserError {
  UserError(
    field: List(String),
    message: String,
    code: option.Option(String),
  )
}

Constructors

  • UserError(
      field: List(String),
      message: String,
      code: option.Option(String),
    )

Values

pub fn handle_app_query(
  store: store.Store,
  document: String,
  variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, AppsError)

Process an apps query document and return a JSON data envelope. Mirrors handleAppQuery. The store argument supplies effective (base + staged) records.

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)

Domain entrypoint for app queries. The registry now lets implemented app reads reach this handler; LiveHybrid passthrough remains a domain decision so staged billing/access scenarios stay local-only after their first write.

pub fn is_app_mutation_root(name: String) -> Bool

Predicate matching the TS APP_MUTATION_ROOTS set.

pub fn is_app_query_root(name: String) -> Bool

Predicate matching the TS APP_QUERY_ROOTS set.

pub fn local_has_app_state(proxy: proxy_state.DraftProxy) -> Bool

True iff the app-domain store has any local app/installation/billing/access records. LiveHybrid app reads pass through while cold, but once mutations stage app state, downstream reads must stay local instead of forwarding synthetic billing/install IDs upstream.

pub fn process(
  store: store.Store,
  document: String,
  variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, AppsError)

Convenience: parse + handle + wrap, for the dispatcher.

pub fn process_mutation(
  store: store.Store,
  identity: synthetic_identity.SyntheticIdentityRegistry,
  request_path: String,
  origin: String,
  document: String,
  variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(MutationOutcome, AppsError)

Process an apps mutation document. Mirrors handleAppMutation. Each mutation handler stages its records and returns a payload; the outcomes are combined into a single {"data": {...}} envelope. Apps mutations don’t currently produce top-level error envelopes — every failure mode is surfaced through userErrors instead.

pub fn serialize_app_installation_node_by_id(
  store: store.Store,
  id: String,
  selections: List(ast.Selection),
  fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_app_node_by_id(
  store: store.Store,
  id: String,
  selections: List(ast.Selection),
  fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_app_one_time_purchase_node_by_id(
  store: store.Store,
  id: String,
  selections: List(ast.Selection),
  fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_app_subscription_node_by_id(
  store: store.Store,
  id: String,
  selections: List(ast.Selection),
  fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn serialize_app_usage_record_node_by_id(
  store: store.Store,
  id: String,
  selections: List(ast.Selection),
  fragments: dict.Dict(String, ast.Definition),
) -> json.Json
pub fn wrap_data(data: json.Json) -> json.Json

Wrap a successful apps response in the standard GraphQL envelope.

Search Document