Add Fulfillment option generator function templates#416
Open
otheriault wants to merge 1 commit into
Open
Conversation
Add Rust, JavaScript/TypeScript, and Wasm templates for the cart.fulfillment-options.generate function, following the established pickup-point-delivery-option-generators pattern (optional fetch target + run target with external HTTP access). - functions-fulfillment-option-generators-rs (shopify_function 2.1.0) - functions-fulfillment-option-generators-js (vanilla-js + typescript) - functions-fulfillment-option-generators-wasm - templates.json: register under "Functions", gated by organizationExpFlags Each flavor mirrors pickup-point structure: schema.graphql, fetch/run input queries, the language-agnostic vitest fixture harness, and locales. Assisted-By: devx/afb31d94-b8e2-4abe-ad93-cc5236235202
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds new function templates for the Fulfillment option generator (
cart.fulfillment-options.generate), following the establishedpickup-point-delivery-option-generatorspattern.Three template directories (one
-jscovers both vanilla JS and TypeScript via Liquid flavor switches):functions-fulfillment-option-generators-rs— Rust (shopify_function 2.1.0)functions-fulfillment-option-generators-js— JavaScript + TypeScriptfunctions-fulfillment-option-generators-wasm— Wasm placeholderRegistered in
templates.jsonunder the Functions group, gated behind an Experiments Platform flag viaorganizationExpFlags.Targets
Mirrors the pickup-point fetch + run pattern:
cart.fulfillment-options.generate.fetch— returns an external HTTP request (only when the buyer's country is Canada in this demo).cart.fulfillment-options.generate.run— parses the response and emitsfulfillmentOptionsAddoperations, with providers/service points deduplicated into thereferencesblock.To simulate an external API, the demo reuses the existing hosted pickup-points JSON file.
Structure parity
Each flavor matches the current pickup-point convention:
schema.graphql, fetch/run input queries, the language-agnostic vitest fixture harness (tests/default.test.js+tests/fixtures/*.json), locales, and.liquidsource.Testing
Validated locally:
expand-liquidfor rust / vanilla-js / typescript / wasmcargo fmt --check,cargo clippy -- -D warnings,cargo build --release --target wasm32-unknown-unknowngraphql-codegentypegen passes (queries validate against the schema; all generated types resolve)Follow-ups (out of this repo)
templates.jsonafter merge