@aphexcms/storage-s3 15.0.0 → 16.0.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 +59 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @aphexcms/storage-s3
|
|
2
|
+
|
|
3
|
+
S3-compatible storage adapter for [AphexCMS](https://github.com/IcelandicIcecream/aphex) — Cloudflare R2, AWS S3, MinIO, and anything else speaking the S3 API.
|
|
4
|
+
|
|
5
|
+
Implements the `StorageAdapter` contract from `@aphexcms/cms-core`. Without it, Aphex stores uploads on the local filesystem, which is fine in development and wrong on any platform with an ephemeral disk.
|
|
6
|
+
|
|
7
|
+
📚 **Documentation: [docs.getaphex.com/storage](https://docs.getaphex.com/storage)**
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @aphexcms/storage-s3
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```ts title="src/lib/server/storage/index.ts"
|
|
18
|
+
import { s3Storage } from '@aphexcms/storage-s3';
|
|
19
|
+
import { env } from '$env/dynamic/private';
|
|
20
|
+
|
|
21
|
+
export const storageAdapter = s3Storage({
|
|
22
|
+
bucket: env.R2_BUCKET,
|
|
23
|
+
endpoint: env.R2_ENDPOINT,
|
|
24
|
+
accessKeyId: env.R2_ACCESS_KEY_ID,
|
|
25
|
+
secretAccessKey: env.R2_SECRET_ACCESS_KEY,
|
|
26
|
+
publicUrl: env.R2_PUBLIC_URL
|
|
27
|
+
}).adapter;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts title="aphex.config.ts"
|
|
31
|
+
import { storageAdapter } from './src/lib/server/storage';
|
|
32
|
+
|
|
33
|
+
export default createCMSConfig({
|
|
34
|
+
schemaTypes,
|
|
35
|
+
database: db,
|
|
36
|
+
storage: storageAdapter
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What `publicUrl` is for
|
|
41
|
+
|
|
42
|
+
Assets are addressed through your app by default, which means every image is proxied through a function invocation. `publicUrl` (or `R2_CDN_URL` for a custom domain) points asset URLs straight at the bucket instead, so the bytes never touch your server.
|
|
43
|
+
|
|
44
|
+
Keep it unset if the bucket is private and you want every read to go through Aphex's access control.
|
|
45
|
+
|
|
46
|
+
## Signed downloads and direct uploads
|
|
47
|
+
|
|
48
|
+
The adapter implements the optional parts of `StorageAdapter` that make the two heavier paths work:
|
|
49
|
+
|
|
50
|
+
- **`getSignedUploadUrl`** — lets large uploads go browser-to-bucket, skipping the request-size ceiling on your platform. Enable it with the `upload` option in `createCMSConfig`.
|
|
51
|
+
- **`getObjectRange`** — lets Aphex inspect the first bytes of a direct upload to verify its real content type, rather than trusting what the browser claimed.
|
|
52
|
+
|
|
53
|
+
## Note on development
|
|
54
|
+
|
|
55
|
+
This package is consumed from `dist`, not from source — a change here needs a rebuild and a dev-server restart before the studio sees it.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aphexcms/storage-s3",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "S3-compatible storage adapter for Aphex CMS (AWS S3, Cloudflare R2, MinIO, etc.)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"s3mini": "^1.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@aphexcms/cms-core": "^
|
|
32
|
+
"@aphexcms/cms-core": "^11.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"tsup": "^8.5.1",
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
|
-
"@aphexcms/cms-core": "^
|
|
37
|
+
"@aphexcms/cms-core": "^11.0.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc",
|