@opensaas/stack-storage-vercel 0.3.0 → 0.5.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @opensaas/stack-storage-vercel@0.3.0 build /home/runner/work/stack/stack/packages/storage-vercel
2
+ > @opensaas/stack-storage-vercel@0.5.0 build /home/runner/work/stack/stack/packages/storage-vercel
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # @opensaas/stack-storage-vercel
2
2
 
3
+ ## 0.5.0
4
+
5
+ ## 0.4.0
6
+
7
+ ### Patch Changes
8
+
9
+ - [#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
10
+
11
+ 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.
12
+
13
+ ## Field Type Inference Improvements
14
+
15
+ 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.
16
+
17
+ **Example:**
18
+
19
+ ```typescript
20
+ // Before
21
+
22
+ fields: {
23
+ displayName: virtual<Lists.User.TypeInfo>({
24
+ type: 'string',
25
+ hooks: {
26
+ resolveOutput: ({ item }) => `${item.name} (${item.email})`,
27
+ },
28
+ }),
29
+ },
30
+ })
31
+
32
+ // After
33
+
34
+ fields: {
35
+ displayName: virtual({
36
+ type: 'string',
37
+ hooks: {
38
+ resolveOutput: ({ item }) => `${item.name} (${item.email})`,
39
+ },
40
+ }),
41
+ },
42
+ })
43
+ ```
44
+
45
+ ## List-Level Hooks Type Inference Fix
46
+
47
+ 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:
48
+ 1. `TOutput` - The item type (what's stored in DB)
49
+ 2. `TCreateInput` - Prisma create input type
50
+ 3. `TUpdateInput` - Prisma update input type
51
+
52
+ **Impact:**
53
+ - `resolveInput` now receives proper Prisma input types (e.g., `PostCreateInput`, `PostUpdateInput`)
54
+ - `validateInput` has access to properly typed input data
55
+ - `beforeOperation` and `afterOperation` have correct item types
56
+ - All list-level hook callbacks now get full IntelliSense and type checking
57
+
58
+ **Example:**
59
+
60
+ ```typescript
61
+ Post: list<Lists.Post.TypeInfo>({
62
+ fields: { title: text(), content: text() },
63
+ hooks: {
64
+ resolveInput: async ({ operation, resolvedData }) => {
65
+ // ✅ resolvedData is now properly typed as PostCreateInput or PostUpdateInput
66
+ // ✅ Full autocomplete for title, content, etc.
67
+ if (operation === 'create') {
68
+ console.log(resolvedData.title) // TypeScript knows this is string | undefined
69
+ }
70
+ return resolvedData
71
+ },
72
+ beforeOperation: async ({ operation, item }) => {
73
+ // ✅ item is now properly typed as Post with all fields
74
+ if (operation === 'update' && item) {
75
+ console.log(item.title) // TypeScript knows this is string
76
+ console.log(item.createdAt) // TypeScript knows this is Date
77
+ }
78
+ },
79
+ },
80
+ })
81
+ ```
82
+
83
+ ## Breaking Changes
84
+ - Field types now accept full `TTypeInfo extends TypeInfo` instead of just `TItem`
85
+ - `FieldsWithItemType` utility replaced with `FieldsWithTypeInfo`
86
+ - All field builders updated to use new type signature
87
+ - List-level hooks now receive properly typed parameters (may reveal existing type errors)
88
+
89
+ ## Benefits
90
+ - ✨ Cleaner code without manual type parameter repetition
91
+ - 🎯 Better type inference in both field-level and list-level hooks
92
+ - 🔄 Consistent type flow from list configuration down to individual fields
93
+ - 🛡️ Maintained full type safety with improved DX
94
+ - 💡 Full IntelliSense support in all hook callbacks
95
+
3
96
  ## 0.3.0
4
97
 
5
98
  ## 0.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensaas/stack-storage-vercel",
3
- "version": "0.3.0",
3
+ "version": "0.5.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.7.2",
19
- "@vitest/coverage-v8": "^4.0.4",
18
+ "@types/node": "^24.10.1",
19
+ "@vitest/coverage-v8": "^4.0.15",
20
20
  "typescript": "^5.9.3",
21
- "vitest": "^4.0.0",
22
- "@opensaas/stack-storage": "0.3.0"
21
+ "vitest": "^4.0.15",
22
+ "@opensaas/stack-storage": "0.5.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@opensaas/stack-storage": "^0"