@opensaas/stack-storage-vercel 0.3.0 → 0.4.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +91 -0
- package/package.json +5 -5
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @opensaas/stack-storage-vercel
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#172](https://github.com/OpenSaasAU/stack/pull/172) [`929a2a9`](https://github.com/OpenSaasAU/stack/commit/929a2a9a2dfa80b1d973d259dd87828d644ea58d) Thanks [@list<Lists.User.TypeInfo>({](https://github.com/list<Lists.User.TypeInfo>({), [@list<Lists.User.TypeInfo>({](https://github.com/list<Lists.User.TypeInfo>({)! - Improve TypeScript type inference for field configs and list-level hooks by automatically passing TypeInfo from list level down
|
|
8
|
+
|
|
9
|
+
This change eliminates the need to manually specify type parameters on field builders when using features like virtual fields, and fixes a critical bug where list-level hooks weren't receiving properly typed parameters.
|
|
10
|
+
|
|
11
|
+
## Field Type Inference Improvements
|
|
12
|
+
|
|
13
|
+
Previously, users had to write `virtual<Lists.User.TypeInfo>({...})` to get proper type inference. Now TypeScript automatically infers the correct types from the list-level type parameter.
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// Before
|
|
19
|
+
|
|
20
|
+
fields: {
|
|
21
|
+
displayName: virtual<Lists.User.TypeInfo>({
|
|
22
|
+
type: 'string',
|
|
23
|
+
hooks: {
|
|
24
|
+
resolveOutput: ({ item }) => `${item.name} (${item.email})`,
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
// After
|
|
31
|
+
|
|
32
|
+
fields: {
|
|
33
|
+
displayName: virtual({
|
|
34
|
+
type: 'string',
|
|
35
|
+
hooks: {
|
|
36
|
+
resolveOutput: ({ item }) => `${item.name} (${item.email})`,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## List-Level Hooks Type Inference Fix
|
|
44
|
+
|
|
45
|
+
Fixed a critical type parameter mismatch where `Hooks<TTypeInfo>` was passing the entire TypeInfo object as the first parameter instead of properly destructuring it into three required parameters:
|
|
46
|
+
1. `TOutput` - The item type (what's stored in DB)
|
|
47
|
+
2. `TCreateInput` - Prisma create input type
|
|
48
|
+
3. `TUpdateInput` - Prisma update input type
|
|
49
|
+
|
|
50
|
+
**Impact:**
|
|
51
|
+
- `resolveInput` now receives proper Prisma input types (e.g., `PostCreateInput`, `PostUpdateInput`)
|
|
52
|
+
- `validateInput` has access to properly typed input data
|
|
53
|
+
- `beforeOperation` and `afterOperation` have correct item types
|
|
54
|
+
- All list-level hook callbacks now get full IntelliSense and type checking
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
Post: list<Lists.Post.TypeInfo>({
|
|
60
|
+
fields: { title: text(), content: text() },
|
|
61
|
+
hooks: {
|
|
62
|
+
resolveInput: async ({ operation, resolvedData }) => {
|
|
63
|
+
// ✅ resolvedData is now properly typed as PostCreateInput or PostUpdateInput
|
|
64
|
+
// ✅ Full autocomplete for title, content, etc.
|
|
65
|
+
if (operation === 'create') {
|
|
66
|
+
console.log(resolvedData.title) // TypeScript knows this is string | undefined
|
|
67
|
+
}
|
|
68
|
+
return resolvedData
|
|
69
|
+
},
|
|
70
|
+
beforeOperation: async ({ operation, item }) => {
|
|
71
|
+
// ✅ item is now properly typed as Post with all fields
|
|
72
|
+
if (operation === 'update' && item) {
|
|
73
|
+
console.log(item.title) // TypeScript knows this is string
|
|
74
|
+
console.log(item.createdAt) // TypeScript knows this is Date
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Breaking Changes
|
|
82
|
+
- Field types now accept full `TTypeInfo extends TypeInfo` instead of just `TItem`
|
|
83
|
+
- `FieldsWithItemType` utility replaced with `FieldsWithTypeInfo`
|
|
84
|
+
- All field builders updated to use new type signature
|
|
85
|
+
- List-level hooks now receive properly typed parameters (may reveal existing type errors)
|
|
86
|
+
|
|
87
|
+
## Benefits
|
|
88
|
+
- ✨ Cleaner code without manual type parameter repetition
|
|
89
|
+
- 🎯 Better type inference in both field-level and list-level hooks
|
|
90
|
+
- 🔄 Consistent type flow from list configuration down to individual fields
|
|
91
|
+
- 🛡️ Maintained full type safety with improved DX
|
|
92
|
+
- 💡 Full IntelliSense support in all hook callbacks
|
|
93
|
+
|
|
3
94
|
## 0.3.0
|
|
4
95
|
|
|
5
96
|
## 0.2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensaas/stack-storage-vercel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Vercel Blob storage provider for OpenSaas Stack file uploads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"@vercel/blob": "^2.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/node": "^24.
|
|
19
|
-
"@vitest/coverage-v8": "^4.0.
|
|
18
|
+
"@types/node": "^24.10.1",
|
|
19
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
20
20
|
"typescript": "^5.9.3",
|
|
21
|
-
"vitest": "^4.0.
|
|
22
|
-
"@opensaas/stack-storage": "0.
|
|
21
|
+
"vitest": "^4.0.15",
|
|
22
|
+
"@opensaas/stack-storage": "0.4.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@opensaas/stack-storage": "^0"
|