@zap-studio/fetch 0.4.5 → 0.4.6
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.
- package/CHANGELOG.md +67 -84
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,145 +1,128 @@
|
|
|
1
1
|
# @zap-studio/fetch
|
|
2
2
|
|
|
3
|
-
## 0.4.
|
|
3
|
+
## 0.4.6
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies
|
|
8
|
-
- @zap-studio/validation@0.3.
|
|
7
|
+
- 5ea3d3b: Updated dependencies.
|
|
8
|
+
- @zap-studio/validation@0.3.1
|
|
9
9
|
|
|
10
|
-
## 0.4.4
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
## 0.4.5
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
- f75b984: Updated dependency `@zap-studio/validation` to `0.3.0`.
|
|
16
|
+
|
|
17
|
+
## 0.4.4
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
### Fixed
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
21
|
+
- 59a8d71: Fixed JSON request body handling.
|
|
22
|
+
- Accept JSON values (including arrays) in `ExtendedRequestInit.body`.
|
|
23
|
+
- Auto-stringify plain JSON body values even when no response schema is provided.
|
|
24
|
+
- Set `Content-Type: application/json` only when auto-stringifying and no explicit content type is set.
|
|
19
25
|
|
|
20
26
|
## 0.4.3
|
|
21
27
|
|
|
22
|
-
###
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- e4542bb: Refined `standardValidate` typings so return types depend on `throwOnError`, and updated `@zap-studio/fetch` integration while preserving the existing boolean configuration API.
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
- e4542bb: Updated dependency `@zap-studio/validation` to `0.2.1`.
|
|
27
35
|
|
|
28
36
|
## 0.4.2
|
|
29
37
|
|
|
30
|
-
###
|
|
38
|
+
### Dependencies
|
|
31
39
|
|
|
32
|
-
- Updated
|
|
33
|
-
- @zap-studio/validation@0.2.0
|
|
40
|
+
- 2de8183: Updated dependency `@zap-studio/validation` to `0.2.0`.
|
|
34
41
|
|
|
35
42
|
## 0.4.1
|
|
36
43
|
|
|
37
|
-
###
|
|
38
|
-
|
|
39
|
-
- 447dbda: Extract shared Standard Schema validation utilities into `@zap-studio/validation` and update `@zap-studio/fetch` to depend on them.
|
|
40
|
-
- Updated dependencies [447dbda]
|
|
41
|
-
- @zap-studio/validation@0.1.0
|
|
44
|
+
### Changed
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
- 447dbda: Switched shared Standard Schema validation utilities to `@zap-studio/validation`.
|
|
44
47
|
|
|
45
|
-
###
|
|
48
|
+
### Dependencies
|
|
46
49
|
|
|
47
|
-
-
|
|
50
|
+
- 447dbda: Updated dependency `@zap-studio/validation` to `0.1.0`.
|
|
48
51
|
|
|
49
|
-
## 0.
|
|
52
|
+
## 0.4.0
|
|
50
53
|
|
|
51
|
-
###
|
|
54
|
+
### Added
|
|
52
55
|
|
|
53
|
-
-
|
|
56
|
+
- 69057cd: Exposed fetch defaults constants and utility helpers as public exports.
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
## 0.3.1
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
- When `throwOnValidationError: false`: returns `Promise<StandardSchemaV1.Result<TSchema>>` (the result object with `value` or `issues`)
|
|
60
|
+
### Changed
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
- 9919f63: Added discriminated return types based on `throwOnValidationError`.
|
|
63
|
+
- `throwOnValidationError: true` (default) returns `Promise<TSchema>`.
|
|
64
|
+
- `throwOnValidationError: false` returns `Promise<StandardSchemaV1.Result<TSchema>>`.
|
|
65
|
+
- This improves type safety and removes manual narrowing in default usage.
|
|
61
66
|
|
|
62
67
|
## 0.3.0
|
|
63
68
|
|
|
64
|
-
###
|
|
69
|
+
### Added
|
|
65
70
|
|
|
66
|
-
- 659621c:
|
|
71
|
+
- 659621c: Added `searchParams` support in `createFetch` for factory-level default query parameters.
|
|
72
|
+
- Per-request `searchParams` still override factory defaults.
|
|
67
73
|
|
|
68
74
|
## 0.2.2
|
|
69
75
|
|
|
70
|
-
###
|
|
76
|
+
### Changed
|
|
71
77
|
|
|
72
|
-
- 5c3abbf:
|
|
78
|
+
- 5c3abbf: Prepared JSR publish and `isolatedDeclarations` support with explicit `$Fetch` and `ApiMethods` types.
|
|
73
79
|
|
|
74
80
|
## 0.2.1
|
|
75
81
|
|
|
76
|
-
###
|
|
82
|
+
### Changed
|
|
77
83
|
|
|
78
|
-
- 82bac5c:
|
|
84
|
+
- 82bac5c: Replaced regex-based slash trimming with more efficient string manipulation for URL normalization.
|
|
79
85
|
|
|
80
86
|
## 0.2.0
|
|
81
87
|
|
|
82
|
-
###
|
|
83
|
-
|
|
84
|
-
- 78afb76: ### Standard Schema Support
|
|
85
|
-
|
|
86
|
-
Migrated from Zod-only validation to **Standard Schema v1** specification, enabling support for multiple validation libraries:
|
|
88
|
+
### Changed
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
- Valibot
|
|
90
|
-
- ArkType
|
|
91
|
-
- Any Standard Schema compliant library
|
|
90
|
+
- 78afb76: Migrated from Zod-only validation to Standard Schema v1 for broader validator compatibility.
|
|
91
|
+
- Supported libraries include Zod, Valibot, ArkType, and other Standard Schema-compliant validators.
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
### Added
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
- 78afb76: Added `createFetch()` factory pattern for pre-configured instances.
|
|
96
|
+
- 78afb76: Added smart URL behavior so absolute URLs bypass `baseURL`.
|
|
97
|
+
- 78afb76: Added automatic JSON body serialization and `Content-Type` handling for schema-based requests.
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
### Breaking
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Migration Guide
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
// Before (Zod-only)
|
|
109
|
-
import { $fetch } from "@zap-studio/fetch";
|
|
110
|
-
import { z } from "zod";
|
|
111
|
-
|
|
112
|
-
// After (Standard Schema - works the same with Zod!)
|
|
113
|
-
import { $fetch } from "@zap-studio/fetch";
|
|
114
|
-
import { z } from "zod"; // Zod 3.23+ is Standard Schema compliant
|
|
115
|
-
|
|
116
|
-
// Or use other libraries
|
|
117
|
-
import * as v from "valibot";
|
|
118
|
-
import { type } from "arktype";
|
|
119
|
-
```
|
|
101
|
+
- 78afb76: Standard Schema-compliant validator libraries are now required (for example Zod 3.23+, Valibot 1.0+, ArkType 2.0+).
|
|
102
|
+
- 78afb76: Internal file structure was reorganized (affects deep imports).
|
|
103
|
+
- 78afb76: `FetchError` constructor now requires `(message, response)`.
|
|
120
104
|
|
|
121
105
|
## 0.1.2
|
|
122
106
|
|
|
123
|
-
###
|
|
107
|
+
### Changed
|
|
124
108
|
|
|
125
|
-
- 69c2b21:
|
|
109
|
+
- 69c2b21: Renamed `safeFetch` to `$fetch` while preserving `safeFetch` compatibility for legacy usage.
|
|
126
110
|
|
|
127
111
|
## 0.1.1
|
|
128
112
|
|
|
129
|
-
###
|
|
113
|
+
### Changed
|
|
130
114
|
|
|
131
|
-
- 5f1812b:
|
|
115
|
+
- 5f1812b: Updated `files` in `package.json` to publish only required artifacts.
|
|
132
116
|
|
|
133
117
|
## 0.1.0
|
|
134
118
|
|
|
135
|
-
###
|
|
136
|
-
|
|
137
|
-
- 1644006: Comprehensive description of the initial release features including:
|
|
119
|
+
### Added
|
|
138
120
|
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
121
|
+
- 1644006: Initial release of `@zap-studio/fetch`.
|
|
122
|
+
- Type-safe HTTP requests with Zod validation.
|
|
123
|
+
- Automatic content-type handling.
|
|
124
|
+
- Multiple response type support.
|
|
125
|
+
- API methods for GET, POST, PUT, PATCH, and DELETE.
|
|
126
|
+
- Flexible error handling.
|
|
127
|
+
- Custom `FetchError` class.
|
|
128
|
+
- Full TypeScript support.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zap-studio/fetch",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@standard-schema/spec": "^1.1.0",
|
|
42
|
-
"@zap-studio/validation": "0.3.
|
|
42
|
+
"@zap-studio/validation": "0.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.2",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"vitest": "^4.0.18",
|
|
52
52
|
"zod": "^4.2.0",
|
|
53
53
|
"@zap-studio/vitest-config": "0.0.0",
|
|
54
|
-
"@zap-studio/
|
|
55
|
-
"@zap-studio/
|
|
54
|
+
"@zap-studio/typescript-config": "0.0.0",
|
|
55
|
+
"@zap-studio/tsdown-config": "0.0.0"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
58
58
|
".": "./dist/index.mjs",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"types": "./dist/index.d.mts",
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "tsdown --config tsdown.config.ts",
|
|
70
|
-
"
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
71
|
"test": "vitest run",
|
|
72
72
|
"test:watch": "vitest --watch"
|
|
73
73
|
}
|