Lumen & Gesso / website · lumengesso.com / app / lib / supabase / types.ts
| 1 | // Auto-generated by the Supabase MCP (`generate_typescript_types`). |
| 2 | // Source of truth for the orders schema + the order_status enum used |
| 3 | // across the order-lifecycle code (orders POST, /checkout, the Stripe |
| 4 | // webhook, the approve route, admin views). |
| 5 | // |
| 6 | // Regenerate after any schema/enum migration: |
| 7 | // - via the Supabase MCP tool `generate_typescript_types` |
| 8 | // - or `supabase gen types typescript --project-id <id>` via the CLI |
| 9 | // |
| 10 | // To get full inference on supabase client calls, swap the untyped |
| 11 | // `supabaseAdmin()` / `supabaseServer()` clients to use `Database` as |
| 12 | // the generic, e.g. `createClient<Database>(url, key)`. Until then this |
| 13 | // file just serves as a checked-in reference + a place to import the |
| 14 | // `Database['public']['Enums']['order_status']` literal-union from. |
| 15 | |
| 16 | export type Json = |
| 17 | | string |
| 18 | | number |
| 19 | | boolean |
| 20 | | null |
| 21 | | { [key: string]: Json | undefined } |
| 22 | | Json[] |
| 23 | |
| 24 | export type Database = { |
| 25 | // Allows to automatically instantiate createClient with right options |
| 26 | // instead of createClient<Database, { PostgrestVersion: 'XX' }>(URL, KEY) |
| 27 | __InternalSupabase: { |
| 28 | PostgrestVersion: "14.5" |
| 29 | } |
| 30 | public: { |
| 31 | Tables: { |
| 32 | generations: { |
| 33 | Row: { |
| 34 | clean_url: string |
| 35 | created_at: string |
| 36 | id: string |
| 37 | model: string |
| 38 | order_id: string |
| 39 | prompt: string |
| 40 | published: boolean |
| 41 | rejected_at: string | null |
| 42 | watermarked_url: string |
| 43 | } |
| 44 | Insert: { |
| 45 | clean_url: string |
| 46 | created_at?: string |
| 47 | id?: string |
| 48 | model: string |
| 49 | order_id: string |
| 50 | prompt: string |
| 51 | published?: boolean |
| 52 | rejected_at?: string | null |
| 53 | watermarked_url: string |
| 54 | } |
| 55 | Update: { |
| 56 | clean_url?: string |
| 57 | created_at?: string |
| 58 | id?: string |
| 59 | model?: string |
| 60 | order_id?: string |
| 61 | prompt?: string |
| 62 | published?: boolean |
| 63 | rejected_at?: string | null |
| 64 | watermarked_url?: string |
| 65 | } |
| 66 | Relationships: [ |
| 67 | { |
| 68 | foreignKeyName: "generations_order_id_fkey" |
| 69 | columns: ["order_id"] |
| 70 | isOneToOne: false |
| 71 | referencedRelation: "orders" |
| 72 | referencedColumns: ["id"] |
| 73 | }, |
| 74 | ] |
| 75 | } |
| 76 | orders: { |
| 77 | Row: { |
| 78 | config: Json |
| 79 | created_at: string |
| 80 | current_generation_id: string | null |
| 81 | custom_style_analyzed_at: string | null |
| 82 | custom_style_description: string | null |
| 83 | custom_style_url: string | null |
| 84 | id: string |
| 85 | pet_photo_urls: string[] |
| 86 | price_cents: number |
| 87 | prodigi_order_id: string | null |
| 88 | revision_note: string | null |
| 89 | shipping_address: Json | null |
| 90 | tracking_number: string | null |
| 91 | tracking_url: string | null |
| 92 | carrier: string | null |
| 93 | status: Database["public"]["Enums"]["order_status"] |
| 94 | stripe_payment_intent_id: string | null |
| 95 | stripe_session_id: string | null |
| 96 | terms_accepted_at: string | null |
| 97 | updated_at: string |
| 98 | user_email: string |
| 99 | user_id: string |
| 100 | } |
| 101 | Insert: { |
| 102 | config: Json |
| 103 | created_at?: string |
| 104 | current_generation_id?: string | null |
| 105 | custom_style_analyzed_at?: string | null |
| 106 | custom_style_description?: string | null |
| 107 | custom_style_url?: string | null |
| 108 | id: string |
| 109 | pet_photo_urls?: string[] |
| 110 | price_cents: number |
| 111 | prodigi_order_id?: string | null |
| 112 | revision_note?: string | null |
| 113 | shipping_address?: Json | null |
| 114 | tracking_number?: string | null |
| 115 | tracking_url?: string | null |
| 116 | carrier?: string | null |
| 117 | status?: Database["public"]["Enums"]["order_status"] |
| 118 | stripe_payment_intent_id?: string | null |
| 119 | stripe_session_id?: string | null |
| 120 | terms_accepted_at?: string | null |
| 121 | updated_at?: string |
| 122 | user_email: string |
| 123 | user_id: string |
| 124 | } |
| 125 | Update: { |
| 126 | config?: Json |
| 127 | created_at?: string |
| 128 | current_generation_id?: string | null |
| 129 | custom_style_analyzed_at?: string | null |
| 130 | custom_style_description?: string | null |
| 131 | custom_style_url?: string | null |
| 132 | id?: string |
| 133 | pet_photo_urls?: string[] |
| 134 | price_cents?: number |
| 135 | prodigi_order_id?: string | null |
| 136 | revision_note?: string | null |
| 137 | shipping_address?: Json | null |
| 138 | tracking_number?: string | null |
| 139 | tracking_url?: string | null |
| 140 | carrier?: string | null |
| 141 | status?: Database["public"]["Enums"]["order_status"] |
| 142 | stripe_payment_intent_id?: string | null |
| 143 | stripe_session_id?: string | null |
| 144 | terms_accepted_at?: string | null |
| 145 | updated_at?: string |
| 146 | user_email?: string |
| 147 | user_id?: string |
| 148 | } |
| 149 | Relationships: [ |
| 150 | { |
| 151 | foreignKeyName: "orders_current_generation_fk" |
| 152 | columns: ["current_generation_id"] |
| 153 | isOneToOne: false |
| 154 | referencedRelation: "generations" |
| 155 | referencedColumns: ["id"] |
| 156 | }, |
| 157 | ] |
| 158 | } |
| 159 | } |
| 160 | Views: { |
| 161 | [_ in never]: never |
| 162 | } |
| 163 | Functions: { |
| 164 | [_ in never]: never |
| 165 | } |
| 166 | Enums: { |
| 167 | order_status: |
| 168 | | "pending_payment" |
| 169 | | "abandoned" |
| 170 | | "pending_design" |
| 171 | | "awaiting_approval" |
| 172 | | "revision_requested" |
| 173 | | "approved" |
| 174 | | "in_production" |
| 175 | | "shipped" |
| 176 | | "cancelled" |
| 177 | // Legacy enum labels — still present in the PG enum because we |
| 178 | // renamed `paid` → `approved` via ALTER TYPE RENAME VALUE |
| 179 | // (no rows ever had `delivered`). Kept in the union so any |
| 180 | // historical SQL or admin tools that mention them still type- |
| 181 | // check. New code should never set these. |
| 182 | | "delivered" |
| 183 | } |
| 184 | CompositeTypes: { |
| 185 | [_ in never]: never |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase"> |
| 191 | |
| 192 | type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">] |
| 193 | |
| 194 | export type Tables< |
| 195 | DefaultSchemaTableNameOrOptions extends |
| 196 | | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) |
| 197 | | { schema: keyof DatabaseWithoutInternals }, |
| 198 | TableName extends DefaultSchemaTableNameOrOptions extends { |
| 199 | schema: keyof DatabaseWithoutInternals |
| 200 | } |
| 201 | ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & |
| 202 | DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) |
| 203 | : never = never, |
| 204 | > = DefaultSchemaTableNameOrOptions extends { |
| 205 | schema: keyof DatabaseWithoutInternals |
| 206 | } |
| 207 | ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & |
| 208 | DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { |
| 209 | Row: infer R |
| 210 | } |
| 211 | ? R |
| 212 | : never |
| 213 | : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & |
| 214 | DefaultSchema["Views"]) |
| 215 | ? (DefaultSchema["Tables"] & |
| 216 | DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { |
| 217 | Row: infer R |
| 218 | } |
| 219 | ? R |
| 220 | : never |
| 221 | : never |
| 222 | |
| 223 | export type TablesInsert< |
| 224 | DefaultSchemaTableNameOrOptions extends |
| 225 | | keyof DefaultSchema["Tables"] |
| 226 | | { schema: keyof DatabaseWithoutInternals }, |
| 227 | TableName extends DefaultSchemaTableNameOrOptions extends { |
| 228 | schema: keyof DatabaseWithoutInternals |
| 229 | } |
| 230 | ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] |
| 231 | : never = never, |
| 232 | > = DefaultSchemaTableNameOrOptions extends { |
| 233 | schema: keyof DatabaseWithoutInternals |
| 234 | } |
| 235 | ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { |
| 236 | Insert: infer I |
| 237 | } |
| 238 | ? I |
| 239 | : never |
| 240 | : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] |
| 241 | ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { |
| 242 | Insert: infer I |
| 243 | } |
| 244 | ? I |
| 245 | : never |
| 246 | : never |
| 247 | |
| 248 | export type TablesUpdate< |
| 249 | DefaultSchemaTableNameOrOptions extends |
| 250 | | keyof DefaultSchema["Tables"] |
| 251 | | { schema: keyof DatabaseWithoutInternals }, |
| 252 | TableName extends DefaultSchemaTableNameOrOptions extends { |
| 253 | schema: keyof DatabaseWithoutInternals |
| 254 | } |
| 255 | ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] |
| 256 | : never = never, |
| 257 | > = DefaultSchemaTableNameOrOptions extends { |
| 258 | schema: keyof DatabaseWithoutInternals |
| 259 | } |
| 260 | ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { |
| 261 | Update: infer U |
| 262 | } |
| 263 | ? U |
| 264 | : never |
| 265 | : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] |
| 266 | ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { |
| 267 | Update: infer U |
| 268 | } |
| 269 | ? U |
| 270 | : never |
| 271 | : never |
| 272 | |
| 273 | export type Enums< |
| 274 | DefaultSchemaEnumNameOrOptions extends |
| 275 | | keyof DefaultSchema["Enums"] |
| 276 | | { schema: keyof DatabaseWithoutInternals }, |
| 277 | EnumName extends DefaultSchemaEnumNameOrOptions extends { |
| 278 | schema: keyof DatabaseWithoutInternals |
| 279 | } |
| 280 | ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] |
| 281 | : never = never, |
| 282 | > = DefaultSchemaEnumNameOrOptions extends { |
| 283 | schema: keyof DatabaseWithoutInternals |
| 284 | } |
| 285 | ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] |
| 286 | : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] |
| 287 | ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] |
| 288 | : never |
| 289 | |
| 290 | export type CompositeTypes< |
| 291 | PublicCompositeTypeNameOrOptions extends |
| 292 | | keyof DefaultSchema["CompositeTypes"] |
| 293 | | { schema: keyof DatabaseWithoutInternals }, |
| 294 | CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { |
| 295 | schema: keyof DatabaseWithoutInternals |
| 296 | } |
| 297 | ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] |
| 298 | : never = never, |
| 299 | > = PublicCompositeTypeNameOrOptions extends { |
| 300 | schema: keyof DatabaseWithoutInternals |
| 301 | } |
| 302 | ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] |
| 303 | : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] |
| 304 | ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] |
| 305 | : never |
| 306 | |
| 307 | export const Constants = { |
| 308 | public: { |
| 309 | Enums: { |
| 310 | order_status: [ |
| 311 | "pending_payment", |
| 312 | "abandoned", |
| 313 | "pending_design", |
| 314 | "awaiting_approval", |
| 315 | "revision_requested", |
| 316 | "approved", |
| 317 | "in_production", |
| 318 | "shipped", |
| 319 | "cancelled", |
| 320 | // Legacy enum label (dead — no rows). See union type above. |
| 321 | "delivered", |
| 322 | ], |
| 323 | }, |
| 324 | }, |
| 325 | } as const |