@openstage/monadyssey-fetch 3.0.0-beta.2 → 3.0.0-beta.3

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/readme.md +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstage/monadyssey-fetch",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,4 +43,4 @@
43
43
  "peerDependencies": {
44
44
  "@openstage/monadyssey-core": "^3.0.0-beta.2"
45
45
  }
46
- }
46
+ }
package/readme.md CHANGED
@@ -100,11 +100,11 @@ await api.fetch<{ message: string }>("/custom", "OPTIONS", {
100
100
  | **Option** | **Type** | **Description** |
101
101
  |----------------|-------------------------------------------------------------|-------------------------------------------------------------------------------|
102
102
  | `headers` | `Record<string, string>` | Custom headers. Merged with defaults, keys normalized to lowercase |
103
- | `body` | `any` | Request payload. Objects auto-JSON; FormData/Blob passed as-is |
103
+ | `body` | `unknown` | Request payload. Objects auto-JSON; FormData/Blob passed as-is |
104
104
  | `responseType`| `"json"`, `"text"`, `"blob"`, `"arrayBuffer"`, `"formData"` | Expected response type. **Defaults to `"json"`** |
105
105
  | `credentials` | `"omit"`, `"same-origin"`, `"include"` | Credential policy. **Defaults to client setting (`"same-origin"`)** |
106
106
  | `observe` | `"body"` or `"response"` | Return parsed body or full `Response`. **Defaults to `"body"`** |
107
- | `transform` | `(data: any) => A` | Transform the response data |
107
+ | `transform` | `(data: unknown) => A` | Transform the response data |
108
108
  | `timeout` | `number` | Per-request timeout in milliseconds. Overrides client-level timeout |
109
109
 
110
110
  ### Error Handling
@@ -114,7 +114,7 @@ Errors are encapsulated in the `HttpError` type, which includes:
114
114
  * `status`: The HTTP status code (500 for network errors)
115
115
  * `message`: Formatted error message containing the URL, status, and raw message
116
116
  * `rawMessage`: The raw error description
117
- * `body`: The response body if available
117
+ * `body`: The response body if available, typed `unknown`. Narrow it safely with `error.bodyAs(guard)`, which returns `Option<T>`
118
118
  * `url`: The request URL
119
119
  * `headers`: The response headers if available
120
120