@vansite/ts-sharetribe-flex-sdk 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/endpoints/marketplace/SitemapData.d.ts +60 -0
  2. package/dist/endpoints/marketplace/index.d.ts +2 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.LICENSE.txt +22 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/dist/index.mjs.LICENSE.txt +22 -0
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.umd.js +1 -1
  10. package/dist/index.umd.js.LICENSE.txt +22 -0
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/sdkTypes/Money.d.ts +8 -1
  13. package/dist/sdkTypes/UUID.d.ts +7 -0
  14. package/dist/types/endpoints/marketplace/SitemapData.d.ts +61 -0
  15. package/dist/types/endpoints/marketplace/SitemapData.d.ts.map +1 -0
  16. package/dist/types/endpoints/marketplace/index.d.ts +2 -0
  17. package/dist/types/endpoints/marketplace/index.d.ts.map +1 -1
  18. package/dist/types/marketplace/sitemapData.d.ts +47 -0
  19. package/dist/types/sdkTypes/Money.d.ts +8 -1
  20. package/dist/types/sdkTypes/Money.d.ts.map +1 -1
  21. package/dist/types/sdkTypes/UUID.d.ts +7 -0
  22. package/dist/types/sdkTypes/UUID.d.ts.map +1 -1
  23. package/dist/types/types/marketplace/sitemapData.d.ts +48 -0
  24. package/dist/types/types/marketplace/sitemapData.d.ts.map +1 -0
  25. package/dist/types/utils/prepare-axios-instance.d.ts +1 -1
  26. package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -1
  27. package/dist/types/utils/stores/BrowserStore.d.ts +16 -2
  28. package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
  29. package/dist/types/utils/stores/ExpressStore.d.ts +20 -1
  30. package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
  31. package/dist/utils/prepare-axios-instance.d.ts +1 -1
  32. package/dist/utils/stores/BrowserStore.d.ts +16 -2
  33. package/dist/utils/stores/ExpressStore.d.ts +20 -1
  34. package/package.json +1 -1
@@ -4,6 +4,12 @@
4
4
  */
5
5
  import { SdkType } from "../types";
6
6
  declare const MONEY_SDK_TYPE = "Money";
7
+ /**
8
+ * Error thrown when invalid Money values are provided.
9
+ */
10
+ export declare class InvalidMoneyError extends Error {
11
+ constructor(message: string);
12
+ }
7
13
  /**
8
14
  * Class representing a monetary value.
9
15
  *
@@ -18,7 +24,8 @@ declare class Money implements SdkType {
18
24
  * Creates an instance of the Money class.
19
25
  *
20
26
  * @param {number} amount - The monetary amount, represented in the smallest unit of the currency (e.g., cents for USD).
21
- * @param {string} currency - The currency code, represented as a three-character string (e.g., "USD").
27
+ * @param {string} currency - The currency code, represented as a three-character uppercase string (e.g., "USD").
28
+ * @throws {InvalidMoneyError} If the amount is not an integer or currency is not a valid ISO 4217 code.
22
29
  * @example
23
30
  * const money = new Money(1000, 'USD');
24
31
  * console.log(money); // Outputs: Money { amount: 1000, currency: 'USD' }
@@ -4,6 +4,12 @@
4
4
  */
5
5
  import { SdkType } from "../types";
6
6
  declare const UUID_SDK_TYPE = "UUID";
7
+ /**
8
+ * Error thrown when an invalid UUID is provided.
9
+ */
10
+ export declare class InvalidUUIDError extends Error {
11
+ constructor(value: unknown);
12
+ }
7
13
  /**
8
14
  * Class representing a UUID (Universally Unique Identifier).
9
15
  *
@@ -16,6 +22,7 @@ declare class UUID implements SdkType {
16
22
  * Creates an instance of the UUID class.
17
23
  *
18
24
  * @param {string} [uuid] - An optional UUID string. If not provided, a new UUID will be generated.
25
+ * @throws {InvalidUUIDError} If the provided value is not a valid UUID string.
19
26
  * @example
20
27
  * const id = new UUID();
21
28
  * console.log(id.toString()); // Outputs a newly generated UUID.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview Client for querying sitemap data in the Sharetribe Marketplace API.
3
+ *
4
+ * Use this to generate XML sitemaps for SEO:
5
+ * - queryListings: Up to 10,000 most recent public listing IDs
6
+ * - queryAssets: CMS page asset paths from Console
7
+ *
8
+ * Note: Results are cached for 1 day by the API.
9
+ *
10
+ * @see https://www.sharetribe.com/docs/concepts/sitemap-in-sharetribe/
11
+ */
12
+ import type { AxiosResponse } from "axios";
13
+ import MarketplaceApi from "./index";
14
+ import { SitemapAssetsResponse, SitemapListingsResponse } from "../../types/marketplace/sitemapData";
15
+ /**
16
+ * Sitemap Data API client
17
+ *
18
+ * Provides access to sitemap generation endpoints.
19
+ * These endpoints return minimal data needed for sitemap XML generation.
20
+ */
21
+ declare class SitemapData {
22
+ private readonly axios;
23
+ private readonly endpoint;
24
+ private readonly headers;
25
+ constructor(api: MarketplaceApi);
26
+ /**
27
+ * Query listing IDs for sitemap generation
28
+ *
29
+ * Returns up to 10,000 most recent public listings.
30
+ * For marketplaces with more listings, use Integration API
31
+ * with createdAt filtering for older listings.
32
+ *
33
+ * @returns {Promise<AxiosResponse<SitemapListingsResponse>>}
34
+ *
35
+ * @example
36
+ * const { data } = await sdk.sitemapData.queryListings();
37
+ * // Generate sitemap URLs from listing IDs
38
+ * data.data.forEach(listing => {
39
+ * console.log(`/l/${listing.id}`);
40
+ * });
41
+ */
42
+ queryListings(): Promise<AxiosResponse<SitemapListingsResponse>>;
43
+ /**
44
+ * Query CMS asset paths for sitemap generation
45
+ *
46
+ * Returns pages created in Sharetribe Console.
47
+ * Excludes pages with built-in or custom paths.
48
+ *
49
+ * @returns {Promise<AxiosResponse<SitemapAssetsResponse>>}
50
+ *
51
+ * @example
52
+ * const { data } = await sdk.sitemapData.queryAssets();
53
+ * // Generate sitemap URLs from asset paths
54
+ * data.data.forEach(asset => {
55
+ * console.log(`/p/${asset.attributes.assetPath}`);
56
+ * });
57
+ */
58
+ queryAssets(): Promise<AxiosResponse<SitemapAssetsResponse>>;
59
+ }
60
+ export default SitemapData;
61
+ //# sourceMappingURL=SitemapData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SitemapData.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/marketplace/SitemapData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAgB,aAAa,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,cAAc,MAAM,SAAS,CAAC;AACrC,OAAO,EAAC,qBAAqB,EAAE,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAEnG;;;;;GAKG;AACH,cAAM,WAAW;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,GAAG,EAAE,cAAc;IAM/B;;;;;;;;;;;;;;;OAeG;IACG,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAMtE;;;;;;;;;;;;;;OAcG;IACG,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAKnE;AAED,eAAe,WAAW,CAAC"}
@@ -32,6 +32,7 @@ import OwnListings from "./OwnListings";
32
32
  import PasswordReset from "./PasswordReset";
33
33
  import ProcessTransitions from "./ProcessTransitions";
34
34
  import Reviews from "./Reviews";
35
+ import SitemapData from "./SitemapData";
35
36
  import Stock from "./Stock";
36
37
  import StockAdjustments from "./StockAdjustments";
37
38
  import StripeAccount from "./StripeAccount";
@@ -65,6 +66,7 @@ declare class MarketplaceApi {
65
66
  readonly passwordReset: PasswordReset;
66
67
  readonly processTransitions: ProcessTransitions;
67
68
  readonly reviews: Reviews;
69
+ readonly sitemapData: SitemapData;
68
70
  readonly stock: Stock;
69
71
  readonly stockAdjustments: StockAdjustments;
70
72
  readonly stripeAccount: StripeAccount;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/marketplace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;gBAEV,GAAG,EAAE,aAAa;CA+B/B;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @fileoverview Type definitions for SitemapData in the Sharetribe Marketplace API.
3
+ *
4
+ * The sitemap_data endpoints provide data for generating XML sitemaps:
5
+ * - queryListings: Returns up to 10,000 most recent public listings
6
+ * - queryAssets: Returns CMS pages/assets created in Console
7
+ *
8
+ * @see https://www.sharetribe.com/docs/concepts/sitemap-in-sharetribe/
9
+ */
10
+ import { ApiMeta, UUID } from "../sharetribe";
11
+ /**
12
+ * Minimal listing data for sitemap generation
13
+ */
14
+ export interface SitemapListing {
15
+ id: UUID;
16
+ type: "listing";
17
+ }
18
+ /**
19
+ * CMS asset data for sitemap generation
20
+ */
21
+ export interface SitemapAsset {
22
+ id: UUID;
23
+ type: "asset";
24
+ attributes: {
25
+ assetPath: string;
26
+ };
27
+ }
28
+ /**
29
+ * Response from sitemap_data/query_listings
30
+ *
31
+ * Returns up to 10,000 most recent public listings.
32
+ * Results are cached for 1 day.
33
+ */
34
+ export interface SitemapListingsResponse {
35
+ data: SitemapListing[];
36
+ meta: ApiMeta;
37
+ }
38
+ /**
39
+ * Response from sitemap_data/query_assets
40
+ *
41
+ * Returns CMS pages created in Console.
42
+ * Excludes pages with built-in/custom paths.
43
+ */
44
+ export interface SitemapAssetsResponse {
45
+ data: SitemapAsset[];
46
+ meta: ApiMeta;
47
+ }
@@ -4,6 +4,12 @@
4
4
  */
5
5
  import { SdkType } from "../types";
6
6
  declare const MONEY_SDK_TYPE = "Money";
7
+ /**
8
+ * Error thrown when invalid Money values are provided.
9
+ */
10
+ export declare class InvalidMoneyError extends Error {
11
+ constructor(message: string);
12
+ }
7
13
  /**
8
14
  * Class representing a monetary value.
9
15
  *
@@ -18,7 +24,8 @@ declare class Money implements SdkType {
18
24
  * Creates an instance of the Money class.
19
25
  *
20
26
  * @param {number} amount - The monetary amount, represented in the smallest unit of the currency (e.g., cents for USD).
21
- * @param {string} currency - The currency code, represented as a three-character string (e.g., "USD").
27
+ * @param {string} currency - The currency code, represented as a three-character uppercase string (e.g., "USD").
28
+ * @throws {InvalidMoneyError} If the amount is not an integer or currency is not a valid ISO 4217 code.
22
29
  * @example
23
30
  * const money = new Money(1000, 'USD');
24
31
  * console.log(money); // Outputs: Money { amount: 1000, currency: 'USD' }
@@ -1 +1 @@
1
- {"version":3,"file":"Money.d.ts","sourceRoot":"","sources":["../../../src/sdkTypes/Money.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjC,QAAA,MAAM,cAAc,UAAU,CAAC;AAE/B;;;;;GAKG;AACH,cAAM,KAAM,YAAW,OAAO;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,QAAQ,EAAE,OAAO,cAAc,CAAC;IAEzC;;;;;;;;OAQG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAwB7C;AAGD,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Money.d.ts","sourceRoot":"","sources":["../../../src/sdkTypes/Money.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAGjC,QAAA,MAAM,cAAc,UAAU,CAAC;AAK/B;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,cAAM,KAAM,YAAW,OAAO;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,QAAQ,EAAE,OAAO,cAAc,CAAC;IAEzC;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAgB7C;AAGD,eAAe,KAAK,CAAC"}
@@ -4,6 +4,12 @@
4
4
  */
5
5
  import { SdkType } from "../types";
6
6
  declare const UUID_SDK_TYPE = "UUID";
7
+ /**
8
+ * Error thrown when an invalid UUID is provided.
9
+ */
10
+ export declare class InvalidUUIDError extends Error {
11
+ constructor(value: unknown);
12
+ }
7
13
  /**
8
14
  * Class representing a UUID (Universally Unique Identifier).
9
15
  *
@@ -16,6 +22,7 @@ declare class UUID implements SdkType {
16
22
  * Creates an instance of the UUID class.
17
23
  *
18
24
  * @param {string} [uuid] - An optional UUID string. If not provided, a new UUID will be generated.
25
+ * @throws {InvalidUUIDError} If the provided value is not a valid UUID string.
19
26
  * @example
20
27
  * const id = new UUID();
21
28
  * console.log(id.toString()); // Outputs a newly generated UUID.
@@ -1 +1 @@
1
- {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/sdkTypes/UUID.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAGjC,QAAA,MAAM,aAAa,SAAS,CAAC;AAE7B;;;;GAIG;AACH,cAAM,IAAK,YAAW,OAAO;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,QAAQ,EAAE,OAAO,aAAa,CAAC;IAExC;;;;;;;;;;OAUG;gBACS,IAAI,CAAC,EAAE,MAAM;IAazB;;;;;;;OAOG;IACH,QAAQ,IAAI,MAAM;CAGnB;AAGD,eAAe,IAAI,CAAC;AAGpB,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/sdkTypes/UUID.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAGjC,QAAA,MAAM,aAAa,SAAS,CAAC;AAE7B;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,KAAK,EAAE,OAAO;CAI3B;AAED;;;;GAIG;AACH,cAAM,IAAK,YAAW,OAAO;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,QAAQ,EAAE,OAAO,aAAa,CAAC;IAExC;;;;;;;;;;;OAWG;gBACS,IAAI,CAAC,EAAE,MAAM;IAezB;;;;;;;OAOG;IACH,QAAQ,IAAI,MAAM;CAGnB;AAGD,eAAe,IAAI,CAAC;AAGpB,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @fileoverview Type definitions for SitemapData in the Sharetribe Marketplace API.
3
+ *
4
+ * The sitemap_data endpoints provide data for generating XML sitemaps:
5
+ * - queryListings: Returns up to 10,000 most recent public listings
6
+ * - queryAssets: Returns CMS pages/assets created in Console
7
+ *
8
+ * @see https://www.sharetribe.com/docs/concepts/sitemap-in-sharetribe/
9
+ */
10
+ import { ApiMeta, UUID } from "../sharetribe";
11
+ /**
12
+ * Minimal listing data for sitemap generation
13
+ */
14
+ export interface SitemapListing {
15
+ id: UUID;
16
+ type: "listing";
17
+ }
18
+ /**
19
+ * CMS asset data for sitemap generation
20
+ */
21
+ export interface SitemapAsset {
22
+ id: UUID;
23
+ type: "asset";
24
+ attributes: {
25
+ assetPath: string;
26
+ };
27
+ }
28
+ /**
29
+ * Response from sitemap_data/query_listings
30
+ *
31
+ * Returns up to 10,000 most recent public listings.
32
+ * Results are cached for 1 day.
33
+ */
34
+ export interface SitemapListingsResponse {
35
+ data: SitemapListing[];
36
+ meta: ApiMeta;
37
+ }
38
+ /**
39
+ * Response from sitemap_data/query_assets
40
+ *
41
+ * Returns CMS pages created in Console.
42
+ * Excludes pages with built-in/custom paths.
43
+ */
44
+ export interface SitemapAssetsResponse {
45
+ data: SitemapAsset[];
46
+ meta: ApiMeta;
47
+ }
48
+ //# sourceMappingURL=sitemapData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemapData.d.ts","sourceRoot":"","sources":["../../../../src/types/marketplace/sitemapData.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;CACf"}
@@ -8,7 +8,7 @@ export declare const isAuthTokenUnauthorized: (error: AxiosError) => boolean | u
8
8
  export declare const routeNeedsTrustedUser: (requestConfig: InternalAxiosRequestConfig, sdk: SharetribeSdk | IntegrationSdk) => boolean | undefined;
9
9
  export declare const prepareAuthorizationHeader: (data: any) => string;
10
10
  export declare function handleResponseSuccess(sdk: SharetribeSdk | IntegrationSdk): (response: AxiosResponse) => AxiosResponse;
11
- export declare function handleResponseFailure(sdk: SharetribeSdk | IntegrationSdk, error: AxiosError | any): Promise<AxiosResponse<any, any, {}>>;
11
+ export declare function handleResponseFailure(sdk: SharetribeSdk | IntegrationSdk, error: AxiosError | any): Promise<unknown>;
12
12
  export declare function handleRequestSuccess(sdk: SharetribeSdk | IntegrationSdk, requestConfig: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig>;
13
13
  export declare function createAxiosConfig(sdk: SharetribeSdk | IntegrationSdk, config: AxiosRequestConfig): AxiosRequestConfig<any>;
14
14
  export declare function prepareAxiosInstance(sdk: SharetribeSdk | IntegrationSdk): void;
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-axios-instance.d.ts","sourceRoot":"","sources":["../../../src/utils/prepare-axios-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAOjG,OAAO,aAAa,MAAM,QAAQ,CAAC;AAEnC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAK/C,eAAO,MAAM,gBAAgB,UAO5B,CAAC;AAiBF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,YAA2B,CAAC;AAC9E,eAAO,MAAM,cAAc,G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qB,GAChC,eAAe,0BAA0B,EACzC,KAAK,aAAa,GAAG,cAAc,wBAepC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,MAAM,GAAG,WACT,CAAC;AAG5C,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,IAC3C,UAAU,aAAa,KAAG,aAAa,CAwBpE;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,aAAa,GAAG,cAAc,EACnC,KAAK,EAAE,UAAU,GAAG,GAAG,oBA+GxB;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,aAAa,GAAG,cAAc,EACnC,aAAa,EAAE,0BAA0B,GACxC,OAAO,CAAC,0BAA0B,CAAC,CAiHrC;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,GAAG,cAAc,EACnC,MAAM,EAAE,kBAAkB,2BAY3B;AAGD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,QAqBvE"}
@@ -4,24 +4,38 @@ import { AuthToken, TokenStore } from "../../types";
4
4
  */
5
5
  export type BrowserStoreOptions = {
6
6
  clientId: string;
7
+ /**
8
+ * Whether to use secure cookies (HTTPS only).
9
+ * Defaults to true for security. Set to false only for local development.
10
+ */
7
11
  secure?: boolean;
12
+ /**
13
+ * SameSite cookie attribute for CSRF protection.
14
+ * Defaults to 'Lax' for balance of security and usability.
15
+ * Use 'Strict' for maximum security, 'None' for cross-site usage (requires secure=true).
16
+ */
17
+ sameSite?: "Strict" | "Lax" | "None";
8
18
  };
9
19
  /**
10
20
  * `BrowserStore` is an implementation of the `TokenStore` interface for storing authentication tokens in browser cookies.
21
+ *
22
+ * **Security Note:** This store uses JavaScript-accessible cookies. For maximum security in production,
23
+ * consider using `ExpressStore` with `httpOnly: true` which prevents JavaScript access to tokens.
11
24
  */
12
25
  declare class BrowserStore implements TokenStore {
13
26
  expiration: number;
14
27
  private namespace;
15
28
  private readonly key;
16
29
  private readonly secure;
30
+ private readonly sameSite;
17
31
  /**
18
32
  * Initializes the `BrowserStore` with client-specific options.
19
33
  * @param options - Configuration options for the store.
20
34
  */
21
- constructor({ clientId, secure }: BrowserStoreOptions);
35
+ constructor({ clientId, secure, sameSite }: BrowserStoreOptions);
22
36
  /**
23
37
  * Retrieves the authentication token from browser cookies.
24
- * @returns A promise that resolves to the `AuthToken` or null if no token exists.
38
+ * @returns The `AuthToken` or null if no token exists or parsing fails.
25
39
  */
26
40
  getToken(): AuthToken | null;
27
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserStore.d.ts","sourceRoot":"","sources":["../../../../src/utils/stores/BrowserStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,cAAM,YAAa,YAAW,UAAU;IACtC,UAAU,EAAE,MAAM,CAAM;IACxB,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C;;;OAGG;gBACS,EAAC,QAAQ,EAAE,MAAM,EAAC,EAAE,mBAAmB;IAKnD;;;OAGG;IACH,QAAQ,IAAI,SAAS,GAAG,IAAI;IAK5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAQhC;;OAEG;IACH,WAAW,IAAI,IAAI;CAGpB;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"BrowserStore.d.ts","sourceRoot":"","sources":["../../../../src/utils/stores/BrowserStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,cAAM,YAAa,YAAW,UAAU;IACtC,UAAU,EAAE,MAAM,CAAM;IACxB,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IAErD;;;OAGG;gBACS,EAAC,QAAQ,EAAE,MAAa,EAAE,QAAgB,EAAC,EAAE,mBAAmB;IAc5E;;;OAGG;IACH,QAAQ,IAAI,SAAS,GAAG,IAAI;IAc5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAQhC;;OAEG;IACH,WAAW,IAAI,IAAI;CAGpB;AAED,eAAe,YAAY,CAAC"}
@@ -7,16 +7,35 @@ export type ExpressStoreOptions = {
7
7
  clientId: string;
8
8
  req: Request;
9
9
  res: Response;
10
+ /**
11
+ * Whether to use secure cookies (HTTPS only).
12
+ * Defaults to true for security. Set to false only for local development.
13
+ */
10
14
  secure?: boolean;
15
+ /**
16
+ * Whether to set httpOnly flag (prevents JavaScript access).
17
+ * Defaults to true for security. This is the recommended setting for server-side token storage.
18
+ */
19
+ httpOnly?: boolean;
20
+ /**
21
+ * SameSite cookie attribute for CSRF protection.
22
+ * Defaults to 'Lax' for balance of security and usability.
23
+ */
24
+ sameSite?: "strict" | "lax" | "none";
11
25
  };
12
26
  /**
13
27
  * `ExpressStore` is an implementation of the `TokenStore` interface for managing authentication tokens via cookies in an Express application.
28
+ *
29
+ * **Security Note:** This store supports `httpOnly` cookies (default: true), which prevents JavaScript access to tokens
30
+ * and is the recommended approach for production server-side token storage.
14
31
  */
15
32
  declare class ExpressStore implements TokenStore {
16
33
  expiration: number;
17
34
  private namespace;
18
35
  private key;
19
36
  private secure;
37
+ private httpOnly;
38
+ private sameSite;
20
39
  private req;
21
40
  private res;
22
41
  private currentToken;
@@ -24,7 +43,7 @@ declare class ExpressStore implements TokenStore {
24
43
  * Initializes the `ExpressStore` with client-specific options.
25
44
  * @param options - Configuration options for the store.
26
45
  */
27
- constructor({ clientId, req, res, secure }: ExpressStoreOptions);
46
+ constructor({ clientId, req, res, secure, httpOnly, sameSite }: ExpressStoreOptions);
28
47
  /**
29
48
  * Retrieves the authentication token, either from cache or from the request cookies.
30
49
  * @returns A promise that resolves to the `AuthToken` or null if no token exists.
@@ -1 +1 @@
1
- {"version":3,"file":"ExpressStore.d.ts","sourceRoot":"","sources":["../../../../src/utils/stores/ExpressStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,cAAM,YAAa,YAAW,UAAU;IACtC,UAAU,EAAE,MAAM,CAAO;IACzB,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,GAAG,CAAW;IACtB,OAAO,CAAC,YAAY,CAA0B;IAE9C;;;OAGG;gBACS,EAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAC,EAAE,mBAAmB;IAY7D;;;OAGG;IACH,QAAQ,IAAI,SAAS,GAAG,IAA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,KAAK,EAAE,SAAS,GAAG,IAAI;IAUhC;;OAEG;IACH,WAAW,IAAI,IAAI;IAKnB;;;OAGG;IACH,OAAO,CAAC,UAAU;CAanB;AAED,eAAe,YAAY,CAAC"}
@@ -8,7 +8,7 @@ export declare const isAuthTokenUnauthorized: (error: AxiosError) => boolean | u
8
8
  export declare const routeNeedsTrustedUser: (requestConfig: InternalAxiosRequestConfig, sdk: SharetribeSdk | IntegrationSdk) => boolean | undefined;
9
9
  export declare const prepareAuthorizationHeader: (data: any) => string;
10
10
  export declare function handleResponseSuccess(sdk: SharetribeSdk | IntegrationSdk): (response: AxiosResponse) => AxiosResponse;
11
- export declare function handleResponseFailure(sdk: SharetribeSdk | IntegrationSdk, error: AxiosError | any): Promise<AxiosResponse<any, any, {}>>;
11
+ export declare function handleResponseFailure(sdk: SharetribeSdk | IntegrationSdk, error: AxiosError | any): Promise<unknown>;
12
12
  export declare function handleRequestSuccess(sdk: SharetribeSdk | IntegrationSdk, requestConfig: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig>;
13
13
  export declare function createAxiosConfig(sdk: SharetribeSdk | IntegrationSdk, config: AxiosRequestConfig): AxiosRequestConfig<any>;
14
14
  export declare function prepareAxiosInstance(sdk: SharetribeSdk | IntegrationSdk): void;
@@ -4,24 +4,38 @@ import { AuthToken, TokenStore } from "../../types";
4
4
  */
5
5
  export type BrowserStoreOptions = {
6
6
  clientId: string;
7
+ /**
8
+ * Whether to use secure cookies (HTTPS only).
9
+ * Defaults to true for security. Set to false only for local development.
10
+ */
7
11
  secure?: boolean;
12
+ /**
13
+ * SameSite cookie attribute for CSRF protection.
14
+ * Defaults to 'Lax' for balance of security and usability.
15
+ * Use 'Strict' for maximum security, 'None' for cross-site usage (requires secure=true).
16
+ */
17
+ sameSite?: "Strict" | "Lax" | "None";
8
18
  };
9
19
  /**
10
20
  * `BrowserStore` is an implementation of the `TokenStore` interface for storing authentication tokens in browser cookies.
21
+ *
22
+ * **Security Note:** This store uses JavaScript-accessible cookies. For maximum security in production,
23
+ * consider using `ExpressStore` with `httpOnly: true` which prevents JavaScript access to tokens.
11
24
  */
12
25
  declare class BrowserStore implements TokenStore {
13
26
  expiration: number;
14
27
  private namespace;
15
28
  private readonly key;
16
29
  private readonly secure;
30
+ private readonly sameSite;
17
31
  /**
18
32
  * Initializes the `BrowserStore` with client-specific options.
19
33
  * @param options - Configuration options for the store.
20
34
  */
21
- constructor({ clientId, secure }: BrowserStoreOptions);
35
+ constructor({ clientId, secure, sameSite }: BrowserStoreOptions);
22
36
  /**
23
37
  * Retrieves the authentication token from browser cookies.
24
- * @returns A promise that resolves to the `AuthToken` or null if no token exists.
38
+ * @returns The `AuthToken` or null if no token exists or parsing fails.
25
39
  */
26
40
  getToken(): AuthToken | null;
27
41
  /**
@@ -7,16 +7,35 @@ export type ExpressStoreOptions = {
7
7
  clientId: string;
8
8
  req: Request;
9
9
  res: Response;
10
+ /**
11
+ * Whether to use secure cookies (HTTPS only).
12
+ * Defaults to true for security. Set to false only for local development.
13
+ */
10
14
  secure?: boolean;
15
+ /**
16
+ * Whether to set httpOnly flag (prevents JavaScript access).
17
+ * Defaults to true for security. This is the recommended setting for server-side token storage.
18
+ */
19
+ httpOnly?: boolean;
20
+ /**
21
+ * SameSite cookie attribute for CSRF protection.
22
+ * Defaults to 'Lax' for balance of security and usability.
23
+ */
24
+ sameSite?: "strict" | "lax" | "none";
11
25
  };
12
26
  /**
13
27
  * `ExpressStore` is an implementation of the `TokenStore` interface for managing authentication tokens via cookies in an Express application.
28
+ *
29
+ * **Security Note:** This store supports `httpOnly` cookies (default: true), which prevents JavaScript access to tokens
30
+ * and is the recommended approach for production server-side token storage.
14
31
  */
15
32
  declare class ExpressStore implements TokenStore {
16
33
  expiration: number;
17
34
  private namespace;
18
35
  private key;
19
36
  private secure;
37
+ private httpOnly;
38
+ private sameSite;
20
39
  private req;
21
40
  private res;
22
41
  private currentToken;
@@ -24,7 +43,7 @@ declare class ExpressStore implements TokenStore {
24
43
  * Initializes the `ExpressStore` with client-specific options.
25
44
  * @param options - Configuration options for the store.
26
45
  */
27
- constructor({ clientId, req, res, secure }: ExpressStoreOptions);
46
+ constructor({ clientId, req, res, secure, httpOnly, sameSite }: ExpressStoreOptions);
28
47
  /**
29
48
  * Retrieves the authentication token, either from cache or from the request cookies.
30
49
  * @returns A promise that resolves to the `AuthToken` or null if no token exists.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vansite/ts-sharetribe-flex-sdk",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "This is a TypeScript SDK for Sharetribe Flex API. It reduces the complexity of the API and provides a more user-friendly interface.",
5
5
  "keywords": [
6
6
  "sharetribe",