Use production GraphQL query for DoorDash modifier extraction

The minimal query was rejected by DoorDash's schema validation.
Replaced with production-matching query including OptionListFragment,
OptionFragment, and NestedExtrasFragment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-10 13:14:11 -07:00
parent 2cf5039c0f
commit 59dfd602cf

View file

@ -146,17 +146,91 @@ chromium.use(stealth());
}
if (!queryTemplate) {
log("Could not capture query template, using hardcoded minimal query");
// Minimal query that gets optionLists
queryTemplate = `query itemPage($storeId: ID!, $itemId: ID!, $consumerId: ID, $isMerchantPreview: Boolean, $isNested: Boolean!, $fulfillmentType: FulfillmentType, $shouldFetchPresetCarousels: Boolean!, $cursorContext: ItemPageCursorContextInput, $shouldFetchStoreLiteData: Boolean!) {
itemPage(storeId: $storeId, itemId: $itemId, consumerId: $consumerId, isMerchantPreview: $isMerchantPreview, fulfillmentType: $fulfillmentType, cursorContext: $cursorContext) {
log("Could not capture query template, using production query");
// Full production query matching DoorDash's frontend schema
queryTemplate = `query itemPage($storeId: ID!, $itemId: ID!, $consumerId: ID, $isMerchantPreview: Boolean, $isNested: Boolean!, $fulfillmentType: FulfillmentType, $shouldFetchPresetCarousels: Boolean!, $cursorContext: ItemPageCursorContextInput, $shouldFetchStoreLiteData: Boolean!, $scheduledMinTimeUtc: String, $scheduledMaxTimeUtc: String) {
itemPage(
storeId: $storeId
itemId: $itemId
consumerId: $consumerId
isMerchantPreview: $isMerchantPreview
fulfillmentType: $fulfillmentType
cursorContext: $cursorContext
scheduledMinTimeUtc: $scheduledMinTimeUtc
scheduledMaxTimeUtc: $scheduledMaxTimeUtc
) {
itemHeader @skip(if: $isNested) {
id
name
description
unitAmount
currency
decimalPlaces
__typename
}
optionLists {
name minNumOptions maxNumOptions isOptional
options { name unitAmount currency decimalPlaces displayString __typename }
...OptionListFragment
__typename
}
__typename
}
}
fragment OptionListFragment on OptionList {
type
id
name
subtitle
minNumOptions
maxNumOptions
minAggregateOptionsQuantity
maxAggregateOptionsQuantity
minOptionChoiceQuantity
maxOptionChoiceQuantity
numFreeOptions
isOptional
options {
...OptionFragment
nestedExtrasList {
...NestedExtrasFragment
__typename
}
__typename
}
__typename
}
fragment OptionFragment on FeedOption {
id
name
unitAmount
currency
displayString
decimalPlaces
nextCursor
defaultQuantity
imgUrl
__typename
}
fragment NestedExtrasFragment on OptionList {
type
id
name
subtitle
minNumOptions
maxNumOptions
minAggregateOptionsQuantity
maxAggregateOptionsQuantity
minOptionChoiceQuantity
maxOptionChoiceQuantity
numFreeOptions
isOptional
options {
...OptionFragment
__typename
}
__typename
}`;
} else {
log("Captured query template (" + queryTemplate.length + " chars)");