• Creates a property key string based on a given key from a Kos data model.

    Property keys are used by the KOS model framework to provide property expansion in model data.

    When create a model dependency or any model metadata that is derived from the existing model data, a property key should be used to reference the data model key.

    For kos dependencies, propKeys can be used to resolve any dependency options that are derived from the data model.

    For topic handlers, the resolved topic can include propKey to allow for dynamic topic resolution based on the data model.

    Type Parameters

    • R extends IKosDataModel

    Parameters

    • key: keyof R

      The key from a Kos data model.

    Returns string

    A property key string enclosed in curly braces with a "PROP_" prefix.

    Example

    // Create a property key for a data model key "name"
    const propertyKey = createPropKey("name");
    // Result: "{PROP_name}"

    Example

    // Create a property key for a data model key "id"
    const propertyKey = createPropKey("id");
    // Result: "{PROP_id}"

    Example

    The propKey can be used as part of dependency or topic listener to allow for models to dynamically change the dependency or topic listener based on the data model.

    @kosDependency({modelType: Ingredient.type, id: propertyKey})