@tuyau/core 1.0.0-beta.14 → 1.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,13 +49,18 @@ type ExtractQueryForGet<T> = Omit<T, 'headers' | 'cookies' | 'params'>;
49
49
  * Excludes 'query', 'params', 'headers', and 'cookies' as these are handled separately by AdonisJS.
50
50
  */
51
51
  type ExtractBody<T> = Omit<T, 'query' | 'params' | 'headers' | 'cookies'>;
52
+ /**
53
+ * Success status codes (2xx)
54
+ */
55
+ type SuccessStatus = 200 | 201 | 202 | 203 | 204 | 205 | 206;
52
56
  /**
53
57
  * Extract the actual response type from a controller return type.
54
- * If the type has a `__response` property (from typed response methods like ok(), created(), etc.),
55
- * extract that. Otherwise return the original type.
58
+ * Only extracts `__response` from successful responses (2xx status codes).
59
+ * For error responses or types without __response, returns the original type.
56
60
  */
57
61
  type ExtractResponse<T> = T extends {
58
62
  __response: infer R;
63
+ __status: SuccessStatus;
59
64
  } ? R : T;
60
65
  /**
61
66
  * Registry mapping endpoint names to their definitions
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tuyau/core",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.14",
4
+ "version": "1.0.0-beta.15",
5
5
  "description": "E2E typesafe client for AdonisJS",
6
6
  "author": "Julien Ripouteau <julien@ripouteau.com>",
7
7
  "license": "MIT",