@vansite/ts-sharetribe-flex-sdk 1.0.34 → 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 (267) 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} +13 -5
  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/prepare-axios-instance.d.ts.map +1 -1
  239. package/dist/types/utils/stores/BrowserStore.d.ts +1 -2
  240. package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
  241. package/dist/types/utils/stores/ExpressStore.d.ts +6 -7
  242. package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
  243. package/dist/types/utils/stores/MemoryStore.d.ts +1 -2
  244. package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -1
  245. package/dist/types/utils/transit.d.ts +1 -1
  246. package/dist/types/utils/transit.d.ts.map +1 -1
  247. package/dist/types/utils/util.d.ts +2 -2
  248. package/dist/types/utils/util.d.ts.map +1 -1
  249. package/dist/utils/apis.d.ts +8 -0
  250. package/dist/utils/config.d.ts +32 -0
  251. package/dist/utils/convert-types.d.ts +13 -0
  252. package/dist/utils/parameter-serializer.d.ts +23 -0
  253. package/dist/utils/prepare-axios-instance.d.ts +14 -0
  254. package/dist/utils/stores/BrowserStore.d.ts +37 -0
  255. package/dist/utils/stores/ExpressStore.d.ts +48 -0
  256. package/dist/utils/stores/MemoryStore.d.ts +23 -0
  257. package/dist/utils/stores/store.d.ts +8 -0
  258. package/dist/utils/transit.d.ts +28 -0
  259. package/dist/utils/util.d.ts +15 -0
  260. package/package.json +16 -14
  261. package/dist/ts-sharetribe-flex-sdk.cjs +0 -3
  262. package/dist/ts-sharetribe-flex-sdk.cjs.map +0 -1
  263. package/dist/ts-sharetribe-flex-sdk.js +0 -3
  264. package/dist/ts-sharetribe-flex-sdk.js.map +0 -1
  265. package/dist/ts-sharetribe-flex-sdk.mjs +0 -3
  266. package/dist/ts-sharetribe-flex-sdk.mjs.map +0 -1
  267. package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +0 -1
@@ -5,6 +5,7 @@ import LatLngBounds from "../sdkTypes/LatLngBounds";
5
5
  import BigDecimal from "../sdkTypes/BigDecimal";
6
6
  import { Agent as HttpAgent } from "http";
7
7
  import { Agent as HttpsAgent } from "https";
8
+ import { TokenStore } from "./store";
8
9
  /**
9
10
  * Supported SDK type classes.
10
11
  */
@@ -42,45 +43,6 @@ export interface TypeHandler<T extends SdkTypeInstance = SdkTypeInstance, U = an
42
43
  value: any;
43
44
  }) => boolean;
44
45
  }
45
- /**
46
- * Interface for storing and managing authentication tokens.
47
- */
48
- export interface TokenStore {
49
- token?: {
50
- access_token: string;
51
- token_type: "bearer";
52
- expires_in: number;
53
- scope?: "public-read" | "trusted:user" | "user" | "integ";
54
- refresh_token?: string;
55
- } | null;
56
- expiration?: number;
57
- /**
58
- * Retrieves the current token.
59
- * @returns A promise resolving to the token or null if no token is available.
60
- */
61
- getToken: () => {
62
- access_token: string;
63
- token_type: "bearer";
64
- expires_in: number;
65
- scope?: "public-read" | "trusted:user" | "user" | "integ";
66
- refresh_token?: string;
67
- } | null;
68
- /**
69
- * Sets a new token.
70
- * @param args - The token details.
71
- */
72
- setToken: (args: {
73
- access_token: string;
74
- token_type: "bearer";
75
- expires_in: number;
76
- scope?: "public-read" | "trusted:user" | "user" | "integ";
77
- refresh_token?: string;
78
- }) => void;
79
- /**
80
- * Removes the current token.
81
- */
82
- removeToken: () => void;
83
- }
84
46
  /**
85
47
  * Interface for SDK configuration settings.
86
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,OAAO,CAAC;AAE5C;;GAEG;AACH,KAAK,YAAY,GACb,OAAO,IAAI,GACX,OAAO,MAAM,GACb,OAAO,KAAK,GACZ,OAAO,YAAY,GACnB,OAAO,UAAU,CAAC;AAEtB;;GAEG;AACH,KAAK,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,UAAU,CAAC;AAEzE;;;GAGG;AACH,KAAK,OAAO,GAAG,GAAG,CAAC;AAEnB;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAC1B,CAAC,SAAS,eAAe,GAAG,eAAe,E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E,SAAS,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB"}
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * @fileoverview Type definitions for Events in the Sharetribe Marketplace API.
3
- * These types define the structure of events, event parameters, and responses for querying events.
4
3
  */
5
4
  import { ApiMeta, UUID } from "../sharetribe";
6
5
  import { ListingWithRelationships } from "../marketplace/listings";
@@ -8,21 +7,42 @@ import { UserWithRelationships } from "../marketplace/user";
8
7
  import { AvailabilityExceptionWithRelationships } from "../marketplace/availabilityExceptions";
9
8
  import { MessageWithRelationships } from "../marketplace/messages";
10
9
  import { TransactionWithRelationships } from "../marketplace/transactions";
11
- import { BookingWithRelationShips } from "../marketplace/bookings";
10
+ import { BookingWithRelationships } from "../marketplace/bookings";
12
11
  import { ReviewWithRelationships } from "../marketplace/reviews";
13
12
  import { StockAdjustmentWithRelationships } from "../marketplace/stockAdjustment";
14
13
  import { StockReservationWithRelationships } from "../marketplace/stockReservations";
14
+ /**
15
+ * Available endpoints
16
+ */
15
17
  export type EventsEndpoints = "query";
16
- export type EventTypes = "listing/created" | "listing/updated" | "listing/deleted" | "user/created" | "user/updated" | "user/deleted" | "availabilityException/created" | "availabilityException/updated" | "availabilityException/deleted" | "message/created" | "message/updated" | "message/deleted" | "transaction/initiated" | "transaction/transitioned" | "transaction/updated" | "transaction/deleted" | "booking/created" | "booking/updated" | "booking/deleted" | "review/created" | "review/updated" | "review/deleted" | "stockAdjustment/created" | "stockAdjustment/updated" | "stockAdjustment/deleted" | "stockReservation/created" | "stockReservation/updated" | "stockReservation/deleted";
18
+ /**
19
+ * All possible event types
20
+ */
21
+ export type EventType = "listing/created" | "listing/updated" | "listing/deleted" | "user/created" | "user/updated" | "user/deleted" | "availabilityException/created" | "availabilityException/updated" | "availabilityException/deleted" | "message/created" | "message/updated" | "message/deleted" | "transaction/initiated" | "transaction/transitioned" | "transaction/updated" | "transaction/deleted" | "booking/created" | "booking/updated" | "booking/deleted" | "review/created" | "review/updated" | "review/deleted" | "stockAdjustment/created" | "stockAdjustment/updated" | "stockAdjustment/deleted" | "stockReservation/created" | "stockReservation/updated" | "stockReservation/deleted";
22
+ /**
23
+ * Source of the event
24
+ */
17
25
  export type EventSource = "source/marketplace-api" | "source/integration-api" | "source/transaction" | "source/console" | "source/admin";
26
+ /**
27
+ * Resource types
28
+ */
18
29
  export type EventResourceType = "listing" | "user" | "availabilityException" | "message" | "transaction" | "booking" | "review" | "stockAdjustment" | "stockReservation";
19
- export type EventResource<T extends EventResourceType = any> = T extends "listing" ? ListingWithRelationships<true> : T extends "user" ? UserWithRelationships<true> : T extends "availabilityException" ? AvailabilityExceptionWithRelationships : T extends "message" ? MessageWithRelationships : T extends "transaction" ? TransactionWithRelationships : T extends "booking" ? BookingWithRelationShips : T extends "review" ? ReviewWithRelationships : T extends "stockAdjustment" ? StockAdjustmentWithRelationships : T extends "stockReservation" ? StockReservationWithRelationships : never;
20
- export type EventAuditData = {
21
- userId: UUID;
22
- adminId: UUID;
23
- clientId: UUID;
24
- requestId: UUID;
25
- };
30
+ /**
31
+ * Strongly-typed resource mapping per event type
32
+ */
33
+ export type EventResource<T extends EventResourceType = EventResourceType> = T extends "listing" ? ListingWithRelationships<true> : T extends "user" ? UserWithRelationships<true> : T extends "availabilityException" ? AvailabilityExceptionWithRelationships : T extends "message" ? MessageWithRelationships : T extends "transaction" ? TransactionWithRelationships : T extends "booking" ? BookingWithRelationships : T extends "review" ? ReviewWithRelationships : T extends "stockAdjustment" ? StockAdjustmentWithRelationships : T extends "stockReservation" ? StockReservationWithRelationships : never;
34
+ /**
35
+ * Audit metadata
36
+ */
37
+ export interface EventAuditData {
38
+ userId?: UUID | null;
39
+ adminId?: UUID | null;
40
+ clientId?: UUID | null;
41
+ requestId?: UUID | null;
42
+ }
43
+ /**
44
+ * Event resource
45
+ */
26
46
  export interface Event {
27
47
  id: UUID;
28
48
  type: "event";
@@ -30,27 +50,39 @@ export interface Event {
30
50
  createdAt: Date;
31
51
  sequenceId: number;
32
52
  marketplaceId: UUID;
33
- eventType: EventTypes;
53
+ eventType: EventType;
34
54
  source: EventSource;
35
55
  resourceId: UUID;
36
56
  resourceType: EventResourceType;
37
57
  resource: EventResource;
38
- previousValues: any;
39
- auditData: EventAuditData;
58
+ previousValues?: Record<string, unknown> | null;
59
+ auditData?: EventAuditData | null;
40
60
  };
41
61
  }
42
- export interface EventQueryParameter {
62
+ /**
63
+ * Query parameters
64
+ */
65
+ export interface EventsQueryParameter {
43
66
  startAfterSequenceId?: number;
44
67
  createdAtStart?: Date | string;
45
68
  resourceId?: UUID | string;
46
69
  relatedResourceId?: UUID | string;
47
- eventTypes?: EventTypes[];
70
+ eventTypes?: EventType[];
48
71
  }
49
- type DataType<E extends EventsEndpoints> = E extends "query" ? Event[] : never;
50
- export type EventsResponse<E extends EventsEndpoints> = {
51
- data: DataType<E>;
52
- } & (E extends "query" ? {
72
+ /**
73
+ * Response data
74
+ */
75
+ type ResponseData<E extends EventsEndpoints> = E extends "query" ? Event[] : never;
76
+ /**
77
+ * Final response type
78
+ */
79
+ export type EventsResponse<E extends EventsEndpoints = "query"> = {
80
+ data: ResponseData<E>;
53
81
  meta: ApiMeta;
54
- } : {});
82
+ };
83
+ /**
84
+ * Convenience alias
85
+ */
86
+ export type EventsQueryResponse = EventsResponse<"query">;
55
87
  export {};
56
88
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/integration/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,sCAAsC,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBA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CAAC;QACnB,aAAa,EAAE,IAAI,CAAC;QACpB,SAAS,EAAE,SAAS,CAAC;QACrB,MAAM,EAAE,WAAW,CAAC;QACpB,UAAU,EAAE,IAAI,CAAC;QACjB,YAAY,EAAE,iBAAiB,CAAC;QAChC,QAAQ,EAAE,aAAa,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAChD,SAAS,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;KACnC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC/B,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,KAAK,YAAY,CAAC,CAAC,SAAS,eAAe,IACzC,CAAC,SAAS,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,OAAO,IAAI;IAChE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC"}
@@ -1,55 +1,98 @@
1
1
  /**
2
- * @fileoverview Type definitions for managing availability exceptions in the Sharetribe Marketplace API.
3
- * These types define the structure of availability exception-related parameters, responses, and relationships.
2
+ * @fileoverview Type definitions for Availability Exceptions in the Sharetribe Marketplace API.
4
3
  */
5
4
  import { ApiMeta, ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
5
+ /**
6
+ * Available endpoints
7
+ */
6
8
  export type AvailabilityExceptionsEndpoints = "query" | "create" | "delete";
9
+ /**
10
+ * Relationship fields that can be included
11
+ */
7
12
  export type AvailabilityExceptionsRelationshipsFields = "ownListing" | "ownListing.marketplace" | "ownListing.author" | "ownListing.images" | "ownListing.currentStock";
13
+ /**
14
+ * Availability Exception resource
15
+ */
8
16
  export interface AvailabilityException {
9
17
  id: UUID;
10
18
  type: "availabilityException";
11
- attributes?: {
19
+ attributes: {
12
20
  seats: number;
13
21
  start: Date;
14
22
  end: Date;
15
23
  };
16
24
  }
25
+ /**
26
+ * With relationships
27
+ */
17
28
  export interface AvailabilityExceptionWithRelationships extends AvailabilityException {
18
29
  relationships: {
19
30
  ownListing: Relationship<false, "ownListing">;
20
31
  };
21
32
  }
22
- export type AvailabilityExceptionType<R extends boolean> = R extends true ? AvailabilityExceptionWithRelationships : AvailabilityException;
33
+ export type AvailabilityExceptionResource<R extends boolean> = R extends true ? AvailabilityExceptionWithRelationships : AvailabilityException;
34
+ /**
35
+ * Base request parameters
36
+ */
23
37
  export interface AvailabilityExceptionsParameter extends ApiParameter {
24
38
  include?: AvailabilityExceptionsRelationshipsFields[];
25
39
  }
40
+ /**
41
+ * Query endpoint
42
+ */
26
43
  export interface AvailabilityExceptionsQueryParameter extends AvailabilityExceptionsParameter {
27
44
  listingId: UUID | string;
28
45
  start: Date | string;
29
46
  end: Date | string;
30
47
  }
48
+ /**
49
+ * Create endpoint
50
+ */
31
51
  export interface AvailabilityExceptionsCreateParameter extends AvailabilityExceptionsParameter {
32
52
  listingId: UUID | string;
33
53
  seats: number;
34
54
  start: Date | string;
35
55
  end: Date | string;
36
56
  }
37
- export interface AvailabilityExceptionsDeleteParameter {
57
+ /**
58
+ * Delete endpoint
59
+ */
60
+ export type AvailabilityExceptionsDeleteParameter = {
38
61
  id: UUID | string;
39
- }
62
+ };
63
+ /**
64
+ * All parameter types
65
+ */
40
66
  type AllAvailabilityExceptionsParameter = AvailabilityExceptionsQueryParameter | AvailabilityExceptionsCreateParameter | AvailabilityExceptionsDeleteParameter;
41
- type AvailabilityExceptionsType<P extends AllAvailabilityExceptionsParameter> = "include" extends keyof P ? P["include"] extends AvailabilityExceptionsRelationshipsFields[] ? true : false : false;
42
- type IncludedType<P extends AllAvailabilityExceptionsParameter> = "include" extends keyof P ? P["include"] extends (keyof RelationshipTypeMap)[] ? Array<RelationshipTypeMap[P["include"][number]]>[] : never : never;
43
- type ExpandReturnType<P extends AllAvailabilityExceptionsParameter, EP> = EP extends {
67
+ /**
68
+ * Include detection fixes TS2536
69
+ */
70
+ type HasInclude<P> = P extends {
71
+ include: infer I extends readonly AvailabilityExceptionsRelationshipsFields[];
72
+ } ? I : never;
73
+ type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
74
+ type IncludedResources<P> = P extends {
75
+ include: infer I extends readonly AvailabilityExceptionsRelationshipsFields[];
76
+ } ? RelationshipTypeMap[I[number]][] : never;
77
+ /**
78
+ * Expand behavior
79
+ */
80
+ type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
44
81
  expand: true;
45
- } ? AvailabilityExceptionType<AvailabilityExceptionsType<P>> : EP extends {
82
+ } ? T : EP extends {
46
83
  expand: false;
47
- } ? Omit<AvailabilityExceptionType<AvailabilityExceptionsType<P>>, "attributes"> : Omit<AvailabilityExceptionType<AvailabilityExceptionsType<P>>, "attributes">;
48
- type DataType<E extends AvailabilityExceptionsEndpoints, P extends AllAvailabilityExceptionsParameter, EP extends ExtraParameterType> = E extends "query" ? AvailabilityExceptionType<AvailabilityExceptionsType<P>>[] : E extends "create" ? ExpandReturnType<P, EP> : E extends "delete" ? Pick<AvailabilityException, "id" | "type"> : never;
49
- export type AvailabilityExceptionsResponse<E extends AvailabilityExceptionsEndpoints, P extends AllAvailabilityExceptionsParameter, EP extends ExtraParameterType = undefined> = {
50
- data: DataType<E, P, EP>;
51
- } & ("include" extends keyof P ? {
52
- included: IncludedType<P>;
84
+ } ? Omit<T, "attributes"> : Omit<T, "attributes">;
85
+ /**
86
+ * Response data per endpoint
87
+ */
88
+ type ResponseData<E extends AvailabilityExceptionsEndpoints, P extends AllAvailabilityExceptionsParameter, EP extends ExtraParameterType | undefined> = E extends "query" ? AvailabilityExceptionResource<IncludesRelationships<P>>[] : E extends "create" ? ExpandResult<AvailabilityExceptionResource<IncludesRelationships<P>>, EP> : E extends "delete" ? Pick<AvailabilityException, "id" | "type"> : never;
89
+ /**
90
+ * Final response type
91
+ */
92
+ export type AvailabilityExceptionsResponse<E extends AvailabilityExceptionsEndpoints, P extends AllAvailabilityExceptionsParameter, EP extends ExtraParameterType | undefined = undefined> = {
93
+ data: ResponseData<E, P, EP>;
94
+ } & (IncludesRelationships<P> extends true ? {
95
+ included: IncludedResources<P>;
53
96
  } : {}) & (E extends "query" ? {
54
97
  meta: ApiMeta;
55
98
  } : {});
@@ -1 +1 @@
1
- {"version":3,"file":"availabilityExceptions.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/availabilityExceptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACL,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,+BAA+B,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAG5E,MAAM,MAAM,yCAAyC,GACjD,YAAY,GACZ,wBAAwB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,yBAAyB,CAAC;AAG9B,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,uBAAuB,CAAC;IAC9B,UAAU,CAAC,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,IAAI,CAAC;QACZ,GAAG,EAAE,IAAI,CAAC;KACX,CAAC;CACH;AAGD,MAAM,WAAW,sCACf,SAAQ,qBAAqB;IAC7B,aAAa,EAAE;QACb,UAAU,EAAE,YAAY,CAAC,K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,GAChB,YAAY,CAAC,6BAA6B,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GACzE,CAAC,SAAS,QAAQ,GAChB,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,MAAM,CAAC,GAC1C,KAAK,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,8BAA8B,CACxC,CAAC,SAAS,+BAA+B,EACzC,CAAC,SAAS,kCAAkC,EAC5C,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,GACnF,CAAC,CAAC,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Availability plan types
3
+ */
4
+ type AvailabilityPlanType = "availability-plan/day" | "availability-plan/time";
5
+ type AvailabilityPlanEntry<T extends AvailabilityPlanType = AvailabilityPlanType> = {
6
+ dayOfWeek: "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun";
7
+ seats: number;
8
+ } & (T extends "availability-plan/time" ? {
9
+ startTime: string;
10
+ endTime: string;
11
+ } : {});
12
+ export type AvailabilityPlan<T extends AvailabilityPlanType = "availability-plan/day"> = {
13
+ type: T;
14
+ timezone: string;
15
+ entries: Array<AvailabilityPlanEntry<T>>;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=availabilityPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availabilityPlan.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/availabilityPlan.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,KAAK,oBAAoB,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAE/E,KAAK,qBAAqB,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,IAAI;IAClF,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,CAAC,CAAC,SAAS,wBAAwB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC;AAEvF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,oBAAoB,GAAG,uBAAuB,IAAI;IACvF,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1C,CAAC"}
@@ -1,11 +1,22 @@
1
1
  /**
2
- * @fileoverview Type definitions for managing bookings in the Sharetribe Marketplace API.
3
- * These types define the structure of booking-related parameters, responses, and relationships.
2
+ * @fileoverview Type definitions for Bookings in the Sharetribe Marketplace API.
3
+ */
4
+ import { ApiMeta, ApiParameter, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
5
+ /**
6
+ * Available endpoints
4
7
  */
5
- import { ApiMeta, ApiParameter, UUID, Relationship, RelationshipTypeMap } from "../sharetribe";
6
8
  export type BookingsEndpoints = "query";
9
+ /**
10
+ * Relationship fields that can be included
11
+ */
7
12
  export type BookingsRelationshipsFields = "transaction" | "transaction.marketplace" | "transaction.listing" | "transaction.provider" | "transaction.customer" | "transaction.booking" | "transaction.stockReservation" | "transaction.reviews" | "transaction.messages";
13
+ /**
14
+ * Booking states
15
+ */
8
16
  export type BookingState = "pending" | "proposed" | "accepted" | "declined" | "cancelled";
17
+ /**
18
+ * Booking resource
19
+ */
9
20
  export interface Booking {
10
21
  id: UUID;
11
22
  type: "booking";
@@ -18,30 +29,53 @@ export interface Booking {
18
29
  state: BookingState;
19
30
  };
20
31
  }
21
- export interface BookingWithRelationShips extends Booking {
32
+ /**
33
+ * With relationships
34
+ */
35
+ export interface BookingWithRelationships extends Booking {
22
36
  relationships: {
23
37
  transaction: Relationship<false, "transaction">;
24
38
  };
25
39
  }
26
- export type BookingType<R extends boolean> = R extends true ? BookingWithRelationShips : Booking;
40
+ export type BookingResource<R extends boolean> = R extends true ? BookingWithRelationships : Booking;
41
+ /**
42
+ * Base request parameters
43
+ */
27
44
  export interface BookingsParameter extends ApiParameter {
28
45
  include?: BookingsRelationshipsFields[];
29
46
  }
47
+ /**
48
+ * Query parameters
49
+ */
30
50
  export interface BookingsQueryParameter extends BookingsParameter {
31
51
  listingId: UUID | string;
32
52
  start: Date | string;
33
53
  end: Date | string;
34
54
  state?: BookingState;
35
55
  }
36
- type BookingsType<P extends BookingsQueryParameter> = "include" extends keyof P ? P["include"] extends BookingsRelationshipsFields[] ? true : false : false;
37
- type IncludedType<P extends BookingsParameter> = "include" extends keyof P ? P["include"] extends (keyof RelationshipTypeMap)[] ? Array<RelationshipTypeMap[P["include"][number]]> : never : never;
38
- type DataType<E extends BookingsEndpoints, P extends BookingsQueryParameter> = E extends "query" ? BookingType<BookingsType<P>>[] : never;
39
- export type BookingsResponse<E extends BookingsEndpoints, P extends BookingsQueryParameter> = {
40
- data: DataType<E, P>;
41
- } & ("include" extends keyof P ? {
42
- included: IncludedType<P>;
43
- } : {}) & (E extends "query" ? {
56
+ /**
57
+ * Include detection fixes TS2536
58
+ */
59
+ type HasInclude<P> = P extends {
60
+ include: infer I extends readonly BookingsRelationshipsFields[];
61
+ } ? I : never;
62
+ type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
63
+ type IncludedResources<P> = P extends {
64
+ include: infer Fields extends readonly BookingsRelationshipsFields[];
65
+ } ? RelationshipTypeMap[Fields[number]][] : never;
66
+ /**
67
+ * Response data
68
+ */
69
+ type ResponseData<E extends BookingsEndpoints, P extends BookingsQueryParameter> = E extends "query" ? BookingResource<IncludesRelationships<P>>[] : never;
70
+ /**
71
+ * Final response type
72
+ */
73
+ export type BookingsResponse<E extends BookingsEndpoints = "query", P extends BookingsQueryParameter = BookingsQueryParameter> = {
74
+ data: ResponseData<E, P>;
75
+ } & (IncludesRelationships<P> extends true ? {
76
+ included: IncludedResources<P>;
77
+ } : {}) & {
44
78
  meta: ApiMeta;
45
- } : {});
79
+ };
46
80
  export {};
47
81
  //# sourceMappingURL=bookings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bookings.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/bookings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAGxC,MAAM,MAAM,2BAA2B,GACnC,aAAa,GACb,yBAAyB,GACzB,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,8BAA8B,GAC9B,qBAAqB,GACrB,sBAAsB,CAAC;AAG3B,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,CAAC;AAGhB,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,IAAI,CAAC;QACZ,GAAG,EAAE,IAAI,CAAC;QACV,YAAY,EAAE,IAAI,CAAC;QACnB,UAAU,EAAE,IAAI,CAAC;QACjB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH;AAGD,MAAM,WAAW,wBAAyB,SAAQ,OAAO;IACvD,aAAa,EAAE;QACb,WAAW,EAAE,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAA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,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,EAAE,CAAC,GAClE,CAAC,CAAC,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"bookings.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/bookings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,aAAa,GACb,yBAAyB,GACzB,qBAAqB,GACrB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,8BAA8B,GAC9B,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,IAAI,CAAC;QACZ,GAAG,EAAE,IAAI,CAAC;QACV,YAAY,EAAE,IAAI,CAAC;QACnB,UAAU,EAAE,IAAI,CAAC;QACjB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,OAAO;IACvD,aAAa,EAAE;QACb,WAAW,EAAE,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;KACjD,CAAC;CACH;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,IAC3C,CAAC,SAAS,IAAI,GAAG,wBAAwB,GAAG,OAA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