@@ -184,6 +184,13 @@ export const postgresRelationshipSchema = Type.Object({
184184} )
185185export type PostgresRelationship = Static < typeof postgresRelationshipSchema >
186186
187+ export const PostgresMetaRoleConfigSchema = Type . Object ( {
188+ op : Type . Union ( [ Type . Literal ( 'remove' ) , Type . Literal ( 'add' ) , Type . Literal ( 'replace' ) ] ) ,
189+ path : Type . String ( ) ,
190+ value : Type . Optional ( Type . String ( ) ) ,
191+ } )
192+ export type PostgresMetaRoleConfig = Static < typeof PostgresMetaRoleConfigSchema >
193+
187194export const postgresRoleSchema = Type . Object ( {
188195 id : Type . Integer ( ) ,
189196 name : Type . String ( ) ,
@@ -198,14 +205,45 @@ export const postgresRoleSchema = Type.Object({
198205 connection_limit : Type . Integer ( ) ,
199206 password : Type . String ( ) ,
200207 valid_until : Type . Union ( [ Type . String ( ) , Type . Null ( ) ] ) ,
201- config : Type . Union ( [
202- Type . String ( ) ,
203- Type . Null ( ) ,
204- Type . Record ( Type . String ( ) , Type . Union ( [ Type . String ( ) ] ) ) ,
205- ] ) ,
208+ config : Type . Union ( [ Type . String ( ) , Type . Null ( ) , Type . Record ( Type . String ( ) , Type . String ( ) ) ] ) ,
206209} )
207210export type PostgresRole = Static < typeof postgresRoleSchema >
208211
212+ export const postgresRoleCreateSchema = Type . Object ( {
213+ name : Type . String ( ) ,
214+ password : Type . Optional ( Type . String ( ) ) ,
215+ inherit_role : Type . Optional ( Type . Boolean ( ) ) ,
216+ can_login : Type . Optional ( Type . Boolean ( ) ) ,
217+ is_superuser : Type . Optional ( Type . Boolean ( ) ) ,
218+ can_create_db : Type . Optional ( Type . Boolean ( ) ) ,
219+ can_create_role : Type . Optional ( Type . Boolean ( ) ) ,
220+ is_replication_role : Type . Optional ( Type . Boolean ( ) ) ,
221+ can_bypass_rls : Type . Optional ( Type . Boolean ( ) ) ,
222+ connection_limit : Type . Optional ( Type . Integer ( ) ) ,
223+ member_of : Type . Optional ( Type . Array ( Type . String ( ) ) ) ,
224+ members : Type . Optional ( Type . Array ( Type . String ( ) ) ) ,
225+ admins : Type . Optional ( Type . Array ( Type . String ( ) ) ) ,
226+ valid_until : Type . Optional ( Type . String ( ) ) ,
227+ config : Type . Optional ( Type . Record ( Type . String ( ) , Type . String ( ) ) ) ,
228+ } )
229+ export type PostgresRoleCreate = Static < typeof postgresRoleCreateSchema >
230+
231+ export const postgresRoleUpdateSchema = Type . Object ( {
232+ name : Type . Optional ( Type . String ( ) ) ,
233+ password : Type . Optional ( Type . String ( ) ) ,
234+ inherit_role : Type . Optional ( Type . Boolean ( ) ) ,
235+ can_login : Type . Optional ( Type . Boolean ( ) ) ,
236+ is_superuser : Type . Optional ( Type . Boolean ( ) ) ,
237+ can_create_db : Type . Optional ( Type . Boolean ( ) ) ,
238+ can_create_role : Type . Optional ( Type . Boolean ( ) ) ,
239+ is_replication_role : Type . Optional ( Type . Boolean ( ) ) ,
240+ can_bypass_rls : Type . Optional ( Type . Boolean ( ) ) ,
241+ connection_limit : Type . Optional ( Type . Integer ( ) ) ,
242+ valid_until : Type . Optional ( Type . String ( ) ) ,
243+ config : Type . Optional ( Type . Array ( PostgresMetaRoleConfigSchema ) ) ,
244+ } )
245+ export type PostgresRoleUpdate = Static < typeof postgresRoleUpdateSchema >
246+
209247export const postgresSchemaSchema = Type . Object ( {
210248 id : Type . Integer ( ) ,
211249 name : Type . String ( ) ,
0 commit comments