@vansite/ts-sharetribe-flex-sdk 1.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 (184) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +191 -0
  3. package/dist/ts-sharetribe-flex-sdk.cjs +3 -0
  4. package/dist/ts-sharetribe-flex-sdk.cjs.LICENSE.txt +701 -0
  5. package/dist/ts-sharetribe-flex-sdk.cjs.map +1 -0
  6. package/dist/ts-sharetribe-flex-sdk.js +3 -0
  7. package/dist/ts-sharetribe-flex-sdk.js.LICENSE.txt +701 -0
  8. package/dist/ts-sharetribe-flex-sdk.js.map +1 -0
  9. package/dist/ts-sharetribe-flex-sdk.mjs +3 -0
  10. package/dist/ts-sharetribe-flex-sdk.mjs.LICENSE.txt +701 -0
  11. package/dist/ts-sharetribe-flex-sdk.mjs.map +1 -0
  12. package/dist/types/endpoints/assets/index.d.ts +62 -0
  13. package/dist/types/endpoints/assets/index.d.ts.map +1 -0
  14. package/dist/types/endpoints/auth/index.d.ts +59 -0
  15. package/dist/types/endpoints/auth/index.d.ts.map +1 -0
  16. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +86 -0
  17. package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -0
  18. package/dist/types/endpoints/integrationApi/Events.d.ts +48 -0
  19. package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -0
  20. package/dist/types/endpoints/integrationApi/Images.d.ts +48 -0
  21. package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -0
  22. package/dist/types/endpoints/integrationApi/Listings.d.ts +150 -0
  23. package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -0
  24. package/dist/types/endpoints/integrationApi/Marketplace.d.ts +39 -0
  25. package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -0
  26. package/dist/types/endpoints/integrationApi/Stock.d.ts +48 -0
  27. package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -0
  28. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +65 -0
  29. package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -0
  30. package/dist/types/endpoints/integrationApi/StockReservation.d.ts +43 -0
  31. package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +1 -0
  32. package/dist/types/endpoints/integrationApi/Transactions.d.ts +121 -0
  33. package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -0
  34. package/dist/types/endpoints/integrationApi/Users.d.ts +108 -0
  35. package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -0
  36. package/dist/types/endpoints/integrationApi/index.d.ts +59 -0
  37. package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -0
  38. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +84 -0
  39. package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -0
  40. package/dist/types/endpoints/marketplace/Bookings.d.ts +45 -0
  41. package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -0
  42. package/dist/types/endpoints/marketplace/CurrentUser.d.ts +182 -0
  43. package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -0
  44. package/dist/types/endpoints/marketplace/Images.d.ts +47 -0
  45. package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -0
  46. package/dist/types/endpoints/marketplace/Listings.d.ts +52 -0
  47. package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -0
  48. package/dist/types/endpoints/marketplace/Marketplace.d.ts +38 -0
  49. package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -0
  50. package/dist/types/endpoints/marketplace/Messages.d.ts +57 -0
  51. package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -0
  52. package/dist/types/endpoints/marketplace/OwnListings.d.ts +181 -0
  53. package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -0
  54. package/dist/types/endpoints/marketplace/PasswordReset.d.ts +63 -0
  55. package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -0
  56. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +43 -0
  57. package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -0
  58. package/dist/types/endpoints/marketplace/Reviews.d.ts +52 -0
  59. package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -0
  60. package/dist/types/endpoints/marketplace/Stock.d.ts +47 -0
  61. package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -0
  62. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +63 -0
  63. package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -0
  64. package/dist/types/endpoints/marketplace/StripeAccount.d.ts +78 -0
  65. package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -0
  66. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +52 -0
  67. package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -0
  68. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +77 -0
  69. package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -0
  70. package/dist/types/endpoints/marketplace/StripePersons.d.ts +46 -0
  71. package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -0
  72. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +43 -0
  73. package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -0
  74. package/dist/types/endpoints/marketplace/TimeSlots.d.ts +44 -0
  75. package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -0
  76. package/dist/types/endpoints/marketplace/Transactions.d.ts +126 -0
  77. package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -0
  78. package/dist/types/endpoints/marketplace/Users.d.ts +42 -0
  79. package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -0
  80. package/dist/types/endpoints/marketplace/index.d.ts +71 -0
  81. package/dist/types/endpoints/marketplace/index.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +143 -0
  83. package/dist/types/index.d.ts.map +1 -0
  84. package/dist/types/integrationSdk.d.ts +121 -0
  85. package/dist/types/integrationSdk.d.ts.map +1 -0
  86. package/dist/types/sdk.d.ts +213 -0
  87. package/dist/types/sdk.d.ts.map +1 -0
  88. package/dist/types/sdkTypes/BigDecimal.d.ts +31 -0
  89. package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -0
  90. package/dist/types/sdkTypes/LatLng.d.ts +35 -0
  91. package/dist/types/sdkTypes/LatLng.d.ts.map +1 -0
  92. package/dist/types/sdkTypes/LatLngBounds.d.ts +52 -0
  93. package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -0
  94. package/dist/types/sdkTypes/Money.d.ts +29 -0
  95. package/dist/types/sdkTypes/Money.d.ts.map +1 -0
  96. package/dist/types/sdkTypes/UUID.d.ts +39 -0
  97. package/dist/types/sdkTypes/UUID.d.ts.map +1 -0
  98. package/dist/types/types/apiConfigs.d.ts +105 -0
  99. package/dist/types/types/apiConfigs.d.ts.map +1 -0
  100. package/dist/types/types/assets/index.d.ts +64 -0
  101. package/dist/types/types/assets/index.d.ts.map +1 -0
  102. package/dist/types/types/authentication/index.d.ts +102 -0
  103. package/dist/types/types/authentication/index.d.ts.map +1 -0
  104. package/dist/types/types/axios.d.ts +11 -0
  105. package/dist/types/types/axios.d.ts.map +1 -0
  106. package/dist/types/types/config.d.ts +138 -0
  107. package/dist/types/types/config.d.ts.map +1 -0
  108. package/dist/types/types/integration/events.d.ts +56 -0
  109. package/dist/types/types/integration/events.d.ts.map +1 -0
  110. package/dist/types/types/marketplace/availabilityExceptions.d.ts +57 -0
  111. package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -0
  112. package/dist/types/types/marketplace/bookings.d.ts +47 -0
  113. package/dist/types/types/marketplace/bookings.d.ts.map +1 -0
  114. package/dist/types/types/marketplace/currentUser.d.ts +159 -0
  115. package/dist/types/types/marketplace/currentUser.d.ts.map +1 -0
  116. package/dist/types/types/marketplace/images.d.ts +40 -0
  117. package/dist/types/types/marketplace/images.d.ts.map +1 -0
  118. package/dist/types/types/marketplace/listings.d.ts +140 -0
  119. package/dist/types/types/marketplace/listings.d.ts.map +1 -0
  120. package/dist/types/types/marketplace/marketplace.d.ts +21 -0
  121. package/dist/types/types/marketplace/marketplace.d.ts.map +1 -0
  122. package/dist/types/types/marketplace/messages.d.ts +50 -0
  123. package/dist/types/types/marketplace/messages.d.ts.map +1 -0
  124. package/dist/types/types/marketplace/ownListings.d.ts +129 -0
  125. package/dist/types/types/marketplace/ownListings.d.ts.map +1 -0
  126. package/dist/types/types/marketplace/passwordReset.d.ts +32 -0
  127. package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -0
  128. package/dist/types/types/marketplace/processTransitions.d.ts +38 -0
  129. package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -0
  130. package/dist/types/types/marketplace/reviews.d.ts +60 -0
  131. package/dist/types/types/marketplace/reviews.d.ts.map +1 -0
  132. package/dist/types/types/marketplace/stock.d.ts +29 -0
  133. package/dist/types/types/marketplace/stock.d.ts.map +1 -0
  134. package/dist/types/types/marketplace/stockAdjustment.d.ts +52 -0
  135. package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -0
  136. package/dist/types/types/marketplace/stockReservations.d.ts +45 -0
  137. package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -0
  138. package/dist/types/types/marketplace/stripeAccount.d.ts +45 -0
  139. package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -0
  140. package/dist/types/types/marketplace/stripeAccountLinks.d.ts +36 -0
  141. package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -0
  142. package/dist/types/types/marketplace/stripeCustomer.d.ts +48 -0
  143. package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -0
  144. package/dist/types/types/marketplace/stripePaymentMethod.d.ts +23 -0
  145. package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -0
  146. package/dist/types/types/marketplace/stripePersons.d.ts +47 -0
  147. package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -0
  148. package/dist/types/types/marketplace/stripeSetupIntents.d.ts +47 -0
  149. package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -0
  150. package/dist/types/types/marketplace/timeSlots.d.ts +54 -0
  151. package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -0
  152. package/dist/types/types/marketplace/transactions.d.ts +191 -0
  153. package/dist/types/types/marketplace/transactions.d.ts.map +1 -0
  154. package/dist/types/types/marketplace/user.d.ts +166 -0
  155. package/dist/types/types/marketplace/user.d.ts.map +1 -0
  156. package/dist/types/types/sdk-types.d.ts +11 -0
  157. package/dist/types/types/sdk-types.d.ts.map +1 -0
  158. package/dist/types/types/sharetribe.d.ts +177 -0
  159. package/dist/types/types/sharetribe.d.ts.map +1 -0
  160. package/dist/types/types/store.d.ts +34 -0
  161. package/dist/types/types/store.d.ts.map +1 -0
  162. package/dist/types/utils/apis.d.ts +9 -0
  163. package/dist/types/utils/apis.d.ts.map +1 -0
  164. package/dist/types/utils/config.d.ts +16 -0
  165. package/dist/types/utils/config.d.ts.map +1 -0
  166. package/dist/types/utils/convert-types.d.ts +14 -0
  167. package/dist/types/utils/convert-types.d.ts.map +1 -0
  168. package/dist/types/utils/parameter-serializer.d.ts +24 -0
  169. package/dist/types/utils/parameter-serializer.d.ts.map +1 -0
  170. package/dist/types/utils/prepare-axios-instance.d.ts +14 -0
  171. package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -0
  172. package/dist/types/utils/stores/BrowserStore.d.ts +39 -0
  173. package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -0
  174. package/dist/types/utils/stores/ExpressStore.d.ts +50 -0
  175. package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -0
  176. package/dist/types/utils/stores/MemoryStore.d.ts +25 -0
  177. package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -0
  178. package/dist/types/utils/stores/store.d.ts +9 -0
  179. package/dist/types/utils/stores/store.d.ts.map +1 -0
  180. package/dist/types/utils/transit.d.ts +30 -0
  181. package/dist/types/utils/transit.d.ts.map +1 -0
  182. package/dist/types/utils/util.d.ts +13 -0
  183. package/dist/types/utils/util.d.ts.map +1 -0
  184. package/package.json +90 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 DKogan90 <david_kogan@hotmail.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # @vansite/ts-sharetribe-flex-sdk
2
+
3
+ ![TypeScript](https://img.shields.io/badge/TypeScript-4.x-blue)
4
+ ![MIT License](https://img.shields.io/badge/license-MIT-green)
5
+ ![Version](https://img.shields.io/badge/version-1.0.0-blue)
6
+
7
+ This is a **TypeScript SDK** for the [Sharetribe Flex API](https://www.sharetribe.com/api-reference/). It simplifies interaction with the API, providing a more user-friendly and intuitive interface for developers and reduces the size of the SDK.
8
+
9
+ ## Features
10
+
11
+ - **Unified SDK**: Combines both the Sharetribe SDK and Integration SDK in one package
12
+ - **Cross-platform**: Works seamlessly in both Node.js and browser environments without additional configuration
13
+ - **Fully typed**: Complete TypeScript definitions based on the official Sharetribe documentation
14
+ - **Lightweight**: Optimized bundle size for better performance
15
+ - **Developer-friendly**: Intuitive API design for easier integration
16
+ - Built-in support for cookie handling and UUID generation
17
+
18
+ ## Installation
19
+
20
+ **npm**
21
+
22
+ ```bash
23
+ npm install @vansite/ts-sharetribe-flex-sdk
24
+ ```
25
+
26
+ **yarn**
27
+
28
+ ```bash
29
+ yarn add @vansite/ts-sharetribe-flex-sdk
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ See also the migration section to see how things changed.
35
+
36
+ ```typescript
37
+ import {
38
+ SharetribeSdk,
39
+ SharetribeIntegrationSdk,
40
+ } from "@vansite/ts-sharetribe-flex-sdk";
41
+
42
+ // Regular SDK for client-side operations
43
+ const sharetribeSdk = new SharetribeSdk({
44
+ clientId: "your-client-id",
45
+ });
46
+
47
+ sharetribeSdk.authInfo().then((response) => {
48
+ console.log(response);
49
+ });
50
+
51
+ // Integration SDK for server-side operations
52
+ const integrationSdk = new SharetribeIntegrationSdk({
53
+ clientId: "your-client-id",
54
+ clientSecret: "your-client-secret",
55
+ });
56
+
57
+ integrationSdk.users.show({ id: "user-id" }).then((response) => {
58
+ console.log(response);
59
+ });
60
+ ```
61
+
62
+ ## Migration
63
+
64
+ ### SDK Loader
65
+
66
+ The Sdk loader is not needed anymore, because there is no difference between the node and web sdk
67
+
68
+ - Remove the sdkLoader file
69
+ - Exchange all sdkTypes with the types from the new sdk
70
+
71
+ **brefore**
72
+
73
+ ```javascript
74
+ import { types as sdkTypes } from "./sdkLoader";
75
+ const { Money } = sdkTypes;
76
+ ```
77
+
78
+ **after:**
79
+
80
+ ```javascript
81
+ import { sdkTypes } from "@vansite/ts-sharetribe-flex-sdk";
82
+ const { Money } = sdkTypes;
83
+ ```
84
+
85
+ ### Transit
86
+
87
+ **before:**
88
+
89
+ ```javascript
90
+ import { transit } from "./sdkLoader";
91
+
92
+ const serialize = (data) => {
93
+ return transit.write(data, {
94
+ typeHandlers,
95
+ verbose: config.sdk.transitVerbose,
96
+ });
97
+ };
98
+
99
+ const deserialize = (str) => {
100
+ return transit.read(str, { typeHandlers });
101
+ };
102
+ ```
103
+
104
+ **after:**
105
+
106
+ ```javascript
107
+ import { transit } from "@vansite/ts-sharetribe-flex-sdk";
108
+
109
+ const serialize = (data) => {
110
+ return transit.write(data, {
111
+ typeHandlers,
112
+ verbose: config.sdk.transitVerbose,
113
+ });
114
+ };
115
+
116
+ const deserialize = (str) => {
117
+ return transit.read(str, { typeHandlers });
118
+ };
119
+ ```
120
+
121
+ ### TokenStores
122
+
123
+ **before:**
124
+
125
+ ```javascript
126
+ const sharetribeSdk = require("sharetribe-flex-sdk");
127
+ const store = sharetribeSdk.tokenStore.memoryStore();
128
+ ```
129
+
130
+ **after:**
131
+
132
+ ```javascript
133
+ const { TokenStore } = require("@vansite/ts-sharetribe-flex-sdk");
134
+ const store = new TokenStore.MemoryStore();
135
+ ```
136
+
137
+ or
138
+
139
+ ```javascript
140
+ const { TokenStore } = require("@vansite/ts-sharetribe-flex-sdk");
141
+ const cookieTokenStore = new TokenStore.ExpressStore({
142
+ clientId: "client-id",
143
+ req,
144
+ secure: true,
145
+ });
146
+ ```
147
+
148
+ ## Scripts
149
+
150
+ **Build the project:**
151
+
152
+ ```bash
153
+ yarn build
154
+ ```
155
+
156
+ **Run tests:**
157
+
158
+ ```bash
159
+ yarn test
160
+ ```
161
+
162
+ **Analyze the bundle size:**
163
+
164
+ ```bash
165
+ yarn analyze
166
+ ```
167
+
168
+ ## Contributing
169
+
170
+ Contributions are welcome and appreciated! If you'd like to help improve this library, please feel free to:
171
+
172
+ - Submit bug reports or feature requests through issues
173
+ - Propose improvements through pull requests
174
+ - Help expand test coverage
175
+ - Improve documentation
176
+
177
+ Please follow standard GitHub flow (fork, branch, pull request) for contributions.
178
+
179
+ ## License
180
+
181
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE.txt) file for details.
182
+
183
+ ---
184
+
185
+ ### Tags
186
+
187
+ - Sharetribe Flex
188
+ - TypeScript SDK
189
+ - Node.js
190
+ - Browser
191
+ - API Integration