@spotsdev/sdk 1.0.0 → 1.1.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/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +7 -3
- package/dist/api/entities.d.ts +316 -0
- package/dist/api/entities.js +9 -0
- package/dist/api/mutations/clubs.d.ts +6 -6
- package/dist/api/mutations/clubs.js +12 -10
- package/dist/api/mutations/conversations.d.ts +7 -7
- package/dist/api/mutations/conversations.js +17 -13
- package/dist/api/mutations/index.js +1 -1
- package/dist/api/mutations/notifications.d.ts +4 -4
- package/dist/api/mutations/notifications.js +7 -7
- package/dist/api/mutations/orders.d.ts +7 -7
- package/dist/api/mutations/orders.js +11 -13
- package/dist/api/mutations/posts.d.ts +13 -13
- package/dist/api/mutations/posts.js +41 -29
- package/dist/api/mutations/products.d.ts +5 -5
- package/dist/api/mutations/products.js +9 -13
- package/dist/api/mutations/spots.d.ts +42 -8
- package/dist/api/mutations/spots.js +51 -13
- package/dist/api/mutations/users.d.ts +12 -10
- package/dist/api/mutations/users.js +20 -18
- package/dist/api/queries/auth.d.ts +5 -5
- package/dist/api/queries/auth.js +7 -7
- package/dist/api/queries/clubs.d.ts +7 -7
- package/dist/api/queries/clubs.js +11 -11
- package/dist/api/queries/conversations.d.ts +5 -5
- package/dist/api/queries/conversations.js +7 -7
- package/dist/api/queries/index.js +1 -1
- package/dist/api/queries/misc.d.ts +8 -32
- package/dist/api/queries/misc.js +28 -66
- package/dist/api/queries/notifications.d.ts +4 -4
- package/dist/api/queries/notifications.js +5 -5
- package/dist/api/queries/orders.d.ts +4 -4
- package/dist/api/queries/orders.js +7 -7
- package/dist/api/queries/posts.d.ts +44 -7
- package/dist/api/queries/posts.js +118 -15
- package/dist/api/queries/products.d.ts +6 -10
- package/dist/api/queries/products.js +7 -9
- package/dist/api/queries/spots.d.ts +31 -16
- package/dist/api/queries/spots.js +113 -31
- package/dist/api/queries/templates.d.ts +6 -9
- package/dist/api/queries/templates.js +8 -13
- package/dist/api/queries/users.d.ts +25 -11
- package/dist/api/queries/users.js +75 -27
- package/dist/api/types.d.ts +36 -33
- package/dist/api/types.js +6 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -8
- package/package.json +6 -21
- package/src/api/client.ts +45 -30
- package/src/api/entities.ts +420 -0
- package/src/api/mutations/clubs.ts +73 -40
- package/src/api/mutations/conversations.ts +91 -47
- package/src/api/mutations/index.ts +8 -8
- package/src/api/mutations/notifications.ts +48 -25
- package/src/api/mutations/orders.ts +101 -70
- package/src/api/mutations/posts.ts +229 -118
- package/src/api/mutations/products.ts +120 -81
- package/src/api/mutations/spots.ts +167 -55
- package/src/api/mutations/users.ts +109 -76
- package/src/api/queries/auth.ts +49 -24
- package/src/api/queries/clubs.ts +53 -38
- package/src/api/queries/conversations.ts +48 -30
- package/src/api/queries/index.ts +21 -21
- package/src/api/queries/misc.ts +53 -82
- package/src/api/queries/notifications.ts +32 -21
- package/src/api/queries/orders.ts +59 -42
- package/src/api/queries/posts.ts +203 -48
- package/src/api/queries/products.ts +51 -44
- package/src/api/queries/spots.ts +216 -85
- package/src/api/queries/templates.ts +39 -32
- package/src/api/queries/users.ts +157 -64
- package/src/api/types.ts +72 -118
- package/src/index.ts +5 -11
package/src/api/queries/users.ts
CHANGED
|
@@ -4,9 +4,38 @@
|
|
|
4
4
|
* TanStack Query hooks for user-related operations.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import {
|
|
8
|
+
useQuery,
|
|
9
|
+
type UseQueryOptions,
|
|
10
|
+
type UseQueryResult,
|
|
11
|
+
} from '@tanstack/react-query'
|
|
12
|
+
|
|
13
|
+
import {getApiClient} from '../client'
|
|
14
|
+
import {
|
|
15
|
+
type ApiResponse,
|
|
16
|
+
type Club,
|
|
17
|
+
type FavoriteSpot,
|
|
18
|
+
type Post,
|
|
19
|
+
type Spot,
|
|
20
|
+
type SpotsSummaryResponse,
|
|
21
|
+
type SpotSubscription,
|
|
22
|
+
type User,
|
|
23
|
+
} from '../types'
|
|
24
|
+
|
|
25
|
+
// Helper to extract array data from API response
|
|
26
|
+
// API can return either { data: T[] } or { data: { data: T[], meta?: {...} } }
|
|
27
|
+
function extractArrayData<T>(data: unknown): T[] {
|
|
28
|
+
if (Array.isArray(data)) {
|
|
29
|
+
return data
|
|
30
|
+
}
|
|
31
|
+
if (data && typeof data === 'object' && 'data' in data) {
|
|
32
|
+
const nested = (data as {data: unknown}).data
|
|
33
|
+
if (Array.isArray(nested)) {
|
|
34
|
+
return nested
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return []
|
|
38
|
+
}
|
|
10
39
|
|
|
11
40
|
// ============================================================================
|
|
12
41
|
// QUERY KEYS
|
|
@@ -16,14 +45,16 @@ export const userKeys = {
|
|
|
16
45
|
all: ['users'] as const,
|
|
17
46
|
me: () => [...userKeys.all, 'me'] as const,
|
|
18
47
|
stats: () => [...userKeys.me(), 'stats'] as const,
|
|
48
|
+
spotsSummary: () => [...userKeys.me(), 'spots-summary'] as const,
|
|
19
49
|
activity: (limit?: number) => [...userKeys.me(), 'activity', limit] as const,
|
|
20
|
-
posts: (params?: {
|
|
50
|
+
posts: (params?: {page?: number; limit?: number}) =>
|
|
51
|
+
[...userKeys.me(), 'posts', params] as const,
|
|
21
52
|
clubs: () => [...userKeys.me(), 'clubs'] as const,
|
|
22
53
|
subscriptions: () => [...userKeys.me(), 'subscriptions'] as const,
|
|
23
54
|
blocked: () => [...userKeys.me(), 'blocked'] as const,
|
|
24
55
|
ownedSpots: () => [...userKeys.me(), 'owned-spots'] as const,
|
|
25
56
|
favorites: () => [...userKeys.me(), 'favorites'] as const,
|
|
26
|
-
}
|
|
57
|
+
}
|
|
27
58
|
|
|
28
59
|
// ============================================================================
|
|
29
60
|
// QUERY HOOKS
|
|
@@ -32,175 +63,237 @@ export const userKeys = {
|
|
|
32
63
|
/**
|
|
33
64
|
* Get current user's profile
|
|
34
65
|
*
|
|
35
|
-
* @endpoint GET /
|
|
66
|
+
* @endpoint GET /users/me
|
|
36
67
|
*/
|
|
37
68
|
export function useCurrentUser(
|
|
38
|
-
options?: Omit<UseQueryOptions<User>, 'queryKey' | 'queryFn'
|
|
69
|
+
options?: Omit<UseQueryOptions<User>, 'queryKey' | 'queryFn'>,
|
|
39
70
|
): UseQueryResult<User> {
|
|
40
71
|
return useQuery({
|
|
41
72
|
queryKey: userKeys.me(),
|
|
42
73
|
queryFn: async (): Promise<User> => {
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
74
|
+
console.log('[SDK-USERS] Fetching /users/me...')
|
|
75
|
+
const client = getApiClient()
|
|
76
|
+
try {
|
|
77
|
+
const response = await client.get<ApiResponse<User>>('/users/me')
|
|
78
|
+
console.log('[SDK-USERS] Success:', response.status)
|
|
79
|
+
return response.data.data
|
|
80
|
+
} catch (error: unknown) {
|
|
81
|
+
const axiosError = error as {
|
|
82
|
+
response?: {status: number}
|
|
83
|
+
config?: {url: string; baseURL?: string}
|
|
84
|
+
}
|
|
85
|
+
console.log(
|
|
86
|
+
'[SDK-USERS] Error:',
|
|
87
|
+
axiosError.response?.status,
|
|
88
|
+
'URL:',
|
|
89
|
+
axiosError.config?.baseURL,
|
|
90
|
+
axiosError.config?.url,
|
|
91
|
+
)
|
|
92
|
+
throw error
|
|
93
|
+
}
|
|
46
94
|
},
|
|
47
95
|
...options,
|
|
48
|
-
})
|
|
96
|
+
})
|
|
49
97
|
}
|
|
50
98
|
|
|
51
99
|
/**
|
|
52
100
|
* Get current user's stats
|
|
53
101
|
*
|
|
54
|
-
* @endpoint GET /
|
|
102
|
+
* @endpoint GET /users/me/stats
|
|
103
|
+
* @deprecated This endpoint doesn't exist in the API. Use useUserSpotsSummary instead.
|
|
55
104
|
*/
|
|
56
105
|
export function useUserStats(
|
|
57
|
-
options?: Omit<
|
|
58
|
-
|
|
106
|
+
options?: Omit<
|
|
107
|
+
UseQueryOptions<{posts: number; responses: number; upvotes: number}>,
|
|
108
|
+
'queryKey' | 'queryFn'
|
|
109
|
+
>,
|
|
110
|
+
): UseQueryResult<{posts: number; responses: number; upvotes: number}> {
|
|
59
111
|
return useQuery({
|
|
60
112
|
queryKey: userKeys.stats(),
|
|
61
113
|
queryFn: async () => {
|
|
62
|
-
const client = getApiClient()
|
|
63
|
-
const response =
|
|
64
|
-
|
|
114
|
+
const client = getApiClient()
|
|
115
|
+
const response =
|
|
116
|
+
await client.get<
|
|
117
|
+
ApiResponse<{posts: number; responses: number; upvotes: number}>
|
|
118
|
+
>('/users/me/stats')
|
|
119
|
+
return response.data.data
|
|
120
|
+
},
|
|
121
|
+
...options,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get current user's spots summary with activity indicators
|
|
127
|
+
*
|
|
128
|
+
* Returns list of spots where user has posted, with:
|
|
129
|
+
* - Post count per spot
|
|
130
|
+
* - Unread messages count
|
|
131
|
+
* - Pending responses count
|
|
132
|
+
* - Last activity timestamp
|
|
133
|
+
*
|
|
134
|
+
* @endpoint GET /users/me/spots-summary
|
|
135
|
+
*/
|
|
136
|
+
export function useUserSpotsSummary(
|
|
137
|
+
options?: Omit<UseQueryOptions<SpotsSummaryResponse>, 'queryKey' | 'queryFn'>,
|
|
138
|
+
): UseQueryResult<SpotsSummaryResponse> {
|
|
139
|
+
return useQuery({
|
|
140
|
+
queryKey: userKeys.spotsSummary(),
|
|
141
|
+
queryFn: async () => {
|
|
142
|
+
const client = getApiClient()
|
|
143
|
+
const response = await client.get<ApiResponse<SpotsSummaryResponse>>(
|
|
144
|
+
'/users/me/spots-summary',
|
|
145
|
+
)
|
|
146
|
+
return response.data.data
|
|
65
147
|
},
|
|
66
148
|
...options,
|
|
67
|
-
})
|
|
149
|
+
})
|
|
68
150
|
}
|
|
69
151
|
|
|
70
152
|
/**
|
|
71
153
|
* Get current user's activity
|
|
72
154
|
*
|
|
73
|
-
* @endpoint GET /
|
|
155
|
+
* @endpoint GET /users/me/activity
|
|
74
156
|
*/
|
|
75
157
|
export function useUserActivity(
|
|
76
158
|
limit: number = 10,
|
|
77
|
-
options?: Omit<UseQueryOptions<unknown[]>, 'queryKey' | 'queryFn'
|
|
159
|
+
options?: Omit<UseQueryOptions<unknown[]>, 'queryKey' | 'queryFn'>,
|
|
78
160
|
): UseQueryResult<unknown[]> {
|
|
79
161
|
return useQuery({
|
|
80
162
|
queryKey: userKeys.activity(limit),
|
|
81
163
|
queryFn: async () => {
|
|
82
|
-
const client = getApiClient()
|
|
83
|
-
const response = await client.get<ApiResponse<unknown
|
|
84
|
-
|
|
164
|
+
const client = getApiClient()
|
|
165
|
+
const response = await client.get<ApiResponse<unknown>>(
|
|
166
|
+
`/users/me/activity?limit=${limit}`,
|
|
167
|
+
)
|
|
168
|
+
return extractArrayData<unknown>(response.data.data)
|
|
85
169
|
},
|
|
86
170
|
...options,
|
|
87
|
-
})
|
|
171
|
+
})
|
|
88
172
|
}
|
|
89
173
|
|
|
90
174
|
/**
|
|
91
175
|
* Get current user's posts
|
|
92
176
|
*
|
|
93
|
-
* @endpoint GET /
|
|
177
|
+
* @endpoint GET /user/me/posts
|
|
94
178
|
*/
|
|
95
179
|
export function useUserPosts(
|
|
96
|
-
params?: {
|
|
97
|
-
options?: Omit<UseQueryOptions<Post[]>, 'queryKey' | 'queryFn'
|
|
180
|
+
params?: {page?: number; limit?: number},
|
|
181
|
+
options?: Omit<UseQueryOptions<Post[]>, 'queryKey' | 'queryFn'>,
|
|
98
182
|
): UseQueryResult<Post[]> {
|
|
99
183
|
return useQuery({
|
|
100
184
|
queryKey: userKeys.posts(params),
|
|
101
185
|
queryFn: async () => {
|
|
102
|
-
const client = getApiClient()
|
|
103
|
-
const queryParams = new URLSearchParams()
|
|
104
|
-
if (params?.page) queryParams.set('page', String(params.page))
|
|
105
|
-
if (params?.limit) queryParams.set('limit', String(params.limit))
|
|
106
|
-
const response = await client.get<ApiResponse<
|
|
107
|
-
|
|
186
|
+
const client = getApiClient()
|
|
187
|
+
const queryParams = new URLSearchParams()
|
|
188
|
+
if (params?.page) queryParams.set('page', String(params.page))
|
|
189
|
+
if (params?.limit) queryParams.set('limit', String(params.limit))
|
|
190
|
+
const response = await client.get<ApiResponse<unknown>>(
|
|
191
|
+
`/user/me/posts?${queryParams}`,
|
|
192
|
+
)
|
|
193
|
+
return extractArrayData<Post>(response.data.data)
|
|
108
194
|
},
|
|
109
195
|
...options,
|
|
110
|
-
})
|
|
196
|
+
})
|
|
111
197
|
}
|
|
112
198
|
|
|
113
199
|
/**
|
|
114
200
|
* Get current user's clubs
|
|
115
201
|
*
|
|
116
|
-
* @endpoint GET /
|
|
202
|
+
* @endpoint GET /user/me/clubs
|
|
117
203
|
*/
|
|
118
204
|
export function useUserClubs(
|
|
119
|
-
options?: Omit<UseQueryOptions<Club[]>, 'queryKey' | 'queryFn'
|
|
205
|
+
options?: Omit<UseQueryOptions<Club[]>, 'queryKey' | 'queryFn'>,
|
|
120
206
|
): UseQueryResult<Club[]> {
|
|
121
207
|
return useQuery({
|
|
122
208
|
queryKey: userKeys.clubs(),
|
|
123
209
|
queryFn: async () => {
|
|
124
|
-
const client = getApiClient()
|
|
125
|
-
const response = await client.get<ApiResponse<
|
|
126
|
-
return response.data.data
|
|
210
|
+
const client = getApiClient()
|
|
211
|
+
const response = await client.get<ApiResponse<unknown>>('/user/me/clubs')
|
|
212
|
+
return extractArrayData<Club>(response.data.data)
|
|
127
213
|
},
|
|
128
214
|
...options,
|
|
129
|
-
})
|
|
215
|
+
})
|
|
130
216
|
}
|
|
131
217
|
|
|
132
218
|
/**
|
|
133
219
|
* Get current user's spot subscriptions
|
|
134
220
|
*
|
|
135
|
-
* @endpoint GET /
|
|
221
|
+
* @endpoint GET /user/me/subscriptions
|
|
136
222
|
*/
|
|
137
223
|
export function useUserSubscriptions(
|
|
138
|
-
options?: Omit<UseQueryOptions<SpotSubscription[]>, 'queryKey' | 'queryFn'
|
|
224
|
+
options?: Omit<UseQueryOptions<SpotSubscription[]>, 'queryKey' | 'queryFn'>,
|
|
139
225
|
): UseQueryResult<SpotSubscription[]> {
|
|
140
226
|
return useQuery({
|
|
141
227
|
queryKey: userKeys.subscriptions(),
|
|
142
228
|
queryFn: async () => {
|
|
143
|
-
const client = getApiClient()
|
|
144
|
-
const response = await client.get<ApiResponse<
|
|
145
|
-
|
|
229
|
+
const client = getApiClient()
|
|
230
|
+
const response = await client.get<ApiResponse<unknown>>(
|
|
231
|
+
'/user/me/subscriptions',
|
|
232
|
+
)
|
|
233
|
+
return extractArrayData<SpotSubscription>(response.data.data)
|
|
146
234
|
},
|
|
147
235
|
...options,
|
|
148
|
-
})
|
|
236
|
+
})
|
|
149
237
|
}
|
|
150
238
|
|
|
151
239
|
/**
|
|
152
240
|
* Get blocked users list
|
|
153
241
|
*
|
|
154
|
-
* @endpoint GET /
|
|
242
|
+
* @endpoint GET /user/me/blocked
|
|
155
243
|
*/
|
|
156
244
|
export function useBlockedUsers(
|
|
157
|
-
options?: Omit<UseQueryOptions<User[]>, 'queryKey' | 'queryFn'
|
|
245
|
+
options?: Omit<UseQueryOptions<User[]>, 'queryKey' | 'queryFn'>,
|
|
158
246
|
): UseQueryResult<User[]> {
|
|
159
247
|
return useQuery({
|
|
160
248
|
queryKey: userKeys.blocked(),
|
|
161
249
|
queryFn: async () => {
|
|
162
|
-
const client = getApiClient()
|
|
163
|
-
const response =
|
|
164
|
-
|
|
250
|
+
const client = getApiClient()
|
|
251
|
+
const response =
|
|
252
|
+
await client.get<ApiResponse<unknown>>('/user/me/blocked')
|
|
253
|
+
return extractArrayData<User>(response.data.data)
|
|
165
254
|
},
|
|
166
255
|
...options,
|
|
167
|
-
})
|
|
256
|
+
})
|
|
168
257
|
}
|
|
169
258
|
|
|
170
259
|
/**
|
|
171
260
|
* Get current user's owned spots (for business owners)
|
|
172
261
|
*
|
|
173
|
-
* @endpoint GET /
|
|
262
|
+
* @endpoint GET /users/me/owned-spots
|
|
174
263
|
*/
|
|
175
264
|
export function useOwnedSpots(
|
|
176
|
-
options?: Omit<UseQueryOptions<Spot[]>, 'queryKey' | 'queryFn'
|
|
265
|
+
options?: Omit<UseQueryOptions<Spot[]>, 'queryKey' | 'queryFn'>,
|
|
177
266
|
): UseQueryResult<Spot[]> {
|
|
178
267
|
return useQuery({
|
|
179
268
|
queryKey: userKeys.ownedSpots(),
|
|
180
269
|
queryFn: async () => {
|
|
181
|
-
const client = getApiClient()
|
|
182
|
-
const response = await client.get<ApiResponse<
|
|
183
|
-
|
|
270
|
+
const client = getApiClient()
|
|
271
|
+
const response = await client.get<ApiResponse<unknown>>(
|
|
272
|
+
'/users/me/owned-spots',
|
|
273
|
+
)
|
|
274
|
+
return extractArrayData<Spot>(response.data.data)
|
|
184
275
|
},
|
|
185
276
|
...options,
|
|
186
|
-
})
|
|
277
|
+
})
|
|
187
278
|
}
|
|
188
279
|
|
|
189
280
|
/**
|
|
190
281
|
* Get current user's favorite spots
|
|
191
282
|
*
|
|
192
|
-
* @endpoint GET /
|
|
283
|
+
* @endpoint GET /users/me/favorites
|
|
193
284
|
*/
|
|
194
285
|
export function useUserFavorites(
|
|
195
|
-
options?: Omit<UseQueryOptions<FavoriteSpot[]>, 'queryKey' | 'queryFn'
|
|
286
|
+
options?: Omit<UseQueryOptions<FavoriteSpot[]>, 'queryKey' | 'queryFn'>,
|
|
196
287
|
): UseQueryResult<FavoriteSpot[]> {
|
|
197
288
|
return useQuery({
|
|
198
289
|
queryKey: userKeys.favorites(),
|
|
199
290
|
queryFn: async () => {
|
|
200
|
-
const client = getApiClient()
|
|
201
|
-
const response = await client.get<ApiResponse<
|
|
202
|
-
|
|
291
|
+
const client = getApiClient()
|
|
292
|
+
const response = await client.get<ApiResponse<unknown>>(
|
|
293
|
+
'/users/me/favorites',
|
|
294
|
+
)
|
|
295
|
+
return extractArrayData<FavoriteSpot>(response.data.data)
|
|
203
296
|
},
|
|
204
297
|
...options,
|
|
205
|
-
})
|
|
298
|
+
})
|
|
206
299
|
}
|
package/src/api/types.ts
CHANGED
|
@@ -2,143 +2,97 @@
|
|
|
2
2
|
* Spots SDK Types
|
|
3
3
|
*
|
|
4
4
|
* Type sources:
|
|
5
|
-
* - Entity types (User, Spot, Post, etc.) →
|
|
6
|
-
* - DTO types (CreatePostDto, etc.) → import from @
|
|
5
|
+
* - Entity types (User, Spot, Post, etc.) → from ./entities (local definitions)
|
|
6
|
+
* - DTO types (CreatePostDto, etc.) → import from @spots/types (OpenAPI generated)
|
|
7
7
|
*
|
|
8
|
-
* This file provides type aliases for SDK convenience
|
|
9
|
-
* single sources of truth:
|
|
10
|
-
* - Prisma schema for entities
|
|
11
|
-
* - OpenAPI spec for DTOs
|
|
8
|
+
* This file provides type aliases for SDK convenience.
|
|
12
9
|
*/
|
|
13
10
|
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// API RESPONSE TYPES
|
|
16
|
-
// ============================================================================
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Standard API response wrapper from ResponseInterceptor
|
|
20
|
-
* All API responses are wrapped in this format
|
|
21
|
-
*/
|
|
22
|
-
export interface ApiResponse<T> {
|
|
23
|
-
success: boolean;
|
|
24
|
-
data: T;
|
|
25
|
-
timestamp: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Paginated response for list endpoints
|
|
30
|
-
* Used inside ApiResponse.data for paginated queries
|
|
31
|
-
*/
|
|
32
|
-
export interface PaginatedResponse<T> {
|
|
33
|
-
data: T[];
|
|
34
|
-
meta: {
|
|
35
|
-
total: number;
|
|
36
|
-
page: number;
|
|
37
|
-
limit: number;
|
|
38
|
-
totalPages: number;
|
|
39
|
-
hasNextPage: boolean;
|
|
40
|
-
hasPreviousPage: boolean;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
11
|
// ============================================================================
|
|
45
12
|
// RE-EXPORTS FROM SOURCES
|
|
46
13
|
// ============================================================================
|
|
47
14
|
|
|
48
15
|
// Re-export all DTO types from @spotsdev/types (OpenAPI generated)
|
|
49
|
-
export * from '@spotsdev/types'
|
|
16
|
+
export * from '@spotsdev/types'
|
|
50
17
|
|
|
51
|
-
// Re-export entity types from
|
|
52
|
-
export
|
|
53
|
-
// Models
|
|
54
|
-
User,
|
|
55
|
-
Spot,
|
|
56
|
-
SpotPost,
|
|
57
|
-
PostReply,
|
|
58
|
-
PostResponse,
|
|
59
|
-
PostUpvote,
|
|
60
|
-
PostReport,
|
|
61
|
-
Club,
|
|
62
|
-
ClubMember,
|
|
63
|
-
Conversation,
|
|
64
|
-
Message,
|
|
65
|
-
Notification,
|
|
66
|
-
PostTemplate,
|
|
67
|
-
Vibe,
|
|
68
|
-
Interest,
|
|
69
|
-
Intention,
|
|
70
|
-
LifeSituation,
|
|
71
|
-
FavoriteSpot,
|
|
72
|
-
SpotImage,
|
|
73
|
-
SpotVibe,
|
|
74
|
-
SpotIntention,
|
|
75
|
-
SpotClaim,
|
|
76
|
-
SpotSubscription,
|
|
77
|
-
City,
|
|
78
|
-
// Marketplace Models
|
|
79
|
-
Product,
|
|
80
|
-
Order,
|
|
81
|
-
OrderItem,
|
|
82
|
-
Payment,
|
|
83
|
-
InventoryLog,
|
|
84
|
-
StripeConnectAccount,
|
|
85
|
-
// Enums
|
|
86
|
-
SpotType,
|
|
87
|
-
SpotPostType,
|
|
88
|
-
AccountStatus,
|
|
89
|
-
ClaimStatus,
|
|
90
|
-
ResponseStatus,
|
|
91
|
-
ReportReason,
|
|
92
|
-
ReportStatus,
|
|
93
|
-
NotificationType,
|
|
94
|
-
// Marketplace Enums
|
|
95
|
-
ProductType,
|
|
96
|
-
ProductStatus,
|
|
97
|
-
OrderStatus,
|
|
98
|
-
PaymentProvider,
|
|
99
|
-
PaymentStatus,
|
|
100
|
-
FulfillmentType,
|
|
101
|
-
InventoryChangeReason,
|
|
102
|
-
} from '@prisma/client';
|
|
18
|
+
// Re-export entity types from local entities file (Prisma-compatible but no Prisma dep)
|
|
19
|
+
export * from './entities'
|
|
103
20
|
|
|
104
21
|
// ============================================================================
|
|
105
22
|
// SDK TYPE ALIASES
|
|
106
23
|
// These provide convenient names that match SDK usage patterns
|
|
107
24
|
// ============================================================================
|
|
108
25
|
|
|
109
|
-
import
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} from '@spotsdev/types'
|
|
26
|
+
import {
|
|
27
|
+
type ClaimSpotDto,
|
|
28
|
+
type CreateConversationDto,
|
|
29
|
+
type CreateMessageDto,
|
|
30
|
+
type CreatePostDto,
|
|
31
|
+
type CreateReplyDto,
|
|
32
|
+
type CreateResponseDto,
|
|
33
|
+
type SendOtpDto,
|
|
34
|
+
type UpdateResponseDto,
|
|
35
|
+
type UpdateUserDto,
|
|
36
|
+
type UpvoteResponseDto,
|
|
37
|
+
type VerifyOtpDto,
|
|
38
|
+
type VerifyOtpWrappedResponseDto,
|
|
39
|
+
} from '@spotsdev/types'
|
|
123
40
|
|
|
124
|
-
import type
|
|
41
|
+
import {type PostTemplate, type SpotPost} from './entities'
|
|
125
42
|
|
|
126
43
|
// Request type aliases (map to DTOs)
|
|
127
|
-
export type SendOtpRequest = SendOtpDto
|
|
128
|
-
export type VerifyOtpRequest = VerifyOtpDto
|
|
129
|
-
export type CreatePostRequest = CreatePostDto
|
|
130
|
-
export type CreateReplyRequest = CreateReplyDto
|
|
131
|
-
export type RespondToPostRequest = CreateResponseDto
|
|
132
|
-
export type UpdateResponseRequest = UpdateResponseDto
|
|
133
|
-
export type UpdateProfileRequest = UpdateUserDto
|
|
134
|
-
export type CreateConversationRequest = CreateConversationDto
|
|
135
|
-
export type SendMessageRequest = CreateMessageDto
|
|
136
|
-
export type ClaimSpotRequest = ClaimSpotDto
|
|
44
|
+
export type SendOtpRequest = SendOtpDto
|
|
45
|
+
export type VerifyOtpRequest = VerifyOtpDto
|
|
46
|
+
export type CreatePostRequest = CreatePostDto
|
|
47
|
+
export type CreateReplyRequest = CreateReplyDto
|
|
48
|
+
export type RespondToPostRequest = CreateResponseDto
|
|
49
|
+
export type UpdateResponseRequest = UpdateResponseDto
|
|
50
|
+
export type UpdateProfileRequest = UpdateUserDto
|
|
51
|
+
export type CreateConversationRequest = CreateConversationDto
|
|
52
|
+
export type SendMessageRequest = CreateMessageDto
|
|
53
|
+
export type ClaimSpotRequest = ClaimSpotDto
|
|
137
54
|
|
|
138
55
|
// Response type aliases
|
|
139
|
-
export type UpvoteResponse = UpvoteResponseDto
|
|
140
|
-
export type AuthResponse = VerifyOtpWrappedResponseDto
|
|
56
|
+
export type UpvoteResponse = UpvoteResponseDto
|
|
57
|
+
export type AuthResponse = VerifyOtpWrappedResponseDto
|
|
141
58
|
|
|
142
59
|
// Entity type aliases (for backward compatibility)
|
|
143
|
-
export type Post = SpotPost
|
|
144
|
-
export type Template = PostTemplate
|
|
60
|
+
export type Post = SpotPost
|
|
61
|
+
export type Template = PostTemplate
|
|
62
|
+
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// SDK-SPECIFIC TYPES (not from entities or DTOs)
|
|
65
|
+
// ============================================================================
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Spot summary with activity indicators
|
|
69
|
+
* Returned by /users/me/spots-summary
|
|
70
|
+
*/
|
|
71
|
+
export interface SpotSummary {
|
|
72
|
+
spotId: string
|
|
73
|
+
spotName: string
|
|
74
|
+
spotSlug: string
|
|
75
|
+
spotType: string
|
|
76
|
+
postCount: number
|
|
77
|
+
unreadMessages: number
|
|
78
|
+
pendingResponses: number
|
|
79
|
+
lastActivity: string | null
|
|
80
|
+
hasNewActivity: boolean
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Response meta for spots summary
|
|
85
|
+
*/
|
|
86
|
+
export interface SpotsSummaryMeta {
|
|
87
|
+
totalSpots: number
|
|
88
|
+
totalUnreadMessages: number
|
|
89
|
+
totalPendingResponses: number
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Full response from /users/me/spots-summary
|
|
94
|
+
*/
|
|
95
|
+
export interface SpotsSummaryResponse {
|
|
96
|
+
data: SpotSummary[]
|
|
97
|
+
meta: SpotsSummaryMeta
|
|
98
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -35,29 +35,23 @@
|
|
|
35
35
|
// API CLIENT
|
|
36
36
|
// ============================================================================
|
|
37
37
|
|
|
38
|
-
export {
|
|
39
|
-
export
|
|
38
|
+
export type {SDKConfig} from './api/client'
|
|
39
|
+
export {configureSDK, getApiClient, getConfig} from './api/client'
|
|
40
40
|
|
|
41
41
|
// ============================================================================
|
|
42
42
|
// TYPES
|
|
43
43
|
// ============================================================================
|
|
44
44
|
|
|
45
|
-
export * from './api/types'
|
|
45
|
+
export * from './api/types'
|
|
46
46
|
|
|
47
47
|
// ============================================================================
|
|
48
48
|
// QUERY HOOKS
|
|
49
49
|
// ============================================================================
|
|
50
50
|
|
|
51
|
-
export * from './api/queries'
|
|
51
|
+
export * from './api/queries'
|
|
52
52
|
|
|
53
53
|
// ============================================================================
|
|
54
54
|
// MUTATION HOOKS
|
|
55
55
|
// ============================================================================
|
|
56
56
|
|
|
57
|
-
export * from './api/mutations'
|
|
58
|
-
|
|
59
|
-
// ============================================================================
|
|
60
|
-
// SERVICES (Plain async functions for testing/non-React)
|
|
61
|
-
// ============================================================================
|
|
62
|
-
|
|
63
|
-
export * from './api/services';
|
|
57
|
+
export * from './api/mutations'
|