UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

58 lines (57 loc) 3.76 kB
/** * Generic event handler for RPC methods. * * Retrieves the RPC method name from the request path and extracts the payload: * - For `POST` / `PUT` / `DELETE`, the payload is read from the JSON * request body as `{ payload: ... }` (compatible with the RPC client). * - For `GET`, expects a JSON-serialized payload in a single query field `payload`. * If present, the handler parses the string using `JSON.parse(payload)`. * If `payload` is missing the RPC receives `undefined`. * A non-string `payload` value (e.g. repeated keys producing an array) or invalid * JSON results in a `400` error response. * * It utilizes hooks provided by Nitro to allow for custom logic before, * after, and in case of errors during RPC calls. * * @param event The H3 event object. * * @returns The result of the RPC call or a `Response` object with an error status. */ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | boolean | void | string[] | import("@scayle/storefront-api").Campaign | Record<string, unknown> | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | import("@scayle/storefront-core").FetchProductsCountResponse | import("@scayle/storefront-core").FetchFiltersResponse | import("@scayle/storefront-core").FetchProductsByCategoryResponse | { success: boolean; } | { result: boolean; } | { basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>; } | { fromBasketKey: string; toBasketKey: string; with?: import("@scayle/storefront-core").BasketWithOptions; orderCustomData?: Record<string, unknown>; } | { readonly type: "success"; readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>; } | { readonly type: "failure"; readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>; readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[]; } | import("@scayle/storefront-api").BrandsEndpointResponseData | import("@scayle/storefront-api").Brand | { path: string; children?: number; includeHidden?: true; includeProductSorting?: boolean; properties?: import("@scayle/storefront-api").ProductCategoryPropertyWith; } | import("@scayle/storefront-api").Category | { categories: import("@scayle/storefront-api").Category[] | import("@scayle/storefront-api").Category; activeNode?: import("@scayle/storefront-api").Category; } | import("@scayle/storefront-api").Category[] | import("@scayle/storefront-core").Order<Record<string, unknown>, Record<string, unknown>> | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").CategorySearchSuggestion | import("@scayle/storefront-api").ProductSearchSuggestion | import("@scayle/storefront-api").NavigationItemSuggestion | { type: undefined; } | import("@scayle/storefront-api").ShopConfiguration | { user?: import("@scayle/storefront-core").ShopUser; } | import("@scayle/storefront-api").Wishlist | Response | import("@scayle/storefront-core").ShopUserAddress[] | { accessToken: string | undefined; checkoutJwt: string; } | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | import("@scayle/storefront-api").PromotionsEndpointResponseData | { message: string; } | null>>; export default _default;