import type { ComponentModel, Model } from "../models"; import type { ConfigurableService } from "../services"; import type { ApplyDesignerSettingsArgs } from "./ApplyDesignerSettingsArgs"; import type { ComponentModelDesignerSettings } from "./ComponentModelDesignerSettings"; import type { GetDesignerSettingsArgs } from "./GetDesignerSettingsArgs"; import type { GetDesignerSettingsSchemaArgs } from "./GetDesignerSettingsSchemaArgs"; import type { ModelDesignerSettings } from "./ModelDesignerSettings"; import type { Group, SettingsSchema } from "./SettingsSchema"; import type { ValidateConfigurableItemArgs } from "./ValidateConfigurableItemArgs"; type Unionize = T[keyof T]; /** * Corresponds to the top-level settings for a component/service. Each item that * is configurable in VertiGIS Studio App Designer must have at least theses * main settings, but can optionally have any number of subsettings forms as * well. */ export type TopLevelSettingsType = ""; /** * A mapping of subsetting types to settings DTOs. Use the `DesignerSettings` * helper to create a settings map. * * @template TSubsettingType A string literal enumeration type that represents * the possible values for `subsettingsType` in callback arguments. Must * include `MainSettings`. */ export type DesignerSettingsMap = { [P in TSubsettingType]: object; }; /** * Helper for creating a `DesignerSettingsMap`. * * @example * // For simple components. * interface Component1Settings = { ... }; * export type Component1SettingsMap = DesignerSettings; * * // For more complex components that have subsettings. * interface Component2Settings = { ... }; * interface Component2Subsettings1 = { ... }; * interface Component2Subsettings2 = { ... }; * export type Component2SettingsMap = DesignerSettings * & DesignerSettings * & DesignerSettings */ export type DesignerSettings = { [P in TSubsettingType]: TSettings; }; /** * Applies settings that were modified in VertiGIS Studio App Designer back to * the model. Note that this function may be invoked to apply any arbitrary * subset of settings at a time. * * @param args Contains the updated settings, the model to update, as well as * other contextual information such as the subsetting type and ID if * applicable. */ export type ApplyDesignerSettingsCallback = (args: MakeApplyDesignerSettingsArgs) => void | Promise; /** * Gets the settings for a component's model, so that it can be configured by * VertiGIS Studio App Designer. * * @param args Information about the settings being requested such as the model, * as well as the subsetting type and ID if applicable. */ export type GetDesignerSettingsCallback = (args: MakeGetDesignerSettingsArgs) => Unionize | Promise>; /** * Callback to confirm there are no warnings or errors on the configurable item. * * @param args The model being validated and utils which could be required for * validation. */ export type ValidateConfigurableItemCallback = (args: ValidateConfigurableItemArgs) => ValidateConfigurableItemResponse[] | Promise; /** * The response from validating a configurable item (component or service) on * save. */ export interface ValidateConfigurableItemResponse { /** * The type of validation response. An error would indicate invalid * configuration and prevent a save. A warning could be used to communicate * a default value is being used, but still allowing a save to occur. */ errorType: "error" | "warning"; /** * The message to display to the user why the error or warning occurred. */ message: string; /** * The search term to open pinpoint with. This would direct the user to the * source of the error or warning. */ pinpointSearchTerm?: string; } /** * Returns the VertiGIS Studio App Designer settings schema for a given model. * * @param args Information about the settings schema being requested. */ export type GetDesignerSettingsSchemaCallback = (args: MakeGetDesignerSettingsSchemaArgs) => MakeGetDesignerSettingsSchemaResult | Promise>; type MakeApplyDesignerSettingsArgs = Unionize<{ [K in keyof TSettingsMap]: ApplyDesignerSettingsArgs>; }>; type MakeGetDesignerSettingsArgs = Unionize<{ [K in keyof TSettingsMap]: GetDesignerSettingsArgs>; }>; type MakeGetDesignerSettingsSchemaArgs = Unionize<{ [K in keyof TSettingsMap]: GetDesignerSettingsSchemaArgs>; }>; type MakeGetDesignerSettingsSchemaResult = Unionize<{ [K in keyof TSettingsMap]: SettingsSchema; }>; /** * Gets the base settings for a component's model. * * @param args Arguments specifying the model and other options. */ export declare function getComponentModelDesignerSettings(args: GetDesignerSettingsArgs): Promise; /** * Gets the base settings schema for a component's model. * * @param args Arguments specifying the model and other options. */ export declare function getComponentModelDesignerSettingsSchema(args: GetDesignerSettingsSchemaArgs): Promise>; /** * Applies base settings to a component's model. * * @param args Arguments specifying the model and other options. */ export declare function applyComponentModelDesignerSettings(args: ApplyDesignerSettingsArgs): Promise; /** * Gets the base settings for a configurable service. * * @param args Arguments specifying the model and other options. */ export declare function getServiceDesignerSettings(args: GetDesignerSettingsArgs): Promise; /** * Applies the base settings for a configurable service. * * @param args Arguments specifying the model and other options. */ export declare function applyServiceDesignerSettings(args: ApplyDesignerSettingsArgs): Promise; /** * Gets the base settings schema for a configurable service. * * @param args Arguments specifying the model and other options. */ export declare function getServiceDesignerSettingsSchema(args: GetDesignerSettingsSchemaArgs): Promise>; /** * Default implementation of the validateConfigurableItem hook for App Designer. * Custom implementations should invoke this one. * * @param model The model to validate. */ export declare function validateConfigurableItem(model: ValidateConfigurableItemArgs): Promise; interface GroupOnlySettingsSchema extends Omit, "settings"> { settings: Group[]; } export {};