@growsober/types 1.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 +116 -0
- package/dist/generated.d.ts +9964 -0
- package/dist/generated.js +7 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +30 -0
- package/package.json +47 -0
- package/src/generated.ts +9965 -0
- package/src/index.ts +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @growsober/types
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript types from the GrowSober API OpenAPI specification.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @growsober/types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { paths, components } from '@growsober/types';
|
|
15
|
+
|
|
16
|
+
// Access schema types
|
|
17
|
+
type User = components['schemas']['UserResponseDto'];
|
|
18
|
+
type Event = components['schemas']['EventResponseDto'];
|
|
19
|
+
type Hub = components['schemas']['HubResponseDto'];
|
|
20
|
+
|
|
21
|
+
// Access path types for type-safe API calls
|
|
22
|
+
type LoginRequest = paths['/api/v1/auth/login']['post']['requestBody']['content']['application/json'];
|
|
23
|
+
type LoginResponse = paths['/api/v1/auth/login']['post']['responses']['200']['content']['application/json'];
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Generating Types
|
|
27
|
+
|
|
28
|
+
Types are auto-generated from the running API's OpenAPI spec:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# From local development API
|
|
32
|
+
npm run generate
|
|
33
|
+
|
|
34
|
+
# From production API
|
|
35
|
+
npm run generate:prod
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Available Types
|
|
39
|
+
|
|
40
|
+
### Auth Types
|
|
41
|
+
- `RegisterDto` - Registration request
|
|
42
|
+
- `LoginDto` - Login request
|
|
43
|
+
- `AuthResponseDto` - Auth response with tokens
|
|
44
|
+
- `RefreshTokenDto` - Token refresh request
|
|
45
|
+
- `TokenResponseDto` - Token response
|
|
46
|
+
- `FirebaseAuthDto` - Firebase auth request
|
|
47
|
+
|
|
48
|
+
### User Types
|
|
49
|
+
- `UserResponseDto` - Full user profile
|
|
50
|
+
- `UserPublicResponseDto` - Public profile
|
|
51
|
+
- `CreateUserDto` - Create user request
|
|
52
|
+
- `UpdateUserDto` - Update user request
|
|
53
|
+
|
|
54
|
+
### Hub Types
|
|
55
|
+
- `HubResponseDto` - Hub details
|
|
56
|
+
- `CreateHubDto` - Create hub request
|
|
57
|
+
- `UpdateHubDto` - Update hub request
|
|
58
|
+
|
|
59
|
+
### Event Types
|
|
60
|
+
- `EventResponseDto` - Event details
|
|
61
|
+
- `CreateEventDto` - Create event request
|
|
62
|
+
- `UpdateEventDto` - Update event request
|
|
63
|
+
|
|
64
|
+
### Booking Types
|
|
65
|
+
- `BookingResponseDto` - Booking details
|
|
66
|
+
- `CreateBookingDto` - Create booking request
|
|
67
|
+
|
|
68
|
+
### Library Types
|
|
69
|
+
- `LibraryContentResponseDto` - Content list item
|
|
70
|
+
- `LibraryContentDetailResponseDto` - Full content
|
|
71
|
+
- `LibraryProgressResponseDto` - User progress
|
|
72
|
+
|
|
73
|
+
### Business Types
|
|
74
|
+
- `BusinessResponseDto` - Business details
|
|
75
|
+
- `OfferResponseDto` - Offer details
|
|
76
|
+
- `RedeemOfferDto` - Redeem offer request
|
|
77
|
+
|
|
78
|
+
### Subscription Types
|
|
79
|
+
- `SubscriptionResponseDto` - Subscription details
|
|
80
|
+
- `CreateCheckoutDto` - Checkout request
|
|
81
|
+
|
|
82
|
+
### Notification Types
|
|
83
|
+
- `NotificationResponseDto` - Notification details
|
|
84
|
+
|
|
85
|
+
## Type Helpers
|
|
86
|
+
|
|
87
|
+
For convenience, use with `@growsober/sdk` which provides type extraction utilities:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import type {
|
|
91
|
+
RequestBody,
|
|
92
|
+
ResponseBody,
|
|
93
|
+
QueryParams,
|
|
94
|
+
PathParams
|
|
95
|
+
} from '@growsober/sdk';
|
|
96
|
+
|
|
97
|
+
// Extract request body type
|
|
98
|
+
type CreateEventBody = RequestBody<'/api/v1/events', 'post'>;
|
|
99
|
+
|
|
100
|
+
// Extract response type
|
|
101
|
+
type EventResponse = ResponseBody<'/api/v1/events/{id}', 'get'>;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Type check
|
|
108
|
+
npm run type-check
|
|
109
|
+
|
|
110
|
+
# Build
|
|
111
|
+
npm run build
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
UNLICENSED - Proprietary
|