UNPKG

2.78 kBTypeScriptView Raw
1export interface Choice {
2 value: string;
3 description?: string;
4}
5/**
6 * Represents a choice of exactly one or some strings from a fixed list of choices
7 */
8export interface Chooser {
9 /**
10 * Whether the user must pick exactly one choice. In this case,
11 * binds to string. Otherwise binds to string[]
12 */
13 pickOne: boolean;
14 choices: Choice[];
15}
16/**
17 * Constant for "freeChoices" type. Indicates that valid input is any number of strings, without validation.
18 * Useful in accepting input from other systems that perform their own validation.
19 * Binds to string[].
20 */
21export declare const FreeChoices = "freeChoices";
22export declare type ParameterType = "string" | "number" | "boolean" | Chooser | "freeChoices";
23/**
24 * Parameter to a command handler.
25 * Parameter values are always captured as strings,
26 * but different types can narrow the required input.
27 */
28export interface Parameter {
29 name: string;
30 description?: string;
31 pattern?: string;
32 required: boolean;
33 displayable?: boolean;
34 valid_input?: string;
35 max_length?: number;
36 min_length?: number;
37 display_name?: string;
38 default_value?: string;
39 /**
40 * Specify the type if this is not a string.
41 */
42 type?: ParameterType;
43 group?: Group;
44 tags?: string[];
45 order?: number;
46 control?: "input" | "textarea";
47}
48/**
49 * Addtional information about parameters
50 */
51export interface Group {
52 readonly name: string;
53 readonly description?: string;
54}
55/**
56 * Tag attached to an automation
57 */
58export interface Tag {
59 name: string;
60 description: string;
61}
62/**
63 * Common metadata to all automations
64 */
65export interface AutomationMetadata {
66 name: string;
67 description: string;
68 tags?: Tag[];
69 values?: ValueDeclaration[];
70}
71export interface ValueDeclaration {
72 name: string;
73 path: string;
74 required: boolean;
75 type?: string;
76}
77export interface MappedParameterDeclaration {
78 name: string;
79 uri: string;
80 required: boolean;
81}
82export interface SecretDeclaration {
83 name: string;
84 uri: string;
85}
86export interface SecretsMetadata {
87 secrets?: SecretDeclaration[];
88}
89export interface EventHandlerMetadata extends AutomationMetadata, SecretsMetadata {
90 subscriptionName: string;
91 subscription: string;
92}
93export interface ParameterMetadata extends SecretsMetadata {
94 parameters?: Parameter[];
95 mapped_parameters?: MappedParameterDeclaration[];
96}
97/**
98 * Command handler metadata. Includes parameters and intent,
99 * allowing invocation from both or by other methods such as command line
100 * or REST
101 */
102export interface CommandHandlerMetadata extends AutomationMetadata, ParameterMetadata {
103 intent?: string[];
104 auto_submit?: boolean;
105}
106//# sourceMappingURL=automationMetadata.d.ts.map
\No newline at end of file