The settings registry interface.

interface ISettingRegistry {
    connector: IDataConnector<
        ISettingRegistry.IPlugin,
        string,
        string,
        string,
    >;
    pluginChanged: ISignal<ISettingRegistry, string>;
    plugins: { [name: string]: undefined | ISettingRegistry.IPlugin };
    schema: ISchema;
    validator: ISchemaValidator;
    get(
        plugin: string,
        key: string,
    ): Promise<
        {
            composite: undefined
            | PartialJSONValue;
            user: undefined | PartialJSONValue;
        },
    >;
    load(
        plugin: string,
        forceTransform?: boolean,
    ): Promise<ISettingRegistry.ISettings<ReadonlyPartialJSONObject>>;
    reload(
        plugin: string,
    ): Promise<ISettingRegistry.ISettings<ReadonlyPartialJSONObject>>;
    remove(plugin: string, key: string): Promise<void>;
    set(plugin: string, key: string, value: PartialJSONValue): Promise<void>;
    transform(
        plugin: string,
        transforms: { compose?: Transform; fetch?: Transform },
    ): IDisposable;
    upload(plugin: string, raw: string): Promise<void>;
}

Implemented by

Properties

connector: IDataConnector<ISettingRegistry.IPlugin, string, string, string>

The data connector used by the setting registry.

pluginChanged: ISignal<ISettingRegistry, string>

A signal that emits the name of a plugin when its settings change.

plugins: { [name: string]: undefined | ISettingRegistry.IPlugin }

The collection of setting registry plugins.

schema: ISchema

The schema of the setting registry.

validator: ISchemaValidator

The schema validator used by the setting registry.

Methods

  • Get an individual setting.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being retrieved.

    • key: string

      The name of the setting being retrieved.

    Returns Promise<
        {
            composite: undefined
            | PartialJSONValue;
            user: undefined | PartialJSONValue;
        },
    >

    A promise that resolves when the setting is retrieved.

  • Remove a single setting in the registry.

    Parameters

    • plugin: string

      The name of the plugin whose setting is being removed.

    • key: string

      The name of the setting being removed.

    Returns Promise<void>

    A promise that resolves when the setting is removed.

  • Register a plugin transform function to act on a specific plugin.

    Parameters

    • plugin: string

      The name of the plugin whose settings are transformed.

    • transforms: { compose?: Transform; fetch?: Transform }

      The transform functions applied to the plugin.

    Returns IDisposable

    A disposable that removes the transforms from the registry.

    • compose transformations: The registry automatically overwrites a plugin's default values with user overrides, but a plugin may instead wish to merge values. This behavior can be accomplished in a compose transformation.
    • fetch transformations: The registry uses the plugin data that is fetched from its connector. If a plugin wants to override, e.g. to update its schema with dynamic defaults, a fetch transformation can be applied.
  • Upload a plugin's settings.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being set.

    • raw: string

      The raw plugin settings being uploaded.

    Returns Promise<void>

    A promise that resolves when the settings have been saved.