@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.
- package/LICENSE.txt +21 -0
- package/README.md +191 -0
- package/dist/ts-sharetribe-flex-sdk.cjs +3 -0
- package/dist/ts-sharetribe-flex-sdk.cjs.LICENSE.txt +701 -0
- package/dist/ts-sharetribe-flex-sdk.cjs.map +1 -0
- package/dist/ts-sharetribe-flex-sdk.js +3 -0
- package/dist/ts-sharetribe-flex-sdk.js.LICENSE.txt +701 -0
- package/dist/ts-sharetribe-flex-sdk.js.map +1 -0
- package/dist/ts-sharetribe-flex-sdk.mjs +3 -0
- package/dist/ts-sharetribe-flex-sdk.mjs.LICENSE.txt +701 -0
- package/dist/ts-sharetribe-flex-sdk.mjs.map +1 -0
- package/dist/types/endpoints/assets/index.d.ts +62 -0
- package/dist/types/endpoints/assets/index.d.ts.map +1 -0
- package/dist/types/endpoints/auth/index.d.ts +59 -0
- package/dist/types/endpoints/auth/index.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +86 -0
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Events.d.ts +48 -0
- package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Images.d.ts +48 -0
- package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Listings.d.ts +150 -0
- package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts +39 -0
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Stock.d.ts +48 -0
- package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +65 -0
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/StockReservation.d.ts +43 -0
- package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Transactions.d.ts +121 -0
- package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Users.d.ts +108 -0
- package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/index.d.ts +59 -0
- package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +84 -0
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Bookings.d.ts +45 -0
- package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts +182 -0
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Images.d.ts +47 -0
- package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Listings.d.ts +52 -0
- package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Marketplace.d.ts +38 -0
- package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Messages.d.ts +57 -0
- package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/OwnListings.d.ts +181 -0
- package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts +63 -0
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +43 -0
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Reviews.d.ts +52 -0
- package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Stock.d.ts +47 -0
- package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +63 -0
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts +78 -0
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +52 -0
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +77 -0
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StripePersons.d.ts +46 -0
- package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +43 -0
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts +44 -0
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Transactions.d.ts +126 -0
- package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Users.d.ts +42 -0
- package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/index.d.ts +71 -0
- package/dist/types/endpoints/marketplace/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +143 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/integrationSdk.d.ts +121 -0
- package/dist/types/integrationSdk.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +213 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/types/sdkTypes/BigDecimal.d.ts +31 -0
- package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -0
- package/dist/types/sdkTypes/LatLng.d.ts +35 -0
- package/dist/types/sdkTypes/LatLng.d.ts.map +1 -0
- package/dist/types/sdkTypes/LatLngBounds.d.ts +52 -0
- package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -0
- package/dist/types/sdkTypes/Money.d.ts +29 -0
- package/dist/types/sdkTypes/Money.d.ts.map +1 -0
- package/dist/types/sdkTypes/UUID.d.ts +39 -0
- package/dist/types/sdkTypes/UUID.d.ts.map +1 -0
- package/dist/types/types/apiConfigs.d.ts +105 -0
- package/dist/types/types/apiConfigs.d.ts.map +1 -0
- package/dist/types/types/assets/index.d.ts +64 -0
- package/dist/types/types/assets/index.d.ts.map +1 -0
- package/dist/types/types/authentication/index.d.ts +102 -0
- package/dist/types/types/authentication/index.d.ts.map +1 -0
- package/dist/types/types/axios.d.ts +11 -0
- package/dist/types/types/axios.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +138 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/integration/events.d.ts +56 -0
- package/dist/types/types/integration/events.d.ts.map +1 -0
- package/dist/types/types/marketplace/availabilityExceptions.d.ts +57 -0
- package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -0
- package/dist/types/types/marketplace/bookings.d.ts +47 -0
- package/dist/types/types/marketplace/bookings.d.ts.map +1 -0
- package/dist/types/types/marketplace/currentUser.d.ts +159 -0
- package/dist/types/types/marketplace/currentUser.d.ts.map +1 -0
- package/dist/types/types/marketplace/images.d.ts +40 -0
- package/dist/types/types/marketplace/images.d.ts.map +1 -0
- package/dist/types/types/marketplace/listings.d.ts +140 -0
- package/dist/types/types/marketplace/listings.d.ts.map +1 -0
- package/dist/types/types/marketplace/marketplace.d.ts +21 -0
- package/dist/types/types/marketplace/marketplace.d.ts.map +1 -0
- package/dist/types/types/marketplace/messages.d.ts +50 -0
- package/dist/types/types/marketplace/messages.d.ts.map +1 -0
- package/dist/types/types/marketplace/ownListings.d.ts +129 -0
- package/dist/types/types/marketplace/ownListings.d.ts.map +1 -0
- package/dist/types/types/marketplace/passwordReset.d.ts +32 -0
- package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -0
- package/dist/types/types/marketplace/processTransitions.d.ts +38 -0
- package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -0
- package/dist/types/types/marketplace/reviews.d.ts +60 -0
- package/dist/types/types/marketplace/reviews.d.ts.map +1 -0
- package/dist/types/types/marketplace/stock.d.ts +29 -0
- package/dist/types/types/marketplace/stock.d.ts.map +1 -0
- package/dist/types/types/marketplace/stockAdjustment.d.ts +52 -0
- package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -0
- package/dist/types/types/marketplace/stockReservations.d.ts +45 -0
- package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripeAccount.d.ts +45 -0
- package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts +36 -0
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripeCustomer.d.ts +48 -0
- package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts +23 -0
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripePersons.d.ts +47 -0
- package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -0
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts +47 -0
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -0
- package/dist/types/types/marketplace/timeSlots.d.ts +54 -0
- package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -0
- package/dist/types/types/marketplace/transactions.d.ts +191 -0
- package/dist/types/types/marketplace/transactions.d.ts.map +1 -0
- package/dist/types/types/marketplace/user.d.ts +166 -0
- package/dist/types/types/marketplace/user.d.ts.map +1 -0
- package/dist/types/types/sdk-types.d.ts +11 -0
- package/dist/types/types/sdk-types.d.ts.map +1 -0
- package/dist/types/types/sharetribe.d.ts +177 -0
- package/dist/types/types/sharetribe.d.ts.map +1 -0
- package/dist/types/types/store.d.ts +34 -0
- package/dist/types/types/store.d.ts.map +1 -0
- package/dist/types/utils/apis.d.ts +9 -0
- package/dist/types/utils/apis.d.ts.map +1 -0
- package/dist/types/utils/config.d.ts +16 -0
- package/dist/types/utils/config.d.ts.map +1 -0
- package/dist/types/utils/convert-types.d.ts +14 -0
- package/dist/types/utils/convert-types.d.ts.map +1 -0
- package/dist/types/utils/parameter-serializer.d.ts +24 -0
- package/dist/types/utils/parameter-serializer.d.ts.map +1 -0
- package/dist/types/utils/prepare-axios-instance.d.ts +14 -0
- package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -0
- package/dist/types/utils/stores/BrowserStore.d.ts +39 -0
- package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -0
- package/dist/types/utils/stores/ExpressStore.d.ts +50 -0
- package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -0
- package/dist/types/utils/stores/MemoryStore.d.ts +25 -0
- package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -0
- package/dist/types/utils/stores/store.d.ts +9 -0
- package/dist/types/utils/stores/store.d.ts.map +1 -0
- package/dist/types/utils/transit.d.ts +30 -0
- package/dist/types/utils/transit.d.ts.map +1 -0
- package/dist/types/utils/util.d.ts +13 -0
- package/dist/types/utils/util.d.ts.map +1 -0
- 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
|
+

|
|
4
|
+

|
|
5
|
+

|
|
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
|