@alistt69/create-api 0.1.5 → 0.1.7

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/README.md +44 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,22 +7,56 @@
7
7
  <h1>@alistt69/create-api</h1>
8
8
 
9
9
  > **One helper. No extra.**
10
- > Light createApi with query, lazy query & mutation hooks.
10
+ > A lightweight createApi inspired by **RTKQ** — with query, lazy query and mutation hooks, built-in cache utilities, stale data handling and a tiny, focused API.
11
11
 
12
12
  [![npm version](https://img.shields.io/npm/v/@alistt69/create-api.svg)](https://www.npmjs.com/package/@alistt69/create-api)
13
13
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
14
+ [![React Version](https://img.shields.io/badge/react-%3E%3D16.8-149eca?logo=react&logoColor=white)](https://react.dev/)
14
15
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
15
16
  [![CI](https://github.com/alistt69/alistt69-create-api/actions/workflows/ci.yml/badge.svg)](https://github.com/alistt69/alistt69-create-api/actions/workflows/ci.yml)
16
17
  </td>
17
18
  </tr>
18
19
  </table>
19
20
 
20
- ## Install
21
+ ## ✨ Overview
22
+
23
+ `@alistt69/create-api` is a lightweight [RTK Query-inspired](https://redux-toolkit.js.org/rtk-query/overview) helper for React apps that need a clean createApi experience without Redux.
24
+
25
+ It provides query, lazy query and mutation hooks, cache helpers and stale data support in a compact API designed for everyday app needs.
26
+
27
+ ## 🔧 What’s inside
28
+
29
+ | Feature | Purpose |
30
+ | -------------------- | ------------------------------------ |
31
+ | Query hooks | Fetch data with generated hooks |
32
+ | Lazy query hooks | Trigger queries manually when needed |
33
+ | Mutation hooks | Handle writes with generated hooks |
34
+ | Cache utils | Read and patch cached data manually |
35
+ | Stale time support | Reuse cached data before refetching |
36
+ | Keep unused data for | Control cache lifetime after unmount |
37
+
38
+ ## 🎯 Why use it?
39
+
40
+ This package is specified for projects with no Redux.
41
+
42
+ It gives you a RTKQ-similar API model and developer experience, while staying smaller, simpler and focused on the most common data-fetching needs.
43
+
44
+ Do whatever you want and however you want with:
45
+ * generated hooks
46
+ * predictable cache behavior
47
+ * simple manual cache updates
48
+ * a focused API without a larger state layer
49
+
50
+ ## 📦 Requirements
51
+ * Node.js 18 or higher
52
+ * React 16.8 or higher
53
+
54
+ ## 🔥 Install
21
55
  ```bash
22
56
  npm i @alistt69/create-api
23
57
  ```
24
58
 
25
- ## Example
59
+ ## ⚡ Quick example
26
60
  ```typescript jsx
27
61
  import { createApi } from '@alistt69/create-api';
28
62
 
@@ -58,7 +92,7 @@ const api = createApi({
58
92
  });
59
93
  ```
60
94
 
61
- ## Usage
95
+ ## 🛠️ Usage
62
96
  ```typescript jsx
63
97
  function Post() {
64
98
  const { data, isLoading } = api.useGetPostQuery('1');
@@ -74,17 +108,14 @@ function Post() {
74
108
  }
75
109
  ```
76
110
 
77
- ## Cache utils
111
+ ## ⚙️ Cache utils
78
112
  ``` typescript
79
113
  api.util.getQueryData('getPost', '1');
80
114
  api.util.setQueryData('getPost', '1', { id: '1', title: 'Local title' });
81
115
  ```
82
116
 
83
- ## Development
84
- ```bash
85
- npm install
86
- npm run typecheck
87
- npm run test
88
- npm run build
89
- npm pack
90
- ```
117
+ ## 📄 License
118
+
119
+ MIT — free and open for everyone.
120
+
121
+ _See [LICENSE](./LICENSE)._
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alistt69/create-api",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Lightweight createApi with query/mutation/lazy hooks",
5
5
  "type": "module",
6
6
  "sideEffects": false,