@vansite/ts-sharetribe-flex-sdk 1.0.33 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/endpoints/assets/index.d.ts +47 -0
- package/dist/endpoints/auth/index.d.ts +45 -0
- package/dist/endpoints/integrationApi/AvailabilityExceptions.d.ts +66 -0
- package/dist/endpoints/integrationApi/Events.d.ts +43 -0
- package/dist/endpoints/integrationApi/Images.d.ts +36 -0
- package/dist/endpoints/integrationApi/Listings.d.ts +87 -0
- package/dist/endpoints/integrationApi/Marketplace.d.ts +30 -0
- package/dist/endpoints/integrationApi/Stock.d.ts +42 -0
- package/dist/endpoints/integrationApi/StockAdjustments.d.ts +64 -0
- package/dist/{types/endpoints/integrationApi/StockReservation.d.ts → endpoints/integrationApi/StockReservations.d.ts} +3 -4
- package/dist/endpoints/integrationApi/Transactions.d.ts +76 -0
- package/dist/endpoints/integrationApi/Users.d.ts +72 -0
- package/dist/endpoints/integrationApi/index.d.ts +58 -0
- package/dist/endpoints/marketplace/AvailabilityExceptions.d.ts +69 -0
- package/dist/endpoints/marketplace/Bookings.d.ts +45 -0
- package/dist/endpoints/marketplace/CurrentUser.d.ts +110 -0
- package/dist/endpoints/marketplace/Images.d.ts +38 -0
- package/dist/endpoints/marketplace/Listings.d.ts +52 -0
- package/dist/endpoints/marketplace/Marketplace.d.ts +33 -0
- package/dist/endpoints/marketplace/Messages.d.ts +51 -0
- package/dist/endpoints/marketplace/OwnListings.d.ts +116 -0
- package/dist/endpoints/marketplace/PasswordReset.d.ts +50 -0
- package/dist/endpoints/marketplace/ProcessTransitions.d.ts +42 -0
- package/dist/endpoints/marketplace/Reviews.d.ts +49 -0
- package/dist/endpoints/marketplace/Stock.d.ts +50 -0
- package/dist/endpoints/marketplace/StockAdjustments.d.ts +64 -0
- package/dist/endpoints/marketplace/StripeAccount.d.ts +56 -0
- package/dist/endpoints/marketplace/StripeAccountLinks.d.ts +42 -0
- package/dist/endpoints/marketplace/StripeCustomer.d.ts +62 -0
- package/dist/endpoints/marketplace/StripePersons.d.ts +37 -0
- package/dist/endpoints/marketplace/StripeSetupIntents.d.ts +42 -0
- package/dist/endpoints/marketplace/TimeSlots.d.ts +40 -0
- package/dist/endpoints/marketplace/Transactions.d.ts +89 -0
- package/dist/endpoints/marketplace/Users.d.ts +34 -0
- package/dist/endpoints/marketplace/index.d.ts +80 -0
- package/dist/index.d.ts +161 -0
- package/dist/index.js +3 -0
- package/dist/{ts-sharetribe-flex-sdk.cjs.LICENSE.txt → index.js.LICENSE.txt} +53 -41
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/{ts-sharetribe-flex-sdk.js.LICENSE.txt → index.mjs.LICENSE.txt} +13 -5
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +3 -0
- package/dist/{ts-sharetribe-flex-sdk.mjs.LICENSE.txt → index.umd.js.LICENSE.txt} +13 -5
- package/dist/index.umd.js.map +1 -0
- package/dist/integrationSdk.d.ts +119 -0
- package/dist/sdk.d.ts +211 -0
- package/dist/sdkTypes/BigDecimal.d.ts +30 -0
- package/dist/sdkTypes/LatLng.d.ts +34 -0
- package/dist/sdkTypes/LatLngBounds.d.ts +51 -0
- package/dist/sdkTypes/Money.d.ts +28 -0
- package/dist/sdkTypes/UUID.d.ts +38 -0
- package/dist/types/apiConfigs.d.ts +104 -0
- package/dist/types/assets/index.d.ts +101 -0
- package/dist/types/authentication/index.d.ts +152 -0
- package/dist/types/axios.d.ts +10 -0
- package/dist/types/config.d.ts +99 -0
- package/dist/types/endpoints/assets/index.d.ts +22 -36
- package/dist/types/endpoints/assets/index.d.ts.map +1 -1
- package/dist/types/endpoints/auth/index.d.ts +20 -41
- package/dist/types/endpoints/auth/index.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +30 -49
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Events.d.ts +23 -27
- package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Images.d.ts +17 -28
- package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Listings.d.ts +42 -104
- package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts +12 -20
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Stock.d.ts +22 -28
- package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +35 -35
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/StockReservations.d.ts +43 -0
- package/dist/types/endpoints/integrationApi/StockReservations.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Transactions.d.ts +36 -80
- package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Users.d.ts +35 -70
- package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/index.d.ts +40 -40
- package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +34 -48
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Bookings.d.ts +24 -23
- package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts +54 -125
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Images.d.ts +19 -27
- package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Listings.d.ts +26 -25
- package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Marketplace.d.ts +15 -19
- package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Messages.d.ts +24 -29
- package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/OwnListings.d.ts +55 -119
- package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts +23 -35
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +22 -22
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Reviews.d.ts +23 -25
- package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Stock.d.ts +30 -26
- package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +36 -34
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts +28 -49
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +22 -31
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +32 -46
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripePersons.d.ts +17 -25
- package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +24 -24
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts +20 -23
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Transactions.d.ts +45 -81
- package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Users.d.ts +15 -22
- package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/index.d.ts +50 -40
- package/dist/types/endpoints/marketplace/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -30
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integration/events.d.ts +87 -0
- package/dist/types/integrationSdk.d.ts +4 -5
- package/dist/types/integrationSdk.d.ts.map +1 -1
- package/dist/types/marketplace/availabilityExceptions.d.ts +99 -0
- package/dist/types/marketplace/availabilityPlan.d.ts +17 -0
- package/dist/types/marketplace/bookings.d.ts +80 -0
- package/dist/types/marketplace/currentUser.d.ts +202 -0
- package/dist/types/marketplace/images.d.ts +65 -0
- package/dist/types/marketplace/listings.d.ts +169 -0
- package/dist/types/marketplace/marketplace.d.ts +30 -0
- package/dist/types/marketplace/messages.d.ts +87 -0
- package/dist/types/marketplace/ownListings.d.ts +155 -0
- package/dist/types/marketplace/passwordReset.d.ts +54 -0
- package/dist/types/marketplace/processTransitions.d.ts +56 -0
- package/dist/types/marketplace/reviews.d.ts +108 -0
- package/dist/types/marketplace/stock.d.ts +45 -0
- package/dist/types/marketplace/stockAdjustment.d.ts +97 -0
- package/dist/types/marketplace/stockReservations.d.ts +89 -0
- package/dist/types/marketplace/stripeAccount.d.ts +67 -0
- package/dist/types/marketplace/stripeAccountLinks.d.ts +55 -0
- package/dist/types/marketplace/stripeCustomer.d.ts +94 -0
- package/dist/types/marketplace/stripePaymentMethod.d.ts +21 -0
- package/dist/types/marketplace/stripePersons.d.ts +48 -0
- package/dist/types/marketplace/stripeSetupIntents.d.ts +48 -0
- package/dist/types/marketplace/timeSlots.d.ts +51 -0
- package/dist/types/marketplace/transactions.d.ts +200 -0
- package/dist/types/marketplace/user.d.ts +200 -0
- package/dist/types/sdk-types.d.ts +10 -0
- package/dist/types/sdk.d.ts +6 -7
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdkTypes/BigDecimal.d.ts +1 -1
- package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -1
- package/dist/types/sdkTypes/LatLng.d.ts +1 -1
- package/dist/types/sdkTypes/LatLng.d.ts.map +1 -1
- package/dist/types/sdkTypes/LatLngBounds.d.ts +1 -1
- package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -1
- package/dist/types/sdkTypes/Money.d.ts +1 -1
- package/dist/types/sdkTypes/Money.d.ts.map +1 -1
- package/dist/types/sdkTypes/UUID.d.ts +1 -1
- package/dist/types/sdkTypes/UUID.d.ts.map +1 -1
- package/dist/types/sharetribe.d.ts +227 -0
- package/dist/types/store.d.ts +22 -0
- package/dist/types/types/apiConfigs.d.ts.map +1 -1
- package/dist/types/types/assets/index.d.ts +74 -36
- package/dist/types/types/assets/index.d.ts.map +1 -1
- package/dist/types/types/authentication/index.d.ts +111 -60
- package/dist/types/types/authentication/index.d.ts.map +1 -1
- package/dist/types/types/axios.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +1 -39
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/types/integration/events.d.ts +52 -20
- package/dist/types/types/integration/events.d.ts.map +1 -1
- package/dist/types/types/marketplace/availabilityExceptions.d.ts +59 -16
- package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -1
- package/dist/types/types/marketplace/availabilityPlan.d.ts +18 -0
- package/dist/types/types/marketplace/availabilityPlan.d.ts.map +1 -0
- package/dist/types/types/marketplace/bookings.d.ts +48 -14
- package/dist/types/types/marketplace/bookings.d.ts.map +1 -1
- package/dist/types/types/marketplace/currentUser.d.ts +99 -55
- package/dist/types/types/marketplace/currentUser.d.ts.map +1 -1
- package/dist/types/types/marketplace/images.d.ts +40 -14
- package/dist/types/types/marketplace/images.d.ts.map +1 -1
- package/dist/types/types/marketplace/listings.d.ts +96 -66
- package/dist/types/types/marketplace/listings.d.ts.map +1 -1
- package/dist/types/types/marketplace/marketplace.d.ts +16 -6
- package/dist/types/types/marketplace/marketplace.d.ts.map +1 -1
- package/dist/types/types/marketplace/messages.d.ts +53 -15
- package/dist/types/types/marketplace/messages.d.ts.map +1 -1
- package/dist/types/types/marketplace/ownListings.d.ts +92 -65
- package/dist/types/types/marketplace/ownListings.d.ts.map +1 -1
- package/dist/types/types/marketplace/passwordReset.d.ts +32 -9
- package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -1
- package/dist/types/types/marketplace/processTransitions.d.ts +33 -14
- package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -1
- package/dist/types/types/marketplace/reviews.d.ts +72 -23
- package/dist/types/types/marketplace/reviews.d.ts.map +1 -1
- package/dist/types/types/marketplace/stock.d.ts +23 -6
- package/dist/types/types/marketplace/stock.d.ts.map +1 -1
- package/dist/types/types/marketplace/stockAdjustment.d.ts +60 -14
- package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -1
- package/dist/types/types/marketplace/stockReservations.d.ts +59 -14
- package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeAccount.d.ts +28 -5
- package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts +26 -6
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeCustomer.d.ts +60 -13
- package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts +1 -2
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripePersons.d.ts +17 -15
- package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts +16 -14
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -1
- package/dist/types/types/marketplace/timeSlots.d.ts +13 -15
- package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -1
- package/dist/types/types/marketplace/transactions.d.ts +77 -83
- package/dist/types/types/marketplace/transactions.d.ts.map +1 -1
- package/dist/types/types/marketplace/user.d.ts +85 -64
- package/dist/types/types/marketplace/user.d.ts.map +1 -1
- package/dist/types/types/sharetribe.d.ts +130 -92
- package/dist/types/types/sharetribe.d.ts.map +1 -1
- package/dist/types/types/store.d.ts +3 -14
- package/dist/types/types/store.d.ts.map +1 -1
- package/dist/types/utils/apis.d.ts +1 -1
- package/dist/types/utils/apis.d.ts.map +1 -1
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/convert-types.d.ts.map +1 -1
- package/dist/types/utils/parameter-serializer.d.ts.map +1 -1
- package/dist/types/utils/prepare-axios-instance.d.ts +1 -1
- package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -1
- package/dist/types/utils/stores/BrowserStore.d.ts +1 -2
- package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
- package/dist/types/utils/stores/ExpressStore.d.ts +6 -7
- package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
- package/dist/types/utils/stores/MemoryStore.d.ts +1 -2
- package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -1
- package/dist/types/utils/stores/store.d.ts.map +1 -1
- package/dist/types/utils/transit.d.ts +1 -1
- package/dist/types/utils/transit.d.ts.map +1 -1
- package/dist/types/utils/util.d.ts +2 -2
- package/dist/types/utils/util.d.ts.map +1 -1
- package/dist/utils/apis.d.ts +8 -0
- package/dist/utils/config.d.ts +32 -0
- package/dist/utils/convert-types.d.ts +13 -0
- package/dist/utils/parameter-serializer.d.ts +23 -0
- package/dist/utils/prepare-axios-instance.d.ts +14 -0
- package/dist/utils/stores/BrowserStore.d.ts +37 -0
- package/dist/utils/stores/ExpressStore.d.ts +48 -0
- package/dist/utils/stores/MemoryStore.d.ts +23 -0
- package/dist/utils/stores/store.d.ts +8 -0
- package/dist/utils/transit.d.ts +28 -0
- package/dist/utils/util.d.ts +15 -0
- package/package.json +18 -17
- package/dist/ts-sharetribe-flex-sdk.cjs +0 -3
- package/dist/ts-sharetribe-flex-sdk.cjs.map +0 -1
- package/dist/ts-sharetribe-flex-sdk.js +0 -3
- package/dist/ts-sharetribe-flex-sdk.js.map +0 -1
- package/dist/ts-sharetribe-flex-sdk.mjs +0 -3
- package/dist/ts-sharetribe-flex-sdk.mjs.map +0 -1
- package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +0 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import UUIDClass from "../sdkTypes/UUID";
|
|
2
|
+
import { User } from "./marketplace/user";
|
|
3
|
+
import { Booking } from "./marketplace/bookings";
|
|
4
|
+
import { Stock } from "./marketplace/stock";
|
|
5
|
+
import { StripePaymentMethod } from "./marketplace/stripePaymentMethod";
|
|
6
|
+
import { Image } from "./marketplace/images";
|
|
7
|
+
import { Listing } from "./marketplace/listings";
|
|
8
|
+
import { Marketplace } from "./marketplace/marketplace";
|
|
9
|
+
import { Message } from "./marketplace/messages";
|
|
10
|
+
import { OwnListing } from "./marketplace/ownListings";
|
|
11
|
+
import { Review } from "./marketplace/reviews";
|
|
12
|
+
import { StockReservation } from "./marketplace/stockReservations";
|
|
13
|
+
import { StripeAccount } from "./marketplace/stripeAccount";
|
|
14
|
+
import { StripeCustomer } from "./marketplace/stripeCustomer";
|
|
15
|
+
import { Transaction } from "./marketplace/transactions";
|
|
16
|
+
import { CurrentUserPermissionSet } from "./marketplace/currentUser";
|
|
17
|
+
import { StockAdjustment } from "./marketplace/stockAdjustment";
|
|
18
|
+
import { ImageAsset } from "./assets";
|
|
19
|
+
/**
|
|
20
|
+
* A mapping of relationship types to their corresponding entities.
|
|
21
|
+
* The `I` flag controls whether private/protected user data is included.
|
|
22
|
+
*/
|
|
23
|
+
export type RelationshipTypeMap<I extends boolean = false> = {
|
|
24
|
+
"author.effectivePermissionSet": CurrentUserPermissionSet;
|
|
25
|
+
"author.marketplace": Marketplace;
|
|
26
|
+
"author.profileImage": Image;
|
|
27
|
+
"author.stripeAccount": StripeAccount;
|
|
28
|
+
"booking.transaction": Transaction;
|
|
29
|
+
"customer.effectivePermissionSet": CurrentUserPermissionSet;
|
|
30
|
+
"customer.marketplace": Marketplace;
|
|
31
|
+
"customer.profileImage": Image;
|
|
32
|
+
"customer.stripeAccount": StripeAccount;
|
|
33
|
+
"effectivePermissionSet": CurrentUserPermissionSet;
|
|
34
|
+
"listing.author": User<I>;
|
|
35
|
+
"listing.currentStock": Stock;
|
|
36
|
+
"listing.images": Image;
|
|
37
|
+
"listing.marketplace": Marketplace;
|
|
38
|
+
"messages.sender": User<I>;
|
|
39
|
+
"messages.transaction": Transaction;
|
|
40
|
+
"ownListing.author": User<I>;
|
|
41
|
+
"ownListing.currentStock": Stock;
|
|
42
|
+
"ownListing.images": Image;
|
|
43
|
+
"ownListing.marketplace": Marketplace;
|
|
44
|
+
"provider.effectivePermissionSet": CurrentUserPermissionSet;
|
|
45
|
+
"provider.marketplace": Marketplace;
|
|
46
|
+
"provider.profileImage": Image;
|
|
47
|
+
"provider.stripeAccount": StripeAccount;
|
|
48
|
+
"reviews.author": User<I>;
|
|
49
|
+
"reviews.author.profileImage": Image;
|
|
50
|
+
"reviews.listing": Listing<I>;
|
|
51
|
+
"reviews.subject": User<I>;
|
|
52
|
+
"sender.effectivePermissionSet": CurrentUserPermissionSet;
|
|
53
|
+
"sender.marketplace": Marketplace;
|
|
54
|
+
"sender.profileImage": Image;
|
|
55
|
+
"sender.stripeAccount": StripeAccount;
|
|
56
|
+
"stockReservation.transaction": Transaction;
|
|
57
|
+
"stripeCustomer.defaultPaymentMethod": StripePaymentMethod;
|
|
58
|
+
"subject.effectivePermissionSet": CurrentUserPermissionSet;
|
|
59
|
+
"subject.marketplace": Marketplace;
|
|
60
|
+
"subject.profileImage": Image;
|
|
61
|
+
"subject.stripeAccount": StripeAccount;
|
|
62
|
+
"transaction.booking": Booking;
|
|
63
|
+
"transaction.customer": User<I>;
|
|
64
|
+
"transaction.listing": Listing<I>;
|
|
65
|
+
"transaction.marketplace": Marketplace;
|
|
66
|
+
"transaction.messages": Message;
|
|
67
|
+
"transaction.provider": User<I>;
|
|
68
|
+
"transaction.reviews": Review;
|
|
69
|
+
"transaction.stockReservation": StockReservation;
|
|
70
|
+
author: User<I>;
|
|
71
|
+
booking: Booking;
|
|
72
|
+
currentStock: Stock;
|
|
73
|
+
customer: User<I>;
|
|
74
|
+
defaultPaymentMethod: StripePaymentMethod;
|
|
75
|
+
imageAsset: ImageAsset;
|
|
76
|
+
images: Image;
|
|
77
|
+
listing: Listing<I>;
|
|
78
|
+
marketplace: Marketplace;
|
|
79
|
+
messages: Message;
|
|
80
|
+
ownListing: OwnListing;
|
|
81
|
+
profileImage: Image;
|
|
82
|
+
provider: User<I>;
|
|
83
|
+
reviews: Review;
|
|
84
|
+
sender: User<I>;
|
|
85
|
+
stockAdjustment: StockAdjustment;
|
|
86
|
+
stockReservation: StockReservation;
|
|
87
|
+
stripeAccount: StripeAccount;
|
|
88
|
+
stripeCustomer: StripeCustomer;
|
|
89
|
+
subject: User<I>;
|
|
90
|
+
transaction: Transaction;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* HTTP status codes that can return API errors
|
|
94
|
+
*/
|
|
95
|
+
export declare const ApiErrorStatuses: {
|
|
96
|
+
readonly BadRequest: 400;
|
|
97
|
+
readonly Unauthorized: 401;
|
|
98
|
+
readonly PaymentRequired: 402;
|
|
99
|
+
readonly Forbidden: 403;
|
|
100
|
+
readonly NotFound: 404;
|
|
101
|
+
readonly Conflict: 409;
|
|
102
|
+
readonly PayloadTooLarge: 413;
|
|
103
|
+
readonly TooManyRequests: 429;
|
|
104
|
+
readonly ServerError: 500;
|
|
105
|
+
};
|
|
106
|
+
export type ApiErrorStatus = typeof ApiErrorStatuses[keyof typeof ApiErrorStatuses];
|
|
107
|
+
/**
|
|
108
|
+
* Strongly typed error codes per status
|
|
109
|
+
*/
|
|
110
|
+
export type ApiErrorCode = "unsupported-content-type" | "bad-request" | "validation-disallowed-key" | "validation-invalid-value" | "validation-invalid-params" | "validation-missing-key" | "auth-invalid-access-token" | "auth-missing-access-token" | "transaction-payment-failed" | "forbidden" | "not-found" | "conflict" | "image-invalid" | "image-invalid-content" | "email-taken" | "email-already-verified" | "email-unverified" | "email-not-found" | "listing-not-found" | "listing-invalid-state" | "stripe-account-not-found" | "stripe-missing-api-key" | "stripe-invalid-payment-intent-status" | "stripe-customer-not-found" | "stripe-multiple-payment-methods-not-supported" | "stripe-payment-method-type-not-supported" | "user-missing-stripe-account" | "user-is-banned" | "user-not-found" | "transaction-locked" | "transaction-not-found" | "transaction-listing-not-found" | "transaction-booking-state-not-pending" | "transaction-booking-state-not-accepted" | "transaction-invalid-transition" | "transaction-invalid-action-sequence" | "transaction-missing-listing-price" | "transaction-missing-stripe-account" | "transaction-same-author-and-customer" | "transaction-stripe-account-disabled-charges" | "transaction-stripe-account-disabled-payouts" | "transaction-charge-zero-payin" | "transaction-charge-zero-payout" | "transaction-zero-payin" | "transaction-unknown-alias" | "transaction-provider-banned-or-deleted" | "transaction-customer-banned-or-deleted" | "request-larger-than-content-length" | "request-upload-over-limit" | "too-many-requests";
|
|
111
|
+
/**
|
|
112
|
+
* Single API error object
|
|
113
|
+
*/
|
|
114
|
+
export interface ApiError {
|
|
115
|
+
id: string;
|
|
116
|
+
status: ApiErrorStatus;
|
|
117
|
+
code: ApiErrorCode;
|
|
118
|
+
title: string;
|
|
119
|
+
detail?: string;
|
|
120
|
+
source?: {
|
|
121
|
+
pointer?: string;
|
|
122
|
+
parameter?: string;
|
|
123
|
+
};
|
|
124
|
+
meta?: Record<string, unknown>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Full error response from Sharetribe API
|
|
128
|
+
*/
|
|
129
|
+
export interface ApiErrorResponse {
|
|
130
|
+
errors: ApiError[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
export interface SharetribeApiError {
|
|
136
|
+
name: string;
|
|
137
|
+
message: string;
|
|
138
|
+
status?: number;
|
|
139
|
+
statusText?: string;
|
|
140
|
+
data: any;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* UUID wrapper instance
|
|
144
|
+
*/
|
|
145
|
+
export type UUID = InstanceType<typeof UUIDClass>;
|
|
146
|
+
/**
|
|
147
|
+
* Pagination metadata
|
|
148
|
+
*/
|
|
149
|
+
export interface ApiMeta {
|
|
150
|
+
totalItems: number;
|
|
151
|
+
totalPages: number;
|
|
152
|
+
page: number;
|
|
153
|
+
perPage: number;
|
|
154
|
+
paginationLimit?: number;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Relationship object in API responses
|
|
158
|
+
*/
|
|
159
|
+
export type Relationship<IsArray extends boolean = false, Type extends keyof RelationshipTypeMap = keyof RelationshipTypeMap> = IsArray extends true ? {
|
|
160
|
+
data: {
|
|
161
|
+
id: UUID;
|
|
162
|
+
type: Type;
|
|
163
|
+
}[];
|
|
164
|
+
} : {
|
|
165
|
+
data: {
|
|
166
|
+
id: UUID;
|
|
167
|
+
type: Type;
|
|
168
|
+
} | null;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Query parameter prefixes
|
|
172
|
+
*/
|
|
173
|
+
export type QueryFields = `fields.${string}`;
|
|
174
|
+
export type QueryLimit = `limit.${string}`;
|
|
175
|
+
export type QueryImageVariant = `imageVariant.${string}`;
|
|
176
|
+
/**
|
|
177
|
+
* Public, metadata, private, protected data query keys
|
|
178
|
+
*/
|
|
179
|
+
export type QueryPub = `pub_${string}`;
|
|
180
|
+
export type QueryMeta = `meta_${string}`;
|
|
181
|
+
export type QueryPriv = `priv_${string}`;
|
|
182
|
+
export type QueryProt = `prot_${string}`;
|
|
183
|
+
/**
|
|
184
|
+
* Optional expand control
|
|
185
|
+
*/
|
|
186
|
+
export interface ExpandParam {
|
|
187
|
+
expand?: boolean;
|
|
188
|
+
}
|
|
189
|
+
export type ExtraParameter = ExpandParam | undefined;
|
|
190
|
+
export type ExtraParameterType = ExtraParameter;
|
|
191
|
+
/**
|
|
192
|
+
* Base API parameter interface (index signatures are now safe)
|
|
193
|
+
*/
|
|
194
|
+
export interface ApiParameter {
|
|
195
|
+
/** Select fields: fields.listings=title,description */
|
|
196
|
+
[K: QueryFields]: string | undefined;
|
|
197
|
+
/** Pagination limits per resource type */
|
|
198
|
+
[K: QueryLimit]: number | undefined;
|
|
199
|
+
/** Image variants */
|
|
200
|
+
[K: QueryImageVariant]: string | undefined;
|
|
201
|
+
/** Public custom fields */
|
|
202
|
+
[K: QueryPub]: string | undefined;
|
|
203
|
+
/** Metadata fields */
|
|
204
|
+
[K: QueryMeta]: string | undefined;
|
|
205
|
+
/** Private fields (admin only) */
|
|
206
|
+
[K: QueryPriv]: string | undefined;
|
|
207
|
+
/** Protected fields (trusted user) */
|
|
208
|
+
[K: QueryProt]: string | undefined;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Geographic types
|
|
212
|
+
*/
|
|
213
|
+
export interface LatLng {
|
|
214
|
+
lat: number;
|
|
215
|
+
lng: number;
|
|
216
|
+
}
|
|
217
|
+
export interface LatLngBounds {
|
|
218
|
+
ne: LatLng;
|
|
219
|
+
sw: LatLng;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Money amount with currency
|
|
223
|
+
*/
|
|
224
|
+
export interface Money {
|
|
225
|
+
amount: number;
|
|
226
|
+
currency: string;
|
|
227
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthToken } from "./authentication";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for managing authentication tokens in a store.
|
|
4
|
+
*/
|
|
5
|
+
export interface TokenStore {
|
|
6
|
+
token?: AuthToken | null;
|
|
7
|
+
expiration?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves the current authentication token.
|
|
10
|
+
* @returns A promise resolving to the current token or null if no token exists.
|
|
11
|
+
*/
|
|
12
|
+
getToken: (() => AuthToken | null) | (() => Promise<AuthToken | null>);
|
|
13
|
+
/**
|
|
14
|
+
* Sets a new authentication token.
|
|
15
|
+
* @param args - Object containing the token's details.
|
|
16
|
+
*/
|
|
17
|
+
setToken: ((args: AuthToken) => void) | ((args: AuthToken) => Promise<void>);
|
|
18
|
+
/**
|
|
19
|
+
* Removes the current authentication token.
|
|
20
|
+
*/
|
|
21
|
+
removeToken: (() => void) | (() => Promise<void>);
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiConfigs.d.ts","sourceRoot":"","sources":["../../../src/types/apiConfigs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"apiConfigs.d.ts","sourceRoot":"","sources":["../../../src/types/apiConfigs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,IAAI,CAAC,SAAS,KAAK,GAC/D;IACA;;OAEG;IACH,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK;QAC1B,OAAO,EAAE;YACP;;eAEG;YACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YACvC;;eAEG;YACH,MAAM,EAAE,0BAA0B,CAAC;SACpC,CAAC;QACF;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK;QAC3B,OAAO,EAAE;YACP;;eAEG;YACH,cAAc,EAAE,mCAAmC,CAAC;YACpD;;eAEG;YACH,MAAM,EAAE,kBAAkB,CAAC;SAC5B,CAAC;QACF;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;OAEG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK;QAC7B,OAAO,EAAE;YACP;;eAEG;YACH,MAAM,EAAE,kBAAkB,CAAC;SAC5B,CAAC;QACF;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,GACC;IACA;;OAEG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK;QAC3B,OAAO,EAAE;YACP;;eAEG;YACH,cAAc,EAAE,mCAAmC,CAAC;YACpD;;eAEG;YACH,MAAM,EAAE,kBAAkB,CAAC;SAC5B,CAAC;QACF;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF;;OAEG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK;QACrC,OAAO,EAAE;YACP;;eAEG;YACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YACvC;;eAEG;YACH,MAAM,EAAE,0BAA0B,CAAC;SACpC,CAAC;QACF;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC"}
|
|
@@ -1,64 +1,102 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Type definitions for
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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?:
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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:
|
|
60
|
-
} & (
|
|
61
|
-
included:
|
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/assets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,KAAK,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;KAC3D,CAAC;CACH;AAED;;GAEG;AACH,MAAM,M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|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export type
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Token introspection response
|
|
126
|
+
*/
|
|
127
|
+
export interface TokenDetails {
|
|
86
128
|
"client-id": string;
|
|
87
129
|
exp: number;
|
|
88
|
-
scope: Scope;
|
|
89
|
-
isLoggedInAs
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
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,oB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MAAM,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,YAAY,IAC9C,CAAC,SAAS,cAAc,GACpB,YAAY,GACZ,SAAS,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../../src/types/axios.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|