{"version":3,"sources":["../../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAE9B,MAAM,qCAAqC;AAAA;AAAA,wCAEH,mBAAmB;AAAA,0CACjB,qBAAqB;AAAA;AAG/D,MAAM,qCAAqC;AAAA;AAAA,6CAEE,mBAAmB;AAAA,+CACjB,qBAAqB;AAAA;AAGpE,SAAS,oBACP,MACA,WACA,cACA;AACA,SAAO,KACJ,QAAQ,qBAAqB,SAAS,EACtC,QAAQ,uBAAuB,YAAY;AAChD;AAQA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEO,SAAS,kBAAkB,aAAa,IAAI;AACjD,SAAO,sBAAsB,KAAK,UAAU,IACxC,qBACA;AACN","sourcesContent":["import type {PresetConfig} from './preset';\n\nconst QUERIES_PLACEHOLDER = '%queries%';\nconst MUTATIONS_PLACEHOLDER = '%mutations%';\n\nconst sfapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n  interface StorefrontQueries extends ${QUERIES_PLACEHOLDER} {}\n  interface StorefrontMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nconst caapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n  interface CustomerAccountQueries extends ${QUERIES_PLACEHOLDER} {}\n  interface CustomerAccountMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nfunction replacePlaceholders(\n  code: string,\n  queryType: string,\n  mutationType: string,\n) {\n  return code\n    .replace(QUERIES_PLACEHOLDER, queryType)\n    .replace(MUTATIONS_PLACEHOLDER, mutationType);\n}\n\ntype DefaultValues = {\n  importTypesFrom: string;\n  namespacedImportName: string;\n  interfaceExtensionCode: NonNullable<PresetConfig['interfaceExtension']>;\n};\n\nconst sfapiDefaultValues: DefaultValues = {\n  importTypesFrom: '@shopify/hydrogen/storefront-api-types',\n  namespacedImportName: 'StorefrontAPI',\n  interfaceExtensionCode: ({queryType, mutationType}) =>\n    replacePlaceholders(\n      sfapiDefaultInterfaceExtensionCode,\n      queryType,\n      mutationType,\n    ),\n};\n\nconst caapiDefaultValues: DefaultValues = {\n  importTypesFrom: '@shopify/hydrogen/customer-account-api-types',\n  namespacedImportName: 'CustomerAccountAPI',\n  interfaceExtensionCode: ({queryType, mutationType}) =>\n    replacePlaceholders(\n      caapiDefaultInterfaceExtensionCode,\n      queryType,\n      mutationType,\n    ),\n};\n\nexport function getDefaultOptions(outputFile = '') {\n  return /(customer|caapi\\.)/i.test(outputFile)\n    ? caapiDefaultValues\n    : sfapiDefaultValues;\n}\n"]}