|
3 | 3 | import type * as Pipedream from "../index.js"; |
4 | 4 |
|
5 | 5 | /** |
6 | | - * A configuration or input field for a component. |
| 6 | + * A configuration or input field for a component. This is a discriminated union based on the type field. |
7 | 7 | */ |
8 | | -export interface ConfigurableProp { |
9 | | - /** When building `configuredProps`, make sure to use this field as the key when setting the prop value */ |
10 | | - name: string; |
11 | | - type: Pipedream.ConfigurablePropType; |
12 | | - /** Value to use as an input label. In cases where `type` is "app", should load the app via `getApp`, etc. and show `app.name` instead. */ |
13 | | - label?: string; |
14 | | - /** A description of the prop, shown to the user when configuring the component. */ |
15 | | - description?: string; |
16 | | - /** If true, this prop does not need to be specified. */ |
17 | | - optional?: boolean; |
18 | | - /** If true, this prop will be ignored. */ |
19 | | - disabled?: boolean; |
20 | | - /** If true, should not expose this prop to the user */ |
21 | | - hidden?: boolean; |
22 | | - /** If true, call `configureComponent` for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ |
23 | | - remoteOptions?: boolean; |
24 | | - /** If true, calls to `configureComponent` for this prop support receiving a `query` parameter to filter remote options */ |
25 | | - useQuery?: boolean; |
26 | | - /** If true, after setting a value for this prop, a call to `reloadComponentProps` is required as the component has dynamic configurable props dependent on this one */ |
27 | | - reloadProps?: boolean; |
28 | | - /** If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ |
29 | | - withLabel?: boolean; |
| 8 | +export type ConfigurableProp = |
| 9 | + | Pipedream.ConfigurableProp.Alert |
| 10 | + | Pipedream.ConfigurableProp.Any |
| 11 | + | Pipedream.ConfigurableProp.App |
| 12 | + | Pipedream.ConfigurableProp.Boolean |
| 13 | + | Pipedream.ConfigurableProp.InterfaceTimer |
| 14 | + | Pipedream.ConfigurableProp.InterfaceApphook |
| 15 | + | Pipedream.ConfigurableProp.Integer |
| 16 | + | Pipedream.ConfigurableProp.InterfaceHttp |
| 17 | + | Pipedream.ConfigurableProp.ServiceDb |
| 18 | + | Pipedream.ConfigurableProp.Sql |
| 19 | + | Pipedream.ConfigurableProp.AirtableBaseId |
| 20 | + | Pipedream.ConfigurableProp.AirtableTableId |
| 21 | + | Pipedream.ConfigurableProp.AirtableViewId |
| 22 | + | Pipedream.ConfigurableProp.AirtableFieldId |
| 23 | + | Pipedream.ConfigurableProp.DiscordChannel |
| 24 | + | Pipedream.ConfigurableProp.DiscordChannel |
| 25 | + | Pipedream.ConfigurableProp.Integer |
| 26 | + | Pipedream.ConfigurableProp.Object_ |
| 27 | + | Pipedream.ConfigurableProp.String |
| 28 | + | Pipedream.ConfigurableProp.String; |
| 29 | + |
| 30 | +export namespace ConfigurableProp { |
| 31 | + export interface Alert extends Pipedream.ConfigurablePropAlert { |
| 32 | + type: "alert"; |
| 33 | + } |
| 34 | + |
| 35 | + export interface Any extends Pipedream.ConfigurablePropAny { |
| 36 | + type: "any"; |
| 37 | + } |
| 38 | + |
| 39 | + export interface App extends Pipedream.ConfigurablePropApp { |
| 40 | + type: "app"; |
| 41 | + } |
| 42 | + |
| 43 | + export interface Boolean extends Pipedream.ConfigurablePropBoolean { |
| 44 | + type: "boolean"; |
| 45 | + } |
| 46 | + |
| 47 | + export interface InterfaceTimer extends Pipedream.ConfigurablePropTimer { |
| 48 | + type: "$.interface.timer"; |
| 49 | + } |
| 50 | + |
| 51 | + export interface InterfaceApphook extends Pipedream.ConfigurablePropApphook { |
| 52 | + type: "$.interface.apphook"; |
| 53 | + } |
| 54 | + |
| 55 | + export interface Integer extends Pipedream.ConfigurablePropIntegerArray { |
| 56 | + type: "integer[]"; |
| 57 | + } |
| 58 | + |
| 59 | + export interface InterfaceHttp extends Pipedream.ConfigurablePropHttp { |
| 60 | + type: "$.interface.http"; |
| 61 | + } |
| 62 | + |
| 63 | + export interface ServiceDb extends Pipedream.ConfigurablePropDb { |
| 64 | + type: "$.service.db"; |
| 65 | + } |
| 66 | + |
| 67 | + export interface Sql extends Pipedream.ConfigurablePropSql { |
| 68 | + type: "sql"; |
| 69 | + } |
| 70 | + |
| 71 | + export interface AirtableBaseId extends Pipedream.ConfigurablePropAirtableBaseId { |
| 72 | + type: "$.airtable.baseId"; |
| 73 | + } |
| 74 | + |
| 75 | + export interface AirtableTableId extends Pipedream.ConfigurablePropAirtableTableId { |
| 76 | + type: "$.airtable.tableId"; |
| 77 | + } |
| 78 | + |
| 79 | + export interface AirtableViewId extends Pipedream.ConfigurablePropAirtableViewId { |
| 80 | + type: "$.airtable.viewId"; |
| 81 | + } |
| 82 | + |
| 83 | + export interface AirtableFieldId extends Pipedream.ConfigurablePropAirtableFieldId { |
| 84 | + type: "$.airtable.fieldId"; |
| 85 | + } |
| 86 | + |
| 87 | + export interface DiscordChannel extends Pipedream.ConfigurablePropDiscordChannel { |
| 88 | + type: "$.discord.channel"; |
| 89 | + } |
| 90 | + |
| 91 | + export interface DiscordChannel extends Pipedream.ConfigurablePropDiscordChannelArray { |
| 92 | + type: "$.discord.channel[]"; |
| 93 | + } |
| 94 | + |
| 95 | + export interface Integer extends Pipedream.ConfigurablePropInteger { |
| 96 | + type: "integer"; |
| 97 | + } |
| 98 | + |
| 99 | + export interface Object_ extends Pipedream.ConfigurablePropObject { |
| 100 | + type: "object"; |
| 101 | + } |
| 102 | + |
| 103 | + export interface String extends Pipedream.ConfigurablePropString { |
| 104 | + type: "string"; |
| 105 | + } |
| 106 | + |
| 107 | + export interface String extends Pipedream.ConfigurablePropStringArray { |
| 108 | + type: "string[]"; |
| 109 | + } |
30 | 110 | } |
0 commit comments