UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

53 lines (52 loc) 1.78 kB
import type { RuntimeConfig } from '@nuxt/schema'; import type { z } from 'zod/mini'; /** * List of keys considered sensitive. * These keys will have their values redacted in logs. */ export declare const sensitiveKeys: string[]; type ZodIssue = z.core.$ZodIssue; /** * Gets a value from a nested object using a path array. * * @param object The object to traverse. * @param pathArray The array of keys representing the path to the value. * * @returns The value at the specified path, stringified. */ export declare const getValue: (object: Record<string | number, unknown>, pathArray: PropertyKey[]) => string; /** * Formats Zod errors for display, redacting sensitive values. * * @see https://zod.dev/ERROR_HANDLING?id=zodissue * * @param issues An array of Zod issues. * @param issues[].code The error code. * @param issues[].path The path to the error in the object. * @param issues[].message The error message. * @param issues[].unionErrors Errors from union types. * @param runtimeConfig The runtime config object. * * @returns An array of formatted error messages. */ export declare const formatZodError: (issues: Array<ZodIssue>, runtimeConfig: RuntimeConfig) => (z.core.$ZodIssue | { code: string; path: string; message: string; value?: string; })[]; /** * Nitro plugin to validate the runtime config against a Zod schema. * * Validates the runtime configuration using the `RuntimeConfigSchema` and logs * success or failure messages to the console. Throws an error if the * validation fails. * * @see https://nitro.build/guide/plugins * * @returns Nitro plugin function * * @throws {Error} If runtimeConfig validations fails. */ declare const _default: import("nitropack").NitroAppPlugin; export default _default;