UNPKG

shopify-storefront

Version:
31 lines 1.36 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShopifyClient = void 0; const astraql_1 = require("astraql"); const checkout_client_1 = __importDefault(require("./checkout/checkout-client")); const products_client_1 = __importDefault(require("./products/products-client")); const shop_client_1 = __importDefault(require("./shop/shop-client")); class ShopifyClient { constructor(settings) { const { storeDomain, accessToken } = settings; const endpoint = `https://${storeDomain}/api/2022-10/graphql.json`; const graphql = new astraql_1.GraphQLClient({ endpoint, headers: { 'X-Shopify-Storefront-Access-Token': accessToken, }, cache: settings.cache ? new astraql_1.CacheLoader({ expiresIn: settings.cache }) : undefined, }); this.checkout = new checkout_client_1.default(graphql); this.products = new products_client_1.default(graphql); this.shop = new shop_client_1.default(graphql); } } exports.ShopifyClient = ShopifyClient; exports.default = ShopifyClient; //# sourceMappingURL=client.js.map