UNPKG

3.56 kBTypeScriptView Raw
1export interface Option {
2 value: string;
3 description?: string;
4}
5/**
6 * Represents a selection of exactly one or some strings from a fixed list of options
7 */
8export interface Options {
9 /**
10 * Whether the user must select exactly one option. In this case,
11 * binds to string. Otherwise binds to string[]
12 */
13 kind?: "single" | "multiple";
14 /**
15 * Possible options to select from
16 */
17 options?: Option[];
18}
19/**
20 * Constant for "freeChoices" type. Indicates that valid input is any number of strings, without validation.
21 * Useful in accepting input from other systems that perform their own validation.
22 * Binds to string[].
23 */
24export declare const FreeChoices = "freeChoices";
25export declare type ParameterType = "string" | "number" | "boolean" | Options;
26export interface BaseParameter {
27 readonly pattern?: RegExp;
28 readonly required?: boolean;
29 readonly description?: string;
30 readonly displayName?: string;
31 readonly validInput?: string;
32 readonly displayable?: boolean;
33 readonly maxLength?: number;
34 readonly minLength?: number;
35 readonly type?: ParameterType;
36 readonly order?: number;
37 readonly control?: "input" | "textarea";
38}
39export interface Parameter extends BaseParameter {
40 readonly name: string;
41}
42export interface BaseValue {
43 path: string;
44 required?: boolean;
45 type?: "string" | "number" | "boolean";
46}
47export declare type Parameters<PARAMS = any> = ParametersListing | ParametersObject<PARAMS>;
48/**
49 * Interface mixed in with BaseParameter to allow adding a default value to a parameter.
50 * When the class-style decorated approach is used, this is unnecessary as any field
51 * value will be used as a default.
52 */
53export interface HasDefaultValue {
54 defaultValue?: any;
55}
56export declare type ParametersObjectValue = (BaseParameter & HasDefaultValue);
57export declare type MappedParameterOrSecretObjectValue = MappedParameterOrSecretDeclaration;
58export declare type ValueParameterObjectValue = ValueDeclaration;
59/**
60 * Object with properties defining parameters, secrets, mapped parameters and values.
61 * Useful for combination via spreads.
62 */
63export declare type ParametersObject<PARAMS, K extends keyof PARAMS = keyof PARAMS> = Record<K, ParametersObjectValue | MappedParameterOrSecretObjectValue | ValueParameterObjectValue>;
64export declare enum DeclarationType {
65 /**
66 * @deprecated use Mapped
67 */
68 mapped = "mapped",
69 /**
70 * @deprecated use Secret
71 */
72 secret = "secret",
73 Mapped = "mapped",
74 Secret = "secret"
75}
76export interface MappedParameterOrSecretDeclaration {
77 declarationType: DeclarationType;
78 uri: string;
79 /**
80 * Only valid on mapped parameters
81 */
82 required?: boolean;
83}
84/**
85 * Define values to be injected from the SDM configuration
86 */
87export declare type ValueDeclaration = BaseValue;
88/**
89 * Define parameters used in a command
90 */
91export interface ParametersListing {
92 readonly parameters: NamedParameter[];
93 readonly mappedParameters: NamedMappedParameter[];
94 readonly secrets: NamedSecret[];
95 readonly values: NamedValue[];
96}
97export declare type NamedParameter = BaseParameter & {
98 name: string;
99} & HasDefaultValue;
100export interface NamedSecret {
101 name: string;
102 uri: string;
103}
104export interface NamedMappedParameter {
105 name: string;
106 uri: string;
107 required?: boolean;
108}
109export declare type NamedValue = NamedValueParameter;
110export interface NamedValueParameter extends BaseValue {
111 name: string;
112}
113//# sourceMappingURL=parameters.d.ts.map
\No newline at end of file