@npora/request 0.1.1
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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/index.cjs +999 -0
- package/dist/index.d.cts +316 -0
- package/dist/index.d.ts +316 -0
- package/dist/index.js +960 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nova Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# @npora/request
|
|
2
|
+
|
|
3
|
+
> A modern, TypeScript-first HTTP client built on top of the Fetch API.
|
|
4
|
+
|
|
5
|
+
Npora Request provides a consistent, extensible and production-ready request layer for modern JavaScript applications.
|
|
6
|
+
|
|
7
|
+
It does **not** replace Fetch.
|
|
8
|
+
|
|
9
|
+
It builds on top of the Fetch API while keeping the native request model.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Features
|
|
14
|
+
|
|
15
|
+
- Fetch First
|
|
16
|
+
- TypeScript First
|
|
17
|
+
- Lightweight
|
|
18
|
+
- Extensible
|
|
19
|
+
- Zero Runtime Dependency
|
|
20
|
+
- Plugin Architecture
|
|
21
|
+
- Custom Adapter
|
|
22
|
+
- Unified Error Handling
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @npora/request
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @npora/request
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Quick Start
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { createClient } from '@npora/request'
|
|
44
|
+
|
|
45
|
+
interface User {
|
|
46
|
+
id: number
|
|
47
|
+
name: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const request = createClient({
|
|
51
|
+
baseURL: 'https://api.example.com'
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const user = await request.get<User>('/users/1')
|
|
55
|
+
|
|
56
|
+
console.log(user)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# Public API
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const request = createClient(options)
|
|
65
|
+
|
|
66
|
+
request.request(config)
|
|
67
|
+
|
|
68
|
+
request.get(url)
|
|
69
|
+
|
|
70
|
+
request.post(url)
|
|
71
|
+
|
|
72
|
+
request.put(url)
|
|
73
|
+
|
|
74
|
+
request.patch(url)
|
|
75
|
+
|
|
76
|
+
request.delete(url)
|
|
77
|
+
|
|
78
|
+
request.use(plugin)
|
|
79
|
+
|
|
80
|
+
request.interceptors.request.use()
|
|
81
|
+
|
|
82
|
+
request.interceptors.response.use()
|
|
83
|
+
|
|
84
|
+
request.interceptors.error.use()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
# Examples
|
|
90
|
+
|
|
91
|
+
See the `examples` directory.
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
examples
|
|
95
|
+
├── basic.ts
|
|
96
|
+
└── plugins.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
# Documentation
|
|
102
|
+
|
|
103
|
+
Project documentation is located in the `docs` directory.
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
docs
|
|
107
|
+
├── blueprint.md
|
|
108
|
+
├── structure.md
|
|
109
|
+
├── features.md
|
|
110
|
+
└── api.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- **Blueprint** — Project vision and architecture
|
|
114
|
+
- **Structure** — Directory responsibilities
|
|
115
|
+
- **Features** — Product roadmap
|
|
116
|
+
- **API** — Public API contract
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
# Browser Support
|
|
121
|
+
|
|
122
|
+
Supported runtimes:
|
|
123
|
+
|
|
124
|
+
- Chrome
|
|
125
|
+
- Edge
|
|
126
|
+
- Firefox
|
|
127
|
+
- Safari
|
|
128
|
+
- Node.js
|
|
129
|
+
|
|
130
|
+
Internet Explorer is **not supported**.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
# Roadmap
|
|
135
|
+
|
|
136
|
+
## v0.1
|
|
137
|
+
|
|
138
|
+
Core
|
|
139
|
+
|
|
140
|
+
- Client
|
|
141
|
+
- Config
|
|
142
|
+
- Pipeline
|
|
143
|
+
- Adapter
|
|
144
|
+
- Error
|
|
145
|
+
|
|
146
|
+
## v0.2
|
|
147
|
+
|
|
148
|
+
Request
|
|
149
|
+
|
|
150
|
+
- Timeout
|
|
151
|
+
- Abort
|
|
152
|
+
- Retry
|
|
153
|
+
- Cache
|
|
154
|
+
|
|
155
|
+
## v0.3
|
|
156
|
+
|
|
157
|
+
Business
|
|
158
|
+
|
|
159
|
+
- Auth
|
|
160
|
+
- Logger
|
|
161
|
+
- Upload
|
|
162
|
+
- Download
|
|
163
|
+
|
|
164
|
+
## v1.0
|
|
165
|
+
|
|
166
|
+
Stable API
|
|
167
|
+
|
|
168
|
+
Production Ready
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
# License
|
|
173
|
+
|
|
174
|
+
MIT © Npora Team
|