shopify_draft_proxy/proxy/localization
Mirrors the localization slice of src/proxy/localization.ts.
Pass 23 ships:
availableLocalesandshopLocalesreads, fully fed by the store plus a hardcoded default catalog when the store hasn’t been hydrated.translatableResource(s)/translatableResourcesByIdsreads. Without a Products domain in the Gleam port the only resources that can be discovered are translation/source-content entries already staged in the store — the resource is reconstructed from those records so captured register-then-read lifecycles can run end-to-end.shopLocaleEnable/Update/Disablemutations, including the “disabling clears translations for that locale” cleanup.translationsRegister/Removemutations with the same validation structure as the TS handler. With no Products in the store, unknown gids still returnRESOURCE_NOT_FOUND; captured resources can be seeded with source-content markers until the Products domain ports.
Types
pub type LocalizationError {
ParseFailed(root_field.RootFieldError)
}
Constructors
-
ParseFailed(root_field.RootFieldError)
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), )
Values
pub fn handle_localization_query(
store_in: store.Store,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, LocalizationError)
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)
Pattern 2: cold LiveHybrid localization reads need the captured upstream product/source-content slice before local translation mutations can validate digests and stage read-after-write effects. Once any localization/product state exists, stay local so staged locale and translation changes are not bypassed by passthrough.
pub fn is_localization_mutation_root(name: String) -> Bool
pub fn is_localization_query_root(name: String) -> Bool
pub fn process(
store_in: store.Store,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(json.Json, LocalizationError)
pub fn process_mutation(
store_in: store.Store,
identity: synthetic_identity.SyntheticIdentityRegistry,
request_path: String,
document: String,
variables: dict.Dict(String, root_field.ResolvedValue),
) -> Result(MutationOutcome, LocalizationError)