@usegraft/sdk-astro 0.1.1 → 0.2.0
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 +44 -0
- package/package.json +18 -5
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @usegraft/sdk-astro
|
|
2
|
+
|
|
3
|
+
> Astro adapter: typed content reads and endpoint mounts over the same handlers every other surface serves.
|
|
4
|
+
|
|
5
|
+
Part of [Graft](https://github.com/AndersonDesign1/graft), a CMS built so an AI agent is the primary operator.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @usegraft/sdk-astro
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Read content
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createGraft } from "@usegraft/sdk-astro";
|
|
17
|
+
import { collections } from "../graft.config";
|
|
18
|
+
|
|
19
|
+
const graft = createGraft({ db, collections });
|
|
20
|
+
const page = await graft.getContent("pages", Astro.params.slug);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Mount the runtime
|
|
24
|
+
|
|
25
|
+
`graftRoute` binds Graft's stateless handlers to an Astro endpoint, so typed functions and MCP are served from your own app rather than a separate process.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// src/pages/api/[...graft].ts
|
|
29
|
+
import { graftRoute } from "@usegraft/sdk-astro";
|
|
30
|
+
|
|
31
|
+
export const ALL = graftRoute({ db, collections, functions });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## MDX
|
|
35
|
+
|
|
36
|
+
Bodies come back as authored source. Render them with Astro's own MDX pipeline rather than a runtime evaluator, which is why this package ships no `MdxBody` equivalent.
|
|
37
|
+
|
|
38
|
+
## Cache invalidation
|
|
39
|
+
|
|
40
|
+
The [`@usegraft/sdk-core`](https://www.npmjs.com/package/@usegraft/sdk-core) tag contract maps onto CDN surrogate keys.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
MIT. [Repository](https://github.com/AndersonDesign1/graft) · [Changelog](https://github.com/AndersonDesign1/graft/blob/feat/core/packages/sdk-astro/CHANGELOG.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usegraft/sdk-astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Astro adapter: typed content reads and endpoint mounts over Graft's stateless handlers.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"ai",
|
|
8
|
+
"astro",
|
|
9
|
+
"cms",
|
|
10
|
+
"content",
|
|
11
|
+
"graft",
|
|
12
|
+
"headless-cms",
|
|
13
|
+
"mcp",
|
|
14
|
+
"ssr",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/AndersonDesign1/graft#readme",
|
|
4
18
|
"license": "MIT",
|
|
5
19
|
"repository": {
|
|
6
20
|
"type": "git",
|
|
@@ -24,10 +38,10 @@
|
|
|
24
38
|
"access": "public"
|
|
25
39
|
},
|
|
26
40
|
"dependencies": {
|
|
27
|
-
"@usegraft/sdk-core": "0.
|
|
41
|
+
"@usegraft/sdk-core": "0.2.0"
|
|
28
42
|
},
|
|
29
43
|
"devDependencies": {
|
|
30
|
-
"@usegraft/core": "0.
|
|
44
|
+
"@usegraft/core": "0.2.0"
|
|
31
45
|
},
|
|
32
46
|
"engines": {
|
|
33
47
|
"node": ">=22.16"
|
|
@@ -36,7 +50,6 @@
|
|
|
36
50
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
37
51
|
"dev": "tsup src/index.ts --format esm --watch",
|
|
38
52
|
"typecheck": "tsc --noEmit",
|
|
39
|
-
"test": "vitest run --passWithNoTests"
|
|
40
|
-
"lint": "oxlint ."
|
|
53
|
+
"test": "vitest run --passWithNoTests"
|
|
41
54
|
}
|
|
42
55
|
}
|