Function defineTriggerInputParamsSchema

  • Used to define the inputParams schema for a Trigger.

    Type Parameters

    • Params extends TProperties

    Parameters

    • definer: ((t) => Params)
        • (t): Params
        • Parameters

          • t: {
                array: (<T>(schema, options?) => TArray<T>);
                boolean: ((options?) => TBoolean);
                literal: (<T>(value, options?) => TLiteral<T>);
                object: (<T>(properties, options?) => TObject<T>);
                optional: {
                    <T, F>(schema, enable): TOptionalFromMappedResult<T, F>;
                    <T, F>(schema, enable): TOptionalWithFlag<T, F>;
                    <T>(schema): TOptionalFromMappedResult<T, true>;
                    <T>(schema): TAddOptional<T>;
                };
                record: (<K, T>(key, schema, options?) => TRecordOrObject<K, T>);
                string: ((options?) => TString);
                union: (<T>(schemas, options?) => Union<T>);
            }
            • array: (<T>(schema, options?) => TArray<T>)
                • <T>(schema, options?): TArray<T>
                • [Json] Creates an Array type

                  Type Parameters

                  • T extends TSchema

                  Parameters

                  • schema: T
                  • Optional options: ArrayOptions

                  Returns TArray<T>

            • boolean: ((options?) => TBoolean)
                • (options?): TBoolean
                • [Json] Creates a Boolean type

                  Parameters

                  • Optional options: SchemaOptions

                  Returns TBoolean

            • literal: (<T>(value, options?) => TLiteral<T>)
                • <T>(value, options?): TLiteral<T>
                • [Json] Creates a Literal type

                  Type Parameters

                  • T extends TLiteralValue

                  Parameters

                  • value: T
                  • Optional options: SchemaOptions

                  Returns TLiteral<T>

            • object: (<T>(properties, options?) => TObject<T>)
                • <T>(properties, options?): TObject<T>
                • [Json] Creates an Object type

                  Type Parameters

                  • T extends TProperties

                  Parameters

                  • properties: T
                  • Optional options: ObjectOptions

                  Returns TObject<T>

            • optional: {
                  <T, F>(schema, enable): TOptionalFromMappedResult<T, F>;
                  <T, F>(schema, enable): TOptionalWithFlag<T, F>;
                  <T>(schema): TOptionalFromMappedResult<T, true>;
                  <T>(schema): TAddOptional<T>;
              }
                • <T, F>(schema, enable): TOptionalFromMappedResult<T, F>
                • [Json] Creates a Optional property

                  Type Parameters

                  • T extends TMappedResult<TProperties>

                  • F extends boolean

                  Parameters

                  • schema: T
                  • enable: F

                  Returns TOptionalFromMappedResult<T, F>

                • <T, F>(schema, enable): TOptionalWithFlag<T, F>
                • [Json] Creates a Optional property

                  Type Parameters

                  • T extends TSchema

                  • F extends boolean

                  Parameters

                  • schema: T
                  • enable: F

                  Returns TOptionalWithFlag<T, F>

                • <T>(schema): TOptionalFromMappedResult<T, true>
                • [Json] Creates a Optional property

                  Type Parameters

                  • T extends TMappedResult<TProperties>

                  Parameters

                  • schema: T

                  Returns TOptionalFromMappedResult<T, true>

                • <T>(schema): TAddOptional<T>
                • [Json] Creates a Optional property

                  Type Parameters

                  • T extends TSchema

                  Parameters

                  • schema: T

                  Returns TAddOptional<T>

            • record: (<K, T>(key, schema, options?) => TRecordOrObject<K, T>)
                • <K, T>(key, schema, options?): TRecordOrObject<K, T>
                • [Json] Creates a Record type

                  Type Parameters

                  • K extends TSchema

                  • T extends TSchema

                  Parameters

                  • key: K
                  • schema: T
                  • Optional options: ObjectOptions

                  Returns TRecordOrObject<K, T>

            • string: ((options?) => TString)
                • (options?): TString
                • [Json] Creates a String type

                  Parameters

                  • Optional options: StringOptions

                  Returns TString

            • union: (<T>(schemas, options?) => Union<T>)
                • <T>(schemas, options?): Union<T>
                • [Json] Creates a Union type

                  Type Parameters

                  • T extends TSchema[]

                  Parameters

                  • schemas: [...T[]]
                  • Optional options: SchemaOptions

                  Returns Union<T>

          Returns Params

    Returns TObject<Params>

    Example

    import { defineTriggerInputParamsSchema } from "@rollout/framework";

    export const inputParamsSchema = defineTriggerInputParamsSchema((t) => ({
    workspace: t.string(),
    project: t.string({ description: "Which project?" }),
    taskId: t.optional(t.string({ title: "Task" })),
    type: t.union([t.literal("A"), t.literal("B")], {
    title: "Task Type",
    }),,
    }));