@ecomiq/core 1.1.0 → 1.2.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 +16 -2
- package/dist/client.cjs +181 -24
- package/dist/client.d.cts +8 -2
- package/dist/client.d.ts +8 -2
- package/dist/client.js +184 -27
- package/dist/index.cjs +16 -10
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +10 -9
- package/dist/libs/{graphql-_6Y8lR_Q.js → graphql-8PZkrq66.js} +12 -8
- package/dist/libs/{graphql-wJH7HaQU.cjs → graphql-BICZrYlZ.cjs} +12 -7
- package/dist/libs/graphql-batch-AFRui-4Y.js +125 -0
- package/dist/libs/graphql-batch-B0xSD6G2.cjs +125 -0
- package/dist/libs/graphql-batch.d.cts +2 -0
- package/dist/libs/graphql-batch.d.ts +2 -0
- package/dist/models/collections.cjs +5 -0
- package/dist/models/collections.d.cts +109 -1
- package/dist/models/collections.d.ts +109 -1
- package/dist/models/collections.js +4 -1
- package/dist/models/customer-order.cjs +1 -1
- package/dist/models/customer-order.js +1 -1
- package/dist/models/{order-draft-C-2WRbjl.cjs → order-draft-DWKoM7Lu.cjs} +1 -1
- package/dist/models/{order-draft-CSIWRIV0.js → order-draft-DhEKDqI8.js} +1 -1
- package/dist/models/{personalization-BPFmkdJ0.js → personalization-CdwIzzSn.js} +1 -22
- package/dist/models/{personalization-CQosKg8O.cjs → personalization-Uh_MWts-.cjs} +0 -25
- package/dist/models/personalization-lines-BurVHB4o.cjs +26 -0
- package/dist/models/personalization-lines-DigNu6OK.js +23 -0
- package/dist/models/personalization-lines.d.cts +15 -0
- package/dist/models/personalization-lines.d.ts +15 -0
- package/dist/models/personalization.d.cts +1 -15
- package/dist/models/personalization.d.ts +1 -15
- package/dist/models/products.cjs +1 -1
- package/dist/models/products.js +1 -1
- package/dist/models/storefront-cart.cjs +1 -1
- package/dist/models/storefront-cart.js +1 -1
- package/dist/models/storefront-reviews.cjs +9 -2
- package/dist/models/storefront-reviews.d.cts +99 -0
- package/dist/models/storefront-reviews.d.ts +99 -0
- package/dist/models/storefront-reviews.js +7 -3
- package/dist/services/layout.service-C6zG6zY7.cjs +65 -0
- package/dist/services/layout.service-DufBhrOR.js +65 -0
- package/dist/services/layout.service.d.cts +1 -0
- package/dist/services/layout.service.d.ts +1 -0
- package/dist/services/{order-draft.service-Dlu6eEkV.cjs → order-draft.service-CdJbIUT6.cjs} +1 -1
- package/dist/services/{order-draft.service-B0VcmWhn.js → order-draft.service-DHhae1Ct.js} +1 -1
- package/dist/services/{review.service-CO2icjpu.cjs → review.service-BgRGfq4t.cjs} +0 -8
- package/dist/services/{review.service-De1YkhFp.js → review.service-DMgxbO94.js} +2 -9
- package/package.json +1 -1
- package/dist/services/layout.service-BkvLzl1g.cjs +0 -50
- package/dist/services/layout.service-DmbeMOkK.js +0 -50
package/dist/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ApiError, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, createApi, resolveApiBaseUrl } from "./api.js";
|
|
2
|
-
import { GraphQLResponseError } from "./libs/graphql-
|
|
2
|
+
import { GraphQLResponseError } from "./libs/graphql-8PZkrq66.js";
|
|
3
3
|
import { graphQLSelection } from "./libs/graphql-selection-H1RMh6VD.js";
|
|
4
4
|
import { createClient } from "./client.js";
|
|
5
5
|
import { CartTokenSchema, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema } from "./models/ids.js";
|
|
6
|
-
import { catalogLinkKey } from "./libs/catalog-link-key-B7l5KZsF.js";
|
|
7
6
|
import { CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, JsonElementSchema, STOREFRONT_SETTINGS_SCHEMA_VERSION, StoreBusinessSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontSettingsSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, getMenuItems } from "./models/settings.js";
|
|
8
|
-
import { CollectionSchema, CollectionsSchema } from "./models/collections.js";
|
|
7
|
+
import { CollectionSchema, CollectionWithCoversSchema, CollectionWithProductsSchema, CollectionsSchema } from "./models/collections.js";
|
|
9
8
|
import { CategoryAncestorSchema, CategoryChildSchema, CategoryDetailSchema, CategoryItemSchema } from "./models/categories-CKkJY8_P.js";
|
|
9
|
+
import { catalogLinkKey } from "./libs/catalog-link-key-B7l5KZsF.js";
|
|
10
10
|
import { SitemapItemSchema, SitemapPageSchema, UrlResolutionSchema } from "./models/urls-Dt_dTt4Q.js";
|
|
11
11
|
import { CATALOG_LINK_ID, CATALOG_LINK_MAX_LENGTH, CatalogLinkReferenceSchema, CatalogLinkSchema, CatalogLinksResponseSchema, catalogLinkCandidates, isCatalogLinkCandidate, readCatalogLink } from "./models/catalog-links-BzJeyBy4.js";
|
|
12
12
|
import { StorefrontPaymentCodeSchema, StorefrontPaymentMethodSchema, StorefrontPaymentMethodsSchema } from "./models/payment-methods--VUUZpMz.js";
|
|
13
13
|
import { ArticleSchema, ArticleSummarySchema, ArticlesSchema, ListArticlesParamsSchema } from "./models/articles-C-4JvT2Z.js";
|
|
14
14
|
import { BundleItemSchema, FacetItemSchema, ProductDetailSchema, ProductImageSchema, ProductMediaTypeSchema, ProductOptionGroupSchema, ProductPriceTierSchema, ProductSellerSchema, ProductSortSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, RelatedProductsParamsSchema, SearchFilterSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, SpecificationTypeSchema, VariantItemSchema } from "./models/products.js";
|
|
15
|
-
import { ItemModifierSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema
|
|
15
|
+
import { ItemModifierSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema } from "./models/personalization-CdwIzzSn.js";
|
|
16
|
+
import { lineTotal, lineUnitPrice, modifierLabel, modifiersUnitPrice } from "./models/personalization-lines-DigNu6OK.js";
|
|
16
17
|
import { ProductAutocompleteParamsSchema, ProductSuggestionSchema, ProductSuggestionsSchema } from "./models/search.js";
|
|
17
18
|
import { AddCartItemParamsSchema, CartItemModifierOptionSchema, CartItemModifierSchema, CartShippingMethodTypeSchema, CreateCartParamsSchema, GetCartParamsSchema, RemoveCartItemParamsSchema, ShippingMethodTargetSelectionSchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontInvoiceTypeSchema, UpdateCartItemQuantityParamsSchema } from "./models/storefront-cart.js";
|
|
18
19
|
import { CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentMethodSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CheckoutMetadataValueSchema, CheckoutModeSchema, CheckoutPaymentChargeSchema, GetShippingOptionsParamsSchema, PaymentBankAccountSchema, PutCartPaymentMethodParamsSchema, PutShippingMethodParamsSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, StorefrontOrderBumpSchema } from "./models/storefront-checkout.js";
|
|
19
|
-
import { CreateCustomerProductReviewParamsSchema, CreateProductReviewParamsSchema, ListProductReviewsParamsSchema, ListStoreReviewsParamsSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontStoreReviewSchema } from "./models/storefront-reviews.js";
|
|
20
|
+
import { CreateCustomerProductReviewParamsSchema, CreateProductReviewParamsSchema, ListProductReviewsParamsSchema, ListStoreReviewsParamsSchema, ProductReviewDirectionSchema, ProductReviewSortSchema, ProductWithReviewsSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontStoreReviewSchema } from "./models/storefront-reviews.js";
|
|
20
21
|
import { CountriesSchema, CountrySchema, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, ProvinceSchema, ProvincesSchema } from "./models/geo.js";
|
|
21
22
|
import { SellerLinkStyleSchema, SellerLinksSchema, SellerProfileSchema, SellerRatingSchema, SellerSummarySchema, SellersSchema } from "./models/sellers.js";
|
|
22
23
|
import { CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, toCustomerSavedAddresses } from "./models/customer-address.js";
|
|
@@ -27,7 +28,7 @@ import { completeCustomerRegistration, getCustomerRegistration } from "./service
|
|
|
27
28
|
import { CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPageSchema, CustomerOrderPaymentSchema, CustomerOrderShipmentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, OrderStepSchema, customerOrderStatusTone, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime } from "./models/customer-order.js";
|
|
28
29
|
import { getProductBySlug, getProducts, getRelatedProducts } from "./services/product.service-B05Qmbuh.js";
|
|
29
30
|
import { autocompleteProducts } from "./services/search.service-DSBMhaSY.js";
|
|
30
|
-
import { createProductReview, listProductReviews } from "./services/review.service-
|
|
31
|
+
import { createProductReview, listProductReviews } from "./services/review.service-DMgxbO94.js";
|
|
31
32
|
import { addCartItem, createCart, getCart, removeCartItem, updateCartItemQuantity } from "./services/cart.service-yMCz9oQP.js";
|
|
32
33
|
import { getPaymentMethods } from "./services/payment-method.service-CjKbAsOh.js";
|
|
33
34
|
import { addCartPromotionCode, checkoutCart, getCartCheckout, getShippingOptions, patchCartAddresses, patchCartBuyer, putCartPaymentMethod, putCartShippingMethod, removeCartPromotionCode, uploadPaymentReceipt } from "./services/checkout.service-CC-3tm2y.js";
|
|
@@ -42,12 +43,12 @@ import { OrderReviewContextItemSchema, OrderReviewContextSchema } from "./models
|
|
|
42
43
|
import { getOrderReviewContext } from "./services/order-review.service-PdBPUsxE.js";
|
|
43
44
|
import { AuthenticateOrderPaymentInputSchema, OrderPaymentInReviewSchema, OrderPaymentMethodSchema, OrderPaymentStartSchema, OrderStatusViewSchema, PaymentAuthentication3DSSchema, PaymentPublicConfigurationSchema } from "./models/order-status-CgaLkU0M.js";
|
|
44
45
|
import { authenticateOrderPayment, getOrderStatus, startOrderPayment, uploadOrderPaymentReceipt } from "./services/order-status.service-MC9hVpP-.js";
|
|
45
|
-
import { OrderDraftCheckoutSchema, OrderDraftItemSchema, OrderDraftSchema } from "./models/order-draft-
|
|
46
|
-
import { checkoutOrderDraft, getOrderDraft } from "./services/order-draft.service-
|
|
46
|
+
import { OrderDraftCheckoutSchema, OrderDraftItemSchema, OrderDraftSchema } from "./models/order-draft-DhEKDqI8.js";
|
|
47
|
+
import { checkoutOrderDraft, getOrderDraft } from "./services/order-draft.service-DHhae1Ct.js";
|
|
47
48
|
import { COMPLAINT_BOOK_ATTACHMENT_TYPES, COMPLAINT_BOOK_MAX_ATTACHMENTS, COMPLAINT_BOOK_MAX_ATTACHMENT_BYTES, ComplaintBookDocumentTypeSchema, ComplaintBookEntryInputSchema, ComplaintBookEntrySchema, ComplaintBookSchema } from "./models/complaint-book-QpQZe7Xl.js";
|
|
48
49
|
import { createComplaintBookEntry, getComplaintBook } from "./services/complaint-book.service-DXiVyKdD.js";
|
|
49
50
|
import { getPageBySlug } from "./services/page.service-CWhWCjMQ.js";
|
|
50
51
|
import { getArticleBySlug, listArticles } from "./services/article.service-DBsOvflH.js";
|
|
51
52
|
import { sanitizeHtml, stripHtml } from "./utils-DK7qa54o.js";
|
|
52
53
|
import { embeddedVideo } from "./video-links-CbRO0m8V.js";
|
|
53
|
-
export { AddCartItemParamsSchema, ApiError, ArticleSchema, ArticleSummarySchema, ArticlesSchema, AuthenticateOrderPaymentInputSchema, BundleItemSchema, CATALOG_LINK_ID, CATALOG_LINK_MAX_LENGTH, COMPLAINT_BOOK_ATTACHMENT_TYPES, COMPLAINT_BOOK_MAX_ATTACHMENTS, COMPLAINT_BOOK_MAX_ATTACHMENT_BYTES, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentMethodSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierOptionSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CartShippingMethodTypeSchema, CartTokenSchema, CatalogLinkReferenceSchema, CatalogLinkSchema, CatalogLinksResponseSchema, CategoryAncestorSchema, CategoryChildSchema, CategoryDetailSchema, CategoryItemSchema, CheckoutMetadataValueSchema, CheckoutModeSchema, CheckoutPaymentChargeSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionsSchema, ComplaintBookDocumentTypeSchema, ComplaintBookEntryInputSchema, ComplaintBookEntrySchema, ComplaintBookSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateCustomerProductReviewParamsSchema, CreateProductReviewParamsSchema, CustomerAddressCreatedSchema, CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, CustomerAuthConfigurationSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPageSchema, CustomerOrderPaymentSchema, CustomerOrderShipmentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegistrationFieldModeSchema, CustomerRegistrationFieldsSchema, CustomerRegistrationInputSchema, CustomerRegistrationSchema, CustomerSessionCreateSchema, CustomerSessionCreatedSchema, CustomerSessionProfileSchema, CustomerSessionSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, EntityIdSchema, FacetItemSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, GraphQLResponseError, ItemModifierSchema, JsonElementSchema, ListArticlesParamsSchema, ListProductReviewsParamsSchema, ListStoreReviewsParamsSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema, NullableEntityIdSchema, OptionalEntityIdSchema, OrderDraftCheckoutSchema, OrderDraftItemSchema, OrderDraftSchema, OrderPaymentInReviewSchema, OrderPaymentMethodSchema, OrderPaymentStartSchema, OrderReviewContextItemSchema, OrderReviewContextSchema, OrderStatusViewSchema, OrderStepSchema, PaymentAuthentication3DSSchema, PaymentBankAccountSchema, PaymentPublicConfigurationSchema, ProductAutocompleteParamsSchema, ProductDetailSchema, ProductImageSchema, ProductMediaTypeSchema, ProductOptionGroupSchema, ProductPriceTierSchema, ProductSellerSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PublicOrderTrackingSchema, PutCartPaymentMethodParamsSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, STOREFRONT_SETTINGS_SCHEMA_VERSION, SearchFilterSchema, SellerLinkStyleSchema, SellerLinksSchema, SellerProfileSchema, SellerRatingSchema, SellerSummarySchema, SellersSchema, ShipmentTrackingEventSchema, ShippingMethodTargetSelectionSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SitemapItemSchema, SitemapPageSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, SpecificationTypeSchema, StoreBusinessSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontInvoiceTypeSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontPaymentCodeSchema, StorefrontPaymentMethodSchema, StorefrontPaymentMethodsSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreReviewSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, TRACKING_STATUS_LABELS, UpdateCartItemQuantityParamsSchema, UrlResolutionSchema, VariantItemSchema, addCartItem, addCartPromotionCode, authenticateOrderPayment, autocompleteProducts, catalogLinkCandidates, catalogLinkKey, checkoutCart, checkoutOrderDraft, completeCustomerRegistration, createApi, createCart, createClient, createComplaintBookEntry, createCustomerAddress, createProductReview, customerMeToProfile, customerMeToProfilePatch, customerOrderStatusTone, customerProfileToPatch, deleteCustomerAddress, embeddedVideo, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, formatTrackingStatus, getArticleBySlug, getCart, getCartCheckout, getComplaintBook, getCountries, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getCustomerRegistration, getDepartments, getDistricts, getMenuItems, getOrderDraft, getOrderReviewContext, getOrderStatus, getOrderTracking, getPageBySlug, getPaymentMethods, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getSellerBySlug, getSellers, getShippingOptions, graphQLSelection, isCatalogLinkCandidate, lineTotal, lineUnitPrice, listArticles, listProductReviews, modifierLabel, modifiersUnitPrice, patchCartAddresses, patchCartBuyer, patchCustomer, putCartPaymentMethod, putCartShippingMethod, readCatalogLink, removeCartItem, removeCartPromotionCode, requestCustomerOrderCancellation, requestCustomerOrderReturn, resolveApiBaseUrl, sanitizeHtml, startOrderPayment, stripHtml, toCustomerSavedAddresses, updateCartItemQuantity, updateCustomerAddress, uploadOrderPaymentReceipt, uploadPaymentReceipt };
|
|
54
|
+
export { AddCartItemParamsSchema, ApiError, ArticleSchema, ArticleSummarySchema, ArticlesSchema, AuthenticateOrderPaymentInputSchema, BundleItemSchema, CATALOG_LINK_ID, CATALOG_LINK_MAX_LENGTH, COMPLAINT_BOOK_ATTACHMENT_TYPES, COMPLAINT_BOOK_MAX_ATTACHMENTS, COMPLAINT_BOOK_MAX_ATTACHMENT_BYTES, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentMethodSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierOptionSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CartShippingMethodTypeSchema, CartTokenSchema, CatalogLinkReferenceSchema, CatalogLinkSchema, CatalogLinksResponseSchema, CategoryAncestorSchema, CategoryChildSchema, CategoryDetailSchema, CategoryItemSchema, CheckoutMetadataValueSchema, CheckoutModeSchema, CheckoutPaymentChargeSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionWithCoversSchema, CollectionWithProductsSchema, CollectionsSchema, ComplaintBookDocumentTypeSchema, ComplaintBookEntryInputSchema, ComplaintBookEntrySchema, ComplaintBookSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateCustomerProductReviewParamsSchema, CreateProductReviewParamsSchema, CustomerAddressCreatedSchema, CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, CustomerAuthConfigurationSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPageSchema, CustomerOrderPaymentSchema, CustomerOrderShipmentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegistrationFieldModeSchema, CustomerRegistrationFieldsSchema, CustomerRegistrationInputSchema, CustomerRegistrationSchema, CustomerSessionCreateSchema, CustomerSessionCreatedSchema, CustomerSessionProfileSchema, CustomerSessionSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, EntityIdSchema, FacetItemSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, GraphQLResponseError, ItemModifierSchema, JsonElementSchema, ListArticlesParamsSchema, ListProductReviewsParamsSchema, ListStoreReviewsParamsSchema, ModifierDisplaySchema, ModifierGroupItemSchema, ModifierOptionItemSchema, ModifierSelectionTypeSchema, NullableEntityIdSchema, OptionalEntityIdSchema, OrderDraftCheckoutSchema, OrderDraftItemSchema, OrderDraftSchema, OrderPaymentInReviewSchema, OrderPaymentMethodSchema, OrderPaymentStartSchema, OrderReviewContextItemSchema, OrderReviewContextSchema, OrderStatusViewSchema, OrderStepSchema, PaymentAuthentication3DSSchema, PaymentBankAccountSchema, PaymentPublicConfigurationSchema, ProductAutocompleteParamsSchema, ProductDetailSchema, ProductImageSchema, ProductMediaTypeSchema, ProductOptionGroupSchema, ProductPriceTierSchema, ProductReviewDirectionSchema, ProductReviewSortSchema, ProductSellerSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductWithReviewsSchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PublicOrderTrackingSchema, PutCartPaymentMethodParamsSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, STOREFRONT_SETTINGS_SCHEMA_VERSION, SearchFilterSchema, SellerLinkStyleSchema, SellerLinksSchema, SellerProfileSchema, SellerRatingSchema, SellerSummarySchema, SellersSchema, ShipmentTrackingEventSchema, ShippingMethodTargetSelectionSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SitemapItemSchema, SitemapPageSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, SpecificationTypeSchema, StoreBusinessSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontInvoiceTypeSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontPaymentCodeSchema, StorefrontPaymentMethodSchema, StorefrontPaymentMethodsSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreReviewSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, TRACKING_STATUS_LABELS, UpdateCartItemQuantityParamsSchema, UrlResolutionSchema, VariantItemSchema, addCartItem, addCartPromotionCode, authenticateOrderPayment, autocompleteProducts, catalogLinkCandidates, catalogLinkKey, checkoutCart, checkoutOrderDraft, completeCustomerRegistration, createApi, createCart, createClient, createComplaintBookEntry, createCustomerAddress, createProductReview, customerMeToProfile, customerMeToProfilePatch, customerOrderStatusTone, customerProfileToPatch, deleteCustomerAddress, embeddedVideo, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, formatTrackingStatus, getArticleBySlug, getCart, getCartCheckout, getComplaintBook, getCountries, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getCustomerRegistration, getDepartments, getDistricts, getMenuItems, getOrderDraft, getOrderReviewContext, getOrderStatus, getOrderTracking, getPageBySlug, getPaymentMethods, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getSellerBySlug, getSellers, getShippingOptions, graphQLSelection, isCatalogLinkCandidate, lineTotal, lineUnitPrice, listArticles, listProductReviews, modifierLabel, modifiersUnitPrice, patchCartAddresses, patchCartBuyer, patchCustomer, putCartPaymentMethod, putCartShippingMethod, readCatalogLink, removeCartItem, removeCartPromotionCode, requestCustomerOrderCancellation, requestCustomerOrderReturn, resolveApiBaseUrl, sanitizeHtml, startOrderPayment, stripHtml, toCustomerSavedAddresses, updateCartItemQuantity, updateCustomerAddress, uploadOrderPaymentReceipt, uploadPaymentReceipt };
|
|
@@ -19,21 +19,25 @@ var GraphQLResponseError = class extends Error {
|
|
|
19
19
|
this.name = "GraphQLResponseError";
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const GraphQLEnvelopeSchema = z.object({
|
|
23
|
+
data: z.unknown().optional(),
|
|
24
|
+
errors: z.array(GraphQLErrorSchema).optional()
|
|
25
|
+
});
|
|
26
|
+
function sendGraphQL(api, domain, document, variables, options = {}) {
|
|
24
27
|
const headers = { "x-Store-Domain": domain };
|
|
25
28
|
if (options.cache === "no-store") headers["cache-control"] = "no-store";
|
|
26
29
|
else if (options.allowStale === false) headers["cache-control"] = "max-stale=0";
|
|
27
|
-
|
|
30
|
+
return api.post("graphql", {
|
|
28
31
|
query: document,
|
|
29
32
|
variables
|
|
30
|
-
},
|
|
31
|
-
data: z.unknown().optional(),
|
|
32
|
-
errors: z.array(GraphQLErrorSchema).optional()
|
|
33
|
-
}), {
|
|
33
|
+
}, GraphQLEnvelopeSchema, {
|
|
34
34
|
headers,
|
|
35
35
|
signal: options.signal
|
|
36
36
|
});
|
|
37
|
+
}
|
|
38
|
+
async function executeGraphQL(api, domain, document, dataSchema, variables, options = {}) {
|
|
39
|
+
if (!document.trim()) throw new Error("GraphQL document is required");
|
|
40
|
+
const response = await sendGraphQL(api, domain, document, variables, options);
|
|
37
41
|
if (response.errors?.length) throw new GraphQLResponseError(response.errors, response.data);
|
|
38
42
|
if (response.data == null) throw new GraphQLResponseError([{ message: "GraphQL response did not include data" }]);
|
|
39
43
|
const parsed = dataSchema.safeParse(response.data);
|
|
@@ -46,4 +50,4 @@ async function executeGraphQL(api, domain, document, dataSchema, variables, opti
|
|
|
46
50
|
}
|
|
47
51
|
return parsed.data;
|
|
48
52
|
}
|
|
49
|
-
export { GraphQLResponseError, executeGraphQL };
|
|
53
|
+
export { GraphQLResponseError, executeGraphQL, sendGraphQL };
|
|
@@ -19,21 +19,25 @@ var GraphQLResponseError = class extends Error {
|
|
|
19
19
|
this.name = "GraphQLResponseError";
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const GraphQLEnvelopeSchema = zod.z.object({
|
|
23
|
+
data: zod.z.unknown().optional(),
|
|
24
|
+
errors: zod.z.array(GraphQLErrorSchema).optional()
|
|
25
|
+
});
|
|
26
|
+
function sendGraphQL(api, domain, document, variables, options = {}) {
|
|
24
27
|
const headers = { "x-Store-Domain": domain };
|
|
25
28
|
if (options.cache === "no-store") headers["cache-control"] = "no-store";
|
|
26
29
|
else if (options.allowStale === false) headers["cache-control"] = "max-stale=0";
|
|
27
|
-
|
|
30
|
+
return api.post("graphql", {
|
|
28
31
|
query: document,
|
|
29
32
|
variables
|
|
30
|
-
},
|
|
31
|
-
data: zod.z.unknown().optional(),
|
|
32
|
-
errors: zod.z.array(GraphQLErrorSchema).optional()
|
|
33
|
-
}), {
|
|
33
|
+
}, GraphQLEnvelopeSchema, {
|
|
34
34
|
headers,
|
|
35
35
|
signal: options.signal
|
|
36
36
|
});
|
|
37
|
+
}
|
|
38
|
+
async function executeGraphQL(api, domain, document, dataSchema, variables, options = {}) {
|
|
39
|
+
if (!document.trim()) throw new Error("GraphQL document is required");
|
|
40
|
+
const response = await sendGraphQL(api, domain, document, variables, options);
|
|
37
41
|
if (response.errors?.length) throw new GraphQLResponseError(response.errors, response.data);
|
|
38
42
|
if (response.data == null) throw new GraphQLResponseError([{ message: "GraphQL response did not include data" }]);
|
|
39
43
|
const parsed = dataSchema.safeParse(response.data);
|
|
@@ -48,3 +52,4 @@ async function executeGraphQL(api, domain, document, dataSchema, variables, opti
|
|
|
48
52
|
}
|
|
49
53
|
exports.GraphQLResponseError = GraphQLResponseError;
|
|
50
54
|
exports.executeGraphQL = executeGraphQL;
|
|
55
|
+
exports.sendGraphQL = sendGraphQL;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { GraphQLResponseError } from "./graphql-8PZkrq66.js";
|
|
2
|
+
import "zod";
|
|
3
|
+
// src/libs/graphql-batch.ts
|
|
4
|
+
const MAX_FIELDS_PER_REQUEST = 20;
|
|
5
|
+
function batchDocument(pending) {
|
|
6
|
+
const declarations = [];
|
|
7
|
+
const fields = [];
|
|
8
|
+
const variables = {};
|
|
9
|
+
pending.forEach(({ request }, index) => {
|
|
10
|
+
const alias = `f${index}`;
|
|
11
|
+
const passed = (request.arguments ?? []).filter((argument) => argument.value !== void 0).map((argument) => {
|
|
12
|
+
const variable = `${alias}_${argument.name}`;
|
|
13
|
+
declarations.push(`$${variable}: ${argument.type}`);
|
|
14
|
+
variables[variable] = argument.value;
|
|
15
|
+
return `${argument.name}: $${variable}`;
|
|
16
|
+
});
|
|
17
|
+
const call = passed.length === 0 ? request.field : `${request.field}(${passed.join(", ")})`;
|
|
18
|
+
fields.push(request.selection ? `${alias}: ${call} { ${request.selection} }` : `${alias}: ${call}`);
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
document: `query StorefrontBatch${declarations.length === 0 ? "" : `(${declarations.join(", ")})`} { ${fields.join(" ")} }`,
|
|
22
|
+
variables
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function fieldErrors(errors, alias, field) {
|
|
26
|
+
return errors.filter((error) => error.path?.[0] === alias).map((error) => ({
|
|
27
|
+
...error,
|
|
28
|
+
path: [field, ...(error.path ?? []).slice(1)]
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function settle(pending, response) {
|
|
32
|
+
const data = response.data !== null && typeof response.data === "object" ? response.data : null;
|
|
33
|
+
pending.forEach((entry, index) => {
|
|
34
|
+
const alias = `f${index}`;
|
|
35
|
+
const value = data?.[alias];
|
|
36
|
+
const errors = fieldErrors(response.errors ?? [], alias, entry.request.field);
|
|
37
|
+
if (errors.length > 0) {
|
|
38
|
+
entry.reject(new GraphQLResponseError(errors, value));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (data === null || !(alias in data)) {
|
|
42
|
+
entry.reject(new GraphQLResponseError([{ message: "GraphQL response did not include data" }]));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const parsed = entry.request.schema.safeParse(value);
|
|
46
|
+
if (!parsed.success) {
|
|
47
|
+
const issue = parsed.error.issues[0];
|
|
48
|
+
entry.reject(new GraphQLResponseError([{
|
|
49
|
+
message: `Unexpected GraphQL data: ${[entry.request.field, ...issue?.path ?? []].join(".")} ${issue?.message}`,
|
|
50
|
+
extensions: { code: "INVALID_RESPONSE" }
|
|
51
|
+
}], value));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
entry.resolve(parsed.data);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function requestKey(options) {
|
|
58
|
+
if (options.cache === "no-store") return "no-store";
|
|
59
|
+
if (options.allowStale === false) return "fresh";
|
|
60
|
+
return "default";
|
|
61
|
+
}
|
|
62
|
+
function createGraphQLBatcher(send) {
|
|
63
|
+
const queues = /* @__PURE__ */ new Map();
|
|
64
|
+
async function run(pending, options) {
|
|
65
|
+
const { document, variables } = batchDocument(pending);
|
|
66
|
+
let response;
|
|
67
|
+
try {
|
|
68
|
+
response = await send(document, variables, options);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
for (const entry of pending) entry.reject(error);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const errors = response.errors ?? [];
|
|
74
|
+
if (response.data == null && errors.length > 0) {
|
|
75
|
+
if (pending.length === 1) {
|
|
76
|
+
const own = fieldErrors(errors, "f0", pending[0].request.field);
|
|
77
|
+
pending[0].reject(new GraphQLResponseError(own.length > 0 ? own : errors));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const failed = new Set(errors.map((error) => error.path?.[0]));
|
|
81
|
+
const rest = pending.filter((_, index) => !failed.has(`f${index}`));
|
|
82
|
+
if (rest.length === pending.length) {
|
|
83
|
+
for (const entry of pending) run([entry], options);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
pending.forEach((entry, index) => {
|
|
87
|
+
if (failed.has(`f${index}`)) entry.reject(new GraphQLResponseError(fieldErrors(errors, `f${index}`, entry.request.field)));
|
|
88
|
+
});
|
|
89
|
+
if (rest.length > 0) run(rest, options);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
settle(pending, response);
|
|
93
|
+
}
|
|
94
|
+
function flush(key) {
|
|
95
|
+
const queue = queues.get(key);
|
|
96
|
+
queues.delete(key);
|
|
97
|
+
if (!queue) return;
|
|
98
|
+
for (let offset = 0; offset < queue.pending.length; offset += MAX_FIELDS_PER_REQUEST) run(queue.pending.slice(offset, offset + MAX_FIELDS_PER_REQUEST), queue.options);
|
|
99
|
+
}
|
|
100
|
+
return { request(request, options = {}) {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const entry = {
|
|
103
|
+
request,
|
|
104
|
+
resolve,
|
|
105
|
+
reject
|
|
106
|
+
};
|
|
107
|
+
if (options.signal) {
|
|
108
|
+
run([entry], options);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const key = requestKey(options);
|
|
112
|
+
const queue = queues.get(key);
|
|
113
|
+
if (queue) {
|
|
114
|
+
queue.pending.push(entry);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
queues.set(key, {
|
|
118
|
+
options,
|
|
119
|
+
pending: [entry]
|
|
120
|
+
});
|
|
121
|
+
setTimeout(() => flush(key), 0);
|
|
122
|
+
});
|
|
123
|
+
} };
|
|
124
|
+
}
|
|
125
|
+
export { createGraphQLBatcher };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const require_graphql = require("./graphql-BICZrYlZ.cjs");
|
|
2
|
+
require("zod");
|
|
3
|
+
// src/libs/graphql-batch.ts
|
|
4
|
+
const MAX_FIELDS_PER_REQUEST = 20;
|
|
5
|
+
function batchDocument(pending) {
|
|
6
|
+
const declarations = [];
|
|
7
|
+
const fields = [];
|
|
8
|
+
const variables = {};
|
|
9
|
+
pending.forEach(({ request }, index) => {
|
|
10
|
+
const alias = `f${index}`;
|
|
11
|
+
const passed = (request.arguments ?? []).filter((argument) => argument.value !== void 0).map((argument) => {
|
|
12
|
+
const variable = `${alias}_${argument.name}`;
|
|
13
|
+
declarations.push(`$${variable}: ${argument.type}`);
|
|
14
|
+
variables[variable] = argument.value;
|
|
15
|
+
return `${argument.name}: $${variable}`;
|
|
16
|
+
});
|
|
17
|
+
const call = passed.length === 0 ? request.field : `${request.field}(${passed.join(", ")})`;
|
|
18
|
+
fields.push(request.selection ? `${alias}: ${call} { ${request.selection} }` : `${alias}: ${call}`);
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
document: `query StorefrontBatch${declarations.length === 0 ? "" : `(${declarations.join(", ")})`} { ${fields.join(" ")} }`,
|
|
22
|
+
variables
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function fieldErrors(errors, alias, field) {
|
|
26
|
+
return errors.filter((error) => error.path?.[0] === alias).map((error) => ({
|
|
27
|
+
...error,
|
|
28
|
+
path: [field, ...(error.path ?? []).slice(1)]
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function settle(pending, response) {
|
|
32
|
+
const data = response.data !== null && typeof response.data === "object" ? response.data : null;
|
|
33
|
+
pending.forEach((entry, index) => {
|
|
34
|
+
const alias = `f${index}`;
|
|
35
|
+
const value = data?.[alias];
|
|
36
|
+
const errors = fieldErrors(response.errors ?? [], alias, entry.request.field);
|
|
37
|
+
if (errors.length > 0) {
|
|
38
|
+
entry.reject(new require_graphql.GraphQLResponseError(errors, value));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (data === null || !(alias in data)) {
|
|
42
|
+
entry.reject(new require_graphql.GraphQLResponseError([{ message: "GraphQL response did not include data" }]));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const parsed = entry.request.schema.safeParse(value);
|
|
46
|
+
if (!parsed.success) {
|
|
47
|
+
const issue = parsed.error.issues[0];
|
|
48
|
+
entry.reject(new require_graphql.GraphQLResponseError([{
|
|
49
|
+
message: `Unexpected GraphQL data: ${[entry.request.field, ...issue?.path ?? []].join(".")} ${issue?.message}`,
|
|
50
|
+
extensions: { code: "INVALID_RESPONSE" }
|
|
51
|
+
}], value));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
entry.resolve(parsed.data);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function requestKey(options) {
|
|
58
|
+
if (options.cache === "no-store") return "no-store";
|
|
59
|
+
if (options.allowStale === false) return "fresh";
|
|
60
|
+
return "default";
|
|
61
|
+
}
|
|
62
|
+
function createGraphQLBatcher(send) {
|
|
63
|
+
const queues = /* @__PURE__ */ new Map();
|
|
64
|
+
async function run(pending, options) {
|
|
65
|
+
const { document, variables } = batchDocument(pending);
|
|
66
|
+
let response;
|
|
67
|
+
try {
|
|
68
|
+
response = await send(document, variables, options);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
for (const entry of pending) entry.reject(error);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const errors = response.errors ?? [];
|
|
74
|
+
if (response.data == null && errors.length > 0) {
|
|
75
|
+
if (pending.length === 1) {
|
|
76
|
+
const own = fieldErrors(errors, "f0", pending[0].request.field);
|
|
77
|
+
pending[0].reject(new require_graphql.GraphQLResponseError(own.length > 0 ? own : errors));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const failed = new Set(errors.map((error) => error.path?.[0]));
|
|
81
|
+
const rest = pending.filter((_, index) => !failed.has(`f${index}`));
|
|
82
|
+
if (rest.length === pending.length) {
|
|
83
|
+
for (const entry of pending) run([entry], options);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
pending.forEach((entry, index) => {
|
|
87
|
+
if (failed.has(`f${index}`)) entry.reject(new require_graphql.GraphQLResponseError(fieldErrors(errors, `f${index}`, entry.request.field)));
|
|
88
|
+
});
|
|
89
|
+
if (rest.length > 0) run(rest, options);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
settle(pending, response);
|
|
93
|
+
}
|
|
94
|
+
function flush(key) {
|
|
95
|
+
const queue = queues.get(key);
|
|
96
|
+
queues.delete(key);
|
|
97
|
+
if (!queue) return;
|
|
98
|
+
for (let offset = 0; offset < queue.pending.length; offset += MAX_FIELDS_PER_REQUEST) run(queue.pending.slice(offset, offset + MAX_FIELDS_PER_REQUEST), queue.options);
|
|
99
|
+
}
|
|
100
|
+
return { request(request, options = {}) {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const entry = {
|
|
103
|
+
request,
|
|
104
|
+
resolve,
|
|
105
|
+
reject
|
|
106
|
+
};
|
|
107
|
+
if (options.signal) {
|
|
108
|
+
run([entry], options);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const key = requestKey(options);
|
|
112
|
+
const queue = queues.get(key);
|
|
113
|
+
if (queue) {
|
|
114
|
+
queue.pending.push(entry);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
queues.set(key, {
|
|
118
|
+
options,
|
|
119
|
+
pending: [entry]
|
|
120
|
+
});
|
|
121
|
+
setTimeout(() => flush(key), 0);
|
|
122
|
+
});
|
|
123
|
+
} };
|
|
124
|
+
}
|
|
125
|
+
exports.createGraphQLBatcher = createGraphQLBatcher;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_models_ids = require("./ids.cjs");
|
|
3
|
+
const require_models_products = require("./products.cjs");
|
|
3
4
|
let zod = require("zod");
|
|
4
5
|
// src/models/collections.ts
|
|
5
6
|
const CollectionSchema = zod.z.object({
|
|
@@ -13,5 +14,9 @@ const CollectionSchema = zod.z.object({
|
|
|
13
14
|
template: zod.z.string().nullable().optional()
|
|
14
15
|
});
|
|
15
16
|
const CollectionsSchema = zod.z.array(CollectionSchema);
|
|
17
|
+
const CollectionWithCoversSchema = CollectionSchema.extend({ imageCandidates: zod.z.array(zod.z.string()) });
|
|
18
|
+
const CollectionWithProductsSchema = CollectionSchema.extend({ products: zod.z.array(require_models_products.ProductSummarySchema) });
|
|
16
19
|
exports.CollectionSchema = CollectionSchema;
|
|
20
|
+
exports.CollectionWithCoversSchema = CollectionWithCoversSchema;
|
|
21
|
+
exports.CollectionWithProductsSchema = CollectionWithProductsSchema;
|
|
17
22
|
exports.CollectionsSchema = CollectionsSchema;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProductSort } from "./products.cjs";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
export declare const CollectionSchema: z.ZodObject<{
|
|
3
4
|
id: z.ZodString;
|
|
@@ -19,5 +20,112 @@ export declare const CollectionsSchema: z.ZodArray<z.ZodObject<{
|
|
|
19
20
|
productCount: z.ZodOptional<z.ZodNumber>;
|
|
20
21
|
template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
22
|
}, z.core.$strip>>;
|
|
23
|
+
export declare const CollectionWithCoversSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
slug: z.ZodString;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
type: z.ZodString;
|
|
30
|
+
productCount: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
imageCandidates: z.ZodArray<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const CollectionWithProductsSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
slug: z.ZodString;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
type: z.ZodString;
|
|
41
|
+
productCount: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
products: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
slug: z.ZodString;
|
|
47
|
+
url: z.ZodString;
|
|
48
|
+
productType: z.ZodString;
|
|
49
|
+
imageUrl: z.ZodString;
|
|
50
|
+
price: z.ZodNumber;
|
|
51
|
+
compareAtPrice: z.ZodNullable<z.ZodNumber>;
|
|
52
|
+
variantCount: z.ZodNumber;
|
|
53
|
+
isAvailable: z.ZodBoolean;
|
|
54
|
+
totalInventory: z.ZodNumber;
|
|
55
|
+
bundleItemsCount: z.ZodNumber;
|
|
56
|
+
brand: z.ZodString;
|
|
57
|
+
category: z.ZodString;
|
|
58
|
+
status: z.ZodString;
|
|
59
|
+
collections: z.ZodArray<z.ZodString>;
|
|
60
|
+
tags: z.ZodArray<z.ZodString>;
|
|
61
|
+
seller: z.ZodNullable<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
slug: z.ZodString;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
options: z.ZodArray<z.ZodObject<{
|
|
67
|
+
key: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
checkbox: "checkbox";
|
|
71
|
+
colorPicker: "colorPicker";
|
|
72
|
+
datePicker: "datePicker";
|
|
73
|
+
dateTimePicker: "dateTimePicker";
|
|
74
|
+
file: "file";
|
|
75
|
+
input: "input";
|
|
76
|
+
number: "number";
|
|
77
|
+
select: "select";
|
|
78
|
+
textArea: "textArea";
|
|
79
|
+
timePicker: "timePicker";
|
|
80
|
+
url: "url";
|
|
81
|
+
}>>;
|
|
82
|
+
values: z.ZodArray<z.ZodObject<{
|
|
83
|
+
key: z.ZodString;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
value: z.ZodString;
|
|
86
|
+
valueId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
valueName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
checkbox: "checkbox";
|
|
90
|
+
colorPicker: "colorPicker";
|
|
91
|
+
datePicker: "datePicker";
|
|
92
|
+
dateTimePicker: "dateTimePicker";
|
|
93
|
+
file: "file";
|
|
94
|
+
input: "input";
|
|
95
|
+
number: "number";
|
|
96
|
+
select: "select";
|
|
97
|
+
textArea: "textArea";
|
|
98
|
+
timePicker: "timePicker";
|
|
99
|
+
url: "url";
|
|
100
|
+
}>>;
|
|
101
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
images: z.ZodArray<z.ZodObject<{
|
|
107
|
+
url: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
order: z.ZodNumber;
|
|
110
|
+
type: z.ZodDefault<z.ZodCatch<z.ZodEnum<{
|
|
111
|
+
image: "image";
|
|
112
|
+
video: "video";
|
|
113
|
+
}>>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
availableVariantId: z.ZodNullable<z.ZodString>;
|
|
116
|
+
hasModifierGroups: z.ZodBoolean;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
}, z.core.$strip>;
|
|
22
119
|
export type Collection = z.infer<typeof CollectionSchema>;
|
|
23
|
-
export type Collections = z.infer<typeof CollectionsSchema>;
|
|
120
|
+
export type Collections = z.infer<typeof CollectionsSchema>;
|
|
121
|
+
export type CollectionWithCovers = z.infer<typeof CollectionWithCoversSchema>;
|
|
122
|
+
export type CollectionWithProducts = z.infer<typeof CollectionWithProductsSchema>;
|
|
123
|
+
export type CollectionCoversOptions = {
|
|
124
|
+
limit?: number;
|
|
125
|
+
candidates?: number;
|
|
126
|
+
};
|
|
127
|
+
export type CollectionsWithProductsOptions = {
|
|
128
|
+
limit?: number;
|
|
129
|
+
products: number;
|
|
130
|
+
sort?: ProductSort;
|
|
131
|
+
};
|