@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.
Files changed (2) hide show
  1. package/CHANGELOG.md +67 -84
  2. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,145 +1,128 @@
1
1
  # @zap-studio/fetch
2
2
 
3
- ## 0.4.5
3
+ ## 0.4.6
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [f75b984]
8
- - @zap-studio/validation@0.3.0
7
+ - 5ea3d3b: Updated dependencies.
8
+ - @zap-studio/validation@0.3.1
9
9
 
10
- ## 0.4.4
11
10
 
12
- ### Patch Changes
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
- - 59a8d71: Fix request body handling for JSON payloads.
19
+ ### Fixed
15
20
 
16
- - Accept JSON values (including arrays) in `ExtendedRequestInit.body`
17
- - Auto-stringify plain JSON body values regardless of whether a response schema is provided
18
- - Set `Content-Type: application/json` only when auto-stringifying and no explicit content type is set
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
- ### Patch Changes
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
- - e4542bb: Refine `standardValidate` typings so the return type depends on the `throwOnError` flag, and update `@zap-studio/fetch` to integrate with the new overloads while preserving its boolean configuration API.
25
- - Updated dependencies [e4542bb]
26
- - @zap-studio/validation@0.2.1
32
+ ### Dependencies
33
+
34
+ - e4542bb: Updated dependency `@zap-studio/validation` to `0.2.1`.
27
35
 
28
36
  ## 0.4.2
29
37
 
30
- ### Patch Changes
38
+ ### Dependencies
31
39
 
32
- - Updated dependencies [2de8183]
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
- ### Patch Changes
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
- ## 0.4.0
46
+ - 447dbda: Switched shared Standard Schema validation utilities to `@zap-studio/validation`.
44
47
 
45
- ### Minor Changes
48
+ ### Dependencies
46
49
 
47
- - 69057cd: Expose fetch defaults constants and utility helpers as public exports.
50
+ - 447dbda: Updated dependency `@zap-studio/validation` to `0.1.0`.
48
51
 
49
- ## 0.3.1
52
+ ## 0.4.0
50
53
 
51
- ### Patch Changes
54
+ ### Added
52
55
 
53
- - 9919f63: Add discriminated return types based on `throwOnValidationError` option
56
+ - 69057cd: Exposed fetch defaults constants and utility helpers as public exports.
54
57
 
55
- The return type of `$fetch` and `api.*` methods now correctly narrows based on the `throwOnValidationError` option:
58
+ ## 0.3.1
56
59
 
57
- - When `throwOnValidationError: true` (default) or unspecified: returns `Promise<TSchema>` (the validated data directly)
58
- - When `throwOnValidationError: false`: returns `Promise<StandardSchemaV1.Result<TSchema>>` (the result object with `value` or `issues`)
60
+ ### Changed
59
61
 
60
- This improves type safety by eliminating the need for manual type narrowing when using the default behavior.
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
- ### Minor Changes
69
+ ### Added
65
70
 
66
- - 659621c: Add `searchParams` option to `createFetch` to allow factory-level default query/search parameters. Per-request `searchParams` continue to override factory defaults.
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
- ### Patch Changes
76
+ ### Changed
71
77
 
72
- - 5c3abbf: Prepare JSR publish and isolatedDeclarations support with new explicit types for `$Fetch` and `ApiMethods`
78
+ - 5c3abbf: Prepared JSR publish and `isolatedDeclarations` support with explicit `$Fetch` and `ApiMethods` types.
73
79
 
74
80
  ## 0.2.1
75
81
 
76
- ### Patch Changes
82
+ ### Changed
77
83
 
78
- - 82bac5c: Replace regex-based slash trimming with more efficient string manipulation functions for URL normalization
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
- ### Minor Changes
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
- - Zod
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
- ### New Features
93
+ ### Added
94
94
 
95
- - **Factory Pattern**: `createFetch()` for creating pre-configured fetch instances with `baseURL`, default `headers`, and error handling options
96
- - **Smart URL Handling**: Absolute URLs bypass `baseURL` configuration
97
- - **Auto JSON Body**: Automatic `JSON.stringify()` and `Content-Type` header when using schemas with request bodies
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
- ### Breaking Changes
99
+ ### Breaking
100
100
 
101
- - Schema validation now requires Standard Schema compliant libraries (Zod 3.23+, Valibot 1.0+, ArkType 2.0+)
102
- - Internal file structure reorganized (affects deep imports if any were used)
103
- - `FetchError` constructor signature changed: now requires `(message, response)`
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
- ### Patch Changes
107
+ ### Changed
124
108
 
125
- - 69c2b21: Change `safeFetch` to `$fetch` syntax and make sure `safeFetch` can also be used for legacy
109
+ - 69c2b21: Renamed `safeFetch` to `$fetch` while preserving `safeFetch` compatibility for legacy usage.
126
110
 
127
111
  ## 0.1.1
128
112
 
129
- ### Patch Changes
113
+ ### Changed
130
114
 
131
- - 5f1812b: Change files field in package.json to distribute only necessary artifacts
115
+ - 5f1812b: Updated `files` in `package.json` to publish only required artifacts.
132
116
 
133
117
  ## 0.1.0
134
118
 
135
- ### Minor Changes
136
-
137
- - 1644006: Comprehensive description of the initial release features including:
119
+ ### Added
138
120
 
139
- - Type-safe HTTP requests with Zod validation
140
- - Automatic content-type handling
141
- - Multiple response type support
142
- - Convenient API methods (GET, POST, PUT, PATCH, DELETE)
143
- - Flexible error handling
144
- - Custom FetchError class
145
- - Full TypeScript support
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.5",
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.0"
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/tsdown-config": "0.0.0",
55
- "@zap-studio/typescript-config": "0.0.0"
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
- "check": "tsc --noEmit",
70
+ "typecheck": "tsc --noEmit",
71
71
  "test": "vitest run",
72
72
  "test:watch": "vitest --watch"
73
73
  }