{"version":3,"sources":["../../../src/v0/common/responses.ts"],"sourcesContent":["/**\n * Common response definitions for v0 API routes\n *\n * This module provides reusable response definitions for error responses\n * and common headers to reduce duplication across route definitions.\n */\n\n/**\n * Rate limit headers included in 429 responses\n */\nexport const rateLimitHeaders = {\n  \"X-RateLimit-Limit\": {\n    schema: {\n      type: \"integer\" as const,\n    },\n    description:\n      \"The number of requests remaining in the current rate limit window.\",\n  },\n  \"X-RateLimit-Remaining\": {\n    schema: {\n      type: \"integer\" as const,\n    },\n    description:\n      \"The number of requests remaining in the current rate limit window.\",\n  },\n  \"X-RateLimit-Reset\": {\n    schema: {\n      type: \"string\" as const,\n    },\n    description: \"The timestamp when the rate limit will be reset.\",\n  },\n  \"Retry-After\": {\n    schema: {\n      type: \"string\" as const,\n    },\n    description: \"The number of seconds to wait before retrying.\",\n  },\n} as const;\n\n/**\n * Retry-After header included in 503 responses\n */\nexport const retryAfterHeader = {\n  \"Retry-After\": {\n    schema: {\n      type: \"string\" as const,\n    },\n    description: \"The number of seconds to wait before retrying.\",\n  },\n} as const;\n\n/**\n * Common error response definitions for all v0 API routes\n *\n * These responses follow the JSON:API error response format and are\n * consistent across all endpoints.\n */\nexport const commonErrorResponses = {\n  /**\n   * 400 Bad Request - Invalid request parameters or body\n   */\n  400: {\n    description: \"Bad Request\",\n    content: {\n      \"application/json\": {\n        schema: {\n          $ref: \"#/components/schemas/ErrorsResponse\",\n        },\n      },\n    },\n  },\n  /**\n   * 401 Unauthorized - Missing or invalid authentication\n   */\n  401: {\n    description: \"Unauthorized\",\n    content: {\n      \"application/json\": {\n        schema: {\n          $ref: \"#/components/schemas/ErrorsResponse\",\n        },\n      },\n    },\n  },\n  /**\n   * 429 Too Many Requests - Rate limit exceeded\n   * Includes rate limit headers\n   */\n  429: {\n    description: \"Too Many Requests\",\n    headers: rateLimitHeaders,\n    content: {\n      \"application/json\": {\n        schema: {\n          $ref: \"#/components/schemas/ErrorsResponse\",\n        },\n      },\n    },\n  },\n  /**\n   * 500 Server Error - Internal server error\n   */\n  500: {\n    description: \"Server Error\",\n    content: {\n      \"application/json\": {\n        schema: {\n          $ref: \"#/components/schemas/ErrorsResponse\",\n        },\n      },\n    },\n  },\n  /**\n   * 503 Service Unavailable - Service temporarily unavailable\n   * Includes Retry-After header\n   */\n  503: {\n    description: \"Service Unavailable\",\n    headers: retryAfterHeader,\n    content: {\n      \"application/json\": {\n        schema: {\n          $ref: \"#/components/schemas/ErrorsResponse\",\n        },\n      },\n    },\n  },\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,IAAM,mBAAmB;AAAA,EAC9B,qBAAqB;AAAA,IACnB,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,aACE;AAAA,EACJ;AAAA,EACA,yBAAyB;AAAA,IACvB,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,aACE;AAAA,EACJ;AAAA,EACA,qBAAqB;AAAA,IACnB,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,aAAa;AAAA,EACf;AAAA,EACA,eAAe;AAAA,IACb,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,aAAa;AAAA,EACf;AACF;AAKO,IAAM,mBAAmB;AAAA,EAC9B,eAAe;AAAA,IACb,QAAQ;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,aAAa;AAAA,EACf;AACF;AAQO,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAIlC,KAAK;AAAA,IACH,aAAa;AAAA,IACb,SAAS;AAAA,MACP,oBAAoB;AAAA,QAClB,QAAQ;AAAA,UACN,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAIA,KAAK;AAAA,IACH,aAAa;AAAA,IACb,SAAS;AAAA,MACP,oBAAoB;AAAA,QAClB,QAAQ;AAAA,UACN,MAAM;AAAA,QAC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