@01.software/sdk 0.30.1 → 0.31.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 +74 -20
- package/dist/client.cjs +81 -16
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +81 -16
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-B9d9kr1d.d.ts → collection-client-ByzY3hWK.d.ts} +3 -3
- package/dist/{collection-client-QPbwimkU.d.cts → collection-client-DFXXz0vk.d.cts} +3 -3
- package/dist/{const-VZuk2tWc.d.cts → const-AytzliEu.d.cts} +4 -4
- package/dist/{const-B75IFDRi.d.ts → const-BGCP-OJL.d.ts} +4 -4
- package/dist/{index-B2WbhEgT.d.cts → index-BGEhoDUs.d.cts} +1 -1
- package/dist/{index-B2WbhEgT.d.ts → index-BGEhoDUs.d.ts} +1 -1
- package/dist/index.cjs +156 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +156 -19
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-DPjO_IbQ.d.cts → payload-types-Wa4-eC6x.d.cts} +790 -534
- package/dist/{payload-types-DPjO_IbQ.d.ts → payload-types-Wa4-eC6x.d.ts} +790 -534
- package/dist/query.cjs +63 -13
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +6 -6
- package/dist/query.d.ts +6 -6
- package/dist/query.js +63 -13
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +142 -17
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +32 -7
- package/dist/server.d.ts +32 -7
- package/dist/server.js +142 -17
- package/dist/server.js.map +1 -1
- package/dist/{types-Dlb2mwpX.d.cts → types-BX2mqDf6.d.ts} +46 -6
- package/dist/{types-1fBLrYU7.d.ts → types-CVA10VC-.d.ts} +6 -2
- package/dist/{types-BwT0eeaz.d.cts → types-CmLG-7RL.d.cts} +6 -2
- package/dist/{types-DuSKPiY5.d.ts → types-DChFjQGz.d.cts} +46 -6
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { d as ClientConfig, h as RootClient } from './types-
|
|
2
|
-
export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as
|
|
3
|
-
import {
|
|
4
|
-
export { A as Article,
|
|
5
|
-
export { C as CollectionType } from './types-
|
|
1
|
+
import { d as ClientConfig, h as RootClient } from './types-DChFjQGz.cjs';
|
|
2
|
+
export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as ProductListingCard, ak as ProductListingCardPriceRange, al as ProductListingGroup, am as ProductListingGroupSummary, an as ProductListingGroupsItem, ao as ProductListingGroupsProduct, ap as ProductListingGroupsResponse, aq as ProductListingProductShape, ar as ProductListingProjection, as as ProductListingSwatch, at as ProductOptionMatrix, au as ProductOptionMatrixOption, av as ProductOptionMatrixValue, aw as ProductOptionMatrixVariant, ax as ProductOptionShape, ay as ProductOptionValueShape, az as ProductSelectionAvailableValue, aA as ProductSelectionByOptionValue, aB as ProductSelectionCodecError, aC as ProductSelectionCodecOptions, aD as ProductSelectionInput, aE as ProductSelectionResolution, aF as ProductSelectionResolutionContext, aG as ProductVariantShape, aH as RemoveDiscountParams, aI as RemoveItemParams, aJ as RequestOptions, R as RetryConfig, aK as ReturnItem, aL as ReturnReason, aM as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aN as ServerApiOptions, aO as ShippingApi, aP as ShippingApiOptions, S as Sort, aQ as StockCheckParams, aR as StockCheckResponse, aS as StockCheckResult, aT as UpdateFulfillmentParams, aU as UpdateItemParams, aV as UpdateOrderParams, aW as UpdateProfileData, aX as UpdateReturnParams, aY as UpdateTransactionParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, W as Where, a$ as buildProductHref, b0 as buildProductListingCard, b1 as buildProductListingGroupsByOption, b2 as buildProductListingProjection, b3 as buildProductOptionMatrix, b4 as buildProductOptionMatrixFromDetail, b5 as createProductSelectionCodec, b6 as getAvailableOptionValues, b7 as getProductSelectionImages, b8 as getSelectedValueByOptionId, b9 as normalizeProductSelection, ba as normalizeProductSelectionFromMatrix, bb as normalizeSelectedValueIds, bc as parseProductSelection, bd as resolveProductSelection, be as resolveProductSelectionFromMatrix, bf as resolveVariantForSelection, bg as stringifyProductSelection } from './types-DChFjQGz.cjs';
|
|
3
|
+
import { P as Product } from './payload-types-Wa4-eC6x.cjs';
|
|
4
|
+
export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, i as Cart, j as CartItem, D as Document, I as Image, O as Order, c as Post, k as PostCategory, l as ProductVariant, T as Tenant, V as Video } from './payload-types-Wa4-eC6x.cjs';
|
|
5
|
+
export { C as CollectionType, P as Product, a as ProductCollection } from './types-CmLG-7RL.cjs';
|
|
6
6
|
export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.cjs';
|
|
7
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-
|
|
7
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-AytzliEu.cjs';
|
|
8
8
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
9
9
|
export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.cjs';
|
|
10
10
|
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.cjs';
|
|
11
11
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.cjs';
|
|
12
|
-
export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-
|
|
12
|
+
export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-BGEhoDUs.cjs';
|
|
13
13
|
|
|
14
14
|
declare const generateOrderNumber: () => string;
|
|
15
15
|
|
|
@@ -31,4 +31,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
|
|
|
31
31
|
|
|
32
32
|
declare function createClient(options: ClientConfig): RootClient;
|
|
33
33
|
|
|
34
|
-
export { RootClient as Client, ClientConfig, RootClient as ClientType,
|
|
34
|
+
export { RootClient as Client, ClientConfig, RootClient as ClientType, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { d as ClientConfig, h as RootClient } from './types-
|
|
2
|
-
export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as
|
|
3
|
-
import {
|
|
4
|
-
export { A as Article,
|
|
5
|
-
export { C as CollectionType } from './types-
|
|
1
|
+
import { d as ClientConfig, h as RootClient } from './types-BX2mqDf6.js';
|
|
2
|
+
export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as ProductListingCard, ak as ProductListingCardPriceRange, al as ProductListingGroup, am as ProductListingGroupSummary, an as ProductListingGroupsItem, ao as ProductListingGroupsProduct, ap as ProductListingGroupsResponse, aq as ProductListingProductShape, ar as ProductListingProjection, as as ProductListingSwatch, at as ProductOptionMatrix, au as ProductOptionMatrixOption, av as ProductOptionMatrixValue, aw as ProductOptionMatrixVariant, ax as ProductOptionShape, ay as ProductOptionValueShape, az as ProductSelectionAvailableValue, aA as ProductSelectionByOptionValue, aB as ProductSelectionCodecError, aC as ProductSelectionCodecOptions, aD as ProductSelectionInput, aE as ProductSelectionResolution, aF as ProductSelectionResolutionContext, aG as ProductVariantShape, aH as RemoveDiscountParams, aI as RemoveItemParams, aJ as RequestOptions, R as RetryConfig, aK as ReturnItem, aL as ReturnReason, aM as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aN as ServerApiOptions, aO as ShippingApi, aP as ShippingApiOptions, S as Sort, aQ as StockCheckParams, aR as StockCheckResponse, aS as StockCheckResult, aT as UpdateFulfillmentParams, aU as UpdateItemParams, aV as UpdateOrderParams, aW as UpdateProfileData, aX as UpdateReturnParams, aY as UpdateTransactionParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, W as Where, a$ as buildProductHref, b0 as buildProductListingCard, b1 as buildProductListingGroupsByOption, b2 as buildProductListingProjection, b3 as buildProductOptionMatrix, b4 as buildProductOptionMatrixFromDetail, b5 as createProductSelectionCodec, b6 as getAvailableOptionValues, b7 as getProductSelectionImages, b8 as getSelectedValueByOptionId, b9 as normalizeProductSelection, ba as normalizeProductSelectionFromMatrix, bb as normalizeSelectedValueIds, bc as parseProductSelection, bd as resolveProductSelection, be as resolveProductSelectionFromMatrix, bf as resolveVariantForSelection, bg as stringifyProductSelection } from './types-BX2mqDf6.js';
|
|
3
|
+
import { P as Product } from './payload-types-Wa4-eC6x.js';
|
|
4
|
+
export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, i as Cart, j as CartItem, D as Document, I as Image, O as Order, c as Post, k as PostCategory, l as ProductVariant, T as Tenant, V as Video } from './payload-types-Wa4-eC6x.js';
|
|
5
|
+
export { C as CollectionType, P as Product, a as ProductCollection } from './types-CVA10VC-.js';
|
|
6
6
|
export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.js';
|
|
7
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-
|
|
7
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-BGCP-OJL.js';
|
|
8
8
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
9
9
|
export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.js';
|
|
10
10
|
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.js';
|
|
11
11
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.js';
|
|
12
|
-
export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-
|
|
12
|
+
export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-BGEhoDUs.js';
|
|
13
13
|
|
|
14
14
|
declare const generateOrderNumber: () => string;
|
|
15
15
|
|
|
@@ -31,4 +31,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
|
|
|
31
31
|
|
|
32
32
|
declare function createClient(options: ClientConfig): RootClient;
|
|
33
33
|
|
|
34
|
-
export { RootClient as Client, ClientConfig, RootClient as ClientType,
|
|
34
|
+
export { RootClient as Client, ClientConfig, RootClient as ClientType, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
|
package/dist/index.js
CHANGED
|
@@ -45,8 +45,16 @@ var ValidationError = class extends SDKError {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
var ApiError = class extends SDKError {
|
|
48
|
-
constructor(message, status, details, userMessage, suggestion) {
|
|
49
|
-
super(
|
|
48
|
+
constructor(message, status, details, userMessage, suggestion, requestId) {
|
|
49
|
+
super(
|
|
50
|
+
"API_ERROR",
|
|
51
|
+
message,
|
|
52
|
+
status,
|
|
53
|
+
details,
|
|
54
|
+
userMessage,
|
|
55
|
+
suggestion,
|
|
56
|
+
requestId
|
|
57
|
+
);
|
|
50
58
|
this.name = "ApiError";
|
|
51
59
|
}
|
|
52
60
|
};
|
|
@@ -97,19 +105,43 @@ var UsageLimitError = class extends SDKError {
|
|
|
97
105
|
};
|
|
98
106
|
var AuthError = class extends SDKError {
|
|
99
107
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
100
|
-
super(
|
|
108
|
+
super(
|
|
109
|
+
"auth_error",
|
|
110
|
+
message,
|
|
111
|
+
401,
|
|
112
|
+
details,
|
|
113
|
+
userMessage,
|
|
114
|
+
suggestion,
|
|
115
|
+
requestId
|
|
116
|
+
);
|
|
101
117
|
this.name = "AuthError";
|
|
102
118
|
}
|
|
103
119
|
};
|
|
104
120
|
var PermissionError = class extends SDKError {
|
|
105
121
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
106
|
-
super(
|
|
122
|
+
super(
|
|
123
|
+
"permission_error",
|
|
124
|
+
message,
|
|
125
|
+
403,
|
|
126
|
+
details,
|
|
127
|
+
userMessage,
|
|
128
|
+
suggestion,
|
|
129
|
+
requestId
|
|
130
|
+
);
|
|
107
131
|
this.name = "PermissionError";
|
|
108
132
|
}
|
|
109
133
|
};
|
|
110
134
|
var NotFoundError = class extends SDKError {
|
|
111
135
|
constructor(message, details, userMessage, suggestion, requestId) {
|
|
112
|
-
super(
|
|
136
|
+
super(
|
|
137
|
+
"not_found",
|
|
138
|
+
message,
|
|
139
|
+
404,
|
|
140
|
+
details,
|
|
141
|
+
userMessage,
|
|
142
|
+
suggestion,
|
|
143
|
+
requestId
|
|
144
|
+
);
|
|
113
145
|
this.name = "NotFoundError";
|
|
114
146
|
}
|
|
115
147
|
};
|
|
@@ -121,7 +153,15 @@ var ConflictError = class extends SDKError {
|
|
|
121
153
|
};
|
|
122
154
|
var RateLimitError = class extends SDKError {
|
|
123
155
|
constructor(message, retryAfter, details, userMessage, suggestion, requestId) {
|
|
124
|
-
super(
|
|
156
|
+
super(
|
|
157
|
+
"rate_limit_exceeded",
|
|
158
|
+
message,
|
|
159
|
+
429,
|
|
160
|
+
details,
|
|
161
|
+
userMessage,
|
|
162
|
+
suggestion,
|
|
163
|
+
requestId
|
|
164
|
+
);
|
|
125
165
|
this.name = "RateLimitError";
|
|
126
166
|
this.retryAfter = retryAfter;
|
|
127
167
|
}
|
|
@@ -170,7 +210,7 @@ function isRateLimitError(error) {
|
|
|
170
210
|
}
|
|
171
211
|
var createNetworkError = (message, status, details, userMessage, suggestion) => new NetworkError(message, status, details, userMessage, suggestion);
|
|
172
212
|
var createValidationError = (message, details, userMessage, suggestion, status) => new ValidationError(message, details, userMessage, suggestion, status);
|
|
173
|
-
var createApiError = (message, status, details, userMessage, suggestion) => new ApiError(message, status, details, userMessage, suggestion);
|
|
213
|
+
var createApiError = (message, status, details, userMessage, suggestion, requestId) => new ApiError(message, status, details, userMessage, suggestion, requestId);
|
|
174
214
|
var createConfigError = (message, details, userMessage, suggestion) => new ConfigError(message, details, userMessage, suggestion);
|
|
175
215
|
var createTimeoutError = (message, details, userMessage, suggestion) => new TimeoutError(message, details, userMessage, suggestion);
|
|
176
216
|
var createUsageLimitError = (message, usage, details, userMessage, suggestion) => new UsageLimitError(message, usage, details, userMessage, suggestion);
|
|
@@ -178,7 +218,14 @@ var createAuthError = (message, details, userMessage, suggestion, requestId) =>
|
|
|
178
218
|
var createPermissionError = (message, details, userMessage, suggestion, requestId) => new PermissionError(message, details, userMessage, suggestion, requestId);
|
|
179
219
|
var createNotFoundError = (message, details, userMessage, suggestion, requestId) => new NotFoundError(message, details, userMessage, suggestion, requestId);
|
|
180
220
|
var createConflictError = (message, details, userMessage, suggestion, requestId) => new ConflictError(message, details, userMessage, suggestion, requestId);
|
|
181
|
-
var createRateLimitError = (message, retryAfter, details, userMessage, suggestion, requestId) => new RateLimitError(
|
|
221
|
+
var createRateLimitError = (message, retryAfter, details, userMessage, suggestion, requestId) => new RateLimitError(
|
|
222
|
+
message,
|
|
223
|
+
retryAfter,
|
|
224
|
+
details,
|
|
225
|
+
userMessage,
|
|
226
|
+
suggestion,
|
|
227
|
+
requestId
|
|
228
|
+
);
|
|
182
229
|
|
|
183
230
|
// src/core/internal/utils/credentials.ts
|
|
184
231
|
function requirePublishableKeyForSecret(apiName, publishableKey, secretKey) {
|
|
@@ -218,6 +265,22 @@ function debugLog(debug, type, message, data) {
|
|
|
218
265
|
console.groupEnd();
|
|
219
266
|
}
|
|
220
267
|
}
|
|
268
|
+
function redactSensitiveHeader(value) {
|
|
269
|
+
const prefix = value.toLowerCase().startsWith("bearer ") ? "Bearer " : "";
|
|
270
|
+
return value.length > 20 ? `${prefix}...****${value.slice(-8)}` : "****";
|
|
271
|
+
}
|
|
272
|
+
function redactSensitiveHeaders(headers) {
|
|
273
|
+
const redacted = Object.fromEntries(headers.entries());
|
|
274
|
+
if (redacted.authorization) {
|
|
275
|
+
redacted.authorization = redactSensitiveHeader(redacted.authorization);
|
|
276
|
+
}
|
|
277
|
+
if (redacted["x-preview-token"]) {
|
|
278
|
+
redacted["x-preview-token"] = redactSensitiveHeader(
|
|
279
|
+
redacted["x-preview-token"]
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
return redacted;
|
|
283
|
+
}
|
|
221
284
|
function getErrorSuggestion(status) {
|
|
222
285
|
if (status === 400)
|
|
223
286
|
return "The request data failed validation. Check field values and types.";
|
|
@@ -292,6 +355,12 @@ async function parseErrorBody(response) {
|
|
|
292
355
|
return fallback;
|
|
293
356
|
}
|
|
294
357
|
}
|
|
358
|
+
function getParsedErrorSuggestion(status, parsed) {
|
|
359
|
+
if (status === 403 && parsed.reason === "origin_not_allowed") {
|
|
360
|
+
return "Add the request origin to the tenant Browser API origins, then retry the browser request.";
|
|
361
|
+
}
|
|
362
|
+
return getErrorSuggestion(status);
|
|
363
|
+
}
|
|
295
364
|
async function delay(ms) {
|
|
296
365
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
297
366
|
}
|
|
@@ -305,7 +374,7 @@ function createHttpStatusError(status, parsed, details, requestId) {
|
|
|
305
374
|
...parsed.errors && { errors: parsed.errors },
|
|
306
375
|
...parsed.body && { body: parsed.body }
|
|
307
376
|
};
|
|
308
|
-
const suggestion =
|
|
377
|
+
const suggestion = getParsedErrorSuggestion(status, parsed);
|
|
309
378
|
if (status === 400 || status === 422) {
|
|
310
379
|
return attachRequestId(
|
|
311
380
|
createValidationError(
|
|
@@ -411,11 +480,7 @@ async function httpFetch(url, options) {
|
|
|
411
480
|
if (!headers.has("Content-Type") && requestInit.body && !(requestInit.body instanceof FormData)) {
|
|
412
481
|
headers.set("Content-Type", "application/json");
|
|
413
482
|
}
|
|
414
|
-
const redactedHeaders =
|
|
415
|
-
if (redactedHeaders["authorization"]) {
|
|
416
|
-
const token = redactedHeaders["authorization"];
|
|
417
|
-
redactedHeaders["authorization"] = token.length > 20 ? `Bearer ...****${token.slice(-8)}` : "****";
|
|
418
|
-
}
|
|
483
|
+
const redactedHeaders = redactSensitiveHeaders(headers);
|
|
419
484
|
debugLog(debug, "request", url, {
|
|
420
485
|
method: requestInit.method || "GET",
|
|
421
486
|
headers: redactedHeaders,
|
|
@@ -433,7 +498,7 @@ async function httpFetch(url, options) {
|
|
|
433
498
|
debugLog(debug, "response", url, {
|
|
434
499
|
status: response.status,
|
|
435
500
|
statusText: response.statusText,
|
|
436
|
-
headers:
|
|
501
|
+
headers: redactSensitiveHeaders(response.headers)
|
|
437
502
|
});
|
|
438
503
|
if (!response.ok) {
|
|
439
504
|
if (isUsageLimitExceededResponse(response)) {
|
|
@@ -866,7 +931,7 @@ async function parseApiResponse(response, endpoint) {
|
|
|
866
931
|
if (reason === "validation_failed") {
|
|
867
932
|
throw attachRequestId(createValidationError(errorMessage, data, errorMessage), requestId);
|
|
868
933
|
}
|
|
869
|
-
if (reason === "token_expired" || reason === "token_invalid" || reason === "key_invalid" || reason === "key_revoked") {
|
|
934
|
+
if (reason === "token_expired" || reason === "token_invalid" || reason === "preview_token_invalid" || reason === "preview_token_required" || reason === "key_invalid" || reason === "key_revoked") {
|
|
870
935
|
throw attachRequestId(createAuthError(errorMessage, data, errorMessage), requestId);
|
|
871
936
|
}
|
|
872
937
|
if (reason === "forbidden") {
|
|
@@ -1796,6 +1861,7 @@ var INTERNAL_COLLECTIONS = [
|
|
|
1796
1861
|
"subscriptions",
|
|
1797
1862
|
"billing-history",
|
|
1798
1863
|
"inventory-reservations",
|
|
1864
|
+
"product-collection-items",
|
|
1799
1865
|
"order-status-logs",
|
|
1800
1866
|
"api-keys",
|
|
1801
1867
|
"personal-access-tokens",
|
|
@@ -1831,7 +1897,6 @@ var COLLECTIONS = [
|
|
|
1831
1897
|
"transactions",
|
|
1832
1898
|
"customers",
|
|
1833
1899
|
"customer-profiles",
|
|
1834
|
-
"customer-profile-lists",
|
|
1835
1900
|
"customer-addresses",
|
|
1836
1901
|
"carts",
|
|
1837
1902
|
"cart-items",
|
|
@@ -1879,6 +1944,7 @@ var COLLECTIONS = [
|
|
|
1879
1944
|
"reaction-types",
|
|
1880
1945
|
"bookmarks",
|
|
1881
1946
|
"post-categories",
|
|
1947
|
+
"customer-profile-lists",
|
|
1882
1948
|
// Events
|
|
1883
1949
|
"event-calendars",
|
|
1884
1950
|
"events",
|
|
@@ -2719,17 +2785,21 @@ function mediaArray(values) {
|
|
|
2719
2785
|
return values.filter(isPresentMedia);
|
|
2720
2786
|
}
|
|
2721
2787
|
function buildSelectionMedia(detail, selectedVariant, matchingVariants, selectedValues) {
|
|
2788
|
+
const selectedVariantImages = mediaArray(selectedVariant?.images);
|
|
2722
2789
|
const selectedValueImages = selectedValues.flatMap(
|
|
2723
2790
|
(value) => mediaArray(value.images)
|
|
2724
2791
|
);
|
|
2792
|
+
const matchingVariantImages = matchingVariants.flatMap(
|
|
2793
|
+
(variant) => mediaArray(variant.images)
|
|
2794
|
+
);
|
|
2725
2795
|
const selectedValuePrimary = selectedValues.map((value) => firstMedia(value.thumbnail) ?? firstMedia(value.images)).find((value) => value != null) ?? null;
|
|
2726
2796
|
const selectedVariantPrimary = firstMedia(selectedVariant?.thumbnail) ?? firstMedia(selectedVariant?.images);
|
|
2727
2797
|
const matchingVariantPrimary = matchingVariants.map(
|
|
2728
2798
|
(variant) => firstMedia(variant.thumbnail) ?? firstMedia(variant.images)
|
|
2729
2799
|
).find((value) => value != null) ?? null;
|
|
2730
2800
|
const detailImages = mediaArray(detail.images);
|
|
2731
|
-
const primaryImage = selectedVariantPrimary ?? selectedValuePrimary ?? firstMedia(detail.listing.primaryImage) ??
|
|
2732
|
-
const images =
|
|
2801
|
+
const primaryImage = selectedVariantPrimary ?? selectedValuePrimary ?? matchingVariantPrimary ?? firstMedia(detail.listing.primaryImage) ?? firstMedia(detailImages);
|
|
2802
|
+
const images = selectedVariantImages.length > 0 ? selectedVariantImages : selectedValueImages.length > 0 ? selectedValueImages : matchingVariantImages.length > 0 ? matchingVariantImages : detailImages;
|
|
2733
2803
|
return {
|
|
2734
2804
|
primaryImage,
|
|
2735
2805
|
images
|
|
@@ -3020,6 +3090,72 @@ function buildProductListingProjection(product, variants) {
|
|
|
3020
3090
|
availableForSale: availableVariants.length > 0
|
|
3021
3091
|
};
|
|
3022
3092
|
}
|
|
3093
|
+
function buildProductListingCard(item, options = {}) {
|
|
3094
|
+
const product = item.product;
|
|
3095
|
+
const groups = item.groups;
|
|
3096
|
+
const primaryImage = firstMedia(product.thumbnail) ?? firstMedia(product.images ?? null) ?? null;
|
|
3097
|
+
const priceRange = aggregateListingPriceRange(groups);
|
|
3098
|
+
const availableForSale = groups.some(
|
|
3099
|
+
(group) => group.listing.availableForSale
|
|
3100
|
+
);
|
|
3101
|
+
const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
|
|
3102
|
+
return {
|
|
3103
|
+
id: String(product.id),
|
|
3104
|
+
href: buildProductHref({ slug: product.slug }, void 0, options),
|
|
3105
|
+
title: product.title,
|
|
3106
|
+
primaryImage,
|
|
3107
|
+
priceRange,
|
|
3108
|
+
availableForSale,
|
|
3109
|
+
swatches
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3112
|
+
function aggregateListingPriceRange(groups) {
|
|
3113
|
+
const minPrice = minOfNullable(groups.map((g) => g.listing.minPrice));
|
|
3114
|
+
const maxPrice = maxOfNullable(groups.map((g) => g.listing.maxPrice));
|
|
3115
|
+
const minCompareAtPrice = minOfNullable(
|
|
3116
|
+
groups.map((g) => g.listing.minCompareAtPrice)
|
|
3117
|
+
);
|
|
3118
|
+
const maxCompareAtPrice = maxOfNullable(
|
|
3119
|
+
groups.map((g) => g.listing.maxCompareAtPrice)
|
|
3120
|
+
);
|
|
3121
|
+
const isPriceRange = minPrice !== null && maxPrice !== null && minPrice !== maxPrice;
|
|
3122
|
+
return {
|
|
3123
|
+
minPrice,
|
|
3124
|
+
maxPrice,
|
|
3125
|
+
minCompareAtPrice,
|
|
3126
|
+
maxCompareAtPrice,
|
|
3127
|
+
isPriceRange
|
|
3128
|
+
};
|
|
3129
|
+
}
|
|
3130
|
+
function buildListingSwatch(product, group, options) {
|
|
3131
|
+
const thumbnail = firstMedia(group.optionValueThumbnail) ?? firstMedia(group.optionValueImages) ?? null;
|
|
3132
|
+
return {
|
|
3133
|
+
optionId: group.optionId,
|
|
3134
|
+
optionValueId: group.optionValueId,
|
|
3135
|
+
label: group.optionValueLabel,
|
|
3136
|
+
swatchColor: group.optionValueSwatchColor ?? null,
|
|
3137
|
+
thumbnail,
|
|
3138
|
+
href: buildProductHref(
|
|
3139
|
+
{ slug: product.slug },
|
|
3140
|
+
{
|
|
3141
|
+
optionId: group.optionId,
|
|
3142
|
+
optionValueId: group.optionValueId,
|
|
3143
|
+
optionValueSlug: group.optionValueSlug,
|
|
3144
|
+
listing: group.listing
|
|
3145
|
+
},
|
|
3146
|
+
options
|
|
3147
|
+
),
|
|
3148
|
+
availableForSale: group.listing.availableForSale
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
function minOfNullable(values) {
|
|
3152
|
+
const numbers = values.filter((v) => v !== null);
|
|
3153
|
+
return numbers.length === 0 ? null : Math.min(...numbers);
|
|
3154
|
+
}
|
|
3155
|
+
function maxOfNullable(values) {
|
|
3156
|
+
const numbers = values.filter((v) => v !== null);
|
|
3157
|
+
return numbers.length === 0 ? null : Math.max(...numbers);
|
|
3158
|
+
}
|
|
3023
3159
|
function buildProductListingGroupsByOption(args) {
|
|
3024
3160
|
const primaryOptionId = args.primaryOptionId ?? void 0;
|
|
3025
3161
|
if (!primaryOptionId) return [];
|
|
@@ -3385,6 +3521,7 @@ export {
|
|
|
3385
3521
|
UsageLimitError,
|
|
3386
3522
|
ValidationError,
|
|
3387
3523
|
buildProductHref,
|
|
3524
|
+
buildProductListingCard,
|
|
3388
3525
|
buildProductListingGroupsByOption,
|
|
3389
3526
|
buildProductListingProjection,
|
|
3390
3527
|
buildProductOptionMatrix,
|