import type { GraphQLSchema } from 'graphql'; import { type WidgetVariableSpec } from '../../../../lib/widget/widgetVariables.js'; type Settings = Record; export interface AssertWidgetSettingsDeps { /** The storefront schema as it is now: what a page that renders this widget runs against. */ getSchema(): Promise; /** The compiled component file a widget type is registered with. */ getComponentPath(type: string): string | undefined; getSpec(componentPath: string): WidgetVariableSpec | null; } /** * Refuse widget settings the storefront would reject when it renders the widget. * * A widget's settings are the variables of its page query, and a typed input * (the slideshow's `slides: [SlideInput]`) rejects any key it does not define. * The widget's own JSON Schema cannot catch that: it is kept loose on purpose * (`additionalProperties: true`, so older saved instances stay valid) and it is a * hand-written copy of what the GraphQL type says. So the GraphQL type is asked * directly, as it stands now, and no list of fields lives here. * * On update pass `previous`, the settings already stored: only what the update * itself introduces is refused, so an older key the page builder cannot show * never locks a merchant out of saving anything else on the widget. * * Never blocks on tooling: a widget with no declarations, or a component file * that cannot be read, is not checked. */ export declare function assertWidgetSettingsMatchSchema(type: string, settings: Settings, previous?: Settings | null, deps?: AssertWidgetSettingsDeps): Promise; export {};