@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.
- 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/SitemapData.d.ts +60 -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 +82 -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} +35 -5
- 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} +35 -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} +35 -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 +35 -0
- package/dist/sdkTypes/UUID.d.ts +45 -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/SitemapData.d.ts +61 -0
- package/dist/types/endpoints/marketplace/SitemapData.d.ts.map +1 -0
- 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 +52 -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/sitemapData.d.ts +47 -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 +9 -2
- package/dist/types/sdkTypes/Money.d.ts.map +1 -1
- package/dist/types/sdkTypes/UUID.d.ts +8 -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/sitemapData.d.ts +48 -0
- package/dist/types/types/marketplace/sitemapData.d.ts.map +1 -0
- 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/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 +17 -4
- package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
- package/dist/types/utils/stores/ExpressStore.d.ts +26 -8
- 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/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 +51 -0
- package/dist/utils/stores/ExpressStore.d.ts +67 -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 +16 -14
- 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
|
@@ -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,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,OAAO,CAAC,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AAC,SAAS,SAAS,wBAAwB,EAAE,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5G,KAAK,qBAAqB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;AAE3E,KAAK,iBAAiB,CAAC,CAAC,IACtB,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC,SAAS,SAAS,wBAAwB,EAAE,CAAA;CAAE,GACtE,mBAAmB,CAAC,YAAY,CAAC,EAAE,GACnC,KAAK,CAAC;AAEZ;;GAEG;AACH,KAAK,YAAY,CACf,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,iBAAiB,IACzB,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,iBAAiB,IACzB;IACF,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC1B,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG;IAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -1,97 +1,148 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Type definitions for
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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,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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AC;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"}
|
|
@@ -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,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C;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 {
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
53
|
+
eventType: EventType;
|
|
34
54
|
source: EventSource;
|
|
35
55
|
resourceId: UUID;
|
|
36
56
|
resourceType: EventResourceType;
|
|
37
57
|
resource: EventResource;
|
|
38
|
-
previousValues
|
|
39
|
-
auditData
|
|
58
|
+
previousValues?: Record<string, unknown> | null;
|
|
59
|
+
auditData?: EventAuditData | null;
|
|
40
60
|
};
|
|
41
61
|
}
|
|
42
|
-
|
|
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?:
|
|
70
|
+
eventTypes?: EventType[];
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/types/integration/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAC,sCAAsC,EAAC,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,4BAA4B,EAAC,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,gCAAgC,EAAC,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAC,iCAAiC,EAAC,MAAM,kCAAkC,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,cAAc,GACd,+BAA+B,GAC/B,+BAA+B,GAC/B,+BAA+B,GAC/B,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,uBAAuB,GACvB,0BAA0B,GAC1B,qB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