@vansite/ts-sharetribe-flex-sdk 1.0.33 → 2.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.
Files changed (271) hide show
  1. package/README.md +1 -1
  2. package/dist/endpoints/assets/index.d.ts +47 -0
  3. package/dist/endpoints/auth/index.d.ts +45 -0
  4. package/dist/endpoints/integrationApi/AvailabilityExceptions.d.ts +66 -0
  5. package/dist/endpoints/integrationApi/Events.d.ts +43 -0
  6. package/dist/endpoints/integrationApi/Images.d.ts +36 -0
  7. package/dist/endpoints/integrationApi/Listings.d.ts +87 -0
  8. package/dist/endpoints/integrationApi/Marketplace.d.ts +30 -0
  9. package/dist/endpoints/integrationApi/Stock.d.ts +42 -0
  10. package/dist/endpoints/integrationApi/StockAdjustments.d.ts +64 -0
  11. package/dist/{types/endpoints/integrationApi/StockReservation.d.ts → endpoints/integrationApi/StockReservations.d.ts} +3 -4
  12. package/dist/endpoints/integrationApi/Transactions.d.ts +76 -0
  13. package/dist/endpoints/integrationApi/Users.d.ts +72 -0
  14. package/dist/endpoints/integrationApi/index.d.ts +58 -0
  15. package/dist/endpoints/marketplace/AvailabilityExceptions.d.ts +69 -0
  16. package/dist/endpoints/marketplace/Bookings.d.ts +45 -0
  17. package/dist/endpoints/marketplace/CurrentUser.d.ts +110 -0
  18. package/dist/endpoints/marketplace/Images.d.ts +38 -0
  19. package/dist/endpoints/marketplace/Listings.d.ts +52 -0
  20. package/dist/endpoints/marketplace/Marketplace.d.ts +33 -0
  21. package/dist/endpoints/marketplace/Messages.d.ts +51 -0
  22. package/dist/endpoints/marketplace/OwnListings.d.ts +116 -0
  23. package/dist/endpoints/marketplace/PasswordReset.d.ts +50 -0
  24. package/dist/endpoints/marketplace/ProcessTransitions.d.ts +42 -0
  25. package/dist/endpoints/marketplace/Reviews.d.ts +49 -0
  26. package/dist/endpoints/marketplace/Stock.d.ts +50 -0
  27. package/dist/endpoints/marketplace/StockAdjustments.d.ts +64 -0
  28. package/dist/endpoints/marketplace/StripeAccount.d.ts +56 -0
  29. package/dist/endpoints/marketplace/StripeAccountLinks.d.ts +42 -0
  30. package/dist/endpoints/marketplace/StripeCustomer.d.ts +62 -0
  31. package/dist/endpoints/marketplace/StripePersons.d.ts +37 -0
  32. package/dist/endpoints/marketplace/StripeSetupIntents.d.ts +42 -0
  33. package/dist/endpoints/marketplace/TimeSlots.d.ts +40 -0
  34. package/dist/endpoints/marketplace/Transactions.d.ts +89 -0
  35. package/dist/endpoints/marketplace/Users.d.ts +34 -0
  36. package/dist/endpoints/marketplace/index.d.ts +80 -0
  37. package/dist/index.d.ts +161 -0
  38. package/dist/index.js +3 -0
  39. package/dist/{ts-sharetribe-flex-sdk.cjs.LICENSE.txt → index.js.LICENSE.txt} +53 -41
  40. package/dist/index.js.map +1 -0
  41. package/dist/index.mjs +3 -0
  42. package/dist/{ts-sharetribe-flex-sdk.js.LICENSE.txt → index.mjs.LICENSE.txt} +13 -5
  43. package/dist/index.mjs.map +1 -0
  44. package/dist/index.umd.js +3 -0
  45. package/dist/{ts-sharetribe-flex-sdk.mjs.LICENSE.txt → index.umd.js.LICENSE.txt} +13 -5
  46. package/dist/index.umd.js.map +1 -0
  47. package/dist/integrationSdk.d.ts +119 -0
  48. package/dist/sdk.d.ts +211 -0
  49. package/dist/sdkTypes/BigDecimal.d.ts +30 -0
  50. package/dist/sdkTypes/LatLng.d.ts +34 -0
  51. package/dist/sdkTypes/LatLngBounds.d.ts +51 -0
  52. package/dist/sdkTypes/Money.d.ts +28 -0
  53. package/dist/sdkTypes/UUID.d.ts +38 -0
  54. package/dist/types/apiConfigs.d.ts +104 -0
  55. package/dist/types/assets/index.d.ts +101 -0
  56. package/dist/types/authentication/index.d.ts +152 -0
  57. package/dist/types/axios.d.ts +10 -0
  58. package/dist/types/config.d.ts +99 -0
  59. package/dist/types/endpoints/assets/index.d.ts +22 -36
  60. package/dist/types/endpoints/assets/index.d.ts.map +1 -1
  61. package/dist/types/endpoints/auth/index.d.ts +20 -41
  62. package/dist/types/endpoints/auth/index.d.ts.map +1 -1
  63. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +30 -49
  64. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -1
  65. package/dist/types/endpoints/integrationApi/Events.d.ts +23 -27
  66. package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -1
  67. package/dist/types/endpoints/integrationApi/Images.d.ts +17 -28
  68. package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -1
  69. package/dist/types/endpoints/integrationApi/Listings.d.ts +42 -104
  70. package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -1
  71. package/dist/types/endpoints/integrationApi/Marketplace.d.ts +12 -20
  72. package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -1
  73. package/dist/types/endpoints/integrationApi/Stock.d.ts +22 -28
  74. package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -1
  75. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +35 -35
  76. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -1
  77. package/dist/types/endpoints/integrationApi/StockReservations.d.ts +43 -0
  78. package/dist/types/endpoints/integrationApi/StockReservations.d.ts.map +1 -0
  79. package/dist/types/endpoints/integrationApi/Transactions.d.ts +36 -80
  80. package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -1
  81. package/dist/types/endpoints/integrationApi/Users.d.ts +35 -70
  82. package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -1
  83. package/dist/types/endpoints/integrationApi/index.d.ts +40 -40
  84. package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -1
  85. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +34 -48
  86. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -1
  87. package/dist/types/endpoints/marketplace/Bookings.d.ts +24 -23
  88. package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -1
  89. package/dist/types/endpoints/marketplace/CurrentUser.d.ts +54 -125
  90. package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -1
  91. package/dist/types/endpoints/marketplace/Images.d.ts +19 -27
  92. package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -1
  93. package/dist/types/endpoints/marketplace/Listings.d.ts +26 -25
  94. package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -1
  95. package/dist/types/endpoints/marketplace/Marketplace.d.ts +15 -19
  96. package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -1
  97. package/dist/types/endpoints/marketplace/Messages.d.ts +24 -29
  98. package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -1
  99. package/dist/types/endpoints/marketplace/OwnListings.d.ts +55 -119
  100. package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -1
  101. package/dist/types/endpoints/marketplace/PasswordReset.d.ts +23 -35
  102. package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -1
  103. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +22 -22
  104. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -1
  105. package/dist/types/endpoints/marketplace/Reviews.d.ts +23 -25
  106. package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -1
  107. package/dist/types/endpoints/marketplace/Stock.d.ts +30 -26
  108. package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -1
  109. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +36 -34
  110. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -1
  111. package/dist/types/endpoints/marketplace/StripeAccount.d.ts +28 -49
  112. package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -1
  113. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +22 -31
  114. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -1
  115. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +32 -46
  116. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -1
  117. package/dist/types/endpoints/marketplace/StripePersons.d.ts +17 -25
  118. package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -1
  119. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +24 -24
  120. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -1
  121. package/dist/types/endpoints/marketplace/TimeSlots.d.ts +20 -23
  122. package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -1
  123. package/dist/types/endpoints/marketplace/Transactions.d.ts +45 -81
  124. package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -1
  125. package/dist/types/endpoints/marketplace/Users.d.ts +15 -22
  126. package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -1
  127. package/dist/types/endpoints/marketplace/index.d.ts +50 -40
  128. package/dist/types/endpoints/marketplace/index.d.ts.map +1 -1
  129. package/dist/types/index.d.ts +15 -30
  130. package/dist/types/index.d.ts.map +1 -1
  131. package/dist/types/integration/events.d.ts +87 -0
  132. package/dist/types/integrationSdk.d.ts +4 -5
  133. package/dist/types/integrationSdk.d.ts.map +1 -1
  134. package/dist/types/marketplace/availabilityExceptions.d.ts +99 -0
  135. package/dist/types/marketplace/availabilityPlan.d.ts +17 -0
  136. package/dist/types/marketplace/bookings.d.ts +80 -0
  137. package/dist/types/marketplace/currentUser.d.ts +202 -0
  138. package/dist/types/marketplace/images.d.ts +65 -0
  139. package/dist/types/marketplace/listings.d.ts +169 -0
  140. package/dist/types/marketplace/marketplace.d.ts +30 -0
  141. package/dist/types/marketplace/messages.d.ts +87 -0
  142. package/dist/types/marketplace/ownListings.d.ts +155 -0
  143. package/dist/types/marketplace/passwordReset.d.ts +54 -0
  144. package/dist/types/marketplace/processTransitions.d.ts +56 -0
  145. package/dist/types/marketplace/reviews.d.ts +108 -0
  146. package/dist/types/marketplace/stock.d.ts +45 -0
  147. package/dist/types/marketplace/stockAdjustment.d.ts +97 -0
  148. package/dist/types/marketplace/stockReservations.d.ts +89 -0
  149. package/dist/types/marketplace/stripeAccount.d.ts +67 -0
  150. package/dist/types/marketplace/stripeAccountLinks.d.ts +55 -0
  151. package/dist/types/marketplace/stripeCustomer.d.ts +94 -0
  152. package/dist/types/marketplace/stripePaymentMethod.d.ts +21 -0
  153. package/dist/types/marketplace/stripePersons.d.ts +48 -0
  154. package/dist/types/marketplace/stripeSetupIntents.d.ts +48 -0
  155. package/dist/types/marketplace/timeSlots.d.ts +51 -0
  156. package/dist/types/marketplace/transactions.d.ts +200 -0
  157. package/dist/types/marketplace/user.d.ts +200 -0
  158. package/dist/types/sdk-types.d.ts +10 -0
  159. package/dist/types/sdk.d.ts +6 -7
  160. package/dist/types/sdk.d.ts.map +1 -1
  161. package/dist/types/sdkTypes/BigDecimal.d.ts +1 -1
  162. package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -1
  163. package/dist/types/sdkTypes/LatLng.d.ts +1 -1
  164. package/dist/types/sdkTypes/LatLng.d.ts.map +1 -1
  165. package/dist/types/sdkTypes/LatLngBounds.d.ts +1 -1
  166. package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -1
  167. package/dist/types/sdkTypes/Money.d.ts +1 -1
  168. package/dist/types/sdkTypes/Money.d.ts.map +1 -1
  169. package/dist/types/sdkTypes/UUID.d.ts +1 -1
  170. package/dist/types/sdkTypes/UUID.d.ts.map +1 -1
  171. package/dist/types/sharetribe.d.ts +227 -0
  172. package/dist/types/store.d.ts +22 -0
  173. package/dist/types/types/apiConfigs.d.ts.map +1 -1
  174. package/dist/types/types/assets/index.d.ts +74 -36
  175. package/dist/types/types/assets/index.d.ts.map +1 -1
  176. package/dist/types/types/authentication/index.d.ts +111 -60
  177. package/dist/types/types/authentication/index.d.ts.map +1 -1
  178. package/dist/types/types/axios.d.ts.map +1 -1
  179. package/dist/types/types/config.d.ts +1 -39
  180. package/dist/types/types/config.d.ts.map +1 -1
  181. package/dist/types/types/integration/events.d.ts +52 -20
  182. package/dist/types/types/integration/events.d.ts.map +1 -1
  183. package/dist/types/types/marketplace/availabilityExceptions.d.ts +59 -16
  184. package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -1
  185. package/dist/types/types/marketplace/availabilityPlan.d.ts +18 -0
  186. package/dist/types/types/marketplace/availabilityPlan.d.ts.map +1 -0
  187. package/dist/types/types/marketplace/bookings.d.ts +48 -14
  188. package/dist/types/types/marketplace/bookings.d.ts.map +1 -1
  189. package/dist/types/types/marketplace/currentUser.d.ts +99 -55
  190. package/dist/types/types/marketplace/currentUser.d.ts.map +1 -1
  191. package/dist/types/types/marketplace/images.d.ts +40 -14
  192. package/dist/types/types/marketplace/images.d.ts.map +1 -1
  193. package/dist/types/types/marketplace/listings.d.ts +96 -66
  194. package/dist/types/types/marketplace/listings.d.ts.map +1 -1
  195. package/dist/types/types/marketplace/marketplace.d.ts +16 -6
  196. package/dist/types/types/marketplace/marketplace.d.ts.map +1 -1
  197. package/dist/types/types/marketplace/messages.d.ts +53 -15
  198. package/dist/types/types/marketplace/messages.d.ts.map +1 -1
  199. package/dist/types/types/marketplace/ownListings.d.ts +92 -65
  200. package/dist/types/types/marketplace/ownListings.d.ts.map +1 -1
  201. package/dist/types/types/marketplace/passwordReset.d.ts +32 -9
  202. package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -1
  203. package/dist/types/types/marketplace/processTransitions.d.ts +33 -14
  204. package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -1
  205. package/dist/types/types/marketplace/reviews.d.ts +72 -23
  206. package/dist/types/types/marketplace/reviews.d.ts.map +1 -1
  207. package/dist/types/types/marketplace/stock.d.ts +23 -6
  208. package/dist/types/types/marketplace/stock.d.ts.map +1 -1
  209. package/dist/types/types/marketplace/stockAdjustment.d.ts +60 -14
  210. package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -1
  211. package/dist/types/types/marketplace/stockReservations.d.ts +59 -14
  212. package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -1
  213. package/dist/types/types/marketplace/stripeAccount.d.ts +28 -5
  214. package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -1
  215. package/dist/types/types/marketplace/stripeAccountLinks.d.ts +26 -6
  216. package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -1
  217. package/dist/types/types/marketplace/stripeCustomer.d.ts +60 -13
  218. package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -1
  219. package/dist/types/types/marketplace/stripePaymentMethod.d.ts +1 -2
  220. package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -1
  221. package/dist/types/types/marketplace/stripePersons.d.ts +17 -15
  222. package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -1
  223. package/dist/types/types/marketplace/stripeSetupIntents.d.ts +16 -14
  224. package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -1
  225. package/dist/types/types/marketplace/timeSlots.d.ts +13 -15
  226. package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -1
  227. package/dist/types/types/marketplace/transactions.d.ts +77 -83
  228. package/dist/types/types/marketplace/transactions.d.ts.map +1 -1
  229. package/dist/types/types/marketplace/user.d.ts +85 -64
  230. package/dist/types/types/marketplace/user.d.ts.map +1 -1
  231. package/dist/types/types/sharetribe.d.ts +130 -92
  232. package/dist/types/types/sharetribe.d.ts.map +1 -1
  233. package/dist/types/types/store.d.ts +3 -14
  234. package/dist/types/types/store.d.ts.map +1 -1
  235. package/dist/types/utils/apis.d.ts +1 -1
  236. package/dist/types/utils/apis.d.ts.map +1 -1
  237. package/dist/types/utils/config.d.ts.map +1 -1
  238. package/dist/types/utils/convert-types.d.ts.map +1 -1
  239. package/dist/types/utils/parameter-serializer.d.ts.map +1 -1
  240. package/dist/types/utils/prepare-axios-instance.d.ts +1 -1
  241. package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -1
  242. package/dist/types/utils/stores/BrowserStore.d.ts +1 -2
  243. package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
  244. package/dist/types/utils/stores/ExpressStore.d.ts +6 -7
  245. package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
  246. package/dist/types/utils/stores/MemoryStore.d.ts +1 -2
  247. package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -1
  248. package/dist/types/utils/stores/store.d.ts.map +1 -1
  249. package/dist/types/utils/transit.d.ts +1 -1
  250. package/dist/types/utils/transit.d.ts.map +1 -1
  251. package/dist/types/utils/util.d.ts +2 -2
  252. package/dist/types/utils/util.d.ts.map +1 -1
  253. package/dist/utils/apis.d.ts +8 -0
  254. package/dist/utils/config.d.ts +32 -0
  255. package/dist/utils/convert-types.d.ts +13 -0
  256. package/dist/utils/parameter-serializer.d.ts +23 -0
  257. package/dist/utils/prepare-axios-instance.d.ts +14 -0
  258. package/dist/utils/stores/BrowserStore.d.ts +37 -0
  259. package/dist/utils/stores/ExpressStore.d.ts +48 -0
  260. package/dist/utils/stores/MemoryStore.d.ts +23 -0
  261. package/dist/utils/stores/store.d.ts +8 -0
  262. package/dist/utils/transit.d.ts +28 -0
  263. package/dist/utils/util.d.ts +15 -0
  264. package/package.json +18 -17
  265. package/dist/ts-sharetribe-flex-sdk.cjs +0 -3
  266. package/dist/ts-sharetribe-flex-sdk.cjs.map +0 -1
  267. package/dist/ts-sharetribe-flex-sdk.js +0 -3
  268. package/dist/ts-sharetribe-flex-sdk.js.map +0 -1
  269. package/dist/ts-sharetribe-flex-sdk.mjs +0 -3
  270. package/dist/ts-sharetribe-flex-sdk.mjs.map +0 -1
  271. package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +0 -1
@@ -1,10 +1,18 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Stripe Customer operations in the Sharetribe Marketplace API.
3
- * This file defines the structure of parameters and responses for the Stripe Customer API endpoints.
4
3
  */
5
- import { ApiParameter, UUID, Relationship, RelationshipTypeMap, ExtraParameterType } from "../sharetribe";
4
+ import { ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
5
+ /**
6
+ * Available endpoints
7
+ */
6
8
  export type StripeCustomerEndpoints = "create" | "addPaymentMethod" | "deletePaymentMethod";
9
+ /**
10
+ * Relationship fields that can be included
11
+ */
7
12
  export type StripeCustomerRelationshipsFields = "defaultPaymentMethod";
13
+ /**
14
+ * Stripe Customer resource
15
+ */
8
16
  export interface StripeCustomer {
9
17
  id: UUID;
10
18
  type: "stripeCustomer";
@@ -12,37 +20,76 @@ export interface StripeCustomer {
12
20
  stripeCustomerId: string;
13
21
  };
14
22
  }
23
+ /**
24
+ * Stripe Customer with relationships
25
+ */
15
26
  export interface StripeCustomerWithRelationships extends StripeCustomer {
16
27
  relationships: {
17
28
  defaultPaymentMethod: Relationship<false, "defaultPaymentMethod">;
18
29
  };
19
30
  }
31
+ /**
32
+ * Select type based on include
33
+ */
20
34
  export type StripeCustomerType<R extends boolean> = R extends true ? StripeCustomerWithRelationships : StripeCustomer;
35
+ /**
36
+ * Base request parameters
37
+ */
21
38
  export interface StripeCustomerParameter extends ApiParameter {
22
39
  include?: StripeCustomerRelationshipsFields[];
23
40
  }
41
+ /**
42
+ * Create endpoint
43
+ */
24
44
  export interface StripeCustomerCreateParameter extends StripeCustomerParameter {
25
45
  stripePaymentMethodId?: string;
26
46
  stripeCustomerEmail?: string;
27
47
  }
48
+ /**
49
+ * Add payment method
50
+ */
28
51
  export interface StripeCustomerAddPaymentMethodParameter extends StripeCustomerParameter {
29
52
  stripePaymentMethodId: string;
30
53
  }
54
+ /**
55
+ * Delete payment method (no body required)
56
+ */
31
57
  export interface StripeCustomerDeletePaymentMethodParameter extends StripeCustomerParameter {
32
58
  }
33
- type AllStripeCustomerParameter = StripeCustomerCreateParameter | StripeCustomerAddPaymentMethodParameter;
34
- type StripeCustomerTypeType<P extends AllStripeCustomerParameter> = "include" extends keyof P ? P["include"] extends StripeCustomerRelationshipsFields[] ? true : false : false;
35
- type IncludedType<P extends AllStripeCustomerParameter> = "include" extends keyof P ? P["include"] extends (keyof RelationshipTypeMap)[] ? Array<RelationshipTypeMap[P["include"][number]]>[] : never : never;
36
- type ExpandReturnType<P extends AllStripeCustomerParameter, EP> = EP extends {
59
+ /**
60
+ * All parameter types
61
+ */
62
+ type AllStripeCustomerParameter = StripeCustomerCreateParameter | StripeCustomerAddPaymentMethodParameter | StripeCustomerDeletePaymentMethodParameter;
63
+ /**
64
+ * Detect if relationships are requested
65
+ */
66
+ type HasInclude<P> = P extends {
67
+ include: infer I extends StripeCustomerRelationshipsFields[];
68
+ } ? I : never;
69
+ type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
70
+ /**
71
+ * Included resources (when include is used)
72
+ */
73
+ type IncludedResources<P> = HasInclude<P> extends infer Fields extends StripeCustomerRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
74
+ /**
75
+ * Expand behavior
76
+ */
77
+ type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
37
78
  expand: true;
38
- } ? StripeCustomerType<StripeCustomerTypeType<P>> : EP extends {
79
+ } ? T : EP extends {
39
80
  expand: false;
40
- } ? Omit<StripeCustomerType<StripeCustomerTypeType<P>>, "attributes"> : Omit<StripeCustomerType<StripeCustomerTypeType<P>>, "attributes">;
41
- type DataType<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType> = E extends "create" ? ExpandReturnType<P, EP> : E extends "addPaymentMethod" ? ExpandReturnType<P, EP> : E extends "deletePaymentMethod" ? ExpandReturnType<P, EP> : never;
42
- export type StripeCustomerResponse<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType = undefined> = {
43
- data: DataType<E, P, EP>;
44
- } & ("include" extends keyof P ? {
45
- included: IncludedType<P>;
81
+ } ? Omit<T, "attributes"> : Omit<T, "attributes">;
82
+ /**
83
+ * Response data per endpoint
84
+ */
85
+ type ResponseData<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType | undefined> = E extends "create" | "addPaymentMethod" | "deletePaymentMethod" ? ExpandResult<StripeCustomerType<IncludesRelationships<P>>, EP> : never;
86
+ /**
87
+ * Final response type
88
+ */
89
+ export type StripeCustomerResponse<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType | undefined = undefined> = {
90
+ data: ResponseData<E, P, EP>;
91
+ } & (IncludesRelationships<P> extends true ? {
92
+ included: IncludedResources<P>;
46
93
  } : {});
47
94
  export {};
48
95
  //# sourceMappingURL=stripeCustomer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripeCustomer.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripeCustomer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,CAAC;AAG1B,MAAM,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AAGvE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE;QACV,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAGD,MAAM,WAAW,+BAAgC,SAAQ,cAAc;IACrE,aAAa,EAAE;QACb,oBAAoB,EAAE,YAAY,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;KACnE,CAAC;CACH;AAGD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,IAAI,GAC9D,+BAA+B,GAC/B,cAAc,CAAC;AAGnB,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,CAAC,EAAE,iCAAiC,EAAE,CAAC;CAC/C;AAGD,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,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AAE9B;;GAEG;AACH,KAAK,YAAY,CACf,CAAC,SAAS,uBAAuB,EACjC,CAAC,SAAS,0BAA0B,EACpC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IAEzC,CAAC,SAAS,QAAQ,GAAG,kBAAkB,GAAG,qBAAqB,GAC3D,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAC9D,KAAK,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,uBAAuB,EACjC,CAAC,SAAS,0BAA0B,EACpC,EAAE,SAAS,kBAAkB,GAAG,SAAS,GAAG,SAAS,IACnD;IACF,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;CAC9B,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG;IAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * @fileoverview Type definition for Stripe Payment Method objects in the Sharetribe Marketplace API.
3
- * This file defines the structure of a Stripe Payment Method, including its attributes.
4
3
  */
5
4
  import { UUID } from "../sharetribe";
6
5
  /**
7
- * Represents a Stripe Payment Method object.
6
+ * Stripe Payment Method resource
8
7
  */
9
8
  export interface StripePaymentMethod {
10
9
  id: UUID;
@@ -1 +1 @@
1
- {"version":3,"file":"stripePaymentMethod.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripePaymentMethod.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,qBAAqB,CAAC;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,qBAAqB,EAAE,MAAM,CAAC;QAC9B,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,cAAc,EAAE,MAAM,CAAC;YACvB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;KACH,CAAC;CACH"}
1
+ {"version":3,"file":"stripePaymentMethod.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripePaymentMethod.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,qBAAqB,CAAC;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,qBAAqB,EAAE,MAAM,CAAC;QAC9B,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,cAAc,EAAE,MAAM,CAAC;YACvB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;KACH,CAAC;CACH"}
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Stripe Persons in the Sharetribe Marketplace API.
3
- * This file includes the structure of Stripe Persons, their attributes, parameters, and response types.
4
3
  */
5
- export type StripePersonsEndpoints = "create";
6
4
  import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
7
5
  /**
8
- * Represents a Stripe Person object.
6
+ * Available endpoints
7
+ */
8
+ export type StripePersonsEndpoints = "create";
9
+ /**
10
+ * Stripe Person resource
9
11
  */
10
- export interface StripePersons {
12
+ export interface StripePerson {
11
13
  id: UUID;
12
14
  type: "stripePerson";
13
15
  attributes: {
@@ -15,33 +17,33 @@ export interface StripePersons {
15
17
  };
16
18
  }
17
19
  /**
18
- * Parameters for making API requests involving Stripe Persons.
20
+ * Base request parameters
19
21
  */
20
22
  export interface StripePersonsParameter extends ApiParameter {
21
23
  }
22
24
  /**
23
- * Parameters for creating a Stripe Person.
25
+ * Parameters for creating a Stripe Person
24
26
  */
25
27
  export interface StripePersonsCreateParameter extends StripePersonsParameter {
26
28
  personToken: string;
27
29
  }
28
30
  /**
29
- * Determines the response type based on the `expand` parameter.
31
+ * Expand behavior (controls inclusion of `attributes`)
30
32
  */
31
- type ExpandReturnType<EP> = EP extends {
33
+ type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
32
34
  expand: true;
33
- } ? StripePersons : EP extends {
35
+ } ? StripePerson : EP extends {
34
36
  expand: false;
35
- } ? Omit<StripePersons, "attributes"> : Omit<StripePersons, "attributes">;
37
+ } ? Omit<StripePerson, "attributes"> : Omit<StripePerson, "attributes">;
36
38
  /**
37
- * Determines the data type based on the endpoint.
39
+ * Response data per endpoint
38
40
  */
39
- type DataType<E extends StripePersonsEndpoints, EP extends ExtraParameterType> = E extends "create" ? ExpandReturnType<EP> : never;
41
+ type ResponseData<E extends StripePersonsEndpoints, EP extends ExtraParameterType | undefined> = E extends "create" ? ExpandResult<EP> : never;
40
42
  /**
41
- * The response type for Stripe Persons API calls.
43
+ * Final response type
42
44
  */
43
- export type StripePersonsResponse<E extends StripePersonsEndpoints, EP extends ExtraParameterType = undefined> = {
44
- data: DataType<E, EP>;
45
+ export type StripePersonsResponse<E extends StripePersonsEndpoints = "create", EP extends ExtraParameterType | undefined = undefined> = {
46
+ data: ResponseData<E, EP>;
45
47
  };
46
48
  export {};
47
49
  //# sourceMappingURL=stripePersons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripePersons.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripePersons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,IAAI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,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,YAAY;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,KAAK,YAAY,CAAC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IACzD,EAAE,SAAS;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GACvB,YAAY,GACZ,EAAE,SAAS;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GAC1B,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAChC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAEzC;;GAEG;AACH,KAAK,YAAY,CACf,CAAC,SAAS,sBAAsB,EAChC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IACvC,CAAC,SAAS,QAAQ,GAAG,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,sBAAsB,GAAG,QAAQ,EAC3C,EAAE,SAAS,kBAAkB,GAAG,SAAS,GAAG,SAAS,IACnD;IACF,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAC3B,CAAC"}
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Stripe Setup Intents in the Sharetribe Marketplace API.
3
- * This file includes the structure of Stripe Setup Intents, their attributes, parameters, and response types.
4
3
  */
5
4
  import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
5
+ /**
6
+ * Available endpoints
7
+ */
6
8
  export type StripeSetupIntentsEndpoints = "create";
7
9
  /**
8
- * Represents a Stripe Setup Intent object.
10
+ * Stripe Setup Intent resource
9
11
  */
10
- export interface StripeSetupIntents {
12
+ export interface StripeSetupIntent {
11
13
  id: UUID;
12
14
  type: "stripeSetupIntent";
13
15
  attributes: {
@@ -16,32 +18,32 @@ export interface StripeSetupIntents {
16
18
  };
17
19
  }
18
20
  /**
19
- * Parameters for making API requests involving Stripe Setup Intents.
21
+ * Base request parameters
20
22
  */
21
23
  export interface StripeSetupIntentsParameter extends ApiParameter {
22
24
  }
23
25
  /**
24
- * Parameters for creating a Stripe Setup Intent.
26
+ * Parameters for creating a setup intent
25
27
  */
26
28
  export interface StripeSetupIntentsCreateParameter extends StripeSetupIntentsParameter {
27
29
  }
28
30
  /**
29
- * Determines the response type based on the `expand` parameter.
31
+ * Expand behavior (controls whether `attributes` is included)
30
32
  */
31
- type ExpandReturnType<EP> = EP extends {
33
+ type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
32
34
  expand: true;
33
- } ? StripeSetupIntents : EP extends {
35
+ } ? StripeSetupIntent : EP extends {
34
36
  expand: false;
35
- } ? Omit<StripeSetupIntents, "attributes"> : Omit<StripeSetupIntents, "attributes">;
37
+ } ? Omit<StripeSetupIntent, "attributes"> : Omit<StripeSetupIntent, "attributes">;
36
38
  /**
37
- * Determines the data type based on the endpoint.
39
+ * Response data per endpoint
38
40
  */
39
- type DataType<E extends StripeSetupIntentsEndpoints, EP extends ExtraParameterType> = E extends "create" ? ExpandReturnType<EP> : never;
41
+ type ResponseData<E extends StripeSetupIntentsEndpoints, EP extends ExtraParameterType | undefined> = E extends "create" ? ExpandResult<EP> : never;
40
42
  /**
41
- * The response type for Stripe Setup Intents API calls.
43
+ * Final response type
42
44
  */
43
- export type StripeSetupIntentsResponse<E extends StripeSetupIntentsEndpoints, EP extends ExtraParameterType = undefined> = {
44
- data: DataType<E, EP>;
45
+ export type StripeSetupIntentsResponse<E extends StripeSetupIntentsEndpoints = "create", EP extends ExtraParameterType | undefined = undefined> = {
46
+ data: ResponseData<E, EP>;
45
47
  };
46
48
  export {};
47
49
  //# sourceMappingURL=stripeSetupIntents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripeSetupIntents.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripeSetupIntents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,mBAAmB,CAAC;IAC1B,UAAU,EAAE;QACV,mBAAmB,EAAE,MAAM,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,YAAY;CAAG;AAEpE;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,2BAA2B;CAAG;AAExC;;GAEG;AACH,KAAK,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GACnD,kBAAkB,GAClB,EAAE,SAAS;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GAC5B,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GACtC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;AAE3C;;GAEG;AACH,KAAK,QAAQ,CACX,CAAC,SAAS,2BAA2B,EACrC,EAAE,SAAS,kBAAkB,IAC3B,CAAC,SAAS,QAAQ,GAAG,gBAAgB,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,0BAA0B,CACpC,CAAC,SAAS,2BAA2B,EACrC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IACvC;IACF,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"stripeSetupIntents.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/stripeSetupIntents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,mBAAmB,CAAC;IAC1B,UAAU,EAAE;QACV,mBAAmB,EAAE,MAAM,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,YAAY;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,2BAA2B;CACpC;AAED;;GAEG;AACH,KAAK,YAAY,CAAC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IACzD,EAAE,SAAS;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GACvB,iBAAiB,GACjB,EAAE,SAAS;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GAC1B,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GACrC,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;AAE9C;;GAEG;AACH,KAAK,YAAY,CACf,CAAC,SAAS,2BAA2B,EACrC,EAAE,SAAS,kBAAkB,GAAG,SAAS,IACvC,CAAC,SAAS,QAAQ,GAAG,YAAY,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,0BAA0B,CACpC,CAAC,SAAS,2BAA2B,GAAG,QAAQ,EAChD,EAAE,SAAS,kBAAkB,GAAG,SAAS,GAAG,SAAS,IACnD;IACF,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAC3B,CAAC"}
@@ -1,37 +1,35 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Time Slots in the Sharetribe Marketplace API.
3
- * This file defines the structure of Time Slots, their parameters, and response types for API requests.
4
3
  */
5
- import { ApiMeta, ApiParameter } from "../sharetribe";
6
- import UUID from "../../sdkTypes/UUID";
4
+ import { ApiMeta, ApiParameter, UUID } from "../sharetribe";
7
5
  /**
8
- * Types of time slots available in the system.
6
+ * Supported time slot types
9
7
  */
10
- export type TimeSlotTypes = "time-slot/day" | "time-slot/time";
8
+ export type TimeSlotType = "time-slot/day" | "time-slot/time";
11
9
  /**
12
- * Endpoints available for Time Slots API.
10
+ * Available endpoints
13
11
  */
14
12
  export type TimeSlotsEndpoints = "query";
15
13
  /**
16
- * Represents a Time Slot object.
14
+ * Time slot resource
17
15
  */
18
16
  export interface TimeSlot {
19
17
  id: UUID;
20
18
  type: "timeSlot";
21
19
  attributes: {
22
- type: TimeSlotTypes;
20
+ type: TimeSlotType;
23
21
  seats: number;
24
22
  start: Date;
25
23
  end: Date;
26
24
  };
27
25
  }
28
26
  /**
29
- * Base parameters for Time Slots API requests.
27
+ * Base request parameters
30
28
  */
31
29
  export interface TimeSlotsParameter extends ApiParameter {
32
30
  }
33
31
  /**
34
- * Parameters for querying Time Slots.
32
+ * Query parameters for fetching availability
35
33
  */
36
34
  export interface TimeSlotsQueryParameter extends TimeSlotsParameter {
37
35
  listingId: UUID | string;
@@ -39,14 +37,14 @@ export interface TimeSlotsQueryParameter extends TimeSlotsParameter {
39
37
  end: Date | string;
40
38
  }
41
39
  /**
42
- * Determines the data type based on the API endpoint.
40
+ * Response data per endpoint
43
41
  */
44
- type DataType<E extends TimeSlotsEndpoints> = E extends "query" ? TimeSlot[] : never;
42
+ type TimeSlotsResponseData<E extends TimeSlotsEndpoints> = E extends "query" ? TimeSlot[] : never;
45
43
  /**
46
- * Response type for Time Slots API calls.
44
+ * Final API response type
47
45
  */
48
- export type TimeSlotsResponse<E extends TimeSlotsEndpoints> = {
49
- data: DataType<E>;
46
+ export type TimeSlotsResponse<E extends TimeSlotsEndpoints = "query"> = {
47
+ data: TimeSlotsResponseData<E>;
50
48
  } & (E extends "query" ? {
51
49
  meta: ApiMeta;
52
50
  } : {});
@@ -1 +1 @@
1
- {"version":3,"file":"timeSlots.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/timeSlots.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,IAAI,MAAM,qBAAqB,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE;QACV,IAAI,EAAE,aAAa,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,IAAI,CAAC;QACZ,GAAG,EAAE,IAAI,CAAC;KACX,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;CAAG;AAE3D;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,KAAK,QAAQ,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,OAAO,GAC3D,QAAQ,EAAE,GACV,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,IAAI;IAC5D,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACnB,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"timeSlots.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/timeSlots.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE;QACV,IAAI,EAAE,YAAY,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,IAAI,CAAC;QACZ,GAAG,EAAE,IAAI,CAAC;KACX,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,KAAK,qBAAqB,CAAC,CAAC,SAAS,kBAAkB,IACrD,CAAC,SAAS,OAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,GAAG,OAAO,IAAI;IACtE,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAChC,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
@@ -1,27 +1,26 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Transactions in the Sharetribe Marketplace API.
3
- * This file defines the structure of transactions, their parameters, and response types for API requests.
4
3
  */
5
- import { ApiMeta, ApiParameter, ExtraParameterType, Money, QueryMeta, QueryProt, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
4
+ import { ApiMeta, ApiParameter, ExtraParameter, ExtraParameterType, Money, QueryMeta, QueryProt, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
6
5
  import { BookingState } from "./bookings";
7
6
  /**
8
- * Available endpoints for the Transactions API.
7
+ * Available endpoints
9
8
  */
10
9
  export type TransactionsEndpoints = "show" | "query" | "initiate" | "initiateSpeculative" | "transition" | "transitionSpeculative" | "updateMetadata";
11
10
  /**
12
- * Fields available for relationships in transactions.
11
+ * Relationship fields that can be included
13
12
  */
14
13
  export type TransactionsRelationshipsFields = "marketplace" | "listing" | "listing.marketplace" | "listing.author" | "listing.images" | "listing.currentStock" | "provider" | "provider.profileImage" | "provider.stripeAccount" | "provider.effectivePermissionSet" | "customer" | "customer.profileImage" | "customer.stripeAccount" | "customer.effectivePermissionSet" | "booking" | "stockReservation" | "reviews" | "reviews.author" | "reviews.subject" | "messages" | "messages.sender";
15
14
  /**
16
- * Roles for parties in a transaction.
15
+ * Roles in a transaction
17
16
  */
18
- export type TransactionsParties = "customer" | "provider";
17
+ export type TransactionParty = "customer" | "provider";
19
18
  /**
20
- * Varieties of transactions.
19
+ * Transaction variety
21
20
  */
22
- export type TransactionsVariety = "sale" | "order";
21
+ export type TransactionVariety = "sale" | "order";
23
22
  /**
24
- * Defines a line item within a transaction.
23
+ * Line item in a transaction
25
24
  */
26
25
  export interface LineItem {
27
26
  code: string;
@@ -32,45 +31,49 @@ export interface LineItem {
32
31
  percentage?: number;
33
32
  reversal?: boolean;
34
33
  lineTotal: Money;
35
- includeFor: TransactionsParties[];
34
+ includeFor: TransactionParty[];
36
35
  }
37
36
  /**
38
- * Defines a transition in a transaction.
37
+ * Process transition record
39
38
  */
40
- export type Transition = {
39
+ export interface Transition {
41
40
  transition: string;
42
41
  createdAt: Date | string;
43
- by: TransactionsParties;
44
- };
42
+ by: TransactionParty;
43
+ }
44
+ /**
45
+ * Core transaction attributes (always present)
46
+ */
47
+ export interface TransactionAttributes {
48
+ createdAt: Date;
49
+ processName: string;
50
+ processVersion: number;
51
+ lastTransition: string;
52
+ lastTransitionedAt: string | Date;
53
+ payinTotal: Money;
54
+ payoutTotal: Money;
55
+ lineItems: LineItem[];
56
+ protectedData: TransactionProtectedData & TransactionCustomProtectedData;
57
+ metadata: TransactionMetadata & TransactionCustomMetadata;
58
+ transitions: Transition[];
59
+ }
45
60
  /**
46
- * Defines the structure of a transaction.
61
+ * Base transaction type
47
62
  */
48
63
  export interface Transaction {
49
64
  id: UUID;
50
65
  type: "transaction";
51
- attributes: {
52
- createdAt: Date;
53
- processName: string;
54
- processVersion: number;
55
- lastTransition: string;
56
- lastTransitionedAt: string;
57
- payinTotal: Money;
58
- payoutTotal: Money;
59
- lineItems: LineItem[];
60
- protectedData: TransactionProtectedData & TransactionCustomProtectedData;
61
- metadata: TransactionMetadata & TransactionCustomMetadata;
62
- transitions: Transition[];
63
- };
66
+ attributes: TransactionAttributes;
64
67
  }
65
68
  /**
66
- * Transaction with additional relationship information.
69
+ * Transaction with relationships
67
70
  */
68
71
  export interface TransactionWithRelationships extends Transaction {
69
72
  relationships: {
70
73
  marketplace: Relationship<false, "marketplace">;
71
74
  listing: Relationship<false, "listing">;
72
- provider: Relationship<false, "user">;
73
- customer: Relationship<false, "user">;
75
+ provider: Relationship<false, "provider">;
76
+ customer: Relationship<false, "customer">;
74
77
  booking: Relationship<false, "booking">;
75
78
  stockReservation: Relationship<false, "stockReservation">;
76
79
  reviews: Relationship<true, "reviews">;
@@ -78,30 +81,28 @@ export interface TransactionWithRelationships extends Transaction {
78
81
  };
79
82
  }
80
83
  /**
81
- * Represents a transaction type based on the inclusion of relationships.
84
+ * Select type based on include
82
85
  */
83
86
  export type TransactionType<R extends boolean> = R extends true ? TransactionWithRelationships : Transaction;
84
87
  /**
85
- * Base parameters for Transactions API requests.
88
+ * Base API parameter
86
89
  */
87
90
  export interface TransactionsParameter extends ApiParameter {
88
91
  include?: TransactionsRelationshipsFields[];
89
92
  }
90
93
  /**
91
- * Parameters for fetching a specific transaction.
94
+ * Show endpoint
92
95
  */
93
96
  export interface TransactionsShowParameter extends TransactionsParameter {
94
97
  id: UUID | string;
95
98
  }
96
99
  /**
97
- * Parameters for querying transactions.
100
+ * Query endpoint (with optional privileged fields when I = true)
98
101
  */
99
102
  export type TransactionsQueryParameter<I extends boolean = false> = TransactionsParameter & {
100
- [keyof: QueryMeta]: string;
101
- [keyof: QueryProt]: string;
102
103
  bookingEnd?: string;
103
104
  bookingStart?: string;
104
- bookingStates?: Array<BookingState>;
105
+ bookingStates?: BookingState[];
105
106
  createdAtEnd?: string;
106
107
  createdAtStart?: string;
107
108
  hasBooking?: boolean;
@@ -111,95 +112,88 @@ export type TransactionsQueryParameter<I extends boolean = false> = Transactions
111
112
  lastTransitionedAtStart?: string;
112
113
  lastTransitions?: string[];
113
114
  listingId?: UUID | string;
114
- only?: TransactionsVariety;
115
+ only?: TransactionVariety;
115
116
  processName?: string;
116
- sort?: "bookingEnd" | "bookingStart" | "createdAt" | "lastMessageAt" | "lastTransitionedAt" | `meta_${string}` | `prot_${string}`;
117
117
  stockReservationStates?: string[];
118
118
  userId?: UUID | string;
119
+ sort?: "bookingEnd" | "bookingStart" | "createdAt" | "lastMessageAt" | "lastTransitionedAt" | `meta_${string}` | `prot_${string}`;
120
+ [keyof: QueryMeta]: string | undefined;
121
+ [keyof: QueryProt]: string | undefined;
119
122
  } & (I extends true ? {
120
123
  customerId?: UUID | string;
121
124
  providerId?: UUID | string;
122
125
  } : {});
123
126
  /**
124
- * Parameters for initiating a transaction.
127
+ * Initiate / Speculative initiate
125
128
  */
126
129
  export interface TransactionsInitiateParameter extends TransactionsParameter {
127
130
  processAlias: string;
128
131
  transition: string;
129
- params: unknown;
132
+ params?: unknown;
130
133
  }
131
- /**
132
- * Parameters for speculative initiation of a transaction.
133
- */
134
- export interface TransactionsInitiateSpeculativeParameter extends TransactionsParameter {
135
- processAlias: string;
136
- transition: string;
137
- params: unknown;
134
+ export interface TransactionsInitiateSpeculativeParameter extends TransactionsInitiateParameter {
138
135
  }
139
136
  /**
140
- * Parameters for transitioning a transaction.
137
+ * Transition / Speculative transition
141
138
  */
142
139
  export interface TransactionsTransitionParameter extends TransactionsParameter {
143
140
  id: UUID | string;
144
141
  transition: string;
145
- params: unknown;
142
+ params?: unknown;
146
143
  }
147
- /**
148
- * Parameters for speculative transitioning of a transaction.
149
- */
150
- export interface TransactionsTransitionSpeculativeParameter extends TransactionsParameter {
151
- id: UUID | string;
152
- transition: string;
153
- params: unknown;
144
+ export interface TransactionsTransitionSpeculativeParameter extends TransactionsTransitionParameter {
154
145
  }
155
146
  /**
156
- * Parameters for updating transaction metadata.
147
+ * Update metadata
157
148
  */
158
149
  export interface TransactionsUpdateMetadataParameter extends TransactionsParameter {
159
150
  id: UUID | string;
160
- metadata: TransactionMetadata & TransactionCustomMetadata;
151
+ metadata?: TransactionMetadata & TransactionCustomMetadata;
161
152
  }
162
153
  /**
163
- * Protected data structure for a transaction.
154
+ * Custom data structures
164
155
  */
165
156
  export interface TransactionProtectedData {
166
157
  [key: string]: any;
167
158
  }
168
- /**
169
- * Custom protected data structure for a transaction.
170
- */
171
- export interface TransactionCustomProtectedData {
159
+ export interface TransactionCustomProtectedData extends Record<string, unknown> {
172
160
  }
173
- /**
174
- * Metadata structure for a transaction.
175
- */
176
161
  export interface TransactionMetadata {
177
162
  [key: string]: any;
178
163
  }
164
+ export interface TransactionCustomMetadata extends Record<string, unknown> {
165
+ }
179
166
  /**
180
- * Custom metadata structure for a transaction.
167
+ * Helpers
181
168
  */
182
- export interface TransactionCustomMetadata {
183
- }
184
- type AllTransactionsParameter = TransactionsShowParameter | TransactionsQueryParameter | TransactionsInitiateParameter | TransactionsInitiateSpeculativeParameter | TransactionsTransitionParameter | TransactionsTransitionSpeculativeParameter;
185
- type TransactionsType<P extends AllTransactionsParameter> = "include" extends keyof P ? P["include"] extends TransactionsRelationshipsFields[] ? true : false : false;
186
- type IncludedType<P extends AllTransactionsParameter> = "include" extends keyof P ? P["include"] extends (keyof RelationshipTypeMap)[] ? Array<RelationshipTypeMap[P["include"][number]]> : never : never;
187
- type ExpandReturnType<P extends AllTransactionsParameter, EP> = EP extends {
169
+ type HasInclude<P> = P extends {
170
+ include: infer I extends TransactionsRelationshipsFields[];
171
+ } ? I : never;
172
+ type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
173
+ type IncludedResources<P> = HasInclude<P> extends infer Fields extends TransactionsRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
174
+ /**
175
+ * Expand behavior (for transition responses)
176
+ */
177
+ type ExpandResult<T, EP extends ExtraParameter | undefined> = EP extends {
188
178
  expand: true;
189
- } ? TransactionType<TransactionsType<P>> : EP extends {
179
+ } ? T : EP extends {
190
180
  expand: false;
191
- } ? Omit<TransactionType<TransactionsType<P>>, "attributes"> : Omit<TransactionType<TransactionsType<P>>, "attributes">;
181
+ } ? Omit<T, "attributes"> : Omit<T, "attributes">;
182
+ /**
183
+ * Union of all parameter types
184
+ */
185
+ type AllTransactionsParameter = TransactionsShowParameter | TransactionsQueryParameter<any> | TransactionsInitiateParameter | TransactionsInitiateSpeculativeParameter | TransactionsTransitionParameter | TransactionsTransitionSpeculativeParameter | TransactionsUpdateMetadataParameter;
192
186
  /**
193
- * Defines the data type based on the Transactions API endpoint and parameters.
187
+ * Final response data type
194
188
  */
195
- type DataType<E extends TransactionsEndpoints, P extends AllTransactionsParameter, EP extends ExtraParameterType | undefined> = E extends "show" ? TransactionType<TransactionsType<P>> : E extends "query" ? TransactionType<TransactionsType<P>>[] : E extends "transition" ? ExpandReturnType<P, EP> : never;
189
+ type TransactionsResponseData<E extends TransactionsEndpoints, P extends AllTransactionsParameter, EP extends ExtraParameter | undefined> = E extends "show" ? TransactionType<IncludesRelationships<P>> : E extends "query" ? TransactionType<IncludesRelationships<P>>[] : E extends "initiate" | "initiateSpeculative" | "transition" | "transitionSpeculative" | "updateMetadata" ? ExpandResult<TransactionType<IncludesRelationships<P>>, EP> : never;
196
190
  /**
197
- * Response structure for Transactions API calls.
191
+ * Final response type
198
192
  */
199
193
  export type TransactionsResponse<E extends TransactionsEndpoints, P extends AllTransactionsParameter, EP extends ExtraParameterType = undefined> = {
200
- data: DataType<E, P, EP>;
201
- } & ("include" extends keyof P ? {
202
- included: IncludedType<P>;
194
+ data: TransactionsResponseData<E, P, EP>;
195
+ } & (IncludesRelationships<P> extends true ? {
196
+ included: IncludedResources<P>;
203
197
  } : {}) & (E extends "query" ? {
204
198
  meta: ApiMeta;
205
199
  } : {});