@@ -55,59 +55,150 @@ type BaseConfigurableProp = {
5555} ;
5656
5757// XXX fix duplicating mapping to value type here and with PropValue
58- type Defaultable < T > = { default ?: T ; options ?: T [ ] ; } ;
58+
59+ type LabelValueOption < T > = {
60+ label : string ;
61+ value : T ;
62+ } ;
63+
64+ type Defaultable < T , SingleT = T > = {
65+ default ?: T ;
66+ options ?: SingleT [ ] | Array < LabelValueOption < SingleT > > ;
67+ }
5968
6069export type ConfigurablePropAlert = BaseConfigurableProp & {
6170 type : "alert" ;
62- alertType : "info" | "neutral" | "warning" | "error" ; // TODO check the types
71+ alertType ? : "info" | "neutral" | "warning" | "error" ; // TODO check the types
6372 content : string ;
6473} ;
74+
6575export type ConfigurablePropAny = BaseConfigurableProp & {
6676 type : "any" ;
6777} & Defaultable < any > ; // eslint-disable-line @typescript-eslint/no-explicit-any
78+
6879export type ConfigurablePropApp = BaseConfigurableProp & {
6980 type : "app" ;
7081 app : string ;
7182} ;
72- export type ConfigurablePropBoolean = BaseConfigurableProp & { type : "boolean" ; } ;
83+
84+ export type ConfigurablePropBoolean = BaseConfigurableProp & {
85+ type : "boolean" ;
86+ } & Defaultable < boolean > ;
87+
7388export type ConfigurablePropInteger = BaseConfigurableProp & {
7489 type : "integer" ;
7590 min ?: number ;
7691 max ?: number ;
7792} & Defaultable < number > ;
93+
7894export type ConfigurablePropObject = BaseConfigurableProp & {
7995 type : "object" ;
8096} & Defaultable < object > ;
97+
8198export type ConfigurablePropString = BaseConfigurableProp & {
8299 type : "string" ;
83100 secret ?: boolean ;
84101} & Defaultable < string > ;
102+
85103export type ConfigurablePropStringArray = BaseConfigurableProp & {
86104 type : "string[]" ;
87105 secret ?: boolean ; // TODO is this supported
88- } & Defaultable < string [ ] > ; // TODO
106+ } & Defaultable < string [ ] , string > ;
107+
108+ export type TimerInterval = {
109+ intervalSeconds : number ;
110+ }
111+
112+ export type TimerCron = {
113+ cron : string ;
114+ }
115+
116+ export type ConfigurablePropTimer = BaseConfigurableProp & {
117+ type : "$.interface.timer" ;
118+ static ?: TimerInterval | TimerCron ;
119+ } & Defaultable < TimerInterval | TimerCron > ;
120+
121+ export type ConfigurablePropApphook = BaseConfigurableProp & {
122+ type : "$.interface.apphook" ;
123+ appProp : string ;
124+ eventNames ?: Array < string > ;
125+ remote ?: boolean ;
126+ static ?: Array < unknown > ;
127+ }
128+
129+ export type ConfigurablePropIntegerArray = BaseConfigurableProp & {
130+ type : "integer[]" ;
131+ min ?: number ;
132+ max ?: number ;
133+ } & Defaultable < number [ ] , number >
134+
135+ export type ConfigurablePropHttp = BaseConfigurableProp & {
136+ type : "$.interface.http" ;
137+ customResponse ?: boolean ;
138+ }
139+
140+ export type ConfigurablePropDb = BaseConfigurableProp & {
141+ type : "$.service.db" ;
142+ }
143+
89144export type ConfigurablePropSql = BaseConfigurableProp & {
90145 type : "sql" ;
91- auth : {
146+ auth ? : {
92147 app : string ;
93148 } ;
94149} & Defaultable < string > ;
95- // | { type: "$.interface.http" } // source only
96- // | { type: "$.interface.timer" } // source only
97- // | { type: "$.service.db" }
98- // | { type: "data_store" }
99- // | { type: "http_request" }
150+
151+ export type ConfigurablePropAirtableBaseId = BaseConfigurableProp & {
152+ type : "$.airtable.baseId" ;
153+ appProp : string ;
154+ }
155+
156+ export type ConfigurablePropAirtableTableId = BaseConfigurableProp & {
157+ type : "$.airtable.tableId" ;
158+ baseIdProp : string ;
159+ }
160+
161+ export type ConfigurablePropAirtableViewId = BaseConfigurableProp & {
162+ type : "$.airtable.viewId" ;
163+ tableIdProp : string ;
164+ }
165+
166+ export type ConfigurablePropAirtableFieldId = BaseConfigurableProp & {
167+ type : "$.airtable.fieldId" ;
168+ tableIdProp : string ;
169+ }
170+
171+ export type ConfigurablePropDiscordChannel = BaseConfigurableProp & {
172+ type : "$.discord.channel" ;
173+ appProp : string ;
174+ }
175+
176+ export type ConfigurablePropDiscordChannelArray = BaseConfigurableProp & {
177+ type : "$.discord.channel[]" ;
178+ appProp : string ;
179+ }
180+
100181export type ConfigurableProp =
182+ | ConfigurablePropAirtableBaseId
183+ | ConfigurablePropAirtableFieldId
184+ | ConfigurablePropAirtableTableId
185+ | ConfigurablePropAirtableViewId
101186 | ConfigurablePropAlert
102187 | ConfigurablePropAny
103188 | ConfigurablePropApp
189+ | ConfigurablePropApphook
104190 | ConfigurablePropBoolean
191+ | ConfigurablePropDb
192+ | ConfigurablePropDiscordChannel
193+ | ConfigurablePropDiscordChannelArray
194+ | ConfigurablePropHttp
105195 | ConfigurablePropInteger
196+ | ConfigurablePropIntegerArray
106197 | ConfigurablePropObject
198+ | ConfigurablePropSql
107199 | ConfigurablePropString
108200 | ConfigurablePropStringArray
109- | ConfigurablePropSql
110- | ( BaseConfigurableProp & { type : "$.discord.channel" ; } ) ;
201+ | ConfigurablePropTimer
111202
112203export type ConfigurableProps = Readonly < ConfigurableProp [ ] > ;
113204
0 commit comments