@meeovi/api 1.0.0 → 1.0.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/README.md +59 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
# 📦 `@meeovi/api` — README.md
|
|
5
|
+
|
|
6
|
+
```md
|
|
7
|
+
# @meeovi/api
|
|
8
|
+
|
|
9
|
+
A dynamic, backend‑agnostic API SDK for Meeovi.
|
|
10
|
+
Supports GraphQL, REST, RPC, and custom transports via a pluggable fetcher system.
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- Dynamic fetcher architecture
|
|
15
|
+
- GraphQL + REST loaders (auto‑import queries/mutations/endpoints)
|
|
16
|
+
- Namespaced operation registry
|
|
17
|
+
- Runtime‑switchable transports
|
|
18
|
+
- Nuxt module for auto‑initialization
|
|
19
|
+
- Provider integration for other Meeovi modules
|
|
20
|
+
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install @meeovi/api
|
|
25
|
+
|
|
26
|
+
⚙️ Setup
|
|
27
|
+
|
|
28
|
+
import { createApolloClient, setFetcher } from '@meeovi/api'
|
|
29
|
+
import { GraphQLFetcher } from '@meeovi/api'
|
|
30
|
+
|
|
31
|
+
createApolloClient('https://api.meeovi.com/graphql')
|
|
32
|
+
setFetcher(GraphQLFetcher)
|
|
33
|
+
|
|
34
|
+
🧩 Usage
|
|
35
|
+
|
|
36
|
+
import { fetcher, getQuery } from '@meeovi/api'
|
|
37
|
+
|
|
38
|
+
const GET_PRODUCT = getQuery('products.GET_PRODUCT')
|
|
39
|
+
|
|
40
|
+
const { data } = await fetcher(GET_PRODUCT, { id: '123' })
|
|
41
|
+
🔌 Fetchers
|
|
42
|
+
|
|
43
|
+
export interface Fetcher {
|
|
44
|
+
execute(req: FetcherRequest): Promise<FetcherResponse>
|
|
45
|
+
}
|
|
46
|
+
Register:
|
|
47
|
+
|
|
48
|
+
registerFetcher('rest', RestFetcher)
|
|
49
|
+
setActiveFetcher('rest')
|
|
50
|
+
🧱 Folder Structure
|
|
51
|
+
Code
|
|
52
|
+
src/
|
|
53
|
+
client/
|
|
54
|
+
fetcher/
|
|
55
|
+
loader/
|
|
56
|
+
graphql/
|
|
57
|
+
rest/
|
|
58
|
+
providers/
|
|
59
|
+
utils/
|