@usegraft/assets 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.
Files changed (2) hide show
  1. package/README.md +37 -0
  2. package/package.json +18 -3
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @usegraft/assets
2
+
3
+ > S3-compatible object storage for binary assets. Cloudflare R2, MinIO, Tigris, or anything speaking the same API.
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/assets
11
+ ```
12
+
13
+ ## Use
14
+
15
+ ```ts
16
+ import { createStorage, storageConfigFromEnv } from "@usegraft/assets";
17
+
18
+ const storage = createStorage(storageConfigFromEnv());
19
+ await storage.put(key, bytes, { contentType });
20
+ const url = await storage.url(key);
21
+ ```
22
+
23
+ `storageConfigFromEnv` reads `S3_BUCKET`, `S3_ENDPOINT`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` and the optional `S3_PUBLIC_URL`. Set `S3_PUBLIC_URL` for a stable public base; without it, reads come back as presigned GETs.
24
+
25
+ ## Keys
26
+
27
+ `defaultKeyFor` and `contentTypeFor` derive a content-addressed key and a MIME type from a filename, so an agent uploading a file does not have to invent either.
28
+
29
+ ```ts
30
+ import { defaultKeyFor, contentTypeFor } from "@usegraft/assets";
31
+ ```
32
+
33
+ Upload from the CLI with `graft asset put <file> [key]`, and reference the result from a collection with `field.asset()`.
34
+
35
+ ---
36
+
37
+ MIT. [Repository](https://github.com/AndersonDesign1/graft) · [Changelog](https://github.com/AndersonDesign1/graft/blob/feat/core/packages/assets/CHANGELOG.md)
package/package.json CHANGED
@@ -1,6 +1,22 @@
1
1
  {
2
2
  "name": "@usegraft/assets",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
+ "description": "S3-compatible object storage for binary assets: Cloudflare R2, MinIO, Tigris.",
5
+ "keywords": [
6
+ "agent",
7
+ "ai",
8
+ "assets",
9
+ "cms",
10
+ "graft",
11
+ "headless-cms",
12
+ "mcp",
13
+ "minio",
14
+ "r2",
15
+ "s3",
16
+ "storage",
17
+ "typescript"
18
+ ],
19
+ "homepage": "https://github.com/AndersonDesign1/graft#readme",
4
20
  "license": "MIT",
5
21
  "repository": {
6
22
  "type": "git",
@@ -33,7 +49,6 @@
33
49
  "build": "tsup src/index.ts --format esm --dts --clean",
34
50
  "dev": "tsup src/index.ts --format esm --watch",
35
51
  "typecheck": "tsc --noEmit",
36
- "test": "vitest run --passWithNoTests",
37
- "lint": "oxlint ."
52
+ "test": "vitest run --passWithNoTests"
38
53
  }
39
54
  }