@venturekit/storage 0.0.0-dev.20260308002709 → 0.0.0-dev.20260310105525
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 +83 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @venturekit/storage
|
|
2
|
+
|
|
3
|
+
> **Warning:** This package is in active development and not production-ready. APIs may change without notice.
|
|
4
|
+
|
|
5
|
+
Storage layer for [VentureKit](https://venturekit.dev) — S3 configuration with CDN, lifecycle, and CORS support.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @venturekit/storage@dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`@venturekit/storage` provides:
|
|
16
|
+
|
|
17
|
+
- **S3 configuration** — `createS3Config()`, `buildS3Config()` for bucket setup
|
|
18
|
+
- **Type definitions** for storage buckets, lifecycle policies, CDN, and CORS
|
|
19
|
+
- **Infrastructure intent integration** — declare storage needs in `venturekit.config.ts`
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Via Infrastructure Intents (Recommended)
|
|
24
|
+
|
|
25
|
+
Declare storage buckets in your VentureKit config:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { defineVenture } from '@venturekit/infra';
|
|
29
|
+
|
|
30
|
+
export default defineVenture({
|
|
31
|
+
// ...
|
|
32
|
+
infrastructure: {
|
|
33
|
+
storage: [
|
|
34
|
+
{ id: 'uploads', purpose: 'uploads', versioned: true },
|
|
35
|
+
{ id: 'assets', purpose: 'assets', cdn: true, corsOrigins: ['*'] },
|
|
36
|
+
{ id: 'backups', purpose: 'backups' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Accessing Storage in Handlers
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { handler } from '@venturekit/runtime';
|
|
46
|
+
import type { IntentOutputs } from '@venturekit/core';
|
|
47
|
+
|
|
48
|
+
export const main = handler(async (_body, ctx, logger) => {
|
|
49
|
+
const outputs = ctx.intentOutputs as IntentOutputs;
|
|
50
|
+
const bucketName = outputs.storage['uploads'].bucketName;
|
|
51
|
+
const cdnUrl = outputs.storage['assets'].cdnUrl;
|
|
52
|
+
// Use AWS SDK to interact with the bucket
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Direct Configuration
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createS3Config, DEFAULT_S3_CONFIG } from '@venturekit/storage';
|
|
60
|
+
|
|
61
|
+
const s3Config = createS3Config({
|
|
62
|
+
bucketName: 'my-uploads',
|
|
63
|
+
versioned: true,
|
|
64
|
+
cdn: true,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Storage Purposes
|
|
69
|
+
|
|
70
|
+
| Purpose | Description |
|
|
71
|
+
|---------|-------------|
|
|
72
|
+
| `uploads` | User-uploaded files |
|
|
73
|
+
| `assets` | Static assets (images, CSS, JS) |
|
|
74
|
+
| `backups` | Database and application backups |
|
|
75
|
+
| `logs` | Application and access logs |
|
|
76
|
+
|
|
77
|
+
## API Reference
|
|
78
|
+
|
|
79
|
+
See the [API reference](https://venturekit.dev/api-reference/storage) for full documentation.
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
Apache-2.0 — see [LICENSE](../../LICENSE) for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturekit/storage",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20260310105525",
|
|
4
4
|
"description": "Storage layer for VentureKit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@venturekit/core": "0.0.0-dev.
|
|
28
|
+
"@venturekit/core": "0.0.0-dev.20260310105525"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^20.10.0",
|