@spotsdev/sdk 1.5.3 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spotsdev/sdk",
3
- "version": "1.5.3",
3
+ "version": "1.7.0",
4
4
  "description": "Shared TypeScript SDK for Spots API - TanStack Query hooks, API client, and utilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -47,7 +47,7 @@
47
47
  "react": ">=18.0.0"
48
48
  },
49
49
  "dependencies": {
50
- "@spotsdev/types": "^1.3.2"
50
+ "@spotsdev/types": "file:../spots-types"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^20.0.0",
@@ -2,7 +2,7 @@
2
2
  * Spots SDK Entity Types
3
3
  *
4
4
  * ALL entity and enum types are imported from @spotsdev/types (generated from OpenAPI spec).
5
- * This file re-exports them with SDK-friendly aliases and adds SDK-specific types.
5
+ * This file re-exports them with SDK-friendly aliases.
6
6
  *
7
7
  * IMPORTANT: Do NOT define entity types here - they come from spots-types.
8
8
  */
@@ -19,6 +19,7 @@ export type {
19
19
  PostStatus,
20
20
  ResponseStatus,
21
21
  ReportReason,
22
+ ReportStatus,
22
23
  ProductType,
23
24
  ProductStatus,
24
25
  FulfillmentType,
@@ -26,6 +27,9 @@ export type {
26
27
  OrderStatus,
27
28
  NotificationType,
28
29
  MediaType,
30
+ ClubCategory,
31
+ ClubStatus,
32
+ ClubMemberStatus,
29
33
 
30
34
  // Spot types
31
35
  SpotResponseDto,
@@ -57,6 +61,18 @@ export type {
57
61
  CreateReportDto,
58
62
  PostStatusDto,
59
63
 
64
+ // Post upvotes
65
+ PostUpvoteDto,
66
+ PostUpvoterDto,
67
+ PostUpvotesMetaDto,
68
+ PostUpvotesResponseDto,
69
+
70
+ // Post reports
71
+ PostReportDto,
72
+
73
+ // Post responses (I'm interested)
74
+ PostResponseEntityDto,
75
+
60
76
  // User types
61
77
  UserResponseDto,
62
78
  UpdateUserDto,
@@ -74,6 +90,8 @@ export type {
74
90
  CreateOrderDto,
75
91
  OrderItemDto,
76
92
  UpdateOrderStatusDto,
93
+ OrderResponseDto,
94
+ OrderItemResponseDto,
77
95
 
78
96
  // Notification types
79
97
  NotificationResponseDto,
@@ -86,10 +104,39 @@ export type {
86
104
  SendOtpResponseDto,
87
105
  RefreshTokenResponseDto,
88
106
 
89
- // Other types
90
- CreateMediaDto,
107
+ // Conversation & Message types
108
+ ConversationDto,
109
+ ConversationParticipantDto,
110
+ ConversationLastMessageDto,
111
+ MessageDto,
112
+ MessageSenderDto,
91
113
  CreateConversationDto,
92
114
  CreateMessageDto,
115
+
116
+ // Reference data types
117
+ VibeDto,
118
+ UserVibeDto,
119
+ LifeSituationDto,
120
+ CityDto,
121
+
122
+ // Club types
123
+ ClubDto,
124
+ ClubMemberDto,
125
+ ClubMemberWithUserDto,
126
+
127
+ // Template types
128
+ PostTemplateDto,
129
+
130
+ // Favorites & Subscriptions
131
+ FavoriteSpotDto,
132
+ SpotSubscriptionDto,
133
+ SpotClaimDto,
134
+
135
+ // Pagination
136
+ PaginationMetaDto,
137
+
138
+ // Other types
139
+ CreateMediaDto,
93
140
  CreateInterestDto,
94
141
  UpdateInterestDto,
95
142
  AddUserInterestDto,
@@ -112,11 +159,22 @@ import type {
112
159
  OrderItemDto as OrderItemDtoType,
113
160
  NotificationResponseDto,
114
161
  SpotOwnerDto,
115
- PostUserDto,
116
- ResponseStatus,
117
- ReportReason,
118
- ClaimStatus,
119
- OrderStatus,
162
+ PostUpvoteDto as PostUpvoteDtoType,
163
+ ConversationDto as ConversationDtoType,
164
+ MessageDto as MessageDtoType,
165
+ ClubDto as ClubDtoType,
166
+ ClubMemberDto as ClubMemberDtoType,
167
+ PostTemplateDto as PostTemplateDtoType,
168
+ VibeDto as VibeDtoType,
169
+ CityDto as CityDtoType,
170
+ FavoriteSpotDto as FavoriteSpotDtoType,
171
+ SpotSubscriptionDto as SpotSubscriptionDtoType,
172
+ SpotClaimDto as SpotClaimDtoType,
173
+ OrderResponseDto as OrderResponseDtoType,
174
+ PostReportDto as PostReportDtoType,
175
+ PostResponseEntityDto as PostResponseEntityDtoType,
176
+ LifeSituationDto as LifeSituationDtoType,
177
+ PaginationMetaDto as PaginationMetaDtoType,
120
178
  } from '@spotsdev/types'
121
179
 
122
180
  // ============================================================================
@@ -149,229 +207,28 @@ export type User = SpotOwnerDto & {
149
207
  updatedAt?: Date
150
208
  }
151
209
 
152
- // ============================================================================
153
- // SDK-SPECIFIC TYPES (not in OpenAPI spec)
154
- // ============================================================================
155
-
156
- // Enums not yet exposed via API DTOs
157
- export type ReportStatus = 'PENDING' | 'REVIEWED' | 'RESOLVED' | 'DISMISSED'
158
- export type ClubMemberRole = 'MEMBER' | 'ADMIN' | 'OWNER'
159
-
160
- // PostResponse entity (different from CreateResponseDto/UpdateResponseDto)
161
- export interface PostResponse {
162
- id: string
163
- postId: string
164
- userId: string
165
- note: string | null
166
- status: ResponseStatus
167
- createdAt: Date
168
- updatedAt: Date
169
- user?: User
170
- post?: SpotPost
171
- }
172
-
173
- // PostUpvote entity
174
- export interface PostUpvote {
175
- id: string
176
- postId: string
177
- userId: string
178
- createdAt: Date
179
- }
180
-
181
- // PostUpvoter for /posts/:id/upvotes endpoint
182
- export interface PostUpvoter {
183
- id: string
184
- userId: string
185
- name: string | null
186
- avatarUrl: string | null
187
- createdAt: Date
188
- }
189
-
190
- // PostUpvotesResponse from /posts/:id/upvotes endpoint
191
- export interface PostUpvotesResponse {
192
- data: PostUpvoter[]
193
- meta: {
194
- total: number
195
- limit: number
196
- offset: number
197
- hasMore: boolean
198
- currentUserUpvoted: boolean
199
- isPostAuthor: boolean
200
- }
201
- }
202
-
203
- // PostReport entity
204
- export interface PostReport {
205
- id: string
206
- postId: string
207
- userId: string
208
- reason: ReportReason
209
- details: string | null
210
- status: ReportStatus
211
- createdAt: Date
212
- updatedAt: Date
213
- }
214
-
215
- // Club entities (not yet in API DTOs)
216
- export interface Club {
217
- id: string
218
- name: string
219
- slug: string
220
- description: string | null
221
- imageUrl: string | null
222
- isPrivate: boolean
223
- createdById: string
224
- createdAt: Date
225
- updatedAt: Date
226
- }
227
-
228
- export interface ClubMember {
229
- id: string
230
- clubId: string
231
- userId: string
232
- role: ClubMemberRole
233
- joinedAt: Date
234
- }
235
-
236
- // Conversation entities (not yet in API DTOs)
237
- export interface Conversation {
238
- id: string
239
- createdAt: Date
240
- updatedAt: Date
241
- participants?: User[]
242
- messages?: Message[]
243
- }
244
-
245
- export interface Message {
246
- id: string
247
- conversationId: string
248
- senderId: string
249
- content: string
250
- createdAt: Date
251
- sender?: User
252
- }
253
-
254
- // Template entity (not yet in API DTOs)
255
- export interface PostTemplate {
256
- id: string
257
- postType: SpotPostType
258
- emoji: string
259
- title: string
260
- placeholder: string | null
261
- isActive: boolean
262
- sortOrder: number
263
- createdAt: Date
264
- updatedAt: Date
265
- }
266
-
267
- // Reference entities (not yet in API DTOs)
268
- export interface Vibe {
269
- id: string
270
- name: string
271
- emoji: string | null
272
- createdAt: Date
273
- }
274
-
275
- export interface Interest {
276
- id: string
277
- name: string
278
- emoji: string | null
279
- category: string | null
280
- createdAt: Date
281
- }
282
-
283
- export interface Intention {
284
- id: string
285
- name: string
286
- emoji: string | null
287
- createdAt: Date
288
- }
289
-
290
- export interface LifeSituation {
291
- id: string
292
- name: string
293
- emoji: string | null
294
- createdAt: Date
295
- }
296
-
297
- // User vibe (simplified vibe attached to user)
298
- export interface UserVibe {
299
- id: string
300
- name: string
301
- emoji: string | null
302
- slug?: string
303
- category?: string
304
- }
305
-
306
- // Favorites and subscriptions (not yet in API DTOs)
307
- export interface FavoriteSpot {
308
- id: string
309
- userId: string
310
- spotId: string
311
- createdAt: Date
312
- spot?: Spot
313
- }
314
-
315
- export interface SpotSubscription {
316
- id: string
317
- spotId: string
318
- userId: string
319
- createdAt: Date
320
- spot?: Spot
321
- }
322
-
323
- // SpotClaim entity
324
- export interface SpotClaim {
325
- id: string
326
- spotId: string
327
- userId: string
328
- status: ClaimStatus
329
- verificationMethod: string | null
330
- createdAt: Date
331
- updatedAt: Date
332
- }
333
-
334
- // City entity
335
- export interface City {
336
- id: string
337
- name: string
338
- country: string
339
- latitude: number
340
- longitude: number
341
- timezone: string | null
342
- createdAt: Date
343
- }
344
-
345
- // Order entity (full order, not just OrderItemDto)
346
- export interface Order {
347
- id: string
348
- spotId: string
349
- userId: string
350
- status: OrderStatus
351
- subtotal: number
352
- tax: number
353
- total: number
354
- currency: string
355
- notes: string | null
356
- metadata: Record<string, unknown> | null
357
- createdAt: Date
358
- updatedAt: Date
359
- items?: OrderItem[]
360
- }
210
+ // Aliases for new types
211
+ export type PostUpvote = PostUpvoteDtoType
212
+ export type Conversation = ConversationDtoType
213
+ export type Message = MessageDtoType
214
+ export type Club = ClubDtoType
215
+ export type ClubMember = ClubMemberDtoType
216
+ export type PostTemplate = PostTemplateDtoType
217
+ export type Vibe = VibeDtoType
218
+ export type City = CityDtoType
219
+ export type FavoriteSpot = FavoriteSpotDtoType
220
+ export type SpotSubscription = SpotSubscriptionDtoType
221
+ export type SpotClaim = SpotClaimDtoType
222
+ export type Order = OrderResponseDtoType
223
+ export type PostReport = PostReportDtoType
224
+ export type PostResponse = PostResponseEntityDtoType
225
+ export type LifeSituation = LifeSituationDtoType
226
+ export type PaginationMeta = PaginationMetaDtoType
361
227
 
362
228
  // ============================================================================
363
- // PAGINATION TYPES
229
+ // GENERIC PAGINATION RESPONSE
364
230
  // ============================================================================
365
231
 
366
- export interface PaginationMeta {
367
- total: number
368
- page: number
369
- limit: number
370
- totalPages: number
371
- hasNextPage: boolean
372
- hasPreviousPage: boolean
373
- }
374
-
375
232
  export interface PaginatedResponse<T> {
376
233
  data: T[]
377
234
  meta: PaginationMeta
@@ -31,14 +31,23 @@ export interface CreateOrderRequest {
31
31
  deliveryAddress?: string
32
32
  }
33
33
 
34
- export interface CreateOrderResponse extends Order {
34
+ export interface CreateOrderResponse extends Omit<Order, 'items'> {
35
35
  items: Array<{
36
36
  id: string
37
+ orderId: string
37
38
  productId: string
38
39
  productName: string
40
+ productType: string
39
41
  quantity: number
40
42
  unitPrice: number
41
43
  totalPrice: number
44
+ status: string
45
+ passCode: string | null
46
+ ticketCode: string | null
47
+ passExpiresAt: string | null
48
+ redeemedAt: string | null
49
+ specialInstructions: string | null
50
+ createdAt: string
42
51
  }>
43
52
  }
44
53
 
@@ -12,7 +12,7 @@ import {
12
12
  } from '@tanstack/react-query'
13
13
  import {getApiClient} from '../client'
14
14
  import {productKeys} from '../queries/products'
15
- import type {Product, ProductType, ProductStatus, ApiResponse} from '../types'
15
+ import type {Product, ProductType, ApiResponse} from '../types'
16
16
 
17
17
  // ============================================================================
18
18
  // TYPES
@@ -26,16 +26,11 @@ export interface CreateProductRequest {
26
26
  type: ProductType
27
27
  price: number
28
28
  currency?: string
29
- stockQuantity?: number
30
- lowStockThreshold?: number
31
- validFrom?: string
32
- validUntil?: string
33
- deliveryRadiusKm?: number
34
- prepTimeMinutes?: number
35
- maxCapacity?: number
36
- eventDate?: string
29
+ stock?: number // Maps to API's stockQuantity
30
+ validityDays?: number // For PASS type - number of days valid
31
+ eventDate?: string // For EVENT_TICKET type
37
32
  imageUrl?: string
38
- metadata?: Record<string, unknown>
33
+ isActive?: boolean // true = ACTIVE, false = DRAFT
39
34
  }
40
35
 
41
36
  /**
@@ -51,19 +46,15 @@ function generateSlug(name: string): string {
51
46
 
52
47
  export interface UpdateProductRequest {
53
48
  name?: string
49
+ slug?: string
54
50
  description?: string
55
51
  price?: number
56
- stockQuantity?: number
57
- lowStockThreshold?: number
58
- status?: ProductStatus
59
- validFrom?: string
60
- validUntil?: string
61
- deliveryRadiusKm?: number
62
- prepTimeMinutes?: number
63
- maxCapacity?: number
64
- eventDate?: string
52
+ type?: ProductType
53
+ stock?: number // Maps to API's stockQuantity
54
+ validityDays?: number // For PASS type - number of days valid
55
+ eventDate?: string // For EVENT_TICKET type
65
56
  imageUrl?: string
66
- metadata?: Record<string, unknown>
57
+ isActive?: boolean // true = ACTIVE, false = DRAFT (maps to status field)
67
58
  }
68
59
 
69
60
  // ============================================================================
@@ -35,7 +35,7 @@ export const orderKeys = {
35
35
  // TYPES
36
36
  // ============================================================================
37
37
 
38
- export interface OrderWithDetails extends Order {
38
+ export interface OrderWithDetails extends Omit<Order, 'items'> {
39
39
  items: (OrderItem & {
40
40
  product: Pick<Product, 'id' | 'name' | 'slug' | 'type' | 'imageUrl'>
41
41
  })[]
package/src/api/types.ts CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  type UpvoteResponseDto,
37
37
  type VerifyOtpDto,
38
38
  type VerifyOtpWrappedResponseDto,
39
+ type PostUpvotesResponseDto,
39
40
  } from '@spotsdev/types'
40
41
 
41
42
  import {type PostTemplate, type SpotPost} from './entities'
@@ -54,6 +55,7 @@ export type ClaimSpotRequest = ClaimSpotDto
54
55
 
55
56
  // Response type aliases
56
57
  export type UpvoteResponse = UpvoteResponseDto
58
+ export type PostUpvotesResponse = PostUpvotesResponseDto
57
59
  export type AuthResponse = VerifyOtpWrappedResponseDto
58
60
 
59
61
  // Entity type aliases (for backward compatibility)