@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
1 lines • 1.48 kB
Source Map (JSON)
{"version":3,"file":"factory.mjs","sources":["../../../../../../src/server/clients/storefront/factory.ts"],"sourcesContent":["import {Session} from '@shopify/shopify-api';\n\nimport {BasicParams} from '../../types';\n\nimport type {StorefrontContext} from '.';\n\nexport function storefrontClientFactory({\n params,\n session,\n}: {\n params: BasicParams;\n session: Session;\n}): StorefrontContext {\n const {api} = params;\n\n return {\n graphql: async (query, options = {}) => {\n const client = new api.clients.Storefront({\n session,\n apiVersion: options.apiVersion,\n });\n\n const apiResponse = await client.request(query, {\n variables: options?.variables,\n retries: options?.tries ? options.tries - 1 : 0,\n headers: options?.headers,\n });\n\n return new Response(JSON.stringify(apiResponse));\n },\n };\n}\n"],"names":[],"mappings":"SAMgB,uBAAuB,CAAC,EACtC,MAAM,EACN,OAAO,GAIR,EAAA;AACC,IAAA,MAAM,EAAC,GAAG,EAAC,GAAG,MAAM;IAEpB,OAAO;QACL,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,GAAG,EAAE,KAAI;YACrC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;gBACxC,OAAO;gBACP,UAAU,EAAE,OAAO,CAAC,UAAU;AAC/B,aAAA,CAAC;YAEF,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;gBAC9C,SAAS,EAAE,OAAO,EAAE,SAAS;AAC7B,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC;gBAC/C,OAAO,EAAE,OAAO,EAAE,OAAO;AAC1B,aAAA,CAAC;YAEF,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;KACF;AACH;;;;"}