- {#if $session?.user?.avatar}
+ {#if $KQL_Me.data?.me?.avatar}

{:else}
diff --git a/src/lib/Pricesummary.svelte b/src/lib/Pricesummary.svelte
index 31fd59f4..5ddd0bc3 100644
--- a/src/lib/Pricesummary.svelte
+++ b/src/lib/Pricesummary.svelte
@@ -1,14 +1,9 @@
diff --git a/src/lib/Search.svelte b/src/lib/Search.svelte
index c2114351..de1895f6 100644
--- a/src/lib/Search.svelte
+++ b/src/lib/Search.svelte
@@ -1,10 +1,10 @@
@@ -13,7 +13,7 @@ export async function load({ page: { host, path, params, query }, fetch }) {
import { goto } from '$app/navigation'
import { createEventDispatcher } from 'svelte'
const dispatch = createEventDispatcher()
-import Icon, { Search } from 'svelte-hero-icons'
+import { Icon, Search } from 'svelte-hero-icons'
export let home = false,
q
let searchInput
diff --git a/src/lib/WishlistProducts.svelte b/src/lib/WishlistProducts.svelte
index 4e1372a1..b63ac604 100644
--- a/src/lib/WishlistProducts.svelte
+++ b/src/lib/WishlistProducts.svelte
@@ -8,18 +8,16 @@
+
+{#if err}
+
+ {#if err.message}
+ {JSON.stringify(err.message, null, 2)}
+ {:else}
+ {JSON.stringify(err, null, 2)}
+ {/if}
+
+{/if}
diff --git a/src/lib/components/HeadingUnderline.svelte b/src/lib/components/HeadingUnderline.svelte
new file mode 100644
index 00000000..1829064d
--- /dev/null
+++ b/src/lib/components/HeadingUnderline.svelte
@@ -0,0 +1,5 @@
+
diff --git a/src/lib/components/Image/Image.svelte b/src/lib/components/Image/Image.svelte
new file mode 100644
index 00000000..98162b05
--- /dev/null
+++ b/src/lib/components/Image/Image.svelte
@@ -0,0 +1,33 @@
+
+
+
+
+

diff --git a/src/lib/components/Image/ImageLoader.svelte b/src/lib/components/Image/ImageLoader.svelte
new file mode 100644
index 00000000..5e7f09ad
--- /dev/null
+++ b/src/lib/components/Image/ImageLoader.svelte
@@ -0,0 +1,24 @@
+
+
+
+ {#if intersecting || nativeLoading}
+
+ {/if}
+
diff --git a/src/lib/components/Image/IntersectionObserver.svelte b/src/lib/components/Image/IntersectionObserver.svelte
new file mode 100644
index 00000000..c5c5eab3
--- /dev/null
+++ b/src/lib/components/Image/IntersectionObserver.svelte
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/lib/components/SEO/SchemaOrg.svelte b/src/lib/components/SEO/SchemaOrg.svelte
index 4c57bc41..4b03e3e2 100644
--- a/src/lib/components/SEO/SchemaOrg.svelte
+++ b/src/lib/components/SEO/SchemaOrg.svelte
@@ -1,5 +1,5 @@
diff --git a/src/lib/components/_CategoriesHome.svelte b/src/lib/components/_CategoriesHome.svelte
new file mode 100644
index 00000000..501644ed
--- /dev/null
+++ b/src/lib/components/_CategoriesHome.svelte
@@ -0,0 +1,218 @@
+
+
+
+
+{#if loading}
+
+
+
+ {#each { length: 8 } as _}
+
+ {/each}
+
+
+
+ {#each { length: 12 } as _}
+
+ {/each}
+
+
+
+{:else if categories && categories.length}
+
+
+
+
+
+
+ Categories
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{/if}
diff --git a/src/lib/components/_ProductCard.svelte b/src/lib/components/_ProductCard.svelte
new file mode 100644
index 00000000..24e723e9
--- /dev/null
+++ b/src/lib/components/_ProductCard.svelte
@@ -0,0 +1,72 @@
+
+
+{#if product && (product.stock > 0 || product.isUnlimited)}
+
+ {#if product.new}
+
+ NEW
+
+ {/if}
+
+
+
+
+
+
+ {#if product.brand}
+
{product.brand}
+ {/if}
+
+
+
{product.name}
+
+ {#if product.foodType}
+
+ {#if product.foodType === 'V'}
+
+ {:else if product.foodType === 'N'}
+
+ {:else}
+
+ {/if}
+
+ {/if}
+
+
+ {#if product.stock === 5}
+
Only few qty left!!
+ {/if}
+
+
+ ${product.price}
+
+ ${product.mrp}
+
+
+ ({Math.floor(100 - (product.price * 100) / product.mrp)}%)
+
+
+
+
+{/if}
diff --git a/src/lib/config/env.js b/src/lib/config/env.js
new file mode 100644
index 00000000..cbfe1389
--- /dev/null
+++ b/src/lib/config/env.js
@@ -0,0 +1,3 @@
+import dotenv from 'dotenv'
+dotenv.config()
+export const HTTP_ENDPOINT = process.env.HTTP_ENDPOINT || 'https://api.misiki.in'
diff --git a/src/lib/config/g.ts b/src/lib/config/g.ts
new file mode 100644
index 00000000..fb2d2bd4
--- /dev/null
+++ b/src/lib/config/g.ts
@@ -0,0 +1,6 @@
+import { GFetch } from '@leveluptuts/g-query'
+
+export const g = new GFetch({
+ path: '/graphql', //whatever your api url is here
+ // More config options coming, for now this is just path to your graphql api
+})
diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts
new file mode 100644
index 00000000..08bff851
--- /dev/null
+++ b/src/lib/config/index.ts
@@ -0,0 +1,47 @@
+const QrCode = 'https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='
+const HTTP_ENDPOINT_AUTOMATION = 'https://misiki.in'
+const WWW_URL = import.meta.env.VITE_WWW_URL || 'http://localhost:3000'
+const DOMAIN = import.meta.env.VITE_DOMAIN
+const GOOGLE_MAPS_KEY = import.meta.env.GOOGLE_MAPS_KEY || 'AIzaSyBIG0jd-iPEfUhwt8tD-Tjxt-yrPFgfRXc'
+const CDN_URL = 'https://ik.imagekit.io/3wzatecz51w3i'
+export const typingTimeout = 0 // After this delay the search api will be fired
+const currency = { symbol: '₹', code: 'INR' }
+const tokenExpiry = 60 * 60 * 24 * 365 // Login validity in seconds
+const ANALYTICS_TRACKING_ID = 'UA-49421899-5'
+const sorts = [
+ { name: 'Relevance', val: null },
+ { name: 'Whats New', val: '-createdAt' },
+ { name: 'Price low to high', val: 'price' },
+ { name: 'Price high to low', val: '-price' }
+]
+const authorInfo = {
+ author: 'Swadesh Behera',
+ entity: 'Misiki',
+ ogLanguage: 'en_US',
+ siteLanguage: 'en-US',
+ siteTitle: ' - Svelte Commerce',
+ siteShortTitle: ' - Svelte Commerce', // used as SchemaOrg siteTitleAlt
+ contactEmail: 'swadesh@misiki.in',
+ facebookAuthorPage: `https://www.facebook.com/itswadesh`,
+ facebookPage: `https://www.facebook.com/codenx`,
+ facebookPageName: 'codenx',
+ githubPage: 'itswadesh',
+ linkedinProfile: 'itswadesh',
+ telegramUsername: 'itswadesh',
+ twitterUsername: 'itswadesh'
+}
+const host = 'https://misiki.in'
+export {
+ sorts,
+ CDN_URL,
+ currency,
+ tokenExpiry,
+ WWW_URL,
+ DOMAIN,
+ HTTP_ENDPOINT_AUTOMATION,
+ ANALYTICS_TRACKING_ID,
+ GOOGLE_MAPS_KEY,
+ authorInfo,
+ host,
+ QrCode
+}
diff --git a/src/lib/graphql/_kitql/graphqlStores.ts b/src/lib/graphql/_kitql/graphqlStores.ts
new file mode 100644
index 00000000..e2c2d0d4
--- /dev/null
+++ b/src/lib/graphql/_kitql/graphqlStores.ts
@@ -0,0 +1,3958 @@
+import { browser } from '$app/env';
+import * as Types from '$lib/graphql/_kitql/graphqlTypes';
+import { defaultStoreValue, RequestStatus, ResponseResultType, type PatchType, type RequestParameters, type RequestQueryParameters, type RequestResult } from '@kitql/client';
+import { get, writable } from 'svelte/store';
+import { kitQLClient } from '../kitQLClient';
+
+/**
+ * Init KitQL (to have clientStarted = true!)
+ *
+ * Waiting for: https://github.com/sveltejs/kit/issues/4447
+ */
+export function KQL__Init() {}
+
+/* Internal. To skip await on a client side navigation in the load function (from queryLoad)! */
+let clientStarted = false; // Will be true on a client side navigation
+if (browser) {
+ addEventListener('sveltekit:start', () => {
+ clientStarted = true;
+ });
+}
+
+/**
+ * ResetAllCaches in One function!
+ */
+export function KQL__ResetAllCaches() {
+ KQL_Address.resetCache();
+ KQL_Addresses.resetCache();
+ KQL_MyAddresses.resetCache();
+ KQL_Cart.resetCache();
+ KQL_Categories.resetCache();
+ KQL_Category.resetCache();
+ KQL_Megamenu.resetCache();
+ KQL_Init.resetCache();
+ KQL_Home.resetCache();
+ KQL_MyOrderItems.resetCache();
+ KQL_MyOrders.resetCache();
+ KQL_Product.resetCache();
+ KQL_ProductSlug.resetCache();
+ KQL_Products.resetCache();
+ KQL_ProductReviews.resetCache();
+ KQL_Reviews.resetCache();
+ KQL_PopularSearches.resetCache();
+ KQL_Settings.resetCache();
+ KQL_Store.resetCache();
+ KQL_StoreOne.resetCache();
+ KQL_Me.resetCache();
+ KQL_TopVendors.resetCache();
+ KQL_RandomVendors.resetCache();
+ KQL_Vendor.resetCache();
+ KQL_VendorProfile.resetCache();
+ KQL_CheckWishlist.resetCache();
+ KQL_MyWishlist.resetCache();
+}
+
+/* Operations 👇 */
+function KQL_AddressStore() {
+ const operationName = 'KQL_Address';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable
>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Address).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.AddressDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.AddressQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.AddressQuery, variables: Types.AddressQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Address), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Address), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Address` Operation
+ */
+export const KQL_Address = KQL_AddressStore();
+
+function KQL_AddressesStore() {
+ const operationName = 'KQL_Addresses';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Addresses).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.AddressesDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.AddressesQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.AddressesQuery, variables: Types.AddressesQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Addresses), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Addresses), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Addresses` Operation
+ */
+export const KQL_Addresses = KQL_AddressesStore();
+
+function KQL_DeleteAddressStore() {
+ const operationName = 'KQL_DeleteAddress';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_DeleteAddress).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.DeleteAddressDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `DeleteAddress` Operation
+ */
+export const KQL_DeleteAddress = KQL_DeleteAddressStore();
+
+function KQL_MyAddressesStore() {
+ const operationName = 'KQL_MyAddresses';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_MyAddresses).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.MyAddressesDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.MyAddressesQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.MyAddressesQuery, variables: Types.MyAddressesQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_MyAddresses), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_MyAddresses), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `MyAddresses` Operation
+ */
+export const KQL_MyAddresses = KQL_MyAddressesStore();
+
+function KQL_SaveAddressStore() {
+ const operationName = 'KQL_SaveAddress';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_SaveAddress).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.SaveAddressDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `SaveAddress` Operation
+ */
+export const KQL_SaveAddress = KQL_SaveAddressStore();
+
+function KQL_AddToCartStore() {
+ const operationName = 'KQL_AddToCart';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_AddToCart).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.AddToCartDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `AddToCart` Operation
+ */
+export const KQL_AddToCart = KQL_AddToCartStore();
+
+function KQL_CartStore() {
+ const operationName = 'KQL_Cart';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Cart).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.CartDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.CartQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.CartQuery, variables: Types.CartQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Cart), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Cart), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Cart` Operation
+ */
+export const KQL_Cart = KQL_CartStore();
+
+function KQL_CheckoutStore() {
+ const operationName = 'KQL_Checkout';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_Checkout).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.CheckoutDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Checkout` Operation
+ */
+export const KQL_Checkout = KQL_CheckoutStore();
+
+function KQL_CategoriesStore() {
+ const operationName = 'KQL_Categories';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Categories).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.CategoriesDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.CategoriesQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.CategoriesQuery, variables: Types.CategoriesQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Categories), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Categories), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Categories` Operation
+ */
+export const KQL_Categories = KQL_CategoriesStore();
+
+function KQL_CategoryStore() {
+ const operationName = 'KQL_Category';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Category).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.CategoryDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.CategoryQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.CategoryQuery, variables: Types.CategoryQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Category), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Category), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Category` Operation
+ */
+export const KQL_Category = KQL_CategoryStore();
+
+function KQL_MegamenuStore() {
+ const operationName = 'KQL_Megamenu';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Megamenu).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.MegamenuDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.MegamenuQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.MegamenuQuery, variables: Types.MegamenuQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Megamenu), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Megamenu), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Megamenu` Operation
+ */
+export const KQL_Megamenu = KQL_MegamenuStore();
+
+function KQL_InitStore() {
+ const operationName = 'KQL_Init';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Init).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.InitDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.InitQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.InitQuery, variables: Types.InitQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Init), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Init), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Init` Operation
+ */
+export const KQL_Init = KQL_InitStore();
+
+function KQL_HomeStore() {
+ const operationName = 'KQL_Home';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Home).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.HomeDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.HomeQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.HomeQuery, variables: Types.HomeQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Home), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Home), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Home` Operation
+ */
+export const KQL_Home = KQL_HomeStore();
+
+function KQL_MyOrderItemsStore() {
+ const operationName = 'KQL_MyOrderItems';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_MyOrderItems).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.MyOrderItemsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.MyOrderItemsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.MyOrderItemsQuery, variables: Types.MyOrderItemsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_MyOrderItems), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_MyOrderItems), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `MyOrderItems` Operation
+ */
+export const KQL_MyOrderItems = KQL_MyOrderItemsStore();
+
+function KQL_MyOrdersStore() {
+ const operationName = 'KQL_MyOrders';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_MyOrders).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.MyOrdersDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.MyOrdersQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.MyOrdersQuery, variables: Types.MyOrdersQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_MyOrders), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_MyOrders), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `MyOrders` Operation
+ */
+export const KQL_MyOrders = KQL_MyOrdersStore();
+
+function KQL_PaySuccessPageHitStore() {
+ const operationName = 'KQL_PaySuccessPageHit';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_PaySuccessPageHit).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.PaySuccessPageHitDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `PaySuccessPageHit` Operation
+ */
+export const KQL_PaySuccessPageHit = KQL_PaySuccessPageHitStore();
+
+function KQL_ProductStore() {
+ const operationName = 'KQL_Product';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Product).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ProductDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.ProductQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.ProductQuery, variables: Types.ProductQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Product), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Product), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Product` Operation
+ */
+export const KQL_Product = KQL_ProductStore();
+
+function KQL_ProductSlugStore() {
+ const operationName = 'KQL_ProductSlug';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_ProductSlug).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ProductSlugDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.ProductSlugQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.ProductSlugQuery, variables: Types.ProductSlugQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_ProductSlug), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_ProductSlug), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `ProductSlug` Operation
+ */
+export const KQL_ProductSlug = KQL_ProductSlugStore();
+
+function KQL_ProductsStore() {
+ const operationName = 'KQL_Products';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Products).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ProductsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.ProductsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.ProductsQuery, variables: Types.ProductsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Products), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Products), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Products` Operation
+ */
+export const KQL_Products = KQL_ProductsStore();
+
+function KQL_ProductReviewsStore() {
+ const operationName = 'KQL_ProductReviews';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_ProductReviews).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ProductReviewsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.ProductReviewsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.ProductReviewsQuery, variables: Types.ProductReviewsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_ProductReviews), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_ProductReviews), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `ProductReviews` Operation
+ */
+export const KQL_ProductReviews = KQL_ProductReviewsStore();
+
+function KQL_ReviewsStore() {
+ const operationName = 'KQL_Reviews';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Reviews).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ReviewsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.ReviewsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.ReviewsQuery, variables: Types.ReviewsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Reviews), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Reviews), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Reviews` Operation
+ */
+export const KQL_Reviews = KQL_ReviewsStore();
+
+function KQL_PopularSearchesStore() {
+ const operationName = 'KQL_PopularSearches';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_PopularSearches).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.PopularSearchesDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.PopularSearchesQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.PopularSearchesQuery, variables: Types.PopularSearchesQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_PopularSearches), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_PopularSearches), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `PopularSearches` Operation
+ */
+export const KQL_PopularSearches = KQL_PopularSearchesStore();
+
+function KQL_SettingsStore() {
+ const operationName = 'KQL_Settings';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Settings).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.SettingsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.SettingsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.SettingsQuery, variables: Types.SettingsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Settings), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Settings), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Settings` Operation
+ */
+export const KQL_Settings = KQL_SettingsStore();
+
+function KQL_StoreStore() {
+ const operationName = 'KQL_Store';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Store).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.StoreDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.StoreQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.StoreQuery, variables: Types.StoreQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Store), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Store), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Store` Operation
+ */
+export const KQL_Store = KQL_StoreStore();
+
+function KQL_StoreOneStore() {
+ const operationName = 'KQL_StoreOne';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_StoreOne).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.StoreOneDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.StoreOneQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.StoreOneQuery, variables: Types.StoreOneQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_StoreOne), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_StoreOne), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `StoreOne` Operation
+ */
+export const KQL_StoreOne = KQL_StoreOneStore();
+
+function KQL_ChangePasswordStore() {
+ const operationName = 'KQL_ChangePassword';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_ChangePassword).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.ChangePasswordDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `ChangePassword` Operation
+ */
+export const KQL_ChangePassword = KQL_ChangePasswordStore();
+
+function KQL_EmailPasswordStore() {
+ const operationName = 'KQL_EmailPassword';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_EmailPassword).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.EmailPasswordDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `EmailPassword` Operation
+ */
+export const KQL_EmailPassword = KQL_EmailPasswordStore();
+
+function KQL_GetOtpStore() {
+ const operationName = 'KQL_GetOtp';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_GetOtp).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.GetOtpDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `GetOtp` Operation
+ */
+export const KQL_GetOtp = KQL_GetOtpStore();
+
+function KQL_LoginStore() {
+ const operationName = 'KQL_Login';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_Login).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.LoginDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Login` Operation
+ */
+export const KQL_Login = KQL_LoginStore();
+
+function KQL_MeStore() {
+ const operationName = 'KQL_Me';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Me).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.MeDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.MeQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.MeQuery, variables: Types.MeQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Me), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Me), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Me` Operation
+ */
+export const KQL_Me = KQL_MeStore();
+
+function KQL_SignOutStore() {
+ const operationName = 'KQL_SignOut';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_SignOut).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.SignOutDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `SignOut` Operation
+ */
+export const KQL_SignOut = KQL_SignOutStore();
+
+function KQL_TopVendorsStore() {
+ const operationName = 'KQL_TopVendors';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_TopVendors).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.TopVendorsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.TopVendorsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.TopVendorsQuery, variables: Types.TopVendorsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_TopVendors), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_TopVendors), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `TopVendors` Operation
+ */
+export const KQL_TopVendors = KQL_TopVendorsStore();
+
+function KQL_UpdateProfileStore() {
+ const operationName = 'KQL_UpdateProfile';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_UpdateProfile).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.UpdateProfileDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `UpdateProfile` Operation
+ */
+export const KQL_UpdateProfile = KQL_UpdateProfileStore();
+
+function KQL_VerifyOtpStore() {
+ const operationName = 'KQL_VerifyOtp';
+ const operationType = ResponseResultType.Mutation;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function mutateLocal(
+ params?: RequestParameters
+ ): Promise> {
+ let { fetch, variables } = params ?? {};
+
+ const storedVariables = get(KQL_VerifyOtp).variables;
+ variables = variables ?? storedVariables;
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.VerifyOtpDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ mutate: mutateLocal,
+
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `VerifyOtp` Operation
+ */
+export const KQL_VerifyOtp = KQL_VerifyOtpStore();
+
+function KQL_RandomVendorsStore() {
+ const operationName = 'KQL_RandomVendors';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_RandomVendors).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.RandomVendorsDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.RandomVendorsQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.RandomVendorsQuery, variables: Types.RandomVendorsQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_RandomVendors), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_RandomVendors), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `RandomVendors` Operation
+ */
+export const KQL_RandomVendors = KQL_RandomVendorsStore();
+
+function KQL_VendorStore() {
+ const operationName = 'KQL_Vendor';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_Vendor).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.VendorDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise => {
+ if (clientStarted) {
+ queryLocal(params); // No await in purpose, we are in a client navigation.
+ } else {
+ await queryLocal(params);
+ }
+ },
+
+ /**
+ * Reset Cache
+ */
+ resetCache(
+ variables: Types.VendorQueryVariables | null = null,
+ allOperationKey: boolean = true,
+ withResetStore: boolean = true
+ ) {
+ kitQLClient.cacheRemove(operationName, { variables, allOperationKey });
+ if (withResetStore) {
+ set({ ...defaultStoreValue, operationName });
+ }
+ },
+
+ /**
+ * Patch the store &&|| cache with some data.
+ */
+ // prettier-ignore
+ patch(data: Types.VendorQuery, variables: Types.VendorQueryVariables | null = null, type: PatchType = 'cache-and-store'): void {
+ let updatedCacheStore = undefined;
+ if(type === 'cache-only' || type === 'cache-and-store') {
+ updatedCacheStore = kitQLClient.cacheUpdate(operationName, data, { variables });
+ }
+ if(type === 'store-only' ) {
+ let toReturn = { ...get(KQL_Vendor), data, variables } ;
+ set(toReturn);
+ }
+ if(type === 'cache-and-store' ) {
+ set({...get(KQL_Vendor), ...updatedCacheStore});
+ }
+ kitQLClient.logInfo(operationName, "patch", type);
+ }
+ };
+}
+/**
+ * KitQL Svelte Store with the latest `Vendor` Operation
+ */
+export const KQL_Vendor = KQL_VendorStore();
+
+function KQL_VendorProfileStore() {
+ const operationName = 'KQL_VendorProfile';
+ const operationType = ResponseResultType.Query;
+
+ // prettier-ignore
+ const { subscribe, set, update } = writable>({...defaultStoreValue, operationName, operationType});
+
+ async function queryLocal(
+ params?: RequestQueryParameters
+ ): Promise> {
+ let { fetch, variables, settings } = params ?? {};
+ let { cacheMs, policy } = settings ?? {};
+
+ const storedVariables = get(KQL_VendorProfile).variables;
+ variables = variables ?? storedVariables;
+ policy = policy ?? kitQLClient.policy;
+
+ // Cache only in the browser for now. In SSR, we will need session identif to not mix peoples data
+ if (browser) {
+ if (policy !== 'network-only') {
+ // prettier-ignore
+ const cachedData = kitQLClient.requestCache({
+ variables, operationName, cacheMs, browser
+ });
+ if (cachedData) {
+ const result = { ...cachedData, isFetching: false, status: RequestStatus.DONE };
+ if (policy === 'cache-first') {
+ set(result);
+ if (!result.isOutdated) {
+ return result;
+ }
+ } else if (policy === 'cache-only') {
+ set(result);
+ return result;
+ } else if (policy === 'cache-and-network') {
+ set(result);
+ }
+ }
+ }
+ }
+
+ update((c) => {
+ return { ...c, isFetching: true, status: RequestStatus.LOADING };
+ });
+
+ // prettier-ignore
+ const res = await kitQLClient.request({
+ skFetch: fetch,
+ document: Types.VendorProfileDocument,
+ variables,
+ operationName,
+ operationType,
+ browser
+ });
+ const result = { ...res, isFetching: false, status: RequestStatus.DONE, variables };
+ set(result);
+ return result;
+ }
+
+ return {
+ subscribe,
+
+ /**
+ * Can be used for SSR, but simpler option is `.queryLoad`
+ * @returns fill this store & the cache
+ */
+ query: queryLocal,
+
+ /**
+ * Ideal for SSR query. To be used in SvelteKit load function
+ * @returns fill this store & the cache
+ */
+ queryLoad: async (
+ params?: RequestQueryParameters
+ ): Promise