@symbo.ls/fetch 3.14.402 → 3.14.403
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 +6 -0
- package/README.md +10 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,17 +4,17 @@ Declarative data fetching for DOMQL with pluggable adapters. Supports caching, s
|
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
|
-
Add `
|
|
7
|
+
Add `fetch` to `config.js` — this is the connection/adapter config (distinct from the per-element `fetch` query declaration; the runtime resolves it onto `context.fetch`):
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
10
|
// Supabase
|
|
11
|
-
|
|
11
|
+
fetch: { adapter: 'supabase', projectId: '...', key: '...' }
|
|
12
12
|
|
|
13
13
|
// Supabase — config from state
|
|
14
|
-
|
|
14
|
+
fetch: { adapter: 'supabase', state: 'supabase' } // merges root state.supabase
|
|
15
15
|
|
|
16
16
|
// REST
|
|
17
|
-
|
|
17
|
+
fetch: {
|
|
18
18
|
adapter: 'rest',
|
|
19
19
|
url: 'https://api.example.com',
|
|
20
20
|
headers: { Authorization: 'Bearer token' },
|
|
@@ -28,9 +28,14 @@ db: {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Local
|
|
31
|
-
|
|
31
|
+
fetch: { adapter: 'local', data: { articles: [] }, persist: true }
|
|
32
|
+
|
|
33
|
+
// Custom/registered adapter (see Registering a named adapter)
|
|
34
|
+
fetch: { adapter: 'sdk', sdk: getSDK() }
|
|
32
35
|
```
|
|
33
36
|
|
|
37
|
+
> `db` is **not** a config key — it's the local name for the resolved adapter you get from `await this.getDB()` (`db.select(...)`, `db.insert(...)`, …).
|
|
38
|
+
|
|
34
39
|
## Declarative `fetch`
|
|
35
40
|
|
|
36
41
|
```js
|