@vansite/ts-sharetribe-flex-sdk 1.0.34 → 3.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 (274) 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/SitemapData.d.ts +60 -0
  27. package/dist/endpoints/marketplace/Stock.d.ts +50 -0
  28. package/dist/endpoints/marketplace/StockAdjustments.d.ts +64 -0
  29. package/dist/endpoints/marketplace/StripeAccount.d.ts +56 -0
  30. package/dist/endpoints/marketplace/StripeAccountLinks.d.ts +42 -0
  31. package/dist/endpoints/marketplace/StripeCustomer.d.ts +62 -0
  32. package/dist/endpoints/marketplace/StripePersons.d.ts +37 -0
  33. package/dist/endpoints/marketplace/StripeSetupIntents.d.ts +42 -0
  34. package/dist/endpoints/marketplace/TimeSlots.d.ts +40 -0
  35. package/dist/endpoints/marketplace/Transactions.d.ts +89 -0
  36. package/dist/endpoints/marketplace/Users.d.ts +34 -0
  37. package/dist/endpoints/marketplace/index.d.ts +82 -0
  38. package/dist/index.d.ts +161 -0
  39. package/dist/index.js +3 -0
  40. package/dist/{ts-sharetribe-flex-sdk.cjs.LICENSE.txt → index.js.LICENSE.txt} +35 -5
  41. package/dist/index.js.map +1 -0
  42. package/dist/index.mjs +3 -0
  43. package/dist/{ts-sharetribe-flex-sdk.js.LICENSE.txt → index.mjs.LICENSE.txt} +35 -5
  44. package/dist/index.mjs.map +1 -0
  45. package/dist/index.umd.js +3 -0
  46. package/dist/{ts-sharetribe-flex-sdk.mjs.LICENSE.txt → index.umd.js.LICENSE.txt} +35 -5
  47. package/dist/index.umd.js.map +1 -0
  48. package/dist/integrationSdk.d.ts +119 -0
  49. package/dist/sdk.d.ts +211 -0
  50. package/dist/sdkTypes/BigDecimal.d.ts +30 -0
  51. package/dist/sdkTypes/LatLng.d.ts +34 -0
  52. package/dist/sdkTypes/LatLngBounds.d.ts +51 -0
  53. package/dist/sdkTypes/Money.d.ts +35 -0
  54. package/dist/sdkTypes/UUID.d.ts +45 -0
  55. package/dist/types/apiConfigs.d.ts +104 -0
  56. package/dist/types/assets/index.d.ts +101 -0
  57. package/dist/types/authentication/index.d.ts +152 -0
  58. package/dist/types/axios.d.ts +10 -0
  59. package/dist/types/config.d.ts +99 -0
  60. package/dist/types/endpoints/assets/index.d.ts +22 -36
  61. package/dist/types/endpoints/assets/index.d.ts.map +1 -1
  62. package/dist/types/endpoints/auth/index.d.ts +20 -41
  63. package/dist/types/endpoints/auth/index.d.ts.map +1 -1
  64. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +30 -49
  65. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -1
  66. package/dist/types/endpoints/integrationApi/Events.d.ts +23 -27
  67. package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -1
  68. package/dist/types/endpoints/integrationApi/Images.d.ts +17 -28
  69. package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -1
  70. package/dist/types/endpoints/integrationApi/Listings.d.ts +42 -104
  71. package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -1
  72. package/dist/types/endpoints/integrationApi/Marketplace.d.ts +12 -20
  73. package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -1
  74. package/dist/types/endpoints/integrationApi/Stock.d.ts +22 -28
  75. package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -1
  76. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +35 -35
  77. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -1
  78. package/dist/types/endpoints/integrationApi/StockReservations.d.ts +43 -0
  79. package/dist/types/endpoints/integrationApi/StockReservations.d.ts.map +1 -0
  80. package/dist/types/endpoints/integrationApi/Transactions.d.ts +36 -80
  81. package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -1
  82. package/dist/types/endpoints/integrationApi/Users.d.ts +35 -70
  83. package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -1
  84. package/dist/types/endpoints/integrationApi/index.d.ts +40 -40
  85. package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -1
  86. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +34 -48
  87. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -1
  88. package/dist/types/endpoints/marketplace/Bookings.d.ts +24 -23
  89. package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -1
  90. package/dist/types/endpoints/marketplace/CurrentUser.d.ts +54 -125
  91. package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -1
  92. package/dist/types/endpoints/marketplace/Images.d.ts +19 -27
  93. package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -1
  94. package/dist/types/endpoints/marketplace/Listings.d.ts +26 -25
  95. package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -1
  96. package/dist/types/endpoints/marketplace/Marketplace.d.ts +15 -19
  97. package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -1
  98. package/dist/types/endpoints/marketplace/Messages.d.ts +24 -29
  99. package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -1
  100. package/dist/types/endpoints/marketplace/OwnListings.d.ts +55 -119
  101. package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -1
  102. package/dist/types/endpoints/marketplace/PasswordReset.d.ts +23 -35
  103. package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -1
  104. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +22 -22
  105. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -1
  106. package/dist/types/endpoints/marketplace/Reviews.d.ts +23 -25
  107. package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -1
  108. package/dist/types/endpoints/marketplace/SitemapData.d.ts +61 -0
  109. package/dist/types/endpoints/marketplace/SitemapData.d.ts.map +1 -0
  110. package/dist/types/endpoints/marketplace/Stock.d.ts +30 -26
  111. package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -1
  112. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +36 -34
  113. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -1
  114. package/dist/types/endpoints/marketplace/StripeAccount.d.ts +28 -49
  115. package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -1
  116. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +22 -31
  117. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -1
  118. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +32 -46
  119. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -1
  120. package/dist/types/endpoints/marketplace/StripePersons.d.ts +17 -25
  121. package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -1
  122. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +24 -24
  123. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -1
  124. package/dist/types/endpoints/marketplace/TimeSlots.d.ts +20 -23
  125. package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -1
  126. package/dist/types/endpoints/marketplace/Transactions.d.ts +45 -81
  127. package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -1
  128. package/dist/types/endpoints/marketplace/Users.d.ts +15 -22
  129. package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -1
  130. package/dist/types/endpoints/marketplace/index.d.ts +52 -40
  131. package/dist/types/endpoints/marketplace/index.d.ts.map +1 -1
  132. package/dist/types/index.d.ts +15 -30
  133. package/dist/types/index.d.ts.map +1 -1
  134. package/dist/types/integration/events.d.ts +87 -0
  135. package/dist/types/integrationSdk.d.ts +4 -5
  136. package/dist/types/integrationSdk.d.ts.map +1 -1
  137. package/dist/types/marketplace/availabilityExceptions.d.ts +99 -0
  138. package/dist/types/marketplace/availabilityPlan.d.ts +17 -0
  139. package/dist/types/marketplace/bookings.d.ts +80 -0
  140. package/dist/types/marketplace/currentUser.d.ts +202 -0
  141. package/dist/types/marketplace/images.d.ts +65 -0
  142. package/dist/types/marketplace/listings.d.ts +169 -0
  143. package/dist/types/marketplace/marketplace.d.ts +30 -0
  144. package/dist/types/marketplace/messages.d.ts +87 -0
  145. package/dist/types/marketplace/ownListings.d.ts +155 -0
  146. package/dist/types/marketplace/passwordReset.d.ts +54 -0
  147. package/dist/types/marketplace/processTransitions.d.ts +56 -0
  148. package/dist/types/marketplace/reviews.d.ts +108 -0
  149. package/dist/types/marketplace/sitemapData.d.ts +47 -0
  150. package/dist/types/marketplace/stock.d.ts +45 -0
  151. package/dist/types/marketplace/stockAdjustment.d.ts +97 -0
  152. package/dist/types/marketplace/stockReservations.d.ts +89 -0
  153. package/dist/types/marketplace/stripeAccount.d.ts +67 -0
  154. package/dist/types/marketplace/stripeAccountLinks.d.ts +55 -0
  155. package/dist/types/marketplace/stripeCustomer.d.ts +94 -0
  156. package/dist/types/marketplace/stripePaymentMethod.d.ts +21 -0
  157. package/dist/types/marketplace/stripePersons.d.ts +48 -0
  158. package/dist/types/marketplace/stripeSetupIntents.d.ts +48 -0
  159. package/dist/types/marketplace/timeSlots.d.ts +51 -0
  160. package/dist/types/marketplace/transactions.d.ts +200 -0
  161. package/dist/types/marketplace/user.d.ts +200 -0
  162. package/dist/types/sdk-types.d.ts +10 -0
  163. package/dist/types/sdk.d.ts +6 -7
  164. package/dist/types/sdk.d.ts.map +1 -1
  165. package/dist/types/sdkTypes/BigDecimal.d.ts +1 -1
  166. package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -1
  167. package/dist/types/sdkTypes/LatLng.d.ts +1 -1
  168. package/dist/types/sdkTypes/LatLng.d.ts.map +1 -1
  169. package/dist/types/sdkTypes/LatLngBounds.d.ts +1 -1
  170. package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -1
  171. package/dist/types/sdkTypes/Money.d.ts +9 -2
  172. package/dist/types/sdkTypes/Money.d.ts.map +1 -1
  173. package/dist/types/sdkTypes/UUID.d.ts +8 -1
  174. package/dist/types/sdkTypes/UUID.d.ts.map +1 -1
  175. package/dist/types/sharetribe.d.ts +227 -0
  176. package/dist/types/store.d.ts +22 -0
  177. package/dist/types/types/apiConfigs.d.ts.map +1 -1
  178. package/dist/types/types/assets/index.d.ts +74 -36
  179. package/dist/types/types/assets/index.d.ts.map +1 -1
  180. package/dist/types/types/authentication/index.d.ts +111 -60
  181. package/dist/types/types/authentication/index.d.ts.map +1 -1
  182. package/dist/types/types/axios.d.ts.map +1 -1
  183. package/dist/types/types/config.d.ts +1 -39
  184. package/dist/types/types/config.d.ts.map +1 -1
  185. package/dist/types/types/integration/events.d.ts +52 -20
  186. package/dist/types/types/integration/events.d.ts.map +1 -1
  187. package/dist/types/types/marketplace/availabilityExceptions.d.ts +59 -16
  188. package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -1
  189. package/dist/types/types/marketplace/availabilityPlan.d.ts +18 -0
  190. package/dist/types/types/marketplace/availabilityPlan.d.ts.map +1 -0
  191. package/dist/types/types/marketplace/bookings.d.ts +48 -14
  192. package/dist/types/types/marketplace/bookings.d.ts.map +1 -1
  193. package/dist/types/types/marketplace/currentUser.d.ts +99 -55
  194. package/dist/types/types/marketplace/currentUser.d.ts.map +1 -1
  195. package/dist/types/types/marketplace/images.d.ts +40 -14
  196. package/dist/types/types/marketplace/images.d.ts.map +1 -1
  197. package/dist/types/types/marketplace/listings.d.ts +96 -66
  198. package/dist/types/types/marketplace/listings.d.ts.map +1 -1
  199. package/dist/types/types/marketplace/marketplace.d.ts +16 -6
  200. package/dist/types/types/marketplace/marketplace.d.ts.map +1 -1
  201. package/dist/types/types/marketplace/messages.d.ts +53 -15
  202. package/dist/types/types/marketplace/messages.d.ts.map +1 -1
  203. package/dist/types/types/marketplace/ownListings.d.ts +92 -65
  204. package/dist/types/types/marketplace/ownListings.d.ts.map +1 -1
  205. package/dist/types/types/marketplace/passwordReset.d.ts +32 -9
  206. package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -1
  207. package/dist/types/types/marketplace/processTransitions.d.ts +33 -14
  208. package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -1
  209. package/dist/types/types/marketplace/reviews.d.ts +72 -23
  210. package/dist/types/types/marketplace/reviews.d.ts.map +1 -1
  211. package/dist/types/types/marketplace/sitemapData.d.ts +48 -0
  212. package/dist/types/types/marketplace/sitemapData.d.ts.map +1 -0
  213. package/dist/types/types/marketplace/stock.d.ts +23 -6
  214. package/dist/types/types/marketplace/stock.d.ts.map +1 -1
  215. package/dist/types/types/marketplace/stockAdjustment.d.ts +60 -14
  216. package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -1
  217. package/dist/types/types/marketplace/stockReservations.d.ts +59 -14
  218. package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -1
  219. package/dist/types/types/marketplace/stripeAccount.d.ts +28 -5
  220. package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -1
  221. package/dist/types/types/marketplace/stripeAccountLinks.d.ts +26 -6
  222. package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -1
  223. package/dist/types/types/marketplace/stripeCustomer.d.ts +60 -13
  224. package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -1
  225. package/dist/types/types/marketplace/stripePaymentMethod.d.ts +1 -2
  226. package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -1
  227. package/dist/types/types/marketplace/stripePersons.d.ts +17 -15
  228. package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -1
  229. package/dist/types/types/marketplace/stripeSetupIntents.d.ts +16 -14
  230. package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -1
  231. package/dist/types/types/marketplace/timeSlots.d.ts +13 -15
  232. package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -1
  233. package/dist/types/types/marketplace/transactions.d.ts +77 -83
  234. package/dist/types/types/marketplace/transactions.d.ts.map +1 -1
  235. package/dist/types/types/marketplace/user.d.ts +85 -64
  236. package/dist/types/types/marketplace/user.d.ts.map +1 -1
  237. package/dist/types/types/sharetribe.d.ts +130 -92
  238. package/dist/types/types/sharetribe.d.ts.map +1 -1
  239. package/dist/types/types/store.d.ts +3 -14
  240. package/dist/types/types/store.d.ts.map +1 -1
  241. package/dist/types/utils/apis.d.ts +1 -1
  242. package/dist/types/utils/apis.d.ts.map +1 -1
  243. package/dist/types/utils/config.d.ts.map +1 -1
  244. package/dist/types/utils/prepare-axios-instance.d.ts +1 -1
  245. package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -1
  246. package/dist/types/utils/stores/BrowserStore.d.ts +17 -4
  247. package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
  248. package/dist/types/utils/stores/ExpressStore.d.ts +26 -8
  249. package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
  250. package/dist/types/utils/stores/MemoryStore.d.ts +1 -2
  251. package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -1
  252. package/dist/types/utils/transit.d.ts +1 -1
  253. package/dist/types/utils/transit.d.ts.map +1 -1
  254. package/dist/types/utils/util.d.ts +2 -2
  255. package/dist/types/utils/util.d.ts.map +1 -1
  256. package/dist/utils/apis.d.ts +8 -0
  257. package/dist/utils/config.d.ts +32 -0
  258. package/dist/utils/convert-types.d.ts +13 -0
  259. package/dist/utils/parameter-serializer.d.ts +23 -0
  260. package/dist/utils/prepare-axios-instance.d.ts +14 -0
  261. package/dist/utils/stores/BrowserStore.d.ts +51 -0
  262. package/dist/utils/stores/ExpressStore.d.ts +67 -0
  263. package/dist/utils/stores/MemoryStore.d.ts +23 -0
  264. package/dist/utils/stores/store.d.ts +8 -0
  265. package/dist/utils/transit.d.ts +28 -0
  266. package/dist/utils/util.d.ts +15 -0
  267. package/package.json +16 -14
  268. package/dist/ts-sharetribe-flex-sdk.cjs +0 -3
  269. package/dist/ts-sharetribe-flex-sdk.cjs.map +0 -1
  270. package/dist/ts-sharetribe-flex-sdk.js +0 -3
  271. package/dist/ts-sharetribe-flex-sdk.js.map +0 -1
  272. package/dist/ts-sharetribe-flex-sdk.mjs +0 -3
  273. package/dist/ts-sharetribe-flex-sdk.mjs.map +0 -1
  274. package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +0 -1
@@ -1,64 +1,102 @@
1
1
  /**
2
- * @fileoverview Type definitions for managing assets in the Sharetribe Marketplace API.
3
- * These types define the structure and relationships of assets such as JSON data and image assets,
4
- * as well as the request and response formats for the asset-related endpoints.
2
+ * @fileoverview Type definitions for Assets in the Sharetribe Marketplace API.
3
+ */
4
+ import type { ApiParameter, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
5
+ import type { ImageVariant, ImageVariantName } from "../marketplace/images";
6
+ /**
7
+ * Available endpoints
5
8
  */
6
- import { ImageVariantNames, ImageVariants } from "../marketplace/images";
7
- import { ApiParameter, Relationship, UUID } from "../sharetribe";
8
- type RelationshipTypeMap = {
9
- imageAsset: ImageAsset;
10
- };
11
9
  export type AssetEndpoints = "assetByAlias" | "assetsByAlias" | "assetByVersion" | "assetsByVersion";
10
+ /**
11
+ * Relationship fields
12
+ */
12
13
  export type AssetRelationshipsFields = "imageAsset";
13
- export type JsonAsset = {
14
- [key: string]: any;
15
- };
16
- export type JsonAssetWithRelationships = {
17
- images: Relationship<true, "imageAsset">;
18
- };
19
- export type ImageAsset = {
14
+ /**
15
+ * Image asset resource
16
+ */
17
+ export interface ImageAsset {
20
18
  id: UUID;
21
19
  type: "imageAsset";
22
20
  attributes: {
23
21
  assetPath: string;
24
- variants: {
25
- [key in ImageVariantNames]?: ImageVariants;
26
- };
22
+ variants: Partial<Record<ImageVariantName, ImageVariant>>;
27
23
  };
28
- };
29
- type IsJsonPath<Path> = Path extends `${string}.json` ? true : false;
30
- export type AssetType<P extends AllAssetParameter> = P extends {
31
- path: infer Path;
32
- } ? IsJsonPath<Path> : P extends {
33
- paths: infer Paths;
34
- } ? Paths extends string[] ? IsJsonPath<Paths[number]> extends true ? JsonAsset : ImageAsset : never : never;
24
+ }
25
+ /**
26
+ * Generic JSON asset (e.g. config, translations)
27
+ */
28
+ export type JsonAsset = Record<string, unknown>;
29
+ /**
30
+ * JSON asset with embedded image relationships
31
+ */
32
+ export interface JsonAssetWithRelationships {
33
+ images: Relationship<true, "imageAsset">;
34
+ }
35
+ /**
36
+ * Base request parameters
37
+ */
35
38
  export interface AssetParameter extends ApiParameter {
36
- include?: JsonAssetWithRelationships[];
39
+ include?: AssetRelationshipsFields[];
37
40
  }
41
+ /**
42
+ * Single asset by alias/version
43
+ */
38
44
  export interface AssetByAliasParameter extends AssetParameter {
39
45
  path: string;
40
46
  alias: string;
41
47
  }
42
- export interface AssetsByAliasParameter extends AssetParameter {
43
- paths: string[];
44
- alias: string;
45
- }
46
48
  export interface AssetByVersionParameter extends AssetParameter {
47
49
  path: string;
48
50
  version: string;
49
51
  }
52
+ /**
53
+ * Multiple assets by alias/version
54
+ */
55
+ export interface AssetsByAliasParameter extends AssetParameter {
56
+ paths: string[];
57
+ alias: string;
58
+ }
50
59
  export interface AssetsByVersionParameter extends AssetParameter {
51
60
  paths: string[];
52
61
  version: string;
53
62
  }
63
+ /**
64
+ * All parameter types
65
+ */
54
66
  type AllAssetParameter = AssetByAliasParameter | AssetsByAliasParameter | AssetByVersionParameter | AssetsByVersionParameter;
55
- type AssetWithIncludeType<P extends AllAssetParameter> = "include" extends keyof P ? P["include"] extends AssetRelationshipsFields[] ? true : false : false;
56
- export type IncludedType<P extends AllAssetParameter> = "include" extends keyof P ? P["include"] extends (keyof RelationshipTypeMap)[] ? Array<AssetWithIncludeType<P>>[] : never : never;
57
- type DataType<E extends AssetEndpoints, P extends AllAssetParameter> = E extends "assetByAlias" | "assetsByAlias" | "assetByVersion" | "assetsByVersion" ? AssetType<P> : never;
67
+ /**
68
+ * Detect if path ends with .json
69
+ */
70
+ type IsJsonPath<Path extends string> = Path extends `${string}.json` ? true : false;
71
+ /**
72
+ * Resolve asset data type from path(s)
73
+ */
74
+ type ResolveAssetType<P extends AllAssetParameter> = P extends {
75
+ path: infer Path extends string;
76
+ } ? IsJsonPath<Path> extends true ? JsonAsset : ImageAsset : P extends {
77
+ paths: infer Paths extends string[];
78
+ } ? Paths extends [string] ? IsJsonPath<Paths[0]> extends true ? JsonAsset : ImageAsset : JsonAsset | ImageAsset : never;
79
+ /**
80
+ * Include detection — fixes TS2536
81
+ */
82
+ type HasInclude<P> = P extends {
83
+ include: infer I extends readonly AssetRelationshipsFields[];
84
+ } ? I : never;
85
+ type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
86
+ type IncludedResources<P> = P extends {
87
+ include: infer I extends readonly AssetRelationshipsFields[];
88
+ } ? RelationshipTypeMap["imageAsset"][] : never;
89
+ /**
90
+ * Response data per endpoint
91
+ */
92
+ type ResponseData<E extends AssetEndpoints, P extends AllAssetParameter> = ResolveAssetType<P>;
93
+ /**
94
+ * Final response type
95
+ */
58
96
  export type AssetResponse<E extends AssetEndpoints, P extends AllAssetParameter> = {
59
- data: DataType<E, P>;
60
- } & ("include" extends keyof P ? {
61
- included: IncludedType<P>;
97
+ data: ResponseData<E, P>;
98
+ } & (IncludesRelationships<P> extends true ? {
99
+ included: IncludedResources<P>;
62
100
  } : {});
63
101
  export {};
64
102
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/assets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGjE,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,iBAAiB,CAAC;AAGtB,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC;AAGpD,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;CAC1C,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE;Q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AAE,CAAC,CAAC"}
@@ -1,97 +1,148 @@
1
1
  /**
2
- * @fileoverview Type definitions for authentication in the Sharetribe Marketplace API.
3
- * These types define the structure of authentication-related parameters, endpoints, and responses.
4
- */
5
- export type TokenTypes = "access_token" | "refresh_token";
6
- export type GrantType = "client_credentials" | "password" | "refresh_token" | "token_exchange" | "authorization_code";
7
- export type Scope = "public-read" | "user" | "trusted:user" | "integ";
8
- export type ScopeType = "public-read" | "user" | "trusted:user" | "integ" | "details" | "refresh-token";
9
- export type IdentityProviderType = "facebook" | "google" | string;
2
+ * @fileoverview Type definitions for Sharetribe Authentication API (OAuth2)
3
+ *
4
+ * @see https://www.sharetribe.com/api-reference/authentication.html
5
+ */
6
+ import type { UUID } from "../sharetribe";
7
+ /**
8
+ * OAuth2 grant types
9
+ */
10
+ export type GrantType = "client_credentials" | "password" | "authorization_code" | "refresh_token" | "token_exchange";
11
+ /**
12
+ * Available scopes
13
+ */
14
+ export type Scope = "public-read" | "user" | "trusted:user" | "integ" | "details" | "refresh-token";
15
+ /**
16
+ * Identity provider ID (built-in + custom)
17
+ */
18
+ export type IdentityProviderId = "facebook" | "google" | string;
10
19
  export type LoginParameterType = "user" | "auth_code";
11
- export type LoginParameter<T extends LoginParameterType> = T extends "user" ? {
12
- username?: string;
13
- password?: string;
14
- } : T extends "auth_code" ? {
15
- code?: string;
16
- redirect_uri?: string;
17
- code_verifier?: string;
18
- } : never;
19
- export type LoginWithIdpParameter = {
20
- idpId: string;
21
- idpClientId: string;
22
- idpToken: string;
23
- };
24
- export type AuthWithIdpParameter = {
25
- client_id: string;
26
- client_secret: string;
27
- } & LoginWithIdpParameter;
28
- export type IdentityProvider<P extends IdentityProviderType> = {
29
- idpId: P;
30
- idpToken: string;
31
- };
32
- type BaseEndpoint = {
20
+ /**
21
+ * Base token request
22
+ */
23
+ interface BaseTokenRequest {
33
24
  client_id: string;
34
- };
35
- export type AnonymousEndpoint = BaseEndpoint & {
25
+ }
26
+ /**
27
+ * Public read access (anonymous)
28
+ */
29
+ export type AnonymousTokenRequest = BaseTokenRequest & {
36
30
  grant_type: "client_credentials";
37
31
  scope: "public-read";
38
32
  };
39
- type UserEndpoint = BaseEndpoint & {
33
+ /**
34
+ * User authentication (password or authorization code)
35
+ */
36
+ export type UserTokenRequest = BaseTokenRequest & {
40
37
  scope: "user";
38
+ grant_type: "password";
39
+ username: string;
40
+ password: string;
41
41
  };
42
- export type UserPasswordEndpoint = UserEndpoint & {
43
- grant_type: "password" | "authorization_code";
44
- username?: string;
45
- password?: string;
46
- code?: string;
47
- redirect_uri?: string;
48
- code_verifier?: string;
42
+ export type UserTokenRequestWithAuthCode = BaseTokenRequest & {
43
+ scope: "user";
44
+ grant_type: "authorization_code";
45
+ code: string;
46
+ redirect_uri: string;
47
+ code_verifier: string;
49
48
  };
50
- export type UserLoginAsEndpoint = UserEndpoint & {
49
+ /**
50
+ * Admin "login as" flow
51
+ */
52
+ export type LoginAsTokenRequest = BaseTokenRequest & {
51
53
  grant_type: "authorization_code";
54
+ scope: "user";
52
55
  code: string;
53
56
  redirect_uri: string;
54
57
  code_verifier: string;
55
58
  };
56
- export type TrustedUserEndpoint = BaseEndpoint & {
59
+ /**
60
+ * Trusted impersonation
61
+ */
62
+ export type TrustedUserTokenRequest = BaseTokenRequest & {
57
63
  client_secret: string;
58
- subject_token: string;
59
64
  grant_type: "token_exchange";
60
65
  scope: "trusted:user";
66
+ subject_token: string;
61
67
  };
62
- type IntegEndpoint = BaseEndpoint & {
63
- scope: "integ";
64
- };
65
- export type IntegClientCredentialsEndpoint = IntegEndpoint & {
66
- grant_type: "client_credentials";
68
+ /**
69
+ * Integration API access
70
+ */
71
+ export type IntegrationTokenRequest = BaseTokenRequest & {
67
72
  client_secret: string;
73
+ grant_type: "client_credentials";
74
+ scope: "integ";
68
75
  };
69
- export type RefreshTokenEndpoint = BaseEndpoint & {
76
+ /**
77
+ * Refresh token
78
+ */
79
+ export type RefreshTokenRequest = BaseTokenRequest & {
70
80
  grant_type: "refresh_token";
71
81
  refresh_token: string;
72
82
  };
73
- export type DetailsEndpoint = void;
74
- export type Endpoint<S extends ScopeType> = S extends "public-read" ? AnonymousEndpoint : S extends "user" ? UserPasswordEndpoint | UserLoginAsEndpoint | UserLoginAsEndpoint : S extends "trusted:user" ? TrustedUserEndpoint : S extends "integ" ? IntegClientCredentialsEndpoint : S extends "details" ? DetailsEndpoint : S extends "refresh-token" ? RefreshTokenEndpoint : never;
75
83
  /**
76
- * Represents an authentication token used for API requests.
84
+ * Token introspection endpoint (no body)
85
+ */
86
+ export type DetailsRequest = void;
87
+ /**
88
+ * All valid token request types
89
+ */
90
+ export type TokenRequest = AnonymousTokenRequest | UserTokenRequest | UserTokenRequestWithAuthCode | LoginAsTokenRequest | TrustedUserTokenRequest | IntegrationTokenRequest | RefreshTokenRequest | DetailsRequest;
91
+ /**
92
+ * Login parameter
93
+ */
94
+ export type LoginParameter<T extends LoginParameterType> = T extends "user" ? {
95
+ username: string;
96
+ password: string;
97
+ } : T extends "auth_code" ? {
98
+ code: string;
99
+ redirect_uri: string;
100
+ code_verifier: string;
101
+ } : never;
102
+ export type LoginWithIdpParameter = {
103
+ idpId: IdentityProviderId;
104
+ idpClientId: string;
105
+ idpToken: string;
106
+ };
107
+ /**
108
+ * Login with external IdP
109
+ */
110
+ export type AuthWithIdpParameter = {
111
+ client_id: string;
112
+ client_secret: string;
113
+ } & LoginWithIdpParameter;
114
+ /**
115
+ * Successful token response
77
116
  */
78
117
  export interface AuthToken {
79
118
  access_token: string;
80
119
  token_type: "bearer";
81
120
  expires_in: number;
82
- scope?: Scope;
121
+ scope?: Scope | Scope[];
83
122
  refresh_token?: string;
84
123
  }
85
- export type TokenDetails = {
124
+ /**
125
+ * Token introspection response
126
+ */
127
+ export interface TokenDetails {
86
128
  "client-id": string;
87
129
  exp: number;
88
- scope: Scope;
89
- isLoggedInAs: boolean;
90
- };
91
- export type TokenResponse<S extends ScopeType> = S extends "public-read" | "user" | "trusted:user" | "integ" | "refresh-token" ? AuthToken : S extends "details" ? TokenDetails : never;
92
- export type RevokeResponse = {
130
+ scope: Scope[];
131
+ isLoggedInAs?: UUID | null;
132
+ }
133
+ /**
134
+ * Token response by endpoint
135
+ */
136
+ export type TokenResponse<T extends TokenRequest> = T extends DetailsRequest ? TokenDetails : AuthToken;
137
+ /**
138
+ * Revoke response
139
+ */
140
+ export interface RevokeResponse {
93
141
  revoked: boolean;
94
- };
142
+ }
143
+ /**
144
+ * Auth info response
145
+ */
95
146
  export type AuthInfoResponse = {
96
147
  scopes?: Scope[];
97
148
  isAnonymous?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/authentication/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,eAAe,CAAC;AAC1D,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,oBAAoB,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AACtE,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,MAAM,GACN,cAAc,GACd,OAAO,GACP,SAAS,GACT,eAAe,CAAC;AACpB,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,CAAC;AAGtD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,MAAM,GACvE;IACE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACD,CAAC,SAAS,WAAW,GACrB;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACD,KAAK,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Ae,GACf,SAAS,GACT,CAAC,SAAS,SAAS,GACnB,YAAY,GACZ,KAAK,CAAC;AAGV,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/authentication/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,UAAU,GACV,oBAAoB,GACpB,eAAe,GACf,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,KAAK,GACb,aAAa,GACb,MAAM,GACN,cAAc,GACd,OAAO,GACP,SAAS,GACT,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,CAAC;AAEtD;;GAEG;AACH,UAAU,gBAAgB;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IACrD,UAAU,EAAE,oBAAoB,CAAC;IACjC,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAA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;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../../src/types/axios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,0BAA0B,GAAG;IAC5E;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../../src/types/axios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,OAAO,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,0BAA0B,GAAG;IAC5E;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -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,EAC3C,CAAC,GAAG,GAAG;IAEP,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB;;OAEG;IACH,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AAe,EAC3C,CAAC,GAAG,GAAG;IAEP,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC;CAC5D;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,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,yBAAyB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,iCAAiC,EAAE,MA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