///
import type { ServerResponse } from 'http';
import type { LoginOperation } from '../types/login';
import type { GetAllPagesOperation, GetPageOperation } from '../types/page';
import type { GetSiteInfoOperation } from '../types/site';
import type { GetCustomerWishlistOperation } from '../types/wishlist';
import type { GetAllProductPathsOperation, GetAllProductsOperation, GetProductOperation } from '../types/product';
import type { APIProvider, CommerceAPI } from '.';
declare const noop: () => never;
export declare const OPERATIONS: readonly ["login", "getAllPages", "getPage", "getSiteInfo", "getCustomerWishlist", "getAllProductPaths", "getAllProducts", "getProduct"];
export declare const defaultOperations: {
login: () => never;
getAllPages: () => never;
getPage: () => never;
getSiteInfo: () => never;
getCustomerWishlist: () => never;
getAllProductPaths: () => never;
getAllProducts: () => never;
getProduct: () => never;
};
export type AllowedOperations = typeof OPERATIONS[number];
export type Operations
= {
login: {
(opts: {
variables: T['variables'];
config?: P['config'];
res: ServerResponse;
}): Promise;
(opts: {
variables: T['variables'];
config?: P['config'];
res: ServerResponse;
} & OperationOptions): Promise;
};
getAllPages: {
(opts?: {
config?: P['config'];
preview?: boolean;
}): Promise;
(opts: {
config?: P['config'];
preview?: boolean;
} & OperationOptions): Promise;
};
getPage: {
(opts: {
variables: T['variables'];
config?: P['config'];
preview?: boolean;
}): Promise;
(opts: {
variables: T['variables'];
config?: P['config'];
preview?: boolean;
} & OperationOptions): Promise;
};
getSiteInfo: {
(opts: {
config?: P['config'];
preview?: boolean;
}): Promise;
(opts: {
config?: P['config'];
preview?: boolean;
} & OperationOptions): Promise;
};
getCustomerWishlist: {
(opts: {
variables: T['variables'];
config?: P['config'];
includeProducts?: boolean;
}): Promise;
(opts: {
variables: T['variables'];
config?: P['config'];
includeProducts?: boolean;
} & OperationOptions): Promise;
};
getAllProductPaths: {
(opts: {
variables?: T['variables'];
config?: P['config'];
}): Promise;
(opts: {
variables?: T['variables'];
config?: P['config'];
} & OperationOptions): Promise;
};
getAllProducts: {
(opts: {
variables?: T['variables'];
config?: P['config'];
preview?: boolean;
}): Promise;
(opts: {
variables?: T['variables'];
config?: P['config'];
preview?: boolean;
} & OperationOptions): Promise;
};
getProduct: {
(opts: {
variables: T['variables'];
config?: P['config'];
preview?: boolean;
}): Promise;
(opts: {
variables: T['variables'];
config?: P['config'];
preview?: boolean;
} & OperationOptions): Promise;
};
};
export type APIOperations = {
[K in keyof Operations
]?: (ctx: OperationContext
) => Operations
[K];
};
export type AllOperations
= {
[K in keyof APIOperations
]-?: P['operations'][K] extends (...args: any) => any ? ReturnType
: typeof noop;
};
export type OperationContext
= {
commerce: CommerceAPI
;
};
export type OperationOptions = {
query: string;
url?: never;
} | {
query?: never;
url: string;
};
export {};